@llmnative/agentico 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +563 -546
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/agentDefinition.d.ts +6 -0
- package/dist/types/domain/entityChatStore.d.ts +10 -5
- package/dist/types/i18n/types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createContext as b, useCallback as x, useContext as S, useEffect as C,
|
|
|
4
4
|
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
5
5
|
//#region src/domain/messageParts.ts
|
|
6
6
|
var j = "text", M = "reasoning";
|
|
7
|
-
function
|
|
7
|
+
function ee(e, t, n) {
|
|
8
8
|
let r = e.findIndex((e) => e.type === t.type && e.id === t.id);
|
|
9
9
|
if (r >= 0) return e.map((e, n) => n === r ? t : e);
|
|
10
10
|
let i = t.type === "reasoning" || !n ? e : e.map((e) => e.type === "reasoning" && e.streaming ? n(e) : e), a = i.findIndex((e) => e.type === "text" && e.id === "text");
|
|
@@ -14,59 +14,59 @@ function N(e, t, n) {
|
|
|
14
14
|
...i.slice(a)
|
|
15
15
|
] : [...i, t];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function N(e) {
|
|
18
18
|
return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function P(e, t) {
|
|
21
21
|
return t.map((t, n) => `${t.header ?? e[n]?.header ?? e[n]?.question ?? t.id ?? `${n + 1}`}: ${t.values.join(", ")}`).join("\n");
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/domain/defineSubagent.ts
|
|
25
|
-
function
|
|
25
|
+
function te(e) {
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/domain/subagentRegistry.ts
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
30
|
+
var F = [];
|
|
31
|
+
function I(e) {
|
|
32
|
+
F = e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function L() {
|
|
35
|
+
return F.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), F;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function R(e) {
|
|
38
|
+
return F.find((t) => t.id === e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/domain/crossAgentTools.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
|
|
42
|
+
var z = [];
|
|
43
|
+
function ne(...e) {
|
|
44
|
+
z = e;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function B(e) {
|
|
47
|
+
return z.flatMap((t) => t(e));
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/domain/mcpTool.ts
|
|
51
|
-
function
|
|
51
|
+
function V(t) {
|
|
52
52
|
let { $schema: n, ...r } = e(t, {
|
|
53
53
|
target: "jsonSchema7",
|
|
54
54
|
$refStrategy: "none"
|
|
55
55
|
});
|
|
56
56
|
return r;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function H(e, t, n, r) {
|
|
59
59
|
return {
|
|
60
60
|
name: e,
|
|
61
61
|
description: t,
|
|
62
|
-
inputSchema:
|
|
63
|
-
...r ? { outputSchema:
|
|
62
|
+
inputSchema: V(n),
|
|
63
|
+
...r ? { outputSchema: V(r) } : {}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/domain/subagentUsageCard.ts
|
|
68
|
-
function
|
|
69
|
-
let t =
|
|
68
|
+
function U(e) {
|
|
69
|
+
let t = V(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
|
|
70
70
|
return Object.entries(n).map(([t, n]) => {
|
|
71
71
|
let i = typeof n.description == "string" ? n.description : "";
|
|
72
72
|
return {
|
|
@@ -80,7 +80,7 @@ function G(e) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/domain/prompts.ts
|
|
83
|
-
var
|
|
83
|
+
var W = {
|
|
84
84
|
orchestratorIntro: "You are Agentico, the orchestrator of this application's tools. Your job is to understand what the user wants to achieve and, once every required parameter is collected, start the right tool among those listed below — do not carry it out yourself \"in words\", invoke it as a tool.",
|
|
85
85
|
responseRules: [
|
|
86
86
|
"BEFORE asking for any parameter, check the \"Page context\" below (if present): if a parameter required by the command is already there or can be deduced from it with reasonable certainty, USE it directly — do not ask the user again. Only ask for parameters that cannot be derived from the context.",
|
|
@@ -109,7 +109,7 @@ var K = {
|
|
|
109
109
|
"block requested above, never before it and never instead of it."
|
|
110
110
|
].join(" "),
|
|
111
111
|
multipleCandidates: "Several subagents are candidates on this page — ask the user which one they mean if their message does not make it clear, before going on."
|
|
112
|
-
},
|
|
112
|
+
}, G = {
|
|
113
113
|
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.",
|
|
114
114
|
responseRules: [
|
|
115
115
|
"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.",
|
|
@@ -138,26 +138,26 @@ var K = {
|
|
|
138
138
|
"richiesto sopra, mai prima e mai al posto suo."
|
|
139
139
|
].join(" "),
|
|
140
140
|
multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere."
|
|
141
|
-
},
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
...
|
|
141
|
+
}, K = W;
|
|
142
|
+
function re(e) {
|
|
143
|
+
K = {
|
|
144
|
+
...K,
|
|
145
145
|
...e
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
function q() {
|
|
149
|
+
return K;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
151
|
+
function ie() {
|
|
152
|
+
K = W;
|
|
153
153
|
}
|
|
154
154
|
//#endregion
|
|
155
155
|
//#region src/domain/cli/renderManifestCli.ts
|
|
156
|
-
function
|
|
156
|
+
function J(e, t) {
|
|
157
157
|
return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
let n =
|
|
159
|
+
function ae(e, t) {
|
|
160
|
+
let n = U(t), r = J(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
|
|
161
161
|
return [
|
|
162
162
|
`COMMAND: ${e} ${t.name}`,
|
|
163
163
|
` ${t.summary}`,
|
|
@@ -169,46 +169,46 @@ function Z(e, t) {
|
|
|
169
169
|
...i,
|
|
170
170
|
"",
|
|
171
171
|
" OUTPUT",
|
|
172
|
-
|
|
172
|
+
oe(t.describeOutput(), 4),
|
|
173
173
|
(t.example, ""),
|
|
174
174
|
t.example ? " EXAMPLE" : "",
|
|
175
175
|
t.example ? ` ${t.example}` : ""
|
|
176
176
|
].filter((e) => e !== "").join("\n");
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function oe(e, t) {
|
|
179
179
|
let n = " ".repeat(t);
|
|
180
180
|
return e.split("\n").map((e) => e && n + e).join("\n");
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function se(e) {
|
|
183
183
|
return [
|
|
184
184
|
"NAME",
|
|
185
185
|
` ${e.id} — ${e.label}`,
|
|
186
186
|
"",
|
|
187
187
|
"DESCRIPTION",
|
|
188
|
-
|
|
188
|
+
oe(e.description, 2),
|
|
189
189
|
"",
|
|
190
|
-
...e.commands.map((t) =>
|
|
190
|
+
...e.commands.map((t) => ae(e.id, t))
|
|
191
191
|
].join("\n");
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
return e.length === 0 ?
|
|
193
|
+
function ce(e) {
|
|
194
|
+
return e.length === 0 ? q().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
|
|
195
195
|
}
|
|
196
196
|
//#endregion
|
|
197
197
|
//#region src/domain/microPrompts.ts
|
|
198
|
-
var
|
|
198
|
+
var Y = {
|
|
199
199
|
id: "closing-summary",
|
|
200
200
|
get text() {
|
|
201
|
-
return
|
|
201
|
+
return q().closingSummary;
|
|
202
202
|
}
|
|
203
|
-
},
|
|
204
|
-
function
|
|
203
|
+
}, X = { [Y.id]: Y };
|
|
204
|
+
function le(e, t) {
|
|
205
205
|
if (!t || t.length === 0) return e;
|
|
206
|
-
let n = t.map((e) =>
|
|
206
|
+
let n = t.map((e) => X[e]?.text).filter((e) => !!e);
|
|
207
207
|
return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/domain/extractErrorMessage.ts
|
|
211
|
-
function
|
|
211
|
+
function ue(e) {
|
|
212
212
|
if (e instanceof Error) return e.message;
|
|
213
213
|
if (typeof e == "object" && e) {
|
|
214
214
|
let t = e;
|
|
@@ -227,13 +227,13 @@ function le(e) {
|
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/domain/extractJsonBlock.ts
|
|
230
|
-
function
|
|
230
|
+
function de(e) {
|
|
231
231
|
let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
|
|
232
232
|
if (t) return t[1].trim();
|
|
233
233
|
let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
|
|
234
|
-
return
|
|
234
|
+
return fe(n) ?? n;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function fe(e) {
|
|
237
237
|
let t = e.search(/[{[]/);
|
|
238
238
|
if (t === -1) return null;
|
|
239
239
|
let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
|
|
@@ -254,8 +254,8 @@ function de(e) {
|
|
|
254
254
|
}
|
|
255
255
|
//#endregion
|
|
256
256
|
//#region src/domain/jsonExportDestination.ts
|
|
257
|
-
var
|
|
258
|
-
id:
|
|
257
|
+
var pe = "json-export", Z = {
|
|
258
|
+
id: pe,
|
|
259
259
|
label: "Export as JSON",
|
|
260
260
|
async apply(e) {
|
|
261
261
|
let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
|
|
@@ -272,7 +272,7 @@ function he(e) {
|
|
|
272
272
|
}
|
|
273
273
|
function ge() {
|
|
274
274
|
return {
|
|
275
|
-
[
|
|
275
|
+
[Z.id]: Z,
|
|
276
276
|
...me
|
|
277
277
|
};
|
|
278
278
|
}
|
|
@@ -315,20 +315,22 @@ function Ce(e, t, n) {
|
|
|
315
315
|
return be().find((e) => Se(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
|
|
316
316
|
}
|
|
317
317
|
function we(e) {
|
|
318
|
-
let t = Se(e.scopeId, e.subagentId, e.entityId), n = be().
|
|
319
|
-
|
|
318
|
+
let t = Se(e.scopeId, e.subagentId, e.entityId), n = be(), r = n.find((e) => Se(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r);
|
|
319
|
+
a.push({
|
|
320
320
|
...e,
|
|
321
|
-
savedAt:
|
|
322
|
-
|
|
321
|
+
savedAt: i,
|
|
322
|
+
startedAt: r ? Te(r) : i
|
|
323
|
+
}), xe(a);
|
|
323
324
|
}
|
|
324
|
-
|
|
325
|
+
var Te = (e) => e.startedAt ?? e.savedAt;
|
|
326
|
+
function Ee(e, t, n) {
|
|
325
327
|
let r = Se(e, t, n);
|
|
326
328
|
xe(be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== r));
|
|
327
329
|
}
|
|
328
|
-
function
|
|
329
|
-
return be().filter((t) => t.scopeId === e).sort((e, t) => t
|
|
330
|
+
function De(e) {
|
|
331
|
+
return be().filter((t) => t.scopeId === e).sort((e, t) => Te(t) - Te(e));
|
|
330
332
|
}
|
|
331
|
-
var
|
|
333
|
+
var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
332
334
|
modelLabel: "Modell",
|
|
333
335
|
modelsLoading: "Wird geladen…",
|
|
334
336
|
noModelsAvailable: "Keine Modelle verfügbar",
|
|
@@ -367,6 +369,8 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
|
367
369
|
stepsLabel: "Schritte des Agenten",
|
|
368
370
|
newInstance: "Neue Instanz von \"{label}\"",
|
|
369
371
|
chatHistory: "Chatverlauf",
|
|
372
|
+
chatStarted: "Begonnen am {at}",
|
|
373
|
+
chatLastMessage: "letzte Nachricht am {at}",
|
|
370
374
|
newChat: "Neuer Chat",
|
|
371
375
|
searchChats: "Chats durchsuchen…",
|
|
372
376
|
messagePlaceholder: "Nachricht schreiben…",
|
|
@@ -384,7 +388,7 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
|
384
388
|
resizePanelHint: "Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",
|
|
385
389
|
pendingQuestions: "Fragen des Agenten",
|
|
386
390
|
stop: "Stoppen"
|
|
387
|
-
},
|
|
391
|
+
}, Ae = {
|
|
388
392
|
modelLabel: "Model",
|
|
389
393
|
modelsLoading: "Loading…",
|
|
390
394
|
noModelsAvailable: "No models available",
|
|
@@ -423,6 +427,8 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
|
423
427
|
stepsLabel: "Steps of the agent",
|
|
424
428
|
newInstance: "New \"{label}\" instance",
|
|
425
429
|
chatHistory: "Chat history",
|
|
430
|
+
chatStarted: "Started {at}",
|
|
431
|
+
chatLastMessage: "last message {at}",
|
|
426
432
|
newChat: "New chat",
|
|
427
433
|
searchChats: "Search chats…",
|
|
428
434
|
messagePlaceholder: "Write a message…",
|
|
@@ -440,7 +446,7 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
|
440
446
|
resizePanelHint: "Drag to resize, double-click to reset",
|
|
441
447
|
pendingQuestions: "Questions of the agent",
|
|
442
448
|
stop: "Stop"
|
|
443
|
-
},
|
|
449
|
+
}, je = {
|
|
444
450
|
modelLabel: "Modello",
|
|
445
451
|
modelsLoading: "Caricamento…",
|
|
446
452
|
noModelsAvailable: "Nessun modello disponibile",
|
|
@@ -479,6 +485,8 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
|
479
485
|
stepsLabel: "Passi dell'agente",
|
|
480
486
|
newInstance: "Nuova istanza di \"{label}\"",
|
|
481
487
|
chatHistory: "Storico chat",
|
|
488
|
+
chatStarted: "Iniziata il {at}",
|
|
489
|
+
chatLastMessage: "ultimo messaggio il {at}",
|
|
482
490
|
newChat: "Nuova chat",
|
|
483
491
|
searchChats: "Cerca nelle chat…",
|
|
484
492
|
messagePlaceholder: "Scrivi un messaggio…",
|
|
@@ -496,22 +504,22 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
|
496
504
|
resizePanelHint: "Trascina per ridimensionare, doppio clic per ripristinare",
|
|
497
505
|
pendingQuestions: "Domande dell'agente",
|
|
498
506
|
stop: "Ferma"
|
|
499
|
-
},
|
|
500
|
-
en: { agentico:
|
|
501
|
-
it: { agentico:
|
|
502
|
-
de: { agentico:
|
|
507
|
+
}, Me = {
|
|
508
|
+
en: { agentico: Ae },
|
|
509
|
+
it: { agentico: je },
|
|
510
|
+
de: { agentico: ke }
|
|
503
511
|
};
|
|
504
512
|
function Q() {
|
|
505
513
|
let { dict: e } = v(), t = e.agentico;
|
|
506
514
|
return t ? {
|
|
507
|
-
...
|
|
515
|
+
...Ae,
|
|
508
516
|
...t
|
|
509
|
-
} :
|
|
517
|
+
} : Ae;
|
|
510
518
|
}
|
|
511
519
|
//#endregion
|
|
512
520
|
//#region src/presentation/AgenticoContext.tsx
|
|
513
|
-
var
|
|
514
|
-
function
|
|
521
|
+
var Ne = "agentico-orchestrator", Pe = b(null);
|
|
522
|
+
function Fe({ children: e, scope: t = null }) {
|
|
515
523
|
let [n, r] = D(null), i = E(null);
|
|
516
524
|
C(() => {
|
|
517
525
|
i.current = n;
|
|
@@ -526,7 +534,7 @@ function Pe({ children: e, scope: t = null }) {
|
|
|
526
534
|
r(n);
|
|
527
535
|
}, []), c = x((e) => {
|
|
528
536
|
r((t) => t && t.id === e ? null : t);
|
|
529
|
-
}, []), 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([]),
|
|
537
|
+
}, []), 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([]), ee = x((e, t, n = null) => {
|
|
530
538
|
M((r) => {
|
|
531
539
|
let i = r.filter((t) => t.id !== e);
|
|
532
540
|
return t ? [...i, {
|
|
@@ -535,30 +543,30 @@ function Pe({ children: e, scope: t = null }) {
|
|
|
535
543
|
card: n
|
|
536
544
|
}] : i;
|
|
537
545
|
});
|
|
538
|
-
}, []),
|
|
539
|
-
|
|
546
|
+
}, []), N = j.length > 0 ? j[j.length - 1] : null, [P, te] = D([]), F = x((e, t) => {
|
|
547
|
+
te((n) => {
|
|
540
548
|
let r = n.filter((t) => t.id !== e);
|
|
541
549
|
return t ? [...r, {
|
|
542
550
|
id: e,
|
|
543
551
|
...t
|
|
544
552
|
}] : r;
|
|
545
553
|
});
|
|
546
|
-
}, []),
|
|
554
|
+
}, []), I = T(() => P.map((e) => ({
|
|
547
555
|
subagentId: e.subagentId,
|
|
548
556
|
componentKey: e.componentKey,
|
|
549
557
|
onResult: e.onResult,
|
|
550
558
|
pinnedEntityId: e.pinnedEntityId
|
|
551
|
-
})), [
|
|
559
|
+
})), [P]), L = T(() => {
|
|
552
560
|
let e = /* @__PURE__ */ new Map();
|
|
553
|
-
for (let t of
|
|
561
|
+
for (let t of P) e.set(t.subagentId, {
|
|
554
562
|
subagentId: t.subagentId,
|
|
555
563
|
componentKey: t.componentKey,
|
|
556
564
|
onResult: t.onResult,
|
|
557
565
|
contextInfo: t.contextInfo
|
|
558
566
|
});
|
|
559
567
|
return [...e.values()];
|
|
560
|
-
}, [
|
|
561
|
-
let t =
|
|
568
|
+
}, [P]), z = T(() => L.map((e) => {
|
|
569
|
+
let t = R(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
562
570
|
if (!t) return null;
|
|
563
571
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
564
572
|
return {
|
|
@@ -566,21 +574,21 @@ function Pe({ children: e, scope: t = null }) {
|
|
|
566
574
|
agenticoHint: n,
|
|
567
575
|
userMessage: t.userMessage
|
|
568
576
|
};
|
|
569
|
-
}).filter((e) => e !== null), [
|
|
570
|
-
if (
|
|
571
|
-
if (
|
|
572
|
-
let e =
|
|
573
|
-
return `${
|
|
574
|
-
}, [
|
|
577
|
+
}).filter((e) => e !== null), [L]), ne = T(() => z.map((e) => e.userMessage), [z]), B = T(() => {
|
|
578
|
+
if (z.length === 0) return null;
|
|
579
|
+
if (z.length === 1) return z[0].agenticoHint;
|
|
580
|
+
let e = z.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
581
|
+
return `${q().multipleCandidates}\n\n${e}`;
|
|
582
|
+
}, [z]) ?? N?.text ?? null, V = z.length > 0 ? null : N?.card ?? null, H = T(() => [...new Set(I.map((e) => e.subagentId))], [I]), U = H.length === 1 ? H[0] : H.length === 0 ? N?.card?.subagentId ?? null : null, W = x((e, t) => {
|
|
575
583
|
u();
|
|
576
584
|
let n = i.current;
|
|
577
585
|
if (n?.id === "agentico-orchestrator") return;
|
|
578
|
-
let r =
|
|
586
|
+
let r = U && n?.id.startsWith(`subagent-${U}-`) ? n : void 0;
|
|
579
587
|
w(r ? {
|
|
580
588
|
taskId: r.id,
|
|
581
589
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
582
590
|
} : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model), A(t?.scopedSubagentId), b(crypto.randomUUID());
|
|
583
|
-
}, [u,
|
|
591
|
+
}, [u, U]), G = x((e, t, n, a, o, s) => {
|
|
584
592
|
if (!n || !a) return;
|
|
585
593
|
let c = i.current;
|
|
586
594
|
if (!c || c.id !== n) return;
|
|
@@ -597,24 +605,24 @@ function Pe({ children: e, scope: t = null }) {
|
|
|
597
605
|
...e,
|
|
598
606
|
savedToDisk: !0
|
|
599
607
|
} : e));
|
|
600
|
-
}, []), [
|
|
601
|
-
u(),
|
|
608
|
+
}, []), [K, re] = D(null), [ie, J] = D(null), ae = x((e, t, n) => {
|
|
609
|
+
u(), re({
|
|
602
610
|
subagentId: e,
|
|
603
611
|
entityId: t,
|
|
604
612
|
snapshot: n
|
|
605
|
-
}),
|
|
606
|
-
}, [u]), [
|
|
607
|
-
u(), c(
|
|
613
|
+
}), J(crypto.randomUUID());
|
|
614
|
+
}, [u]), [oe, se] = D(null), [ce, Y] = D(null), X = x((e, t) => {
|
|
615
|
+
u(), c(Ne), se({
|
|
608
616
|
subagentId: e,
|
|
609
617
|
extraDestinations: t
|
|
610
|
-
}),
|
|
611
|
-
}, [u, c]), [
|
|
612
|
-
|
|
618
|
+
}), Y(crypto.randomUUID());
|
|
619
|
+
}, [u, c]), [le, ue] = D(null), [de, fe] = D(null), pe = x((e, t, n) => {
|
|
620
|
+
se(null), ue({
|
|
613
621
|
subagentId: e,
|
|
614
622
|
params: t,
|
|
615
623
|
extraDestinations: n
|
|
616
|
-
}),
|
|
617
|
-
}, []), [
|
|
624
|
+
}), fe(crypto.randomUUID());
|
|
625
|
+
}, []), [Z, me] = D(null), [he, ge] = D(null), _e = x((e, t, n) => {
|
|
618
626
|
u(), me({
|
|
619
627
|
subagentId: e,
|
|
620
628
|
params: t,
|
|
@@ -631,34 +639,34 @@ function Pe({ children: e, scope: t = null }) {
|
|
|
631
639
|
closeTask: c,
|
|
632
640
|
toggleOpen: l,
|
|
633
641
|
pendingGoal: d,
|
|
634
|
-
startOrchestrator:
|
|
635
|
-
pageContext:
|
|
636
|
-
pageContextCard:
|
|
637
|
-
setPageContext:
|
|
638
|
-
scopedSubagentId:
|
|
642
|
+
startOrchestrator: W,
|
|
643
|
+
pageContext: B,
|
|
644
|
+
pageContextCard: V,
|
|
645
|
+
setPageContext: ee,
|
|
646
|
+
scopedSubagentId: U,
|
|
639
647
|
pendingScopedSubagentId: O,
|
|
640
|
-
componentAnchors:
|
|
641
|
-
anchoredUserMessages:
|
|
642
|
-
registerComponentAnchor:
|
|
648
|
+
componentAnchors: I,
|
|
649
|
+
anchoredUserMessages: ne,
|
|
650
|
+
registerComponentAnchor: F,
|
|
643
651
|
openPanel: u,
|
|
644
652
|
pendingExtraDestinations: p,
|
|
645
653
|
pendingAttachments: h,
|
|
646
654
|
pendingModel: _,
|
|
647
655
|
orchestratorRunId: y,
|
|
648
656
|
pendingCarryOver: S,
|
|
649
|
-
commitEntityChat:
|
|
650
|
-
resumeEntityChat:
|
|
651
|
-
pendingResume:
|
|
652
|
-
resumeRunId:
|
|
657
|
+
commitEntityChat: G,
|
|
658
|
+
resumeEntityChat: ae,
|
|
659
|
+
pendingResume: K,
|
|
660
|
+
resumeRunId: ie,
|
|
653
661
|
dismissForeignTask: ve,
|
|
654
|
-
pendingManualEntry:
|
|
655
|
-
manualEntryRunId:
|
|
656
|
-
startManualEntry:
|
|
657
|
-
pendingResumeWithAI:
|
|
658
|
-
resumeWithAIRunId:
|
|
659
|
-
resumeWithAI:
|
|
662
|
+
pendingManualEntry: oe,
|
|
663
|
+
manualEntryRunId: ce,
|
|
664
|
+
startManualEntry: X,
|
|
665
|
+
pendingResumeWithAI: le,
|
|
666
|
+
resumeWithAIRunId: de,
|
|
667
|
+
resumeWithAI: pe,
|
|
660
668
|
startSubagent: _e,
|
|
661
|
-
pendingStart:
|
|
669
|
+
pendingStart: Z,
|
|
662
670
|
startRunId: he
|
|
663
671
|
}), [
|
|
664
672
|
t,
|
|
@@ -668,49 +676,49 @@ function Pe({ children: e, scope: t = null }) {
|
|
|
668
676
|
c,
|
|
669
677
|
l,
|
|
670
678
|
d,
|
|
671
|
-
|
|
672
|
-
|
|
679
|
+
W,
|
|
680
|
+
B,
|
|
681
|
+
V,
|
|
682
|
+
ee,
|
|
673
683
|
U,
|
|
674
|
-
N,
|
|
675
|
-
G,
|
|
676
684
|
O,
|
|
677
|
-
L,
|
|
678
|
-
V,
|
|
679
685
|
I,
|
|
686
|
+
ne,
|
|
687
|
+
F,
|
|
680
688
|
u,
|
|
681
689
|
p,
|
|
682
690
|
h,
|
|
683
691
|
_,
|
|
684
692
|
y,
|
|
685
693
|
S,
|
|
686
|
-
|
|
687
|
-
Z,
|
|
688
|
-
J,
|
|
689
|
-
X,
|
|
690
|
-
ve,
|
|
691
|
-
re,
|
|
694
|
+
G,
|
|
692
695
|
ae,
|
|
693
|
-
|
|
696
|
+
K,
|
|
697
|
+
ie,
|
|
698
|
+
ve,
|
|
699
|
+
oe,
|
|
694
700
|
ce,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
701
|
+
X,
|
|
702
|
+
le,
|
|
703
|
+
de,
|
|
698
704
|
pe,
|
|
705
|
+
_e,
|
|
706
|
+
Z,
|
|
699
707
|
he
|
|
700
708
|
]);
|
|
701
|
-
return /* @__PURE__ */ k(
|
|
709
|
+
return /* @__PURE__ */ k(Pe.Provider, {
|
|
702
710
|
value: ye,
|
|
703
711
|
children: e
|
|
704
712
|
});
|
|
705
713
|
}
|
|
706
714
|
function $() {
|
|
707
|
-
let e = S(
|
|
715
|
+
let e = S(Pe);
|
|
708
716
|
if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
|
|
709
717
|
return e;
|
|
710
718
|
}
|
|
711
719
|
//#endregion
|
|
712
720
|
//#region src/presentation/AgentActivityLog.tsx
|
|
713
|
-
function
|
|
721
|
+
function Ie(e) {
|
|
714
722
|
let t = e.search(/[{[]/);
|
|
715
723
|
if (t === -1) return [{
|
|
716
724
|
type: "text",
|
|
@@ -756,18 +764,18 @@ function Fe(e) {
|
|
|
756
764
|
language: "json"
|
|
757
765
|
});
|
|
758
766
|
let u = e.slice(s + 1);
|
|
759
|
-
return u.trim() && l.push(...
|
|
767
|
+
return u.trim() && l.push(...Ie(u)), l;
|
|
760
768
|
}
|
|
761
|
-
function
|
|
769
|
+
function Le(e) {
|
|
762
770
|
let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
|
|
763
|
-
for (; i = n.exec(e);) i.index > r && t.push(...
|
|
771
|
+
for (; i = n.exec(e);) i.index > r && t.push(...Ie(e.slice(r, i.index))), t.push({
|
|
764
772
|
type: "code",
|
|
765
773
|
content: i[2].replace(/\n$/, ""),
|
|
766
774
|
language: i[1]
|
|
767
775
|
}), r = n.lastIndex;
|
|
768
|
-
return r < e.length && t.push(...
|
|
776
|
+
return r < e.length && t.push(...Ie(e.slice(r))), t;
|
|
769
777
|
}
|
|
770
|
-
function
|
|
778
|
+
function Re({ content: e, language: t }) {
|
|
771
779
|
let [n, r] = D(!1);
|
|
772
780
|
return /* @__PURE__ */ A("div", {
|
|
773
781
|
className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
@@ -782,9 +790,9 @@ function Le({ content: e, language: t }) {
|
|
|
782
790
|
}), !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" })]
|
|
783
791
|
});
|
|
784
792
|
}
|
|
785
|
-
function
|
|
786
|
-
let n =
|
|
787
|
-
return /* @__PURE__ */ k(O, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ k(
|
|
793
|
+
function ze({ text: e, tone: t }) {
|
|
794
|
+
let n = Le(e);
|
|
795
|
+
return /* @__PURE__ */ k(O, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ k(Re, {
|
|
788
796
|
content: e.content,
|
|
789
797
|
language: e.language
|
|
790
798
|
}, n) : e.content.trim() && /* @__PURE__ */ k(r, {
|
|
@@ -793,7 +801,7 @@ function Re({ text: e, tone: t }) {
|
|
|
793
801
|
className: "break-words text-xs leading-relaxed"
|
|
794
802
|
}, n)) });
|
|
795
803
|
}
|
|
796
|
-
function
|
|
804
|
+
function Be({ status: e }) {
|
|
797
805
|
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, {
|
|
798
806
|
name: "check",
|
|
799
807
|
size: 12,
|
|
@@ -808,11 +816,11 @@ function ze({ status: e }) {
|
|
|
808
816
|
className: "shrink-0 text-destructive"
|
|
809
817
|
});
|
|
810
818
|
}
|
|
811
|
-
function
|
|
819
|
+
function Ve(e, t) {
|
|
812
820
|
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;
|
|
813
821
|
}
|
|
814
|
-
var
|
|
815
|
-
function
|
|
822
|
+
var He = 96;
|
|
823
|
+
function Ue({ entry: e, pinned: t = !0 }) {
|
|
816
824
|
let n = E(null), [r, i] = D(!1), [a, o] = D(!1);
|
|
817
825
|
w(() => {
|
|
818
826
|
let e = n.current;
|
|
@@ -826,7 +834,7 @@ function He({ entry: e, pinned: t = !0 }) {
|
|
|
826
834
|
children: [/* @__PURE__ */ A("div", {
|
|
827
835
|
ref: n,
|
|
828
836
|
className: `space-y-1 px-2.5 pt-1.5 ${s ? "overflow-hidden" : ""}`,
|
|
829
|
-
style: s ? { maxHeight:
|
|
837
|
+
style: s ? { maxHeight: He } : void 0,
|
|
830
838
|
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ k("div", {
|
|
831
839
|
className: "flex flex-wrap gap-1",
|
|
832
840
|
children: e.attachmentNames.map((e, t) => /* @__PURE__ */ A("span", {
|
|
@@ -840,7 +848,7 @@ function He({ entry: e, pinned: t = !0 }) {
|
|
|
840
848
|
children: e
|
|
841
849
|
})]
|
|
842
850
|
}, t))
|
|
843
|
-
}), /* @__PURE__ */ k(
|
|
851
|
+
}), /* @__PURE__ */ k(ze, { text: e.detail ?? "" })]
|
|
844
852
|
}), a && /* @__PURE__ */ A("button", {
|
|
845
853
|
type: "button",
|
|
846
854
|
onClick: () => i((e) => !e),
|
|
@@ -854,13 +862,13 @@ function He({ entry: e, pinned: t = !0 }) {
|
|
|
854
862
|
})
|
|
855
863
|
});
|
|
856
864
|
}
|
|
857
|
-
var
|
|
865
|
+
var We = {
|
|
858
866
|
running: "loader-circle",
|
|
859
867
|
done: "check",
|
|
860
868
|
error: "x",
|
|
861
869
|
stopped: "circle-slash"
|
|
862
870
|
};
|
|
863
|
-
function
|
|
871
|
+
function Ge({ steps: e }) {
|
|
864
872
|
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 }));
|
|
865
873
|
return /* @__PURE__ */ k(f, {
|
|
866
874
|
ariaLabel: t.stepsLabel,
|
|
@@ -876,12 +884,12 @@ function We({ steps: e }) {
|
|
|
876
884
|
className: e.status === "error" ? "text-destructive" : void 0,
|
|
877
885
|
children: e.label
|
|
878
886
|
}),
|
|
879
|
-
icon:
|
|
887
|
+
icon: We[e.status]
|
|
880
888
|
}))
|
|
881
889
|
}]
|
|
882
890
|
});
|
|
883
891
|
}
|
|
884
|
-
function
|
|
892
|
+
function Ke(e, t) {
|
|
885
893
|
let n = e.at(-1);
|
|
886
894
|
if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
|
|
887
895
|
let r = [...n.parts].reverse().find((e) => e.type === "questions");
|
|
@@ -890,7 +898,7 @@ function Ge(e, t) {
|
|
|
890
898
|
part: r
|
|
891
899
|
};
|
|
892
900
|
}
|
|
893
|
-
function
|
|
901
|
+
function qe({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
|
|
894
902
|
let o = !!n?.canAnswer(e.id);
|
|
895
903
|
return /* @__PURE__ */ k(i, {
|
|
896
904
|
questions: t.questions,
|
|
@@ -901,7 +909,7 @@ function Ke({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
|
|
|
901
909
|
className: a ?? "text-xs"
|
|
902
910
|
});
|
|
903
911
|
}
|
|
904
|
-
function
|
|
912
|
+
function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
905
913
|
let i = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), o = [];
|
|
906
914
|
for (let e of i) {
|
|
907
915
|
let t = o.at(-1);
|
|
@@ -916,7 +924,7 @@ function qe({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
916
924
|
return /* @__PURE__ */ k("div", {
|
|
917
925
|
className: "space-y-2",
|
|
918
926
|
children: o.map((n) => {
|
|
919
|
-
if ("steps" in n) return /* @__PURE__ */ k(
|
|
927
|
+
if ("steps" in n) return /* @__PURE__ */ k(Ge, { steps: n.steps }, n.key);
|
|
920
928
|
let { part: i } = n;
|
|
921
929
|
return i.type === "text" ? i.text.trim() ? /* @__PURE__ */ k(r, {
|
|
922
930
|
content: i.text,
|
|
@@ -927,7 +935,7 @@ function qe({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
927
935
|
streaming: i.streaming,
|
|
928
936
|
duration: i.duration,
|
|
929
937
|
className: "my-0"
|
|
930
|
-
}, n.key) : /* @__PURE__ */ k(
|
|
938
|
+
}, n.key) : /* @__PURE__ */ k(qe, {
|
|
931
939
|
entry: e,
|
|
932
940
|
part: i,
|
|
933
941
|
questions: t
|
|
@@ -935,13 +943,13 @@ function qe({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
935
943
|
})
|
|
936
944
|
});
|
|
937
945
|
}
|
|
938
|
-
function
|
|
946
|
+
function Ye({ entry: e, questions: t, hiddenPartId: n }) {
|
|
939
947
|
let i = Q();
|
|
940
948
|
if (e.kind === "thinking" && e.parts) {
|
|
941
949
|
let r = e.status === "error" || e.status === "stopped" || e.status === "running" && e.parts.length === 0;
|
|
942
950
|
return /* @__PURE__ */ A("li", {
|
|
943
951
|
className: "text-xs text-muted-foreground",
|
|
944
|
-
children: [e.parts.length > 0 && /* @__PURE__ */ k(
|
|
952
|
+
children: [e.parts.length > 0 && /* @__PURE__ */ k(Je, {
|
|
945
953
|
entry: e,
|
|
946
954
|
questions: t,
|
|
947
955
|
hiddenPartId: n
|
|
@@ -949,15 +957,15 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
949
957
|
className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
|
|
950
958
|
children: [/* @__PURE__ */ k("span", {
|
|
951
959
|
className: "pt-px",
|
|
952
|
-
children: /* @__PURE__ */ k(
|
|
960
|
+
children: /* @__PURE__ */ k(Be, { status: e.status })
|
|
953
961
|
}), /* @__PURE__ */ k("span", {
|
|
954
962
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
955
|
-
children:
|
|
963
|
+
children: Ve(e, i)
|
|
956
964
|
})]
|
|
957
965
|
})]
|
|
958
966
|
});
|
|
959
967
|
}
|
|
960
|
-
let a = e.kind === "thinking" && e.detail ?
|
|
968
|
+
let a = e.kind === "thinking" && e.detail ? Le(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? Ve(e, i) : e.label;
|
|
961
969
|
return /* @__PURE__ */ A("li", {
|
|
962
970
|
className: "text-xs text-muted-foreground",
|
|
963
971
|
children: [
|
|
@@ -965,7 +973,7 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
965
973
|
className: "flex items-start gap-1.5",
|
|
966
974
|
children: [/* @__PURE__ */ k("span", {
|
|
967
975
|
className: "pt-px",
|
|
968
|
-
children: /* @__PURE__ */ k(
|
|
976
|
+
children: /* @__PURE__ */ k(Be, { status: e.status })
|
|
969
977
|
}), /* @__PURE__ */ k("span", {
|
|
970
978
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
971
979
|
children: c
|
|
@@ -973,7 +981,7 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
973
981
|
}),
|
|
974
982
|
o.length > 0 && /* @__PURE__ */ k("div", {
|
|
975
983
|
className: "mt-1 ml-[18px] space-y-1",
|
|
976
|
-
children: o.map((e, t) => /* @__PURE__ */ k(
|
|
984
|
+
children: o.map((e, t) => /* @__PURE__ */ k(Re, {
|
|
977
985
|
content: e.content,
|
|
978
986
|
language: e.language
|
|
979
987
|
}, t))
|
|
@@ -989,7 +997,7 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
989
997
|
]
|
|
990
998
|
});
|
|
991
999
|
}
|
|
992
|
-
function
|
|
1000
|
+
function Xe({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
993
1001
|
if (e.length === 0) return null;
|
|
994
1002
|
let i = [];
|
|
995
1003
|
for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
|
|
@@ -998,12 +1006,12 @@ function Ye({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
|
998
1006
|
} : { entries: [t] }) : i[i.length - 1].entries.push(t);
|
|
999
1007
|
return /* @__PURE__ */ k("ul", {
|
|
1000
1008
|
className: "space-y-0.5",
|
|
1001
|
-
children: i.map((e) => /* @__PURE__ */ A("li", { children: [e.user && /* @__PURE__ */ k(
|
|
1009
|
+
children: i.map((e) => /* @__PURE__ */ A("li", { children: [e.user && /* @__PURE__ */ k(Ue, {
|
|
1002
1010
|
entry: e.user,
|
|
1003
1011
|
pinned: r
|
|
1004
1012
|
}), e.entries.length > 0 && /* @__PURE__ */ k("ul", {
|
|
1005
1013
|
className: "space-y-0.5",
|
|
1006
|
-
children: e.entries.map((e) => /* @__PURE__ */ k(
|
|
1014
|
+
children: e.entries.map((e) => /* @__PURE__ */ k(Ye, {
|
|
1007
1015
|
entry: e,
|
|
1008
1016
|
questions: t,
|
|
1009
1017
|
hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
|
|
@@ -1013,55 +1021,55 @@ function Ye({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
|
1013
1021
|
}
|
|
1014
1022
|
//#endregion
|
|
1015
1023
|
//#region src/presentation/panelWidth.ts
|
|
1016
|
-
var
|
|
1017
|
-
function
|
|
1024
|
+
var Ze = 420, Qe = 320, $e = "60vw", et = "agentico:panel-width";
|
|
1025
|
+
function tt(e, t) {
|
|
1018
1026
|
if (typeof e == "number") return e;
|
|
1019
1027
|
let n = Number.parseFloat(e);
|
|
1020
1028
|
return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
|
|
1021
1029
|
}
|
|
1022
|
-
function
|
|
1030
|
+
function nt(e, t, n) {
|
|
1023
1031
|
return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
|
|
1024
1032
|
}
|
|
1025
|
-
function
|
|
1033
|
+
function rt() {
|
|
1026
1034
|
try {
|
|
1027
|
-
let e = window.localStorage.getItem(
|
|
1035
|
+
let e = window.localStorage.getItem(et), t = e === null ? NaN : Number(e);
|
|
1028
1036
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
1029
1037
|
} catch {
|
|
1030
1038
|
return null;
|
|
1031
1039
|
}
|
|
1032
1040
|
}
|
|
1033
|
-
function
|
|
1041
|
+
function it(e) {
|
|
1034
1042
|
try {
|
|
1035
|
-
e === null ? window.localStorage.removeItem(
|
|
1043
|
+
e === null ? window.localStorage.removeItem(et) : window.localStorage.setItem(et, String(e));
|
|
1036
1044
|
} catch {}
|
|
1037
1045
|
}
|
|
1038
|
-
function
|
|
1046
|
+
function at() {
|
|
1039
1047
|
return typeof window > "u" ? Infinity : window.innerWidth;
|
|
1040
1048
|
}
|
|
1041
|
-
function
|
|
1042
|
-
let [i, a] = D(
|
|
1049
|
+
function ot({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = $e, onWidthChange: r }) {
|
|
1050
|
+
let [i, a] = D(at), [o, s] = D(() => rt() ?? e);
|
|
1043
1051
|
C(() => {
|
|
1044
1052
|
if (typeof window > "u") return;
|
|
1045
1053
|
let e = () => a(window.innerWidth);
|
|
1046
1054
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1047
1055
|
}, []);
|
|
1048
|
-
let c = t, l = Math.max(c,
|
|
1056
|
+
let c = t, l = Math.max(c, tt(n, i)), u = nt(o, c, l);
|
|
1049
1057
|
return C(() => {
|
|
1050
1058
|
r?.(u);
|
|
1051
1059
|
}, [u]), {
|
|
1052
1060
|
width: u,
|
|
1053
1061
|
min: c,
|
|
1054
1062
|
max: l,
|
|
1055
|
-
set: x((e) => s(
|
|
1056
|
-
commit: x((e) =>
|
|
1063
|
+
set: x((e) => s(nt(e, c, l)), [c, l]),
|
|
1064
|
+
commit: x((e) => it(nt(e, c, l)), [c, l]),
|
|
1057
1065
|
reset: x(() => {
|
|
1058
|
-
s(e),
|
|
1066
|
+
s(e), it(null);
|
|
1059
1067
|
}, [e])
|
|
1060
1068
|
};
|
|
1061
1069
|
}
|
|
1062
1070
|
//#endregion
|
|
1063
1071
|
//#region src/presentation/AgenticoResizeHandle.tsx
|
|
1064
|
-
function
|
|
1072
|
+
function st({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
|
|
1065
1073
|
let o = Q(), s = E(null), [c, l] = D(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
|
|
1066
1074
|
let t = s.current;
|
|
1067
1075
|
if (t && t.pointerId === e.pointerId) {
|
|
@@ -1119,7 +1127,7 @@ function ot({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1119
1127
|
}
|
|
1120
1128
|
//#endregion
|
|
1121
1129
|
//#region src/presentation/AgenticoToggle.tsx
|
|
1122
|
-
function
|
|
1130
|
+
function ct({ className: e = "" }) {
|
|
1123
1131
|
let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
|
|
1124
1132
|
return /* @__PURE__ */ k(t, {
|
|
1125
1133
|
icon: "bot",
|
|
@@ -1132,21 +1140,21 @@ function st({ className: e = "" }) {
|
|
|
1132
1140
|
}
|
|
1133
1141
|
//#endregion
|
|
1134
1142
|
//#region src/presentation/useAIModelCatalog.ts
|
|
1135
|
-
var
|
|
1136
|
-
function
|
|
1143
|
+
var lt = "llmnative-cms.selectedAIModel";
|
|
1144
|
+
function ut() {
|
|
1137
1145
|
try {
|
|
1138
|
-
return localStorage.getItem(
|
|
1146
|
+
return localStorage.getItem(lt) ?? "";
|
|
1139
1147
|
} catch {
|
|
1140
1148
|
return "";
|
|
1141
1149
|
}
|
|
1142
1150
|
}
|
|
1143
|
-
function
|
|
1151
|
+
function dt(e) {
|
|
1144
1152
|
try {
|
|
1145
|
-
e ? localStorage.setItem(
|
|
1153
|
+
e ? localStorage.setItem(lt, e) : localStorage.removeItem(lt);
|
|
1146
1154
|
} catch {}
|
|
1147
1155
|
}
|
|
1148
|
-
function
|
|
1149
|
-
let e = _()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = D({}), [i, a] = D(!1), [o, s] = D(
|
|
1156
|
+
function ft() {
|
|
1157
|
+
let e = _()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = D({}), [i, a] = D(!1), [o, s] = D(ut);
|
|
1150
1158
|
return C(() => {
|
|
1151
1159
|
if (!t) {
|
|
1152
1160
|
r({});
|
|
@@ -1157,7 +1165,7 @@ function dt() {
|
|
|
1157
1165
|
if (n) return;
|
|
1158
1166
|
r(e.modelsByProvider);
|
|
1159
1167
|
let t = Object.values(e.modelsByProvider).flat();
|
|
1160
|
-
s((e) => t.some((t) => t.id === e) ? e : (
|
|
1168
|
+
s((e) => t.some((t) => t.id === e) ? e : (dt(""), ""));
|
|
1161
1169
|
}).catch((e) => {
|
|
1162
1170
|
console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
|
|
1163
1171
|
}).finally(() => {
|
|
@@ -1171,17 +1179,17 @@ function dt() {
|
|
|
1171
1179
|
modelsLoading: i,
|
|
1172
1180
|
selectedModel: o,
|
|
1173
1181
|
setSelectedModel: (e) => {
|
|
1174
|
-
|
|
1182
|
+
dt(e), s(e);
|
|
1175
1183
|
}
|
|
1176
1184
|
};
|
|
1177
1185
|
}
|
|
1178
1186
|
//#endregion
|
|
1179
1187
|
//#region src/domain/approval.ts
|
|
1180
|
-
var
|
|
1181
|
-
function
|
|
1188
|
+
var pt = "approval";
|
|
1189
|
+
function mt(e, t) {
|
|
1182
1190
|
return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
|
|
1183
1191
|
}
|
|
1184
|
-
function
|
|
1192
|
+
function ht(e, t, n) {
|
|
1185
1193
|
let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
|
|
1186
1194
|
return {
|
|
1187
1195
|
approved: r.includes(t) && !r.includes(n),
|
|
@@ -1190,35 +1198,44 @@ function mt(e, t, n) {
|
|
|
1190
1198
|
}
|
|
1191
1199
|
//#endregion
|
|
1192
1200
|
//#region src/presentation/useAgent.ts
|
|
1193
|
-
var
|
|
1194
|
-
function
|
|
1195
|
-
return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <=
|
|
1201
|
+
var gt = 20, _t = 26e4;
|
|
1202
|
+
function vt(e) {
|
|
1203
|
+
return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= _t);
|
|
1196
1204
|
}
|
|
1197
|
-
function
|
|
1198
|
-
let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } =
|
|
1205
|
+
function yt(e, t = {}) {
|
|
1206
|
+
let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = ft(), [u, f] = D(!1), [p, m] = D(null), [g, v] = D(!1), [y, b] = D([]), x = E([]), S = (e) => {
|
|
1199
1207
|
b((t) => {
|
|
1200
1208
|
let n = typeof e == "function" ? e(t) : e;
|
|
1201
1209
|
return x.current = n, n;
|
|
1202
1210
|
});
|
|
1203
|
-
}, C = E(/* @__PURE__ */ new Map()), w = Q(),
|
|
1204
|
-
|
|
1205
|
-
let
|
|
1206
|
-
|
|
1207
|
-
},
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
let
|
|
1211
|
-
|
|
1212
|
-
},
|
|
1213
|
-
|
|
1214
|
-
|
|
1211
|
+
}, C = E(/* @__PURE__ */ new Map()), w = Q(), O = E(w);
|
|
1212
|
+
O.current = w;
|
|
1213
|
+
let k = E(null), A = E(!1), M = E(null), te = () => {
|
|
1214
|
+
M.current?.abort();
|
|
1215
|
+
}, F = _()?.registry ?? {}, [I, L] = D(void 0), R = E(void 0), z = (e, t) => {
|
|
1216
|
+
if (!t) return !1;
|
|
1217
|
+
if (!e) return !0;
|
|
1218
|
+
let n = h(t);
|
|
1219
|
+
return !!n && e.includes(n.provider);
|
|
1220
|
+
}, ne = T(() => I ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => I.includes(e.provider))]).filter(([, e]) => e.length)) : o, [I, o]), B = z(I, c) ? c : Object.values(ne).flat()[0]?.id ?? "", H = r && B ? h(B) : null, U = H ? F[H.provider] : null, W = e.executor, G = !!W?.alongside, K = !!W && !G, re = E([]), ie = (e) => !!e && re.current.some((t) => t.value === e), J = E(!1), [ae, oe] = D([]), [se, ce] = D(""), Y = E(""), X = (e) => {
|
|
1221
|
+
Y.current = e, ce(e);
|
|
1222
|
+
}, de = (e) => {
|
|
1223
|
+
let t = W?.models?.(e) ?? [];
|
|
1224
|
+
re.current = t, oe(t);
|
|
1225
|
+
let n = W?.catalogProviders?.(e);
|
|
1226
|
+
R.current = n, L(n);
|
|
1227
|
+
let r = G && !z(n, c) ? t[0]?.value : void 0;
|
|
1228
|
+
X(W?.defaultModel?.(e) ?? r ?? "");
|
|
1229
|
+
}, fe = async (e, t, n, r) => {
|
|
1230
|
+
let i = k.current;
|
|
1231
|
+
if (!i || !W) return m(O.current.noActiveSession), null;
|
|
1215
1232
|
let a = new AbortController();
|
|
1216
|
-
|
|
1233
|
+
M.current = a;
|
|
1217
1234
|
let o = crypto.randomUUID();
|
|
1218
1235
|
S((e) => [...e, {
|
|
1219
1236
|
id: o,
|
|
1220
1237
|
kind: "thinking",
|
|
1221
|
-
label:
|
|
1238
|
+
label: O.current.thinking,
|
|
1222
1239
|
status: "running",
|
|
1223
1240
|
parts: []
|
|
1224
1241
|
}]);
|
|
@@ -1228,14 +1245,14 @@ function vt(e, t = {}) {
|
|
|
1228
1245
|
duration: e.duration ?? c(e.id)
|
|
1229
1246
|
}), u = (e, t) => S((n) => n.map((n) => {
|
|
1230
1247
|
if (n.id !== o) return n;
|
|
1231
|
-
let r = e(n.parts ?? []), i =
|
|
1248
|
+
let r = e(n.parts ?? []), i = N(r);
|
|
1232
1249
|
return {
|
|
1233
1250
|
...n,
|
|
1234
1251
|
parts: r,
|
|
1235
1252
|
...t ? { status: t } : {},
|
|
1236
1253
|
...i ? { detail: i } : {}
|
|
1237
1254
|
};
|
|
1238
|
-
})), d = (e) => u((t) =>
|
|
1255
|
+
})), d = (e) => u((t) => ee(t, e, l)), f = !1, p = (e, t) => {
|
|
1239
1256
|
t?.id && t.id !== "text" && (f = !0), d({
|
|
1240
1257
|
type: "text",
|
|
1241
1258
|
id: t?.id ?? "text",
|
|
@@ -1280,7 +1297,7 @@ function vt(e, t = {}) {
|
|
|
1280
1297
|
});
|
|
1281
1298
|
}));
|
|
1282
1299
|
}, x = (e, t) => {
|
|
1283
|
-
u((n) => (t && !f ?
|
|
1300
|
+
u((n) => (t && !f ? ee(n, {
|
|
1284
1301
|
type: "text",
|
|
1285
1302
|
id: j,
|
|
1286
1303
|
text: t,
|
|
@@ -1296,13 +1313,13 @@ function vt(e, t = {}) {
|
|
|
1296
1313
|
_.clear();
|
|
1297
1314
|
}, w = e || r?.historyText || "";
|
|
1298
1315
|
try {
|
|
1299
|
-
let o = await
|
|
1316
|
+
let o = await W.turn({
|
|
1300
1317
|
params: i.params,
|
|
1301
1318
|
context: i.context,
|
|
1302
1319
|
text: e,
|
|
1303
1320
|
first: t,
|
|
1304
1321
|
signal: a.signal,
|
|
1305
|
-
...n ||
|
|
1322
|
+
...n || Y.current ? { model: n || Y.current } : {},
|
|
1306
1323
|
...r ? { answers: {
|
|
1307
1324
|
id: r.id,
|
|
1308
1325
|
answers: r.answers
|
|
@@ -1327,13 +1344,13 @@ function vt(e, t = {}) {
|
|
|
1327
1344
|
return i.history = [...i.history, ...w ? [{
|
|
1328
1345
|
role: "user",
|
|
1329
1346
|
content: w
|
|
1330
|
-
}] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), m(
|
|
1347
|
+
}] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), m(ue(e)), null);
|
|
1331
1348
|
} finally {
|
|
1332
|
-
|
|
1349
|
+
M.current = null;
|
|
1333
1350
|
}
|
|
1334
|
-
},
|
|
1351
|
+
}, pe = async (e, t, n) => {
|
|
1335
1352
|
let r = x.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
1336
|
-
if (!r || r.type !== "questions") throw m(
|
|
1353
|
+
if (!r || r.type !== "questions") throw m(O.current.noActiveSession), Error(O.current.noActiveSession);
|
|
1337
1354
|
let i = () => S((r) => r.map((r) => r.id === e ? {
|
|
1338
1355
|
...r,
|
|
1339
1356
|
parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
|
|
@@ -1342,30 +1359,30 @@ function vt(e, t = {}) {
|
|
|
1342
1359
|
} : e)
|
|
1343
1360
|
} : r)), a = `${e}:${t}`, o = C.current.get(a);
|
|
1344
1361
|
if (o) return C.current.delete(a), i(), o.resolve(n), null;
|
|
1345
|
-
if (
|
|
1346
|
-
if (!
|
|
1347
|
-
|
|
1362
|
+
if (A.current) throw m(O.current.requestInProgress), Error(O.current.requestInProgress);
|
|
1363
|
+
if (!K || !k.current) throw m(O.current.noActiveSession), Error(O.current.noActiveSession);
|
|
1364
|
+
A.current = !0, f(!0), m(null), i();
|
|
1348
1365
|
try {
|
|
1349
|
-
return await
|
|
1366
|
+
return await fe("", !1, void 0, {
|
|
1350
1367
|
id: t,
|
|
1351
1368
|
answers: n,
|
|
1352
|
-
historyText:
|
|
1369
|
+
historyText: P(r.questions, n)
|
|
1353
1370
|
});
|
|
1354
1371
|
} finally {
|
|
1355
|
-
|
|
1372
|
+
A.current = !1, f(!1);
|
|
1356
1373
|
}
|
|
1357
|
-
},
|
|
1358
|
-
let i =
|
|
1359
|
-
if (!
|
|
1360
|
-
let
|
|
1361
|
-
if (!
|
|
1362
|
-
n?.length && (
|
|
1363
|
-
let
|
|
1374
|
+
}, Z = async (t, n, r) => {
|
|
1375
|
+
let i = R.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && z(i, r) ? r : z(i, B) ? void 0 : a, c = k.current;
|
|
1376
|
+
if (!c) return m(O.current.noActiveSession), null;
|
|
1377
|
+
let l = s ? h(s) : H, u = l ? F[l.provider] : null;
|
|
1378
|
+
if (!u || !l) return m(O.current.noProviderAvailable), null;
|
|
1379
|
+
n?.length && (c.attachmentsRef.current = [...c.attachmentsRef.current ?? [], ...n]);
|
|
1380
|
+
let f = (n ?? []).filter((e) => d.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= _t ? `\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(""), p = vt(n ?? []), g = c.tools.map((e) => ({
|
|
1364
1381
|
name: e.name,
|
|
1365
1382
|
description: e.description,
|
|
1366
|
-
inputSchema:
|
|
1367
|
-
})),
|
|
1368
|
-
let i =
|
|
1383
|
+
inputSchema: V(e.inputSchema)
|
|
1384
|
+
})), _ = (e, t, n, r) => {
|
|
1385
|
+
let i = O.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
|
|
1369
1386
|
S((e) => [...e, {
|
|
1370
1387
|
id: a,
|
|
1371
1388
|
kind: "thinking",
|
|
@@ -1373,7 +1390,7 @@ function vt(e, t = {}) {
|
|
|
1373
1390
|
status: "running",
|
|
1374
1391
|
parts: [{
|
|
1375
1392
|
type: "questions",
|
|
1376
|
-
id:
|
|
1393
|
+
id: pt,
|
|
1377
1394
|
questions: [{
|
|
1378
1395
|
header: i.approvalHeader,
|
|
1379
1396
|
question: i.approveQuestion.replace("{action}", o),
|
|
@@ -1382,10 +1399,10 @@ function vt(e, t = {}) {
|
|
|
1382
1399
|
}]
|
|
1383
1400
|
}]
|
|
1384
1401
|
}]);
|
|
1385
|
-
let s = `${a}:${
|
|
1402
|
+
let s = `${a}:${pt}`;
|
|
1386
1403
|
return new Promise((e, t) => {
|
|
1387
1404
|
let n = () => {
|
|
1388
|
-
C.current.delete(s),
|
|
1405
|
+
C.current.delete(s), b(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
|
|
1389
1406
|
};
|
|
1390
1407
|
if (r.aborted) {
|
|
1391
1408
|
n();
|
|
@@ -1393,88 +1410,88 @@ function vt(e, t = {}) {
|
|
|
1393
1410
|
}
|
|
1394
1411
|
r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
|
|
1395
1412
|
resolve: (t) => {
|
|
1396
|
-
r.removeEventListener("abort", n),
|
|
1413
|
+
r.removeEventListener("abort", n), b(a, "done"), e(ht(t, i.approve, i.reject));
|
|
1397
1414
|
},
|
|
1398
1415
|
reject: t
|
|
1399
1416
|
});
|
|
1400
1417
|
});
|
|
1401
|
-
},
|
|
1402
|
-
|
|
1403
|
-
let
|
|
1418
|
+
}, v = new Map(c.tools.map((e) => [e.name, e])), y = new AbortController();
|
|
1419
|
+
M.current = y;
|
|
1420
|
+
let b = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
|
|
1404
1421
|
...i,
|
|
1405
1422
|
status: t,
|
|
1406
1423
|
...n === void 0 ? {} : { detail: n },
|
|
1407
1424
|
...r === void 0 ? {} : { toolNames: r }
|
|
1408
1425
|
} : i));
|
|
1409
1426
|
try {
|
|
1410
|
-
let n =
|
|
1411
|
-
for (let t = 0; t <
|
|
1412
|
-
let
|
|
1427
|
+
let n = c.history, r = t;
|
|
1428
|
+
for (let t = 0; t < gt; t++) {
|
|
1429
|
+
let i = crypto.randomUUID();
|
|
1413
1430
|
S((e) => [...e, {
|
|
1414
|
-
id:
|
|
1431
|
+
id: i,
|
|
1415
1432
|
kind: "thinking",
|
|
1416
|
-
label:
|
|
1433
|
+
label: O.current.thinking,
|
|
1417
1434
|
status: "running"
|
|
1418
1435
|
}]);
|
|
1419
|
-
let
|
|
1436
|
+
let a;
|
|
1420
1437
|
try {
|
|
1421
|
-
|
|
1438
|
+
a = await u.complete({
|
|
1422
1439
|
prompt: r,
|
|
1423
|
-
model:
|
|
1440
|
+
model: l.model,
|
|
1424
1441
|
history: n,
|
|
1425
|
-
tools:
|
|
1426
|
-
signal:
|
|
1427
|
-
attachments: t === 0 ?
|
|
1428
|
-
logId:
|
|
1442
|
+
tools: g.length ? g : void 0,
|
|
1443
|
+
signal: y.signal,
|
|
1444
|
+
attachments: t === 0 ? p : void 0,
|
|
1445
|
+
logId: c.logId
|
|
1429
1446
|
});
|
|
1430
1447
|
} catch (t) {
|
|
1431
|
-
return
|
|
1448
|
+
return c.history = [...n, ...r ? [{
|
|
1432
1449
|
role: "user",
|
|
1433
|
-
content: r +
|
|
1434
|
-
}] : []],
|
|
1450
|
+
content: r + f
|
|
1451
|
+
}] : []], y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), m(ue(t)), null);
|
|
1435
1452
|
}
|
|
1436
|
-
if (
|
|
1453
|
+
if (c.history = [...n, ...r ? [{
|
|
1437
1454
|
role: "user",
|
|
1438
|
-
content: r +
|
|
1439
|
-
}] : []], !
|
|
1440
|
-
if (
|
|
1455
|
+
content: r + f
|
|
1456
|
+
}] : []], !a) return y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), m(O.current.noProviderResponse), null);
|
|
1457
|
+
if (a.type === "text") return b(i, "done", a.text), e.conversational && a.text.trim() && S((e) => e.map((e) => e.id === i ? {
|
|
1441
1458
|
...e,
|
|
1442
1459
|
parts: [{
|
|
1443
1460
|
type: "text",
|
|
1444
1461
|
id: "text",
|
|
1445
|
-
text:
|
|
1462
|
+
text: a.text
|
|
1446
1463
|
}]
|
|
1447
|
-
} : e)),
|
|
1464
|
+
} : e)), c.history = [
|
|
1448
1465
|
...n,
|
|
1449
1466
|
...r ? [{
|
|
1450
1467
|
role: "user",
|
|
1451
|
-
content: r +
|
|
1468
|
+
content: r + f
|
|
1452
1469
|
}] : [],
|
|
1453
1470
|
{
|
|
1454
1471
|
role: "assistant",
|
|
1455
|
-
content:
|
|
1472
|
+
content: a.text
|
|
1456
1473
|
}
|
|
1457
|
-
], e.parseResponse(
|
|
1458
|
-
responseLength:
|
|
1459
|
-
responsePreview:
|
|
1460
|
-
params:
|
|
1461
|
-
}), m(
|
|
1462
|
-
let
|
|
1463
|
-
let t =
|
|
1474
|
+
], e.parseResponse(a.text, c.params, c.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
|
|
1475
|
+
responseLength: a.text.length,
|
|
1476
|
+
responsePreview: a.text.length > 2e3 ? `${a.text.slice(0, 1e3)}\n…[troncato qui nel log, ${a.text.length} caratteri totali]…\n${a.text.slice(-1e3)}` : a.text,
|
|
1477
|
+
params: c.params
|
|
1478
|
+
}), m(O.current.invalidResponse), e.fallback(c.params, c.context));
|
|
1479
|
+
let o = a.toolCalls.map((e) => {
|
|
1480
|
+
let t = v.get(e.name);
|
|
1464
1481
|
return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
|
|
1465
1482
|
});
|
|
1466
|
-
|
|
1467
|
-
let
|
|
1468
|
-
for (let t of
|
|
1469
|
-
let n =
|
|
1470
|
-
if (n &&
|
|
1471
|
-
|
|
1483
|
+
b(i, "done", a.text || void 0, a.text ? void 0 : o);
|
|
1484
|
+
let s = /* @__PURE__ */ new Map();
|
|
1485
|
+
for (let t of a.toolCalls) {
|
|
1486
|
+
let n = v.get(t.name);
|
|
1487
|
+
if (n && mt(n, t.input)) try {
|
|
1488
|
+
s.set(t.id, await _(t.id, n, t.input, y.signal));
|
|
1472
1489
|
} catch {
|
|
1473
|
-
return e.fallback(
|
|
1490
|
+
return e.fallback(c.params, c.context);
|
|
1474
1491
|
}
|
|
1475
1492
|
}
|
|
1476
|
-
let
|
|
1477
|
-
let t =
|
|
1493
|
+
let d = await Promise.all(a.toolCalls.map(async (e) => {
|
|
1494
|
+
let t = v.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
|
|
1478
1495
|
if (r && !r.approved) {
|
|
1479
1496
|
S((t) => [...t, {
|
|
1480
1497
|
id: e.id,
|
|
@@ -1482,7 +1499,7 @@ function vt(e, t = {}) {
|
|
|
1482
1499
|
label: n,
|
|
1483
1500
|
status: "stopped"
|
|
1484
1501
|
}]);
|
|
1485
|
-
let t =
|
|
1502
|
+
let t = q().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
|
|
1486
1503
|
return {
|
|
1487
1504
|
toolCallId: e.id,
|
|
1488
1505
|
name: e.name,
|
|
@@ -1495,7 +1512,7 @@ function vt(e, t = {}) {
|
|
|
1495
1512
|
kind: "tool",
|
|
1496
1513
|
label: n,
|
|
1497
1514
|
status: "running"
|
|
1498
|
-
}]), !t) return
|
|
1515
|
+
}]), !t) return b(e.id, "error"), {
|
|
1499
1516
|
toolCallId: e.id,
|
|
1500
1517
|
name: e.name,
|
|
1501
1518
|
output: `Tool sconosciuto: ${e.name}`,
|
|
@@ -1503,16 +1520,16 @@ function vt(e, t = {}) {
|
|
|
1503
1520
|
};
|
|
1504
1521
|
try {
|
|
1505
1522
|
let n = await t.execute(e.input);
|
|
1506
|
-
return
|
|
1523
|
+
return b(e.id, "done"), {
|
|
1507
1524
|
toolCallId: e.id,
|
|
1508
1525
|
name: e.name,
|
|
1509
1526
|
output: n
|
|
1510
1527
|
};
|
|
1511
1528
|
} catch (t) {
|
|
1512
|
-
return
|
|
1529
|
+
return b(e.id, "error"), {
|
|
1513
1530
|
toolCallId: e.id,
|
|
1514
1531
|
name: e.name,
|
|
1515
|
-
output:
|
|
1532
|
+
output: ue(t),
|
|
1516
1533
|
isError: !0
|
|
1517
1534
|
};
|
|
1518
1535
|
}
|
|
@@ -1521,53 +1538,53 @@ function vt(e, t = {}) {
|
|
|
1521
1538
|
...n,
|
|
1522
1539
|
...r ? [{
|
|
1523
1540
|
role: "user",
|
|
1524
|
-
content: r +
|
|
1541
|
+
content: r + f
|
|
1525
1542
|
}] : [],
|
|
1526
1543
|
{
|
|
1527
1544
|
role: "assistant",
|
|
1528
|
-
content:
|
|
1529
|
-
toolCalls:
|
|
1545
|
+
content: a.text,
|
|
1546
|
+
toolCalls: a.toolCalls
|
|
1530
1547
|
},
|
|
1531
1548
|
{
|
|
1532
1549
|
role: "tool_result",
|
|
1533
|
-
results:
|
|
1550
|
+
results: d
|
|
1534
1551
|
}
|
|
1535
1552
|
], r = "";
|
|
1536
1553
|
}
|
|
1537
|
-
let
|
|
1554
|
+
let i = crypto.randomUUID();
|
|
1538
1555
|
S((e) => [...e, {
|
|
1539
|
-
id:
|
|
1556
|
+
id: i,
|
|
1540
1557
|
kind: "thinking",
|
|
1541
|
-
label:
|
|
1558
|
+
label: O.current.thinking,
|
|
1542
1559
|
status: "running"
|
|
1543
1560
|
}]);
|
|
1544
|
-
let
|
|
1561
|
+
let a;
|
|
1545
1562
|
try {
|
|
1546
|
-
|
|
1547
|
-
prompt:
|
|
1548
|
-
model:
|
|
1563
|
+
a = await u.complete({
|
|
1564
|
+
prompt: le(q().stopCallingTools, e.microPromptIds),
|
|
1565
|
+
model: l.model,
|
|
1549
1566
|
history: n,
|
|
1550
|
-
signal:
|
|
1551
|
-
logId:
|
|
1567
|
+
signal: y.signal,
|
|
1568
|
+
logId: c.logId
|
|
1552
1569
|
});
|
|
1553
1570
|
} catch {
|
|
1554
|
-
|
|
1571
|
+
a = null;
|
|
1555
1572
|
}
|
|
1556
|
-
if (
|
|
1557
|
-
|
|
1573
|
+
if (a?.type === "text") {
|
|
1574
|
+
b(i, "done", a.text), c.history = [...n, {
|
|
1558
1575
|
role: "assistant",
|
|
1559
|
-
content:
|
|
1576
|
+
content: a.text
|
|
1560
1577
|
}];
|
|
1561
|
-
let t = e.parseResponse(
|
|
1578
|
+
let t = e.parseResponse(a.text, c.params, c.context);
|
|
1562
1579
|
if (t) return t;
|
|
1563
|
-
} else
|
|
1564
|
-
return
|
|
1580
|
+
} else b(i, y.signal.aborted ? "stopped" : "error"), c.history = n;
|
|
1581
|
+
return y.signal.aborted || m(O.current.tooManyToolTurns), e.fallback(c.params, c.context);
|
|
1565
1582
|
} finally {
|
|
1566
|
-
|
|
1583
|
+
M.current = null;
|
|
1567
1584
|
}
|
|
1568
|
-
},
|
|
1569
|
-
if (
|
|
1570
|
-
|
|
1585
|
+
}, me = async (t, n) => {
|
|
1586
|
+
if (A.current) return m(O.current.requestInProgress), null;
|
|
1587
|
+
A.current = !0, m(null), S(n?.openingMessage ? [{
|
|
1571
1588
|
id: crypto.randomUUID(),
|
|
1572
1589
|
kind: "user",
|
|
1573
1590
|
label: "Tu",
|
|
@@ -1577,20 +1594,20 @@ function vt(e, t = {}) {
|
|
|
1577
1594
|
}] : []), f(!0);
|
|
1578
1595
|
try {
|
|
1579
1596
|
let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
|
|
1580
|
-
if (
|
|
1597
|
+
if (k.current = {
|
|
1581
1598
|
params: t,
|
|
1582
1599
|
context: i,
|
|
1583
1600
|
tools: o,
|
|
1584
1601
|
history: [],
|
|
1585
1602
|
logId: crypto.randomUUID(),
|
|
1586
1603
|
attachmentsRef: a
|
|
1587
|
-
},
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1590
|
-
let e = n?.model ||
|
|
1591
|
-
if (
|
|
1604
|
+
}, K) return v(!0), de(t), await fe(n?.openingMessage ?? "", !0);
|
|
1605
|
+
if (G) {
|
|
1606
|
+
de(t), J.current = !1;
|
|
1607
|
+
let e = n?.model || Y.current;
|
|
1608
|
+
if (ie(e)) return v(!0), J.current = !0, await fe(n?.openingMessage ?? "", !0, e);
|
|
1592
1609
|
}
|
|
1593
|
-
let s = n?.model || void 0, c = s ? !!
|
|
1610
|
+
let s = n?.model || void 0, c = s ? !!F[h(s)?.provider ?? ""] : !!U;
|
|
1594
1611
|
if (!r || !c) {
|
|
1595
1612
|
v(!1);
|
|
1596
1613
|
let n = e.fallback(t, i);
|
|
@@ -1598,44 +1615,44 @@ function vt(e, t = {}) {
|
|
|
1598
1615
|
id: crypto.randomUUID(),
|
|
1599
1616
|
kind: "tool",
|
|
1600
1617
|
status: "done",
|
|
1601
|
-
label: e.describeFallback?.(n) ??
|
|
1618
|
+
label: e.describeFallback?.(n) ?? O.current.aiDisabledFallback
|
|
1602
1619
|
}]), n;
|
|
1603
1620
|
}
|
|
1604
1621
|
v(!0);
|
|
1605
|
-
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, u =
|
|
1606
|
-
return await
|
|
1622
|
+
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);
|
|
1623
|
+
return await Z(u, l, s);
|
|
1607
1624
|
} catch (e) {
|
|
1608
|
-
return m(
|
|
1625
|
+
return m(ue(e)), null;
|
|
1609
1626
|
} finally {
|
|
1610
|
-
|
|
1627
|
+
A.current = !1, f(!1);
|
|
1611
1628
|
}
|
|
1612
|
-
},
|
|
1613
|
-
if (
|
|
1614
|
-
m(
|
|
1629
|
+
}, he = async (t, n) => {
|
|
1630
|
+
if (A.current) {
|
|
1631
|
+
m(O.current.requestInProgress);
|
|
1615
1632
|
return;
|
|
1616
1633
|
}
|
|
1617
|
-
|
|
1634
|
+
A.current = !0, m(null), S(n.activity), f(!0);
|
|
1618
1635
|
try {
|
|
1619
1636
|
let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
|
|
1620
|
-
|
|
1637
|
+
k.current = {
|
|
1621
1638
|
params: t,
|
|
1622
1639
|
context: i,
|
|
1623
1640
|
tools: o,
|
|
1624
1641
|
history: n.history,
|
|
1625
1642
|
logId: crypto.randomUUID(),
|
|
1626
1643
|
attachmentsRef: a
|
|
1627
|
-
}, (
|
|
1644
|
+
}, (K || G) && de(t), J.current = !1, v(K || G || r && !!U);
|
|
1628
1645
|
} catch (e) {
|
|
1629
|
-
m(
|
|
1646
|
+
m(ue(e));
|
|
1630
1647
|
} finally {
|
|
1631
|
-
|
|
1648
|
+
A.current = !1, f(!1);
|
|
1632
1649
|
}
|
|
1633
|
-
},
|
|
1634
|
-
if (
|
|
1650
|
+
}, ge = async (t, n) => {
|
|
1651
|
+
if (A.current) return m(O.current.requestInProgress), null;
|
|
1635
1652
|
if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
|
|
1636
|
-
let r =
|
|
1637
|
-
if (!r) return m(
|
|
1638
|
-
|
|
1653
|
+
let r = k.current;
|
|
1654
|
+
if (!r) return m(O.current.noActiveSession), null;
|
|
1655
|
+
A.current = !0, f(!0), S((e) => [...e, {
|
|
1639
1656
|
id: crypto.randomUUID(),
|
|
1640
1657
|
kind: "user",
|
|
1641
1658
|
label: "Tu",
|
|
@@ -1644,21 +1661,21 @@ function vt(e, t = {}) {
|
|
|
1644
1661
|
...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
|
|
1645
1662
|
}]);
|
|
1646
1663
|
try {
|
|
1647
|
-
if (
|
|
1648
|
-
let i = n?.model || (
|
|
1649
|
-
if (
|
|
1650
|
-
let e = !
|
|
1651
|
-
return
|
|
1664
|
+
if (K) return await fe(t, !1, n?.model || void 0);
|
|
1665
|
+
let i = n?.model || (G ? Y.current : "");
|
|
1666
|
+
if (G && ie(i)) {
|
|
1667
|
+
let e = !J.current;
|
|
1668
|
+
return J.current = !0, await fe(t, e, i);
|
|
1652
1669
|
}
|
|
1653
|
-
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, o =
|
|
1654
|
-
return await
|
|
1670
|
+
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, o = le(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
|
|
1671
|
+
return await Z(o, a, n?.model || void 0);
|
|
1655
1672
|
} catch (e) {
|
|
1656
|
-
return m(
|
|
1673
|
+
return m(ue(e)), null;
|
|
1657
1674
|
} finally {
|
|
1658
|
-
|
|
1675
|
+
A.current = !1, f(!1);
|
|
1659
1676
|
}
|
|
1660
|
-
},
|
|
1661
|
-
let t =
|
|
1677
|
+
}, _e = () => {
|
|
1678
|
+
let t = k.current;
|
|
1662
1679
|
if (!t) return null;
|
|
1663
1680
|
m(null);
|
|
1664
1681
|
let n = e.fallback(t.params, t.context);
|
|
@@ -1666,58 +1683,58 @@ function vt(e, t = {}) {
|
|
|
1666
1683
|
id: crypto.randomUUID(),
|
|
1667
1684
|
kind: "tool",
|
|
1668
1685
|
status: "done",
|
|
1669
|
-
label: e.describeFallback?.(n) ??
|
|
1686
|
+
label: e.describeFallback?.(n) ?? O.current.continueWithoutAiFallback
|
|
1670
1687
|
}]), n;
|
|
1671
|
-
},
|
|
1672
|
-
history:
|
|
1688
|
+
}, ve = () => k.current ? {
|
|
1689
|
+
history: k.current.history,
|
|
1673
1690
|
activity: y
|
|
1674
1691
|
} : null;
|
|
1675
1692
|
return {
|
|
1676
1693
|
enabled: r,
|
|
1677
1694
|
setEnabled: i,
|
|
1678
1695
|
hasProviders: a,
|
|
1679
|
-
selectedModel:
|
|
1680
|
-
setSelectedModel:
|
|
1681
|
-
|
|
1696
|
+
selectedModel: K || G && se ? se : B,
|
|
1697
|
+
setSelectedModel: K ? X : G ? (e) => {
|
|
1698
|
+
ie(e) ? X(e) : (X(""), l(e));
|
|
1682
1699
|
} : l,
|
|
1683
|
-
modelsByProvider:
|
|
1700
|
+
modelsByProvider: ne,
|
|
1684
1701
|
modelsLoading: s,
|
|
1685
1702
|
running: u,
|
|
1686
1703
|
error: p,
|
|
1687
1704
|
canContinue: g,
|
|
1688
|
-
remote:
|
|
1689
|
-
remoteModels:
|
|
1690
|
-
alongside:
|
|
1691
|
-
...
|
|
1705
|
+
remote: K,
|
|
1706
|
+
remoteModels: ae,
|
|
1707
|
+
alongside: G,
|
|
1708
|
+
...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
|
|
1692
1709
|
activity: y,
|
|
1693
|
-
run:
|
|
1694
|
-
resume:
|
|
1695
|
-
sendMessage:
|
|
1696
|
-
stop:
|
|
1697
|
-
runFallback:
|
|
1698
|
-
snapshot:
|
|
1699
|
-
answerQuestions:
|
|
1710
|
+
run: me,
|
|
1711
|
+
resume: he,
|
|
1712
|
+
sendMessage: ge,
|
|
1713
|
+
stop: te,
|
|
1714
|
+
runFallback: _e,
|
|
1715
|
+
snapshot: ve,
|
|
1716
|
+
answerQuestions: pe
|
|
1700
1717
|
};
|
|
1701
1718
|
}
|
|
1702
1719
|
//#endregion
|
|
1703
1720
|
//#region src/domain/orchestrator/prompt.ts
|
|
1704
|
-
function
|
|
1705
|
-
let e =
|
|
1721
|
+
function bt() {
|
|
1722
|
+
let e = q();
|
|
1706
1723
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
1707
1724
|
}
|
|
1708
|
-
function
|
|
1709
|
-
let r =
|
|
1725
|
+
function xt(e, t, n) {
|
|
1726
|
+
let r = q(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
1710
1727
|
return `${r.orchestratorIntro}
|
|
1711
1728
|
|
|
1712
1729
|
${r.toolsHeading}
|
|
1713
1730
|
${t}
|
|
1714
1731
|
${i}
|
|
1715
|
-
${
|
|
1732
|
+
${bt()}
|
|
1716
1733
|
|
|
1717
1734
|
${r.userRequestHeading}
|
|
1718
1735
|
${e}`;
|
|
1719
1736
|
}
|
|
1720
|
-
function
|
|
1737
|
+
function St(e, t) {
|
|
1721
1738
|
return t ? {
|
|
1722
1739
|
kind: "handoff",
|
|
1723
1740
|
...t
|
|
@@ -1728,27 +1745,27 @@ function xt(e, t) {
|
|
|
1728
1745
|
}
|
|
1729
1746
|
//#endregion
|
|
1730
1747
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
1731
|
-
function St(e) {
|
|
1732
|
-
return R().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
1733
|
-
}
|
|
1734
1748
|
function Ct(e) {
|
|
1749
|
+
return L().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
1750
|
+
}
|
|
1751
|
+
function wt(e) {
|
|
1735
1752
|
return {
|
|
1736
1753
|
buildContext(e) {
|
|
1737
1754
|
return {
|
|
1738
|
-
cliCatalog:
|
|
1755
|
+
cliCatalog: ce(Ct(e.scopedSubagentId)),
|
|
1739
1756
|
handoff: { current: null },
|
|
1740
1757
|
collected: {}
|
|
1741
1758
|
};
|
|
1742
1759
|
},
|
|
1743
1760
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
1744
|
-
return
|
|
1761
|
+
return xt(e, n, t);
|
|
1745
1762
|
},
|
|
1746
1763
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
1747
|
-
return `${e}\n\n${
|
|
1764
|
+
return `${e}\n\n${bt()}\n\n${q().toolsHeading}\n${n}`;
|
|
1748
1765
|
},
|
|
1749
1766
|
parseResponse(e, t, n) {
|
|
1750
1767
|
let r = n.handoff.current;
|
|
1751
|
-
return n.handoff.current = null,
|
|
1768
|
+
return n.handoff.current = null, St(e, r);
|
|
1752
1769
|
},
|
|
1753
1770
|
fallback() {
|
|
1754
1771
|
return {
|
|
@@ -1760,11 +1777,11 @@ function Ct(e) {
|
|
|
1760
1777
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
1761
1778
|
},
|
|
1762
1779
|
getTools(t, n, r) {
|
|
1763
|
-
let i =
|
|
1780
|
+
let i = B({
|
|
1764
1781
|
attachmentsRef: r,
|
|
1765
1782
|
collected: n.collected,
|
|
1766
1783
|
proxyFetch: g
|
|
1767
|
-
}), a = t.scopedSubagentId ?
|
|
1784
|
+
}), a = t.scopedSubagentId ? R(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Ct(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
1768
1785
|
name: `${t.id}_${r.name}`,
|
|
1769
1786
|
description: `${t.label}: ${r.summary}`,
|
|
1770
1787
|
inputSchema: r.inputSchema,
|
|
@@ -1778,7 +1795,7 @@ function Ct(e) {
|
|
|
1778
1795
|
params: i
|
|
1779
1796
|
}, {
|
|
1780
1797
|
status: "queued",
|
|
1781
|
-
note: m(
|
|
1798
|
+
note: m(q().handoffQueued, { label: t.label })
|
|
1782
1799
|
};
|
|
1783
1800
|
}
|
|
1784
1801
|
})));
|
|
@@ -1788,17 +1805,17 @@ function Ct(e) {
|
|
|
1788
1805
|
}
|
|
1789
1806
|
//#endregion
|
|
1790
1807
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
1791
|
-
function
|
|
1808
|
+
function Tt(e, t) {
|
|
1792
1809
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
1793
1810
|
}
|
|
1794
1811
|
//#endregion
|
|
1795
1812
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
1796
|
-
function
|
|
1813
|
+
function Et({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
1797
1814
|
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();
|
|
1798
1815
|
e.destinationIds.forEach((e) => {
|
|
1799
1816
|
let t = v[e];
|
|
1800
1817
|
t && b.set(e, t);
|
|
1801
|
-
}), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(
|
|
1818
|
+
}), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(Z.id, Z);
|
|
1802
1819
|
let x = Array.from(b.values()), S = async (i) => {
|
|
1803
1820
|
f(i), _(null);
|
|
1804
1821
|
try {
|
|
@@ -1811,7 +1828,7 @@ function Tt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
1811
1828
|
storageProvider: l?.storageProvider ?? null,
|
|
1812
1829
|
proxyFetch: u
|
|
1813
1830
|
}, n);
|
|
1814
|
-
h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n,
|
|
1831
|
+
h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Tt(e, n));
|
|
1815
1832
|
} catch (e) {
|
|
1816
1833
|
_(e instanceof Error ? e.message : String(e));
|
|
1817
1834
|
} finally {
|
|
@@ -1844,16 +1861,16 @@ function Tt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
1844
1861
|
}
|
|
1845
1862
|
//#endregion
|
|
1846
1863
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
1847
|
-
var
|
|
1848
|
-
function Dt(e) {
|
|
1849
|
-
Object.assign(Et, e);
|
|
1850
|
-
}
|
|
1864
|
+
var Dt = {};
|
|
1851
1865
|
function Ot(e) {
|
|
1852
|
-
|
|
1866
|
+
Object.assign(Dt, e);
|
|
1867
|
+
}
|
|
1868
|
+
function kt(e) {
|
|
1869
|
+
return Dt[e];
|
|
1853
1870
|
}
|
|
1854
1871
|
//#endregion
|
|
1855
1872
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
1856
|
-
function
|
|
1873
|
+
function At({ result: e }) {
|
|
1857
1874
|
let [t, n] = D(!1);
|
|
1858
1875
|
return /* @__PURE__ */ A("div", {
|
|
1859
1876
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
@@ -1870,7 +1887,7 @@ function kt({ result: e }) {
|
|
|
1870
1887
|
}
|
|
1871
1888
|
//#endregion
|
|
1872
1889
|
//#region src/presentation/liveAnchorDestination.ts
|
|
1873
|
-
function
|
|
1890
|
+
function jt(e, t, n) {
|
|
1874
1891
|
return e.length === 0 ? null : {
|
|
1875
1892
|
id: "live-component",
|
|
1876
1893
|
label: "Applica al componente aperto",
|
|
@@ -1881,30 +1898,30 @@ function At(e, t, n) {
|
|
|
1881
1898
|
}
|
|
1882
1899
|
//#endregion
|
|
1883
1900
|
//#region src/presentation/subagentControls.ts
|
|
1884
|
-
var
|
|
1885
|
-
function Mt(e) {
|
|
1886
|
-
Object.assign(jt, e);
|
|
1887
|
-
}
|
|
1901
|
+
var Mt = {};
|
|
1888
1902
|
function Nt(e) {
|
|
1889
|
-
|
|
1903
|
+
Object.assign(Mt, e);
|
|
1904
|
+
}
|
|
1905
|
+
function Pt(e) {
|
|
1906
|
+
return Mt[e];
|
|
1890
1907
|
}
|
|
1891
1908
|
//#endregion
|
|
1892
1909
|
//#region src/presentation/SubagentRunner.tsx
|
|
1893
|
-
var
|
|
1894
|
-
function
|
|
1895
|
-
let c =
|
|
1910
|
+
var Ft = () => ({});
|
|
1911
|
+
function It({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
1912
|
+
let c = yt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = y(), f = E(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = D(null), h = (t) => {
|
|
1896
1913
|
e.definition.conversational || m(t);
|
|
1897
|
-
}, [g, _] = D([]), [v, b] = D(null), x =
|
|
1898
|
-
p && p !==
|
|
1899
|
-
let
|
|
1914
|
+
}, [g, _] = D([]), [v, b] = D(null), x = kt(e.id), S = x?.kind === "selection" ? x : null, [w, j] = D(null), M = E(!1), ee = E(0), N = E(null);
|
|
1915
|
+
p && p !== N.current && (N.current = p, ee.current = (r?.length ?? 0) + c.activity.length);
|
|
1916
|
+
let P = E(!1), te = c.remote || !c.hasProviders || c.selectedModel !== "";
|
|
1900
1917
|
C(() => {
|
|
1901
|
-
!M.current &&
|
|
1918
|
+
!M.current && te && (M.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
|
|
1902
1919
|
model: o,
|
|
1903
1920
|
openingMessage: s
|
|
1904
1921
|
}).then((e) => {
|
|
1905
1922
|
e && h(e);
|
|
1906
1923
|
})));
|
|
1907
|
-
}, [
|
|
1924
|
+
}, [te]), C(() => {
|
|
1908
1925
|
if (!p || !u) return;
|
|
1909
1926
|
let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = ge();
|
|
1910
1927
|
n.forEach((n) => {
|
|
@@ -1918,7 +1935,7 @@ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
1918
1935
|
...t,
|
|
1919
1936
|
pinnedEntityId: r
|
|
1920
1937
|
}).then((n) => {
|
|
1921
|
-
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t,
|
|
1938
|
+
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Tt(e, t));
|
|
1922
1939
|
}).catch((e) => b(e instanceof Error ? e.message : String(e))));
|
|
1923
1940
|
});
|
|
1924
1941
|
}, [
|
|
@@ -1928,79 +1945,79 @@ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
1928
1945
|
]), C(() => {
|
|
1929
1946
|
p && S && j(S.defaultSelection(p));
|
|
1930
1947
|
}, [p, S]);
|
|
1931
|
-
let
|
|
1948
|
+
let F = (e, t) => {
|
|
1932
1949
|
j((n) => n && {
|
|
1933
1950
|
...n,
|
|
1934
1951
|
[e]: t
|
|
1935
1952
|
});
|
|
1936
|
-
},
|
|
1953
|
+
}, I = (e) => h(e), L = T(() => p && S && w ? S.applySelection(p, w) : p, [
|
|
1937
1954
|
p,
|
|
1938
1955
|
S,
|
|
1939
1956
|
w
|
|
1940
|
-
]),
|
|
1941
|
-
|
|
1957
|
+
]), R = T(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), z = T(() => jt(R, t, f), [
|
|
1958
|
+
R,
|
|
1942
1959
|
t,
|
|
1943
1960
|
f
|
|
1944
|
-
]),
|
|
1961
|
+
]), ne = T(() => z ? [z, ...n ?? []] : n, [z, n]), B = e.chatEntityId?.(t), V = E(!1);
|
|
1945
1962
|
C(() => {
|
|
1946
|
-
let n =
|
|
1947
|
-
if (
|
|
1963
|
+
let n = V.current && !c.running;
|
|
1964
|
+
if (V.current = c.running, !n || !B || !u) return;
|
|
1948
1965
|
let i = c.snapshot();
|
|
1949
1966
|
i && we({
|
|
1950
1967
|
scopeId: u.id,
|
|
1951
1968
|
subagentId: e.id,
|
|
1952
|
-
entityId:
|
|
1969
|
+
entityId: B,
|
|
1953
1970
|
params: t,
|
|
1954
|
-
title:
|
|
1971
|
+
title: Tt(e, t),
|
|
1955
1972
|
history: i.history,
|
|
1956
1973
|
activity: [...r ?? [], ...i.activity]
|
|
1957
1974
|
});
|
|
1958
1975
|
}, [c.running]);
|
|
1959
|
-
let
|
|
1960
|
-
|
|
1961
|
-
},
|
|
1976
|
+
let H = () => {
|
|
1977
|
+
P.current = !0, c.running && c.stop(), l.closeTask(f);
|
|
1978
|
+
}, U = E(Pt(e.id) ?? Ft).current, W = U({
|
|
1962
1979
|
params: t,
|
|
1963
1980
|
taskId: f,
|
|
1964
1981
|
running: c.running,
|
|
1965
|
-
close:
|
|
1966
|
-
}),
|
|
1982
|
+
close: H
|
|
1983
|
+
}), G = (e) => {
|
|
1967
1984
|
_((t) => t.includes(e) ? t : [...t, e]);
|
|
1968
1985
|
};
|
|
1969
1986
|
return C(() => {
|
|
1970
|
-
|
|
1987
|
+
P.current || l.openTask({
|
|
1971
1988
|
id: f,
|
|
1972
|
-
title:
|
|
1989
|
+
title: Tt(e, t),
|
|
1973
1990
|
icon: e.icon,
|
|
1974
1991
|
agent: c,
|
|
1975
1992
|
onApplied: (e) => h(e),
|
|
1976
1993
|
precedingActivity: r,
|
|
1977
|
-
panelExtraAnchorIndex:
|
|
1978
|
-
onDismiss:
|
|
1979
|
-
...
|
|
1980
|
-
panelActions:
|
|
1981
|
-
composerActions:
|
|
1982
|
-
composerCommands:
|
|
1994
|
+
panelExtraAnchorIndex: ee.current,
|
|
1995
|
+
onDismiss: H,
|
|
1996
|
+
...B ? { savedToDisk: !0 } : {},
|
|
1997
|
+
panelActions: W.content,
|
|
1998
|
+
composerActions: W.actions,
|
|
1999
|
+
composerCommands: W.commands,
|
|
1983
2000
|
panelExtra: p ? /* @__PURE__ */ A(O, { children: [
|
|
1984
2001
|
S && w ? /* @__PURE__ */ k(S.Report, {
|
|
1985
2002
|
result: p,
|
|
1986
2003
|
selection: w,
|
|
1987
|
-
onChange:
|
|
2004
|
+
onChange: F
|
|
1988
2005
|
}) : x?.kind === "editable" ? /* @__PURE__ */ k(x.Report, {
|
|
1989
2006
|
result: p,
|
|
1990
|
-
onResultChange:
|
|
1991
|
-
}) : /* @__PURE__ */ k(
|
|
2007
|
+
onResultChange: I
|
|
2008
|
+
}) : /* @__PURE__ */ k(At, { result: L }),
|
|
1992
2009
|
v && /* @__PURE__ */ A("p", {
|
|
1993
2010
|
className: "text-xs text-destructive",
|
|
1994
2011
|
children: ["Salvataggio automatico non riuscito: ", v]
|
|
1995
2012
|
}),
|
|
1996
|
-
/* @__PURE__ */ k(
|
|
2013
|
+
/* @__PURE__ */ k(Et, {
|
|
1997
2014
|
manifest: e,
|
|
1998
|
-
result:
|
|
2015
|
+
result: L,
|
|
1999
2016
|
meta: t,
|
|
2000
2017
|
taskId: f,
|
|
2001
2018
|
initiallyApplied: g,
|
|
2002
|
-
onApplied:
|
|
2003
|
-
extraDestinations:
|
|
2019
|
+
onApplied: G,
|
|
2020
|
+
extraDestinations: ne
|
|
2004
2021
|
})
|
|
2005
2022
|
] }) : void 0
|
|
2006
2023
|
});
|
|
@@ -2019,29 +2036,29 @@ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2019
2036
|
e,
|
|
2020
2037
|
t,
|
|
2021
2038
|
p,
|
|
2022
|
-
|
|
2039
|
+
L,
|
|
2023
2040
|
w,
|
|
2024
2041
|
g,
|
|
2025
2042
|
n,
|
|
2026
2043
|
r,
|
|
2027
2044
|
v,
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2045
|
+
W.content,
|
|
2046
|
+
W.actions,
|
|
2047
|
+
W.commands
|
|
2031
2048
|
]), C(() => () => {
|
|
2032
2049
|
l.closeTask(f);
|
|
2033
2050
|
}, [l.closeTask, f]), null;
|
|
2034
2051
|
}
|
|
2035
2052
|
//#endregion
|
|
2036
2053
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
2037
|
-
function
|
|
2038
|
-
let t = Q(), n =
|
|
2054
|
+
function Lt({ userGoal: e }) {
|
|
2055
|
+
let t = Q(), n = yt(T(() => wt({
|
|
2039
2056
|
unavailable: t.orchestratorUnavailable,
|
|
2040
2057
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
2041
2058
|
preparing: t.orchestratorPreparing,
|
|
2042
2059
|
collecting: t.orchestratorCollecting
|
|
2043
2060
|
}), []), { 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) => {
|
|
2044
|
-
e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(
|
|
2061
|
+
e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Ne));
|
|
2045
2062
|
};
|
|
2046
2063
|
C(() => {
|
|
2047
2064
|
!o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
|
|
@@ -2057,7 +2074,7 @@ function It({ userGoal: e }) {
|
|
|
2057
2074
|
}));
|
|
2058
2075
|
}, [s]), C(() => {
|
|
2059
2076
|
p.current || r.openTask({
|
|
2060
|
-
id:
|
|
2077
|
+
id: Ne,
|
|
2061
2078
|
title: "Agentico",
|
|
2062
2079
|
icon: "bot",
|
|
2063
2080
|
agent: n,
|
|
@@ -2065,7 +2082,7 @@ function It({ userGoal: e }) {
|
|
|
2065
2082
|
scopedSubagentId: d.current,
|
|
2066
2083
|
precedingActivity: f.current?.activity,
|
|
2067
2084
|
onDismiss: () => {
|
|
2068
|
-
p.current = !0, n.running && n.stop(), r.closeTask(
|
|
2085
|
+
p.current = !0, n.running && n.stop(), r.closeTask(Ne);
|
|
2069
2086
|
}
|
|
2070
2087
|
});
|
|
2071
2088
|
}, [
|
|
@@ -2078,12 +2095,12 @@ function It({ userGoal: e }) {
|
|
|
2078
2095
|
n.hasProviders,
|
|
2079
2096
|
r.openTask
|
|
2080
2097
|
]), C(() => () => {
|
|
2081
|
-
r.closeTask(
|
|
2098
|
+
r.closeTask(Ne);
|
|
2082
2099
|
}, [r.closeTask]);
|
|
2083
2100
|
let h = T(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
|
|
2084
2101
|
if (!i) return null;
|
|
2085
|
-
let g =
|
|
2086
|
-
return g ? /* @__PURE__ */ k(
|
|
2102
|
+
let g = R(i.subagentId);
|
|
2103
|
+
return g ? /* @__PURE__ */ k(It, {
|
|
2087
2104
|
manifest: g,
|
|
2088
2105
|
params: i.params,
|
|
2089
2106
|
extraDestinations: c.current,
|
|
@@ -2094,8 +2111,8 @@ function It({ userGoal: e }) {
|
|
|
2094
2111
|
}
|
|
2095
2112
|
//#endregion
|
|
2096
2113
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
2097
|
-
function
|
|
2098
|
-
let r =
|
|
2114
|
+
function Rt({ manifest: e, extraDestinations: n }) {
|
|
2115
|
+
let r = yt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = E(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = D(null), [l, u] = D([]), d = kt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = D(null), [h, g] = D(null), _ = E(!1), v = (t) => {
|
|
2099
2116
|
if (!e.manualEntry) return;
|
|
2100
2117
|
let n;
|
|
2101
2118
|
try {
|
|
@@ -2122,7 +2139,7 @@ function Lt({ manifest: e, extraDestinations: n }) {
|
|
|
2122
2139
|
p
|
|
2123
2140
|
]), S = (e) => {
|
|
2124
2141
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
2125
|
-
}, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ?
|
|
2142
|
+
}, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? jt(w, h, o) : null, [
|
|
2126
2143
|
w,
|
|
2127
2144
|
h,
|
|
2128
2145
|
o
|
|
@@ -2151,8 +2168,8 @@ function Lt({ manifest: e, extraDestinations: n }) {
|
|
|
2151
2168
|
}) : d?.kind === "editable" ? /* @__PURE__ */ k(d.Report, {
|
|
2152
2169
|
result: s,
|
|
2153
2170
|
onResultChange: b
|
|
2154
|
-
}) : /* @__PURE__ */ k(
|
|
2155
|
-
/* @__PURE__ */ k(
|
|
2171
|
+
}) : /* @__PURE__ */ k(At, { result: x }),
|
|
2172
|
+
/* @__PURE__ */ k(Et, {
|
|
2156
2173
|
manifest: e,
|
|
2157
2174
|
result: x,
|
|
2158
2175
|
meta: h ?? {},
|
|
@@ -2189,7 +2206,7 @@ function Lt({ manifest: e, extraDestinations: n }) {
|
|
|
2189
2206
|
}
|
|
2190
2207
|
//#endregion
|
|
2191
2208
|
//#region src/presentation/Agentico.tsx
|
|
2192
|
-
function
|
|
2209
|
+
function zt(e, t) {
|
|
2193
2210
|
return Object.values(e).flat().map((e) => {
|
|
2194
2211
|
let n = t?.(e.provider, e.providerLabel ?? e.provider);
|
|
2195
2212
|
return {
|
|
@@ -2201,7 +2218,7 @@ function Rt(e, t) {
|
|
|
2201
2218
|
};
|
|
2202
2219
|
});
|
|
2203
2220
|
}
|
|
2204
|
-
function
|
|
2221
|
+
function Bt({ task: e }) {
|
|
2205
2222
|
let t = Q(), [n, r] = D(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
|
|
2206
2223
|
if (r(""), s) {
|
|
2207
2224
|
s.onSubmit(e.text);
|
|
@@ -2213,7 +2230,7 @@ function zt({ task: e }) {
|
|
|
2213
2230
|
}).then((e) => {
|
|
2214
2231
|
e && a(e);
|
|
2215
2232
|
});
|
|
2216
|
-
}, u = !!s || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...
|
|
2233
|
+
}, u = !!s || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...zt(i.modelsByProvider, i.catalogGroup)] : zt(i.modelsByProvider);
|
|
2217
2234
|
return /* @__PURE__ */ k(o, {
|
|
2218
2235
|
value: n,
|
|
2219
2236
|
onChange: r,
|
|
@@ -2233,8 +2250,8 @@ function zt({ task: e }) {
|
|
|
2233
2250
|
maxHeight: 220
|
|
2234
2251
|
});
|
|
2235
2252
|
}
|
|
2236
|
-
function
|
|
2237
|
-
let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } =
|
|
2253
|
+
function Vt() {
|
|
2254
|
+
let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = ft(), l = (t) => {
|
|
2238
2255
|
t.text.trim() && (e(t.text.trim(), {
|
|
2239
2256
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
2240
2257
|
model: t.model || void 0
|
|
@@ -2247,7 +2264,7 @@ function Bt() {
|
|
|
2247
2264
|
disabled: !n.trim() || u,
|
|
2248
2265
|
onSubmit: l,
|
|
2249
2266
|
attachments: !0,
|
|
2250
|
-
models:
|
|
2267
|
+
models: zt(a),
|
|
2251
2268
|
selectedModel: s,
|
|
2252
2269
|
onModelChange: c,
|
|
2253
2270
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
@@ -2255,7 +2272,7 @@ function Bt() {
|
|
|
2255
2272
|
maxHeight: 220
|
|
2256
2273
|
});
|
|
2257
2274
|
}
|
|
2258
|
-
function
|
|
2275
|
+
function Ht(e, t, n = Date.now()) {
|
|
2259
2276
|
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
2260
2277
|
numeric: "auto",
|
|
2261
2278
|
style: "short"
|
|
@@ -2267,7 +2284,7 @@ function Vt(e, t, n = Date.now()) {
|
|
|
2267
2284
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
2268
2285
|
return i.format(0, "minute");
|
|
2269
2286
|
}
|
|
2270
|
-
function
|
|
2287
|
+
function Ut({ card: e }) {
|
|
2271
2288
|
let t = Q();
|
|
2272
2289
|
return e.humanSummaryOnly ? /* @__PURE__ */ A("div", {
|
|
2273
2290
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
@@ -2323,7 +2340,7 @@ function Ht({ card: e }) {
|
|
|
2323
2340
|
]
|
|
2324
2341
|
});
|
|
2325
2342
|
}
|
|
2326
|
-
function
|
|
2343
|
+
function Wt({ messages: e }) {
|
|
2327
2344
|
return /* @__PURE__ */ k("div", {
|
|
2328
2345
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2329
2346
|
children: e.map((e, t) => /* @__PURE__ */ k("p", {
|
|
@@ -2332,25 +2349,25 @@ function Ut({ messages: e }) {
|
|
|
2332
2349
|
}, t))
|
|
2333
2350
|
});
|
|
2334
2351
|
}
|
|
2335
|
-
function
|
|
2336
|
-
let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ?
|
|
2352
|
+
function Gt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
2353
|
+
let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ? De(e) : [], [
|
|
2337
2354
|
e,
|
|
2338
2355
|
r,
|
|
2339
2356
|
h
|
|
2340
2357
|
]), y = async (t) => {
|
|
2341
|
-
let r =
|
|
2358
|
+
let r = R(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
|
|
2342
2359
|
if (!i || window.confirm(i)) {
|
|
2343
2360
|
try {
|
|
2344
2361
|
await r?.onArchive?.(t.entityId, t.params);
|
|
2345
2362
|
} catch {
|
|
2346
2363
|
return;
|
|
2347
2364
|
}
|
|
2348
|
-
|
|
2365
|
+
Ee(e, t.subagentId, t.entityId), n === Oe(t.subagentId, t.entityId) && s(), g((e) => e + 1);
|
|
2349
2366
|
}
|
|
2350
2367
|
}, b = T(() => {
|
|
2351
2368
|
let e = p.trim().toLowerCase();
|
|
2352
2369
|
return e ? _.filter((t) => {
|
|
2353
|
-
let n =
|
|
2370
|
+
let n = R(t.subagentId)?.label ?? t.subagentId;
|
|
2354
2371
|
return t.title.toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
2355
2372
|
}) : _;
|
|
2356
2373
|
}, [_, p]);
|
|
@@ -2394,7 +2411,7 @@ function Wt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2394
2411
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
2395
2412
|
children: _.length === 0 ? d.noSavedChats : d.noResults
|
|
2396
2413
|
}) : b.map((e) => {
|
|
2397
|
-
let t =
|
|
2414
|
+
let t = R(e.subagentId), r = n === Oe(e.subagentId, e.entityId);
|
|
2398
2415
|
return /* @__PURE__ */ k(l, {
|
|
2399
2416
|
icon: r ? "check" : t?.icon ?? "bot",
|
|
2400
2417
|
className: r ? "bg-accent font-medium" : void 0,
|
|
@@ -2418,95 +2435,95 @@ function Wt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2418
2435
|
]
|
|
2419
2436
|
}), /* @__PURE__ */ k("span", {
|
|
2420
2437
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2421
|
-
title: new Date(e.savedAt).toLocaleString(f)
|
|
2422
|
-
children:
|
|
2438
|
+
title: `${d.chatStarted.replace("{at}", new Date(Te(e)).toLocaleString(f))} · ${d.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(f))}`,
|
|
2439
|
+
children: Ht(Te(e), f)
|
|
2423
2440
|
})]
|
|
2424
2441
|
})
|
|
2425
2442
|
}, `${e.subagentId}:${e.entityId}`);
|
|
2426
2443
|
})
|
|
2427
2444
|
});
|
|
2428
2445
|
}
|
|
2429
|
-
function
|
|
2430
|
-
let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: w, scope: T } = $(), j = Q(), M = E(null), [
|
|
2446
|
+
function Kt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
|
|
2447
|
+
let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: w, scope: T } = $(), j = Q(), M = E(null), [ee, N] = D(!1), P = ot({
|
|
2431
2448
|
defaultWidth: e,
|
|
2432
2449
|
minWidth: n,
|
|
2433
2450
|
maxWidth: r,
|
|
2434
2451
|
onWidthChange: i
|
|
2435
|
-
}),
|
|
2436
|
-
(!a || a.agent.running || a.savedToDisk || window.confirm(j.unsavedConversationConfirm)) && (m(),
|
|
2437
|
-
},
|
|
2438
|
-
canAnswer: (e) =>
|
|
2452
|
+
}), te = () => {
|
|
2453
|
+
(!a || a.agent.running || a.savedToDisk || window.confirm(j.unsavedConversationConfirm)) && (m(), N(!1));
|
|
2454
|
+
}, F = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], I = F.length, L = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? I, I)), z = F.slice(0, L), ne = F.slice(L), B = !!(a && !a.agent.running && a.agent.error), V = new Set(a?.agent.activity.map((e) => e.id) ?? []), H = a ? {
|
|
2455
|
+
canAnswer: (e) => V.has(e),
|
|
2439
2456
|
onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
|
|
2440
2457
|
e && a.onApplied(e);
|
|
2441
2458
|
})
|
|
2442
|
-
} : void 0,
|
|
2459
|
+
} : void 0, U = H ? Ke(F, H.canAnswer) : null, W = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? R(a.scopedSubagentId) : void 0, G = W?.manualEntry ? W : null, K = E(!0);
|
|
2443
2460
|
C(() => {
|
|
2444
2461
|
let e = M.current;
|
|
2445
2462
|
if (!e) return;
|
|
2446
2463
|
let t = () => {
|
|
2447
|
-
|
|
2464
|
+
K.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
|
|
2448
2465
|
};
|
|
2449
2466
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
2450
2467
|
}, [a?.id]), C(() => {
|
|
2451
2468
|
let e = M.current;
|
|
2452
|
-
e && (
|
|
2469
|
+
e && (K.current = !0, e.scrollTop = e.scrollHeight);
|
|
2453
2470
|
}, [a?.id]);
|
|
2454
|
-
let
|
|
2471
|
+
let re = F.at(-1)?.detail?.length ?? 0;
|
|
2455
2472
|
C(() => {
|
|
2456
2473
|
let e = M.current;
|
|
2457
|
-
e &&
|
|
2474
|
+
e && K.current && (e.scrollTop = e.scrollHeight);
|
|
2458
2475
|
}, [
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2476
|
+
I,
|
|
2477
|
+
B,
|
|
2478
|
+
re
|
|
2462
2479
|
]);
|
|
2463
|
-
let
|
|
2480
|
+
let q = E(null);
|
|
2464
2481
|
C(() => {
|
|
2465
|
-
let e = M.current, t =
|
|
2482
|
+
let e = M.current, t = q.current;
|
|
2466
2483
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
2467
2484
|
let n = new ResizeObserver(() => {
|
|
2468
|
-
|
|
2485
|
+
K.current && (e.scrollTop = e.scrollHeight);
|
|
2469
2486
|
});
|
|
2470
2487
|
return n.observe(t), () => n.disconnect();
|
|
2471
2488
|
}, [a?.id, o]);
|
|
2472
|
-
let
|
|
2473
|
-
manifest:
|
|
2489
|
+
let ie = s ? /* @__PURE__ */ k(Lt, { userGoal: s }, c) : null, J = f ? R(f.subagentId) : void 0, ae = f && J ? /* @__PURE__ */ k(It, {
|
|
2490
|
+
manifest: J,
|
|
2474
2491
|
params: f.snapshot.params,
|
|
2475
|
-
taskId:
|
|
2492
|
+
taskId: Oe(f.subagentId, f.entityId),
|
|
2476
2493
|
resumeSeed: {
|
|
2477
2494
|
history: f.snapshot.history,
|
|
2478
2495
|
activity: f.snapshot.activity
|
|
2479
2496
|
}
|
|
2480
|
-
}, p) : null,
|
|
2481
|
-
manifest:
|
|
2497
|
+
}, p) : null, oe = g ? R(g.subagentId) : void 0, se = g && oe ? /* @__PURE__ */ k(Rt, {
|
|
2498
|
+
manifest: oe,
|
|
2482
2499
|
extraDestinations: g.extraDestinations
|
|
2483
|
-
}, _) : null,
|
|
2484
|
-
manifest:
|
|
2500
|
+
}, _) : null, ce = b ? R(b.subagentId) : void 0, Y = b && ce ? /* @__PURE__ */ k(It, {
|
|
2501
|
+
manifest: ce,
|
|
2485
2502
|
params: b.params,
|
|
2486
2503
|
extraDestinations: b.extraDestinations
|
|
2487
|
-
}, x) : null,
|
|
2488
|
-
manifest:
|
|
2504
|
+
}, x) : null, X = S ? R(S.subagentId) : void 0, le = S && X ? /* @__PURE__ */ k(It, {
|
|
2505
|
+
manifest: X,
|
|
2489
2506
|
params: S.params,
|
|
2490
2507
|
taskId: S.taskId,
|
|
2491
2508
|
openingMessage: S.openingMessage
|
|
2492
2509
|
}, w) : null;
|
|
2493
2510
|
return o ? /* @__PURE__ */ A(O, { children: [
|
|
2494
|
-
X,
|
|
2495
|
-
Z,
|
|
2496
2511
|
ie,
|
|
2497
|
-
|
|
2498
|
-
|
|
2512
|
+
ae,
|
|
2513
|
+
se,
|
|
2514
|
+
Y,
|
|
2515
|
+
le,
|
|
2499
2516
|
/* @__PURE__ */ A("div", {
|
|
2500
|
-
style: { width:
|
|
2517
|
+
style: { width: P.width },
|
|
2501
2518
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
2502
2519
|
children: [
|
|
2503
|
-
/* @__PURE__ */ k(
|
|
2504
|
-
width:
|
|
2505
|
-
min:
|
|
2506
|
-
max:
|
|
2507
|
-
onResize:
|
|
2508
|
-
onCommit:
|
|
2509
|
-
onReset:
|
|
2520
|
+
/* @__PURE__ */ k(st, {
|
|
2521
|
+
width: P.width,
|
|
2522
|
+
min: P.min,
|
|
2523
|
+
max: P.max,
|
|
2524
|
+
onResize: P.set,
|
|
2525
|
+
onCommit: P.commit,
|
|
2526
|
+
onReset: P.reset
|
|
2510
2527
|
}),
|
|
2511
2528
|
/* @__PURE__ */ A("div", {
|
|
2512
2529
|
className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
|
|
@@ -2515,44 +2532,44 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2515
2532
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
2516
2533
|
children: a ? a.title : "Agentico"
|
|
2517
2534
|
}),
|
|
2518
|
-
T && /* @__PURE__ */ k(
|
|
2535
|
+
T && /* @__PURE__ */ k(Gt, {
|
|
2519
2536
|
scopeId: T.id,
|
|
2520
2537
|
currentTaskId: a?.id ?? null,
|
|
2521
|
-
open:
|
|
2522
|
-
onOpenChange:
|
|
2523
|
-
onNewChat:
|
|
2538
|
+
open: ee,
|
|
2539
|
+
onOpenChange: N,
|
|
2540
|
+
onNewChat: te,
|
|
2524
2541
|
onSelect: (e, t, n) => h(e, t, n),
|
|
2525
2542
|
onArchivedCurrent: m
|
|
2526
2543
|
}),
|
|
2527
|
-
/* @__PURE__ */ k(
|
|
2544
|
+
/* @__PURE__ */ k(ct, {})
|
|
2528
2545
|
]
|
|
2529
2546
|
}),
|
|
2530
2547
|
/* @__PURE__ */ k("div", {
|
|
2531
2548
|
ref: M,
|
|
2532
|
-
className: `flex-1 overflow-y-auto px-3 pb-2 ${
|
|
2549
|
+
className: `flex-1 overflow-y-auto px-3 pb-2 ${U ? "min-h-24" : "min-h-0"}`,
|
|
2533
2550
|
children: /* @__PURE__ */ k("div", {
|
|
2534
|
-
ref:
|
|
2551
|
+
ref: q,
|
|
2535
2552
|
className: "pt-2",
|
|
2536
2553
|
children: a ? /* @__PURE__ */ A(O, { children: [
|
|
2537
|
-
a.manualEntry &&
|
|
2554
|
+
a.manualEntry && F.length === 0 && /* @__PURE__ */ k("p", {
|
|
2538
2555
|
className: "text-xs text-muted-foreground",
|
|
2539
2556
|
children: a.manualEntry.prompt
|
|
2540
2557
|
}),
|
|
2541
|
-
/* @__PURE__ */ k(
|
|
2542
|
-
activity:
|
|
2543
|
-
questions:
|
|
2544
|
-
docked:
|
|
2545
|
-
pinUserMessages: !
|
|
2558
|
+
/* @__PURE__ */ k(Xe, {
|
|
2559
|
+
activity: z,
|
|
2560
|
+
questions: H,
|
|
2561
|
+
docked: U,
|
|
2562
|
+
pinUserMessages: !U
|
|
2546
2563
|
}),
|
|
2547
2564
|
a.panelExtra && /* @__PURE__ */ k("div", {
|
|
2548
2565
|
className: "mt-3",
|
|
2549
2566
|
children: a.panelExtra
|
|
2550
2567
|
}),
|
|
2551
|
-
|
|
2552
|
-
activity:
|
|
2553
|
-
questions:
|
|
2554
|
-
docked:
|
|
2555
|
-
pinUserMessages: !
|
|
2568
|
+
ne.length > 0 && /* @__PURE__ */ k(Xe, {
|
|
2569
|
+
activity: ne,
|
|
2570
|
+
questions: H,
|
|
2571
|
+
docked: U,
|
|
2572
|
+
pinUserMessages: !U
|
|
2556
2573
|
}),
|
|
2557
2574
|
!a.agent.running && a.agent.error && /* @__PURE__ */ A("div", {
|
|
2558
2575
|
className: "mt-2 flex items-center gap-2",
|
|
@@ -2576,8 +2593,8 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2576
2593
|
variant: "secondary",
|
|
2577
2594
|
className: "shrink-0",
|
|
2578
2595
|
onClick: () => {
|
|
2579
|
-
if (
|
|
2580
|
-
v(
|
|
2596
|
+
if (G) {
|
|
2597
|
+
v(G.id, y);
|
|
2581
2598
|
return;
|
|
2582
2599
|
}
|
|
2583
2600
|
let e = a.agent.runFallback();
|
|
@@ -2586,13 +2603,13 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2586
2603
|
})
|
|
2587
2604
|
]
|
|
2588
2605
|
})
|
|
2589
|
-
] }) : d.length > 0 ? /* @__PURE__ */ k(
|
|
2606
|
+
] }) : d.length > 0 ? /* @__PURE__ */ k(Wt, { messages: d }) : u ? /* @__PURE__ */ k(Ut, { card: u }) : /* @__PURE__ */ k("p", {
|
|
2590
2607
|
className: "text-xs text-muted-foreground",
|
|
2591
2608
|
children: l ?? j.orchestratorStarterHint
|
|
2592
2609
|
})
|
|
2593
2610
|
})
|
|
2594
2611
|
}),
|
|
2595
|
-
a &&
|
|
2612
|
+
a && U ? /* @__PURE__ */ A("section", {
|
|
2596
2613
|
"aria-label": j.pendingQuestions,
|
|
2597
2614
|
className: "flex min-h-0 shrink flex-col border-t border-border/60",
|
|
2598
2615
|
children: [
|
|
@@ -2602,12 +2619,12 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2602
2619
|
}),
|
|
2603
2620
|
/* @__PURE__ */ k("div", {
|
|
2604
2621
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
2605
|
-
children: /* @__PURE__ */ k(
|
|
2606
|
-
entry:
|
|
2607
|
-
part:
|
|
2608
|
-
questions:
|
|
2622
|
+
children: /* @__PURE__ */ k(qe, {
|
|
2623
|
+
entry: U.entry,
|
|
2624
|
+
part: U.part,
|
|
2625
|
+
questions: H,
|
|
2609
2626
|
autoFocus: !0
|
|
2610
|
-
}, `${
|
|
2627
|
+
}, `${U.entry.id}:${U.part.id}`)
|
|
2611
2628
|
}),
|
|
2612
2629
|
a.agent.running && /* @__PURE__ */ k("div", {
|
|
2613
2630
|
className: "flex shrink-0 justify-end px-4 pb-3",
|
|
@@ -2624,27 +2641,27 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2624
2641
|
children: [a?.panelActions && /* @__PURE__ */ k("div", {
|
|
2625
2642
|
className: "mb-2",
|
|
2626
2643
|
children: a.panelActions
|
|
2627
|
-
}), a ? /* @__PURE__ */ k(
|
|
2644
|
+
}), a ? /* @__PURE__ */ k(Bt, { task: a }, a.id) : /* @__PURE__ */ k(Vt, {})]
|
|
2628
2645
|
})
|
|
2629
2646
|
]
|
|
2630
2647
|
})
|
|
2631
2648
|
] }) : /* @__PURE__ */ A(O, { children: [
|
|
2632
|
-
X,
|
|
2633
|
-
Z,
|
|
2634
2649
|
ie,
|
|
2635
|
-
|
|
2636
|
-
|
|
2650
|
+
ae,
|
|
2651
|
+
se,
|
|
2652
|
+
Y,
|
|
2653
|
+
le
|
|
2637
2654
|
] });
|
|
2638
2655
|
}
|
|
2639
2656
|
//#endregion
|
|
2640
2657
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
2641
|
-
function
|
|
2658
|
+
function qt(e, t) {
|
|
2642
2659
|
let { setPageContext: n } = $(), r = E(crypto.randomUUID()).current;
|
|
2643
2660
|
C(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
2644
2661
|
}
|
|
2645
2662
|
//#endregion
|
|
2646
2663
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
2647
|
-
function
|
|
2664
|
+
function Jt(e, t, n, r, i = !0, a) {
|
|
2648
2665
|
let { registerComponentAnchor: o } = $(), s = E(crypto.randomUUID()).current, c = E(n);
|
|
2649
2666
|
c.current = n, C(() => {
|
|
2650
2667
|
if (i) return o(s, {
|
|
@@ -2663,6 +2680,6 @@ function qt(e, t, n, r, i = !0, a) {
|
|
|
2663
2680
|
]);
|
|
2664
2681
|
}
|
|
2665
2682
|
//#endregion
|
|
2666
|
-
export {
|
|
2683
|
+
export { $e as AGENTICO_MAX_WIDTH, Qe as AGENTICO_MIN_WIDTH, Ze as AGENTICO_WIDTH, et as AGENTICO_WIDTH_STORAGE_KEY, Kt as Agentico, Fe as AgenticoProvider, ct as AgenticoToggle, M as DEFAULT_REASONING_PART_ID, j as DEFAULT_TEXT_PART_ID, pe as JSON_EXPORT_DESTINATION_ID, X as MICRO_PROMPT_REGISTRY, Ne as ORCHESTRATOR_TASK_ID, Y as SUMMARY_MICRO_PROMPT, ke as agenticoDe, Ae as agenticoEn, je as agenticoIt, W as agenticoPromptsEn, G as agenticoPromptsIt, Me as agenticoTranslations, le as applyMicroPrompts, Te as chatStartedAt, re as configureAgenticoPrompts, ve as configureEntityChatStore, B as createCrossAgentTools, te as defineSubagent, Oe as entityChatTaskId, ue as extractErrorMessage, de as extractJsonBlock, R as findSubagentManifest, P as formatQuestionAnswers, q as getAgenticoPrompts, ge as getDestinationRegistry, Ce as getEntityChat, Pt as getSubagentControls, L as getSubagentRegistry, kt as getSubagentReport, Z as jsonExportDestination, De as listEntityChats, N as messagePartsText, ne as registerCrossAgentTools, he as registerDestinations, Nt as registerSubagentControls, Ot as registerSubagentReports, I as registerSubagents, Ee as removeEntityChat, ce as renderRegistryCli, se as renderSubagentCli, ie as resetAgenticoPrompts, we as saveEntityChat, V as toJsonSchema, H as toMcpTool, ee as upsertMessagePart, yt as useAgent, $ as useAgentico, Q as useAgenticoI18n, qt as useAgenticoPageContext, Jt as useSubagentComponentContext };
|
|
2667
2684
|
|
|
2668
2685
|
//# sourceMappingURL=index.mjs.map
|