@llmnative/agentico 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +877 -734
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/entityChatStore.d.ts +21 -1
- package/dist/types/domain/prompts.d.ts +2 -0
- package/dist/types/domain/subagentManifest.d.ts +7 -0
- package/dist/types/i18n/types.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/presentation/chatTitles.d.ts +16 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { zodToJsonSchema as e } from "zod-to-json-schema";
|
|
2
|
-
import { ActionButton as t, Badge as n, ChatMarkdown as r, ChatQuestions as i, ChatReasoning as a, Chatbot as o, Code as s, Dropdown as c, DropdownItem as l,
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { ActionButton as t, Badge as n, ChatMarkdown as r, ChatQuestions as i, ChatReasoning as a, Chatbot as o, Code as s, Dropdown as c, DropdownItem as l, Form as u, Icon as d, Input as f, Modal as p, PromptUtils as m, Tree as h, getAIModelCatalog as g, interpolate as _, parseAIModelRef as v, proxyFetch as y, useAIProviderRegistry as b, useFormController as x, useI18n as S, useProxy as C } from "@llmnative/react";
|
|
3
|
+
import { createContext as w, useCallback as T, useContext as E, useEffect as D, useLayoutEffect as O, useMemo as k, useRef as A, useState as j } from "react";
|
|
4
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
5
5
|
//#region src/domain/messageParts.ts
|
|
6
|
-
var
|
|
7
|
-
function
|
|
6
|
+
var F = "text", ee = "reasoning";
|
|
7
|
+
function I(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 ee(e, t, n) {
|
|
|
14
14
|
...i.slice(a)
|
|
15
15
|
] : [...i, t];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function L(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 R(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 z(e) {
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/domain/subagentRegistry.ts
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
30
|
+
var B = [];
|
|
31
|
+
function te(e) {
|
|
32
|
+
B = e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function V() {
|
|
35
|
+
return B.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), B;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function H(e) {
|
|
38
|
+
return B.find((t) => t.id === e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/domain/crossAgentTools.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
|
|
42
|
+
var U = [];
|
|
43
|
+
function W(...e) {
|
|
44
|
+
U = e;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function G(e) {
|
|
47
|
+
return U.flatMap((t) => t(e));
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/domain/mcpTool.ts
|
|
51
|
-
function
|
|
51
|
+
function K(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 q(e, t, n, r) {
|
|
59
59
|
return {
|
|
60
60
|
name: e,
|
|
61
61
|
description: t,
|
|
62
|
-
inputSchema:
|
|
63
|
-
...r ? { outputSchema:
|
|
62
|
+
inputSchema: K(n),
|
|
63
|
+
...r ? { outputSchema: K(r) } : {}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/domain/subagentUsageCard.ts
|
|
68
|
-
function
|
|
69
|
-
let t =
|
|
68
|
+
function ne(e) {
|
|
69
|
+
let t = K(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 U(e) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/domain/prompts.ts
|
|
83
|
-
var
|
|
83
|
+
var J = {
|
|
84
84
|
orchestratorIntro: "You are Agentico, the orchestrator of this application's tools. Your job is to understand what the user wants to achieve and, once every required parameter is collected, start the right tool among those listed below — do not carry it out yourself \"in words\", invoke it as a tool.",
|
|
85
85
|
responseRules: [
|
|
86
86
|
"BEFORE asking for any parameter, check the \"Page context\" below (if present): if a parameter required by the command is already there or can be deduced from it with reasonable certainty, USE it directly — do not ask the user again. Only ask for parameters that cannot be derived from the context.",
|
|
@@ -108,8 +108,9 @@ var W = {
|
|
|
108
108
|
"needless repetition of the original task. The summary goes AFTER the JSON",
|
|
109
109
|
"block requested above, never before it and never instead of it."
|
|
110
110
|
].join(" "),
|
|
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
|
-
|
|
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
|
+
chatTitle: "Write a title for this chat, as a list of chats shows it: 3 to 6 words saying what it is about, in the language the person writes in. Answer with the title only: no quotes, no final period.\n\n{chat}"
|
|
113
|
+
}, Y = {
|
|
113
114
|
orchestratorIntro: "Sei Agentico, l'orchestratore dei tool di questa applicazione. Il tuo compito è capire cosa vuole ottenere l'utente e, una volta raccolti tutti i parametri necessari, avviare il tool giusto tra quelli elencati sotto — non eseguirlo tu stesso \"a parole\", invocalo come strumento.",
|
|
114
115
|
responseRules: [
|
|
115
116
|
"PRIMA di chiedere qualunque parametro, controlla il \"Contesto pagina\" (se presente) qui sotto: se un parametro richiesto dal comando è già lì o si può dedurre da lì con ragionevole certezza (es. l'utente sta guardando lo storico di un tool specifico, o un'esecuzione passata con parametri simili), USALO direttamente — non chiederlo di nuovo all'utente. Chiedi solo i parametri che NON emergono in nessun modo dal contesto.",
|
|
@@ -137,27 +138,28 @@ var W = {
|
|
|
137
138
|
"ripetizioni superflue del compito originale. Il riepilogo va DOPO il blocco JSON",
|
|
138
139
|
"richiesto sopra, mai prima e mai al posto suo."
|
|
139
140
|
].join(" "),
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere.",
|
|
142
|
+
chatTitle: "Scrivi un titolo per questa chat, come lo mostra un elenco di chat: da 3 a 6 parole che dicono di cosa parla, nella lingua in cui scrive la persona. Rispondi solo con il titolo: niente virgolette, niente punto finale.\n\n{chat}"
|
|
143
|
+
}, re = J;
|
|
144
|
+
function ie(e) {
|
|
145
|
+
re = {
|
|
146
|
+
...re,
|
|
145
147
|
...e
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
150
|
+
function X() {
|
|
151
|
+
return re;
|
|
150
152
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
153
|
+
function ae() {
|
|
154
|
+
re = J;
|
|
153
155
|
}
|
|
154
156
|
//#endregion
|
|
155
157
|
//#region src/domain/cli/renderManifestCli.ts
|
|
156
|
-
function
|
|
158
|
+
function oe(e, t) {
|
|
157
159
|
return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
|
|
158
160
|
}
|
|
159
|
-
function
|
|
160
|
-
let n =
|
|
161
|
+
function se(e, t) {
|
|
162
|
+
let n = ne(t), r = oe(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
|
|
161
163
|
return [
|
|
162
164
|
`COMMAND: ${e} ${t.name}`,
|
|
163
165
|
` ${t.summary}`,
|
|
@@ -169,46 +171,46 @@ function ae(e, t) {
|
|
|
169
171
|
...i,
|
|
170
172
|
"",
|
|
171
173
|
" OUTPUT",
|
|
172
|
-
|
|
174
|
+
Z(t.describeOutput(), 4),
|
|
173
175
|
(t.example, ""),
|
|
174
176
|
t.example ? " EXAMPLE" : "",
|
|
175
177
|
t.example ? ` ${t.example}` : ""
|
|
176
178
|
].filter((e) => e !== "").join("\n");
|
|
177
179
|
}
|
|
178
|
-
function
|
|
180
|
+
function Z(e, t) {
|
|
179
181
|
let n = " ".repeat(t);
|
|
180
182
|
return e.split("\n").map((e) => e && n + e).join("\n");
|
|
181
183
|
}
|
|
182
|
-
function
|
|
184
|
+
function ce(e) {
|
|
183
185
|
return [
|
|
184
186
|
"NAME",
|
|
185
187
|
` ${e.id} — ${e.label}`,
|
|
186
188
|
"",
|
|
187
189
|
"DESCRIPTION",
|
|
188
|
-
|
|
190
|
+
Z(e.description, 2),
|
|
189
191
|
"",
|
|
190
|
-
...e.commands.map((t) =>
|
|
192
|
+
...e.commands.map((t) => se(e.id, t))
|
|
191
193
|
].join("\n");
|
|
192
194
|
}
|
|
193
|
-
function
|
|
194
|
-
return e.length === 0 ?
|
|
195
|
+
function le(e) {
|
|
196
|
+
return e.length === 0 ? X().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
|
|
195
197
|
}
|
|
196
198
|
//#endregion
|
|
197
199
|
//#region src/domain/microPrompts.ts
|
|
198
|
-
var
|
|
200
|
+
var ue = {
|
|
199
201
|
id: "closing-summary",
|
|
200
202
|
get text() {
|
|
201
|
-
return
|
|
203
|
+
return X().closingSummary;
|
|
202
204
|
}
|
|
203
|
-
},
|
|
204
|
-
function
|
|
205
|
+
}, de = { [ue.id]: ue };
|
|
206
|
+
function fe(e, t) {
|
|
205
207
|
if (!t || t.length === 0) return e;
|
|
206
|
-
let n = t.map((e) =>
|
|
208
|
+
let n = t.map((e) => de[e]?.text).filter((e) => !!e);
|
|
207
209
|
return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
|
|
208
210
|
}
|
|
209
211
|
//#endregion
|
|
210
212
|
//#region src/domain/extractErrorMessage.ts
|
|
211
|
-
function
|
|
213
|
+
function pe(e) {
|
|
212
214
|
if (e instanceof Error) return e.message;
|
|
213
215
|
if (typeof e == "object" && e) {
|
|
214
216
|
let t = e;
|
|
@@ -227,13 +229,13 @@ function ue(e) {
|
|
|
227
229
|
}
|
|
228
230
|
//#endregion
|
|
229
231
|
//#region src/domain/extractJsonBlock.ts
|
|
230
|
-
function
|
|
232
|
+
function me(e) {
|
|
231
233
|
let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
|
|
232
234
|
if (t) return t[1].trim();
|
|
233
235
|
let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
|
|
234
|
-
return
|
|
236
|
+
return he(n) ?? n;
|
|
235
237
|
}
|
|
236
|
-
function
|
|
238
|
+
function he(e) {
|
|
237
239
|
let t = e.search(/[{[]/);
|
|
238
240
|
if (t === -1) return null;
|
|
239
241
|
let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
|
|
@@ -254,8 +256,8 @@ function fe(e) {
|
|
|
254
256
|
}
|
|
255
257
|
//#endregion
|
|
256
258
|
//#region src/domain/jsonExportDestination.ts
|
|
257
|
-
var
|
|
258
|
-
id:
|
|
259
|
+
var ge = "json-export", _e = {
|
|
260
|
+
id: ge,
|
|
259
261
|
label: "Export as JSON",
|
|
260
262
|
async apply(e) {
|
|
261
263
|
let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
|
|
@@ -266,23 +268,23 @@ var pe = "json-export", Z = {
|
|
|
266
268
|
URL.revokeObjectURL(n);
|
|
267
269
|
}
|
|
268
270
|
}
|
|
269
|
-
},
|
|
270
|
-
function
|
|
271
|
-
|
|
271
|
+
}, ve = {};
|
|
272
|
+
function ye(e) {
|
|
273
|
+
ve = e;
|
|
272
274
|
}
|
|
273
|
-
function
|
|
275
|
+
function be() {
|
|
274
276
|
return {
|
|
275
|
-
[
|
|
276
|
-
...
|
|
277
|
+
[_e.id]: _e,
|
|
278
|
+
...ve
|
|
277
279
|
};
|
|
278
280
|
}
|
|
279
281
|
//#endregion
|
|
280
282
|
//#region src/domain/entityChatStore.ts
|
|
281
|
-
var
|
|
282
|
-
function
|
|
283
|
-
|
|
283
|
+
var xe = "llmnative.agentico.entityChat";
|
|
284
|
+
function Se(e) {
|
|
285
|
+
xe = e.storageKey;
|
|
284
286
|
}
|
|
285
|
-
function
|
|
287
|
+
function Ce(e) {
|
|
286
288
|
if (!e || typeof e != "object") return null;
|
|
287
289
|
let t = e;
|
|
288
290
|
if (typeof t.entityId != "string") return null;
|
|
@@ -294,43 +296,68 @@ function ye(e) {
|
|
|
294
296
|
scopeId: n
|
|
295
297
|
};
|
|
296
298
|
}
|
|
297
|
-
function
|
|
299
|
+
function we() {
|
|
298
300
|
try {
|
|
299
|
-
let e = localStorage.getItem(
|
|
301
|
+
let e = localStorage.getItem(xe);
|
|
300
302
|
if (!e) return [];
|
|
301
303
|
let t = JSON.parse(e);
|
|
302
|
-
return Array.isArray(t) ? t.map(
|
|
304
|
+
return Array.isArray(t) ? t.map(Ce).filter((e) => e !== null) : [];
|
|
303
305
|
} catch {
|
|
304
306
|
return [];
|
|
305
307
|
}
|
|
306
308
|
}
|
|
307
|
-
|
|
309
|
+
var Te = /* @__PURE__ */ new Set();
|
|
310
|
+
function Ee(e) {
|
|
311
|
+
return Te.add(e), () => {
|
|
312
|
+
Te.delete(e);
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function De(e) {
|
|
308
316
|
try {
|
|
309
|
-
localStorage.setItem(
|
|
317
|
+
localStorage.setItem(xe, JSON.stringify(e));
|
|
310
318
|
} catch {}
|
|
319
|
+
for (let e of [...Te]) e();
|
|
311
320
|
}
|
|
312
|
-
var
|
|
313
|
-
function
|
|
314
|
-
let r =
|
|
315
|
-
return
|
|
321
|
+
var Oe = (e, t, n) => `${e}:${t}:${n}`;
|
|
322
|
+
function ke(e, t, n) {
|
|
323
|
+
let r = Oe(e, t, n);
|
|
324
|
+
return we().find((e) => Oe(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
|
|
316
325
|
}
|
|
317
|
-
function
|
|
318
|
-
let t =
|
|
326
|
+
function Ae(e) {
|
|
327
|
+
let t = Oe(e.scopeId, e.subagentId, e.entityId), n = we(), r = n.find((e) => Oe(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r);
|
|
319
328
|
a.push({
|
|
320
329
|
...e,
|
|
321
330
|
savedAt: i,
|
|
322
|
-
startedAt: r ?
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
331
|
+
startedAt: r ? Fe(r) : i,
|
|
332
|
+
...r?.name ? {
|
|
333
|
+
name: r.name,
|
|
334
|
+
namedBy: r.namedBy
|
|
335
|
+
} : {}
|
|
336
|
+
}), De(a);
|
|
337
|
+
}
|
|
338
|
+
var je = (e) => {
|
|
339
|
+
let t = (e.activity.find((e) => e.kind === "user" && e.detail?.trim())?.detail ?? "").trim().split("\n")[0].trim();
|
|
340
|
+
return t.length > 80 ? `${t.slice(0, 80).trimEnd()}…` : t;
|
|
341
|
+
}, Me = (e) => e.name || je(e) || e.title || e.entityId, Ne = (e) => e.activity.some((e) => e.kind === "user" && !!e.detail?.trim());
|
|
342
|
+
function Pe(e, t, n, r, i = "person") {
|
|
343
|
+
let a = Oe(e, t, n), o = we(), s = o.find((e) => Oe(e.scopeId, e.subagentId, e.entityId) === a);
|
|
344
|
+
if (!s || i === "model" && s.namedBy === "person") return !1;
|
|
345
|
+
let c = r.trim().replace(/\s+/g, " ").slice(0, 120), { name: l, namedBy: u, ...d } = s, f = c ? {
|
|
346
|
+
...d,
|
|
347
|
+
name: c,
|
|
348
|
+
namedBy: i
|
|
349
|
+
} : d;
|
|
350
|
+
return De(o.map((e) => e === s ? f : e)), !0;
|
|
351
|
+
}
|
|
352
|
+
var Fe = (e) => e.startedAt ?? e.savedAt;
|
|
353
|
+
function Ie(e, t, n) {
|
|
354
|
+
let r = Oe(e, t, n);
|
|
355
|
+
De(we().filter((e) => Oe(e.scopeId, e.subagentId, e.entityId) !== r));
|
|
329
356
|
}
|
|
330
|
-
function
|
|
331
|
-
return
|
|
357
|
+
function Le(e) {
|
|
358
|
+
return we().filter((t) => t.scopeId === e).sort((e, t) => Fe(t) - Fe(e));
|
|
332
359
|
}
|
|
333
|
-
var
|
|
360
|
+
var Re = (e, t) => `entitychat-${e}-${t}`, ze = {
|
|
334
361
|
modelLabel: "Modell",
|
|
335
362
|
modelsLoading: "Wird geladen…",
|
|
336
363
|
noModelsAvailable: "Keine Modelle verfügbar",
|
|
@@ -369,6 +396,9 @@ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
|
369
396
|
stepsLabel: "Schritte des Agenten",
|
|
370
397
|
newInstance: "Neue Instanz von \"{label}\"",
|
|
371
398
|
chatHistory: "Chatverlauf",
|
|
399
|
+
renameChat: "Umbenennen",
|
|
400
|
+
chatTitleLabel: "Titel",
|
|
401
|
+
chatTitleHint: "Leer: der aus dem Chat geschriebene Titel.",
|
|
372
402
|
chatStarted: "Begonnen am {at}",
|
|
373
403
|
chatLastMessage: "letzte Nachricht am {at}",
|
|
374
404
|
newChat: "Neuer Chat",
|
|
@@ -388,7 +418,7 @@ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
|
388
418
|
resizePanelHint: "Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",
|
|
389
419
|
pendingQuestions: "Fragen des Agenten",
|
|
390
420
|
stop: "Stoppen"
|
|
391
|
-
},
|
|
421
|
+
}, Be = {
|
|
392
422
|
modelLabel: "Model",
|
|
393
423
|
modelsLoading: "Loading…",
|
|
394
424
|
noModelsAvailable: "No models available",
|
|
@@ -427,6 +457,9 @@ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
|
427
457
|
stepsLabel: "Steps of the agent",
|
|
428
458
|
newInstance: "New \"{label}\" instance",
|
|
429
459
|
chatHistory: "Chat history",
|
|
460
|
+
renameChat: "Rename",
|
|
461
|
+
chatTitleLabel: "Title",
|
|
462
|
+
chatTitleHint: "Empty: the title written from the chat.",
|
|
430
463
|
chatStarted: "Started {at}",
|
|
431
464
|
chatLastMessage: "last message {at}",
|
|
432
465
|
newChat: "New chat",
|
|
@@ -446,7 +479,7 @@ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
|
446
479
|
resizePanelHint: "Drag to resize, double-click to reset",
|
|
447
480
|
pendingQuestions: "Questions of the agent",
|
|
448
481
|
stop: "Stop"
|
|
449
|
-
},
|
|
482
|
+
}, Ve = {
|
|
450
483
|
modelLabel: "Modello",
|
|
451
484
|
modelsLoading: "Caricamento…",
|
|
452
485
|
noModelsAvailable: "Nessun modello disponibile",
|
|
@@ -485,6 +518,9 @@ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
|
485
518
|
stepsLabel: "Passi dell'agente",
|
|
486
519
|
newInstance: "Nuova istanza di \"{label}\"",
|
|
487
520
|
chatHistory: "Storico chat",
|
|
521
|
+
renameChat: "Rinomina",
|
|
522
|
+
chatTitleLabel: "Titolo",
|
|
523
|
+
chatTitleHint: "Vuoto: il titolo scritto dalla chat.",
|
|
488
524
|
chatStarted: "Iniziata il {at}",
|
|
489
525
|
chatLastMessage: "ultimo messaggio il {at}",
|
|
490
526
|
newChat: "Nuova chat",
|
|
@@ -504,27 +540,27 @@ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
|
|
|
504
540
|
resizePanelHint: "Trascina per ridimensionare, doppio clic per ripristinare",
|
|
505
541
|
pendingQuestions: "Domande dell'agente",
|
|
506
542
|
stop: "Ferma"
|
|
507
|
-
},
|
|
508
|
-
en: { agentico:
|
|
509
|
-
it: { agentico:
|
|
510
|
-
de: { agentico:
|
|
543
|
+
}, He = {
|
|
544
|
+
en: { agentico: Be },
|
|
545
|
+
it: { agentico: Ve },
|
|
546
|
+
de: { agentico: ze }
|
|
511
547
|
};
|
|
512
548
|
function Q() {
|
|
513
|
-
let { dict: e } =
|
|
549
|
+
let { dict: e } = S(), t = e.agentico;
|
|
514
550
|
return t ? {
|
|
515
|
-
...
|
|
551
|
+
...Be,
|
|
516
552
|
...t
|
|
517
|
-
} :
|
|
553
|
+
} : Be;
|
|
518
554
|
}
|
|
519
555
|
//#endregion
|
|
520
556
|
//#region src/presentation/AgenticoContext.tsx
|
|
521
|
-
var
|
|
522
|
-
function
|
|
523
|
-
let [n, r] =
|
|
524
|
-
|
|
557
|
+
var Ue = "agentico-orchestrator", We = w(null);
|
|
558
|
+
function Ge({ children: e, scope: t = null }) {
|
|
559
|
+
let [n, r] = j(null), i = A(null);
|
|
560
|
+
D(() => {
|
|
525
561
|
i.current = n;
|
|
526
562
|
}, [n]);
|
|
527
|
-
let [a, o] =
|
|
563
|
+
let [a, o] = j(!1), s = T((e) => {
|
|
528
564
|
let t = i.current;
|
|
529
565
|
t && t.id !== e.id && t.onDismiss();
|
|
530
566
|
let n = t && t.id === e.id && t.savedToDisk && e.savedToDisk === void 0 ? {
|
|
@@ -532,10 +568,10 @@ function Fe({ children: e, scope: t = null }) {
|
|
|
532
568
|
savedToDisk: !0
|
|
533
569
|
} : e;
|
|
534
570
|
r(n);
|
|
535
|
-
}, []), c =
|
|
571
|
+
}, []), c = T((e) => {
|
|
536
572
|
r((t) => t && t.id === e ? null : t);
|
|
537
|
-
}, []), l =
|
|
538
|
-
|
|
573
|
+
}, []), l = T(() => o((e) => !e), []), u = T(() => o(!0), []), [d, f] = j(null), [p, m] = j(void 0), [h, g] = j(void 0), [_, v] = j(void 0), [y, b] = j(null), [x, S] = j(null), [C, w] = j(void 0), [E, O] = j([]), M = T((e, t, n = null) => {
|
|
574
|
+
O((r) => {
|
|
539
575
|
let i = r.filter((t) => t.id !== e);
|
|
540
576
|
return t ? [...i, {
|
|
541
577
|
id: e,
|
|
@@ -543,30 +579,30 @@ function Fe({ children: e, scope: t = null }) {
|
|
|
543
579
|
card: n
|
|
544
580
|
}] : i;
|
|
545
581
|
});
|
|
546
|
-
}, []),
|
|
547
|
-
|
|
582
|
+
}, []), P = E.length > 0 ? E[E.length - 1] : null, [F, ee] = j([]), I = T((e, t) => {
|
|
583
|
+
ee((n) => {
|
|
548
584
|
let r = n.filter((t) => t.id !== e);
|
|
549
585
|
return t ? [...r, {
|
|
550
586
|
id: e,
|
|
551
587
|
...t
|
|
552
588
|
}] : r;
|
|
553
589
|
});
|
|
554
|
-
}, []),
|
|
590
|
+
}, []), L = k(() => F.map((e) => ({
|
|
555
591
|
subagentId: e.subagentId,
|
|
556
592
|
componentKey: e.componentKey,
|
|
557
593
|
onResult: e.onResult,
|
|
558
594
|
pinnedEntityId: e.pinnedEntityId
|
|
559
|
-
})), [
|
|
595
|
+
})), [F]), R = k(() => {
|
|
560
596
|
let e = /* @__PURE__ */ new Map();
|
|
561
|
-
for (let t of
|
|
597
|
+
for (let t of F) e.set(t.subagentId, {
|
|
562
598
|
subagentId: t.subagentId,
|
|
563
599
|
componentKey: t.componentKey,
|
|
564
600
|
onResult: t.onResult,
|
|
565
601
|
contextInfo: t.contextInfo
|
|
566
602
|
});
|
|
567
603
|
return [...e.values()];
|
|
568
|
-
}, [
|
|
569
|
-
let t =
|
|
604
|
+
}, [F]), z = k(() => R.map((e) => {
|
|
605
|
+
let t = H(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
570
606
|
if (!t) return null;
|
|
571
607
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
572
608
|
return {
|
|
@@ -574,26 +610,26 @@ function Fe({ children: e, scope: t = null }) {
|
|
|
574
610
|
agenticoHint: n,
|
|
575
611
|
userMessage: t.userMessage
|
|
576
612
|
};
|
|
577
|
-
}).filter((e) => e !== null), [
|
|
613
|
+
}).filter((e) => e !== null), [R]), B = k(() => z.map((e) => e.userMessage), [z]), te = k(() => {
|
|
578
614
|
if (z.length === 0) return null;
|
|
579
615
|
if (z.length === 1) return z[0].agenticoHint;
|
|
580
616
|
let e = z.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
581
|
-
return `${
|
|
582
|
-
}, [z]) ??
|
|
617
|
+
return `${X().multipleCandidates}\n\n${e}`;
|
|
618
|
+
}, [z]) ?? P?.text ?? null, V = z.length > 0 ? null : P?.card ?? null, U = k(() => [...new Set(L.map((e) => e.subagentId))], [L]), W = U.length === 1 ? U[0] : U.length === 0 ? P?.card?.subagentId ?? null : null, G = T((e, t) => {
|
|
583
619
|
u();
|
|
584
620
|
let n = i.current;
|
|
585
621
|
if (n?.id === "agentico-orchestrator") return;
|
|
586
|
-
let r =
|
|
587
|
-
|
|
622
|
+
let r = W && n?.id.startsWith(`subagent-${W}-`) ? n : void 0;
|
|
623
|
+
S(r ? {
|
|
588
624
|
taskId: r.id,
|
|
589
625
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
590
|
-
} : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model),
|
|
591
|
-
}, [u,
|
|
626
|
+
} : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model), w(t?.scopedSubagentId), b(crypto.randomUUID());
|
|
627
|
+
}, [u, W]), K = T((e, t, n, a, o, s) => {
|
|
592
628
|
if (!n || !a) return;
|
|
593
629
|
let c = i.current;
|
|
594
630
|
if (!c || c.id !== n) return;
|
|
595
631
|
let l = c.agent.snapshot();
|
|
596
|
-
l && (
|
|
632
|
+
l && (Ae({
|
|
597
633
|
scopeId: a,
|
|
598
634
|
subagentId: e,
|
|
599
635
|
entityId: t,
|
|
@@ -605,33 +641,33 @@ function Fe({ children: e, scope: t = null }) {
|
|
|
605
641
|
...e,
|
|
606
642
|
savedToDisk: !0
|
|
607
643
|
} : e));
|
|
608
|
-
}, []), [
|
|
609
|
-
u(),
|
|
644
|
+
}, []), [q, ne] = j(null), [J, Y] = j(null), re = T((e, t, n) => {
|
|
645
|
+
u(), ne({
|
|
610
646
|
subagentId: e,
|
|
611
647
|
entityId: t,
|
|
612
648
|
snapshot: n
|
|
613
|
-
}),
|
|
614
|
-
}, [u]), [
|
|
615
|
-
u(), c(
|
|
649
|
+
}), Y(crypto.randomUUID());
|
|
650
|
+
}, [u]), [ie, ae] = j(null), [oe, se] = j(null), Z = T((e, t) => {
|
|
651
|
+
u(), c(Ue), ae({
|
|
616
652
|
subagentId: e,
|
|
617
653
|
extraDestinations: t
|
|
618
|
-
}),
|
|
619
|
-
}, [u, c]), [
|
|
620
|
-
|
|
654
|
+
}), se(crypto.randomUUID());
|
|
655
|
+
}, [u, c]), [ce, le] = j(null), [ue, de] = j(null), fe = T((e, t, n) => {
|
|
656
|
+
ae(null), le({
|
|
621
657
|
subagentId: e,
|
|
622
658
|
params: t,
|
|
623
659
|
extraDestinations: n
|
|
624
|
-
}),
|
|
625
|
-
}, []), [
|
|
660
|
+
}), de(crypto.randomUUID());
|
|
661
|
+
}, []), [pe, me] = j(null), [he, ge] = j(null), _e = T((e, t, n) => {
|
|
626
662
|
u(), me({
|
|
627
663
|
subagentId: e,
|
|
628
664
|
params: t,
|
|
629
665
|
...n
|
|
630
666
|
}), ge(crypto.randomUUID());
|
|
631
|
-
}, [u]), ve =
|
|
667
|
+
}, [u]), ve = T(() => {
|
|
632
668
|
let e = i.current;
|
|
633
669
|
e && e.onDismiss();
|
|
634
|
-
}, []), ye =
|
|
670
|
+
}, []), ye = k(() => ({
|
|
635
671
|
scope: t,
|
|
636
672
|
task: n,
|
|
637
673
|
isOpen: a,
|
|
@@ -639,34 +675,34 @@ function Fe({ children: e, scope: t = null }) {
|
|
|
639
675
|
closeTask: c,
|
|
640
676
|
toggleOpen: l,
|
|
641
677
|
pendingGoal: d,
|
|
642
|
-
startOrchestrator:
|
|
643
|
-
pageContext:
|
|
678
|
+
startOrchestrator: G,
|
|
679
|
+
pageContext: te,
|
|
644
680
|
pageContextCard: V,
|
|
645
|
-
setPageContext:
|
|
646
|
-
scopedSubagentId:
|
|
647
|
-
pendingScopedSubagentId:
|
|
648
|
-
componentAnchors:
|
|
649
|
-
anchoredUserMessages:
|
|
650
|
-
registerComponentAnchor:
|
|
681
|
+
setPageContext: M,
|
|
682
|
+
scopedSubagentId: W,
|
|
683
|
+
pendingScopedSubagentId: C,
|
|
684
|
+
componentAnchors: L,
|
|
685
|
+
anchoredUserMessages: B,
|
|
686
|
+
registerComponentAnchor: I,
|
|
651
687
|
openPanel: u,
|
|
652
688
|
pendingExtraDestinations: p,
|
|
653
689
|
pendingAttachments: h,
|
|
654
690
|
pendingModel: _,
|
|
655
691
|
orchestratorRunId: y,
|
|
656
|
-
pendingCarryOver:
|
|
657
|
-
commitEntityChat:
|
|
658
|
-
resumeEntityChat:
|
|
659
|
-
pendingResume:
|
|
660
|
-
resumeRunId:
|
|
692
|
+
pendingCarryOver: x,
|
|
693
|
+
commitEntityChat: K,
|
|
694
|
+
resumeEntityChat: re,
|
|
695
|
+
pendingResume: q,
|
|
696
|
+
resumeRunId: J,
|
|
661
697
|
dismissForeignTask: ve,
|
|
662
|
-
pendingManualEntry:
|
|
663
|
-
manualEntryRunId:
|
|
664
|
-
startManualEntry:
|
|
665
|
-
pendingResumeWithAI:
|
|
666
|
-
resumeWithAIRunId:
|
|
667
|
-
resumeWithAI:
|
|
698
|
+
pendingManualEntry: ie,
|
|
699
|
+
manualEntryRunId: oe,
|
|
700
|
+
startManualEntry: Z,
|
|
701
|
+
pendingResumeWithAI: ce,
|
|
702
|
+
resumeWithAIRunId: ue,
|
|
703
|
+
resumeWithAI: fe,
|
|
668
704
|
startSubagent: _e,
|
|
669
|
-
pendingStart:
|
|
705
|
+
pendingStart: pe,
|
|
670
706
|
startRunId: he
|
|
671
707
|
}), [
|
|
672
708
|
t,
|
|
@@ -676,49 +712,49 @@ function Fe({ children: e, scope: t = null }) {
|
|
|
676
712
|
c,
|
|
677
713
|
l,
|
|
678
714
|
d,
|
|
715
|
+
G,
|
|
716
|
+
te,
|
|
717
|
+
V,
|
|
718
|
+
M,
|
|
679
719
|
W,
|
|
720
|
+
C,
|
|
721
|
+
L,
|
|
680
722
|
B,
|
|
681
|
-
V,
|
|
682
|
-
ee,
|
|
683
|
-
U,
|
|
684
|
-
O,
|
|
685
723
|
I,
|
|
686
|
-
ne,
|
|
687
|
-
F,
|
|
688
724
|
u,
|
|
689
725
|
p,
|
|
690
726
|
h,
|
|
691
727
|
_,
|
|
692
728
|
y,
|
|
693
|
-
|
|
694
|
-
G,
|
|
695
|
-
ae,
|
|
729
|
+
x,
|
|
696
730
|
K,
|
|
697
|
-
|
|
731
|
+
re,
|
|
732
|
+
q,
|
|
733
|
+
J,
|
|
698
734
|
ve,
|
|
735
|
+
ie,
|
|
699
736
|
oe,
|
|
737
|
+
Z,
|
|
700
738
|
ce,
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
de,
|
|
704
|
-
pe,
|
|
739
|
+
ue,
|
|
740
|
+
fe,
|
|
705
741
|
_e,
|
|
706
|
-
|
|
742
|
+
pe,
|
|
707
743
|
he
|
|
708
744
|
]);
|
|
709
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ N(We.Provider, {
|
|
710
746
|
value: ye,
|
|
711
747
|
children: e
|
|
712
748
|
});
|
|
713
749
|
}
|
|
714
750
|
function $() {
|
|
715
|
-
let e =
|
|
751
|
+
let e = E(We);
|
|
716
752
|
if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
|
|
717
753
|
return e;
|
|
718
754
|
}
|
|
719
755
|
//#endregion
|
|
720
756
|
//#region src/presentation/AgentActivityLog.tsx
|
|
721
|
-
function
|
|
757
|
+
function Ke(e) {
|
|
722
758
|
let t = e.search(/[{[]/);
|
|
723
759
|
if (t === -1) return [{
|
|
724
760
|
type: "text",
|
|
@@ -764,97 +800,97 @@ function Ie(e) {
|
|
|
764
800
|
language: "json"
|
|
765
801
|
});
|
|
766
802
|
let u = e.slice(s + 1);
|
|
767
|
-
return u.trim() && l.push(...
|
|
803
|
+
return u.trim() && l.push(...Ke(u)), l;
|
|
768
804
|
}
|
|
769
|
-
function
|
|
805
|
+
function qe(e) {
|
|
770
806
|
let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
|
|
771
|
-
for (; i = n.exec(e);) i.index > r && t.push(...
|
|
807
|
+
for (; i = n.exec(e);) i.index > r && t.push(...Ke(e.slice(r, i.index))), t.push({
|
|
772
808
|
type: "code",
|
|
773
809
|
content: i[2].replace(/\n$/, ""),
|
|
774
810
|
language: i[1]
|
|
775
811
|
}), r = n.lastIndex;
|
|
776
|
-
return r < e.length && t.push(...
|
|
812
|
+
return r < e.length && t.push(...Ke(e.slice(r))), t;
|
|
777
813
|
}
|
|
778
|
-
function
|
|
779
|
-
let [n, r] =
|
|
780
|
-
return /* @__PURE__ */
|
|
814
|
+
function Je({ content: e, language: t }) {
|
|
815
|
+
let [n, r] = j(!1);
|
|
816
|
+
return /* @__PURE__ */ P("div", {
|
|
781
817
|
className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
782
818
|
onClick: () => r((e) => !e),
|
|
783
819
|
title: n ? "Clic per comprimere" : "Clic per espandere",
|
|
784
|
-
children: [/* @__PURE__ */
|
|
820
|
+
children: [/* @__PURE__ */ N(s, {
|
|
785
821
|
language: t,
|
|
786
822
|
showCopy: n,
|
|
787
823
|
background: "transparent",
|
|
788
824
|
className: "!text-[11px]",
|
|
789
825
|
children: e
|
|
790
|
-
}), !n && /* @__PURE__ */
|
|
826
|
+
}), !n && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
791
827
|
});
|
|
792
828
|
}
|
|
793
|
-
function
|
|
794
|
-
let n =
|
|
795
|
-
return /* @__PURE__ */
|
|
829
|
+
function Ye({ text: e, tone: t }) {
|
|
830
|
+
let n = qe(e);
|
|
831
|
+
return /* @__PURE__ */ N(M, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ N(Je, {
|
|
796
832
|
content: e.content,
|
|
797
833
|
language: e.language
|
|
798
|
-
}, n) : e.content.trim() && /* @__PURE__ */
|
|
834
|
+
}, n) : e.content.trim() && /* @__PURE__ */ N(r, {
|
|
799
835
|
content: e.content.trim(),
|
|
800
836
|
tone: t,
|
|
801
837
|
className: "break-words text-xs leading-relaxed"
|
|
802
838
|
}, n)) });
|
|
803
839
|
}
|
|
804
|
-
function
|
|
805
|
-
return e === "running" ? /* @__PURE__ */
|
|
840
|
+
function Xe({ status: e }) {
|
|
841
|
+
return e === "running" ? /* @__PURE__ */ N("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ N(d, {
|
|
806
842
|
name: "check",
|
|
807
843
|
size: 12,
|
|
808
844
|
className: "shrink-0 text-green-600"
|
|
809
|
-
}) : e === "stopped" ? /* @__PURE__ */
|
|
845
|
+
}) : e === "stopped" ? /* @__PURE__ */ N(d, {
|
|
810
846
|
name: "circle-slash",
|
|
811
847
|
size: 12,
|
|
812
848
|
className: "shrink-0 text-muted-foreground"
|
|
813
|
-
}) : /* @__PURE__ */
|
|
849
|
+
}) : /* @__PURE__ */ N(d, {
|
|
814
850
|
name: "x",
|
|
815
851
|
size: 12,
|
|
816
852
|
className: "shrink-0 text-destructive"
|
|
817
853
|
});
|
|
818
854
|
}
|
|
819
|
-
function
|
|
855
|
+
function Ze(e, t) {
|
|
820
856
|
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;
|
|
821
857
|
}
|
|
822
|
-
var
|
|
823
|
-
function
|
|
824
|
-
let n =
|
|
825
|
-
|
|
858
|
+
var Qe = 96;
|
|
859
|
+
function $e({ entry: e, pinned: t = !0 }) {
|
|
860
|
+
let n = A(null), [r, i] = j(!1), [a, o] = j(!1);
|
|
861
|
+
O(() => {
|
|
826
862
|
let e = n.current;
|
|
827
863
|
e && o(e.scrollHeight > 97);
|
|
828
864
|
}, [e.detail, e.attachmentNames]);
|
|
829
865
|
let s = a && !r;
|
|
830
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ N("div", {
|
|
831
867
|
className: `${t ? "sticky top-0 z-20 border-b border-border/40" : ""} flex justify-end bg-background py-1.5`,
|
|
832
|
-
children: /* @__PURE__ */
|
|
868
|
+
children: /* @__PURE__ */ P("div", {
|
|
833
869
|
className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
|
|
834
|
-
children: [/* @__PURE__ */
|
|
870
|
+
children: [/* @__PURE__ */ P("div", {
|
|
835
871
|
ref: n,
|
|
836
872
|
className: `space-y-1 px-2.5 pt-1.5 ${s ? "overflow-hidden" : ""}`,
|
|
837
|
-
style: s ? { maxHeight:
|
|
838
|
-
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */
|
|
873
|
+
style: s ? { maxHeight: Qe } : void 0,
|
|
874
|
+
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ N("div", {
|
|
839
875
|
className: "flex flex-wrap gap-1",
|
|
840
|
-
children: e.attachmentNames.map((e, t) => /* @__PURE__ */
|
|
876
|
+
children: e.attachmentNames.map((e, t) => /* @__PURE__ */ P("span", {
|
|
841
877
|
className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
|
|
842
|
-
children: [/* @__PURE__ */
|
|
878
|
+
children: [/* @__PURE__ */ N(d, {
|
|
843
879
|
name: "paperclip",
|
|
844
880
|
size: 10,
|
|
845
881
|
className: "shrink-0"
|
|
846
|
-
}), /* @__PURE__ */
|
|
882
|
+
}), /* @__PURE__ */ N("span", {
|
|
847
883
|
className: "max-w-[160px] truncate",
|
|
848
884
|
children: e
|
|
849
885
|
})]
|
|
850
886
|
}, t))
|
|
851
|
-
}), /* @__PURE__ */
|
|
852
|
-
}), a && /* @__PURE__ */
|
|
887
|
+
}), /* @__PURE__ */ N(Ye, { text: e.detail ?? "" })]
|
|
888
|
+
}), a && /* @__PURE__ */ P("button", {
|
|
853
889
|
type: "button",
|
|
854
890
|
onClick: () => i((e) => !e),
|
|
855
891
|
className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
|
|
856
892
|
title: r ? "Comprimi" : "Espandi",
|
|
857
|
-
children: [s && /* @__PURE__ */
|
|
893
|
+
children: [s && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ N(d, {
|
|
858
894
|
name: r ? "chevron-up" : "chevron-down",
|
|
859
895
|
size: 12
|
|
860
896
|
})]
|
|
@@ -862,15 +898,15 @@ function Ue({ entry: e, pinned: t = !0 }) {
|
|
|
862
898
|
})
|
|
863
899
|
});
|
|
864
900
|
}
|
|
865
|
-
var
|
|
901
|
+
var et = {
|
|
866
902
|
running: "loader-circle",
|
|
867
903
|
done: "check",
|
|
868
904
|
error: "x",
|
|
869
905
|
stopped: "circle-slash"
|
|
870
906
|
};
|
|
871
|
-
function
|
|
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 :
|
|
873
|
-
return /* @__PURE__ */
|
|
907
|
+
function tt({ steps: e }) {
|
|
908
|
+
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 : _(t.steps, { count: e.length }));
|
|
909
|
+
return /* @__PURE__ */ N(h, {
|
|
874
910
|
ariaLabel: t.stepsLabel,
|
|
875
911
|
selectedId: null,
|
|
876
912
|
itemClassName: "py-0.5 text-xs text-muted-foreground",
|
|
@@ -880,16 +916,16 @@ function Ge({ steps: e }) {
|
|
|
880
916
|
icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
|
|
881
917
|
children: e.map((e) => ({
|
|
882
918
|
id: e.id,
|
|
883
|
-
label: /* @__PURE__ */
|
|
919
|
+
label: /* @__PURE__ */ N("span", {
|
|
884
920
|
className: e.status === "error" ? "text-destructive" : void 0,
|
|
885
921
|
children: e.label
|
|
886
922
|
}),
|
|
887
|
-
icon:
|
|
923
|
+
icon: et[e.status]
|
|
888
924
|
}))
|
|
889
925
|
}]
|
|
890
926
|
});
|
|
891
927
|
}
|
|
892
|
-
function
|
|
928
|
+
function nt(e, t) {
|
|
893
929
|
let n = e.at(-1);
|
|
894
930
|
if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
|
|
895
931
|
let r = [...n.parts].reverse().find((e) => e.type === "questions");
|
|
@@ -898,9 +934,9 @@ function Ke(e, t) {
|
|
|
898
934
|
part: r
|
|
899
935
|
};
|
|
900
936
|
}
|
|
901
|
-
function
|
|
937
|
+
function rt({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
|
|
902
938
|
let o = !!n?.canAnswer(e.id);
|
|
903
|
-
return /* @__PURE__ */
|
|
939
|
+
return /* @__PURE__ */ N(i, {
|
|
904
940
|
questions: t.questions,
|
|
905
941
|
...t.answers ? { answers: t.answers } : {},
|
|
906
942
|
disabled: !t.answers && !o,
|
|
@@ -909,7 +945,7 @@ function qe({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
|
|
|
909
945
|
className: a ?? "text-xs"
|
|
910
946
|
});
|
|
911
947
|
}
|
|
912
|
-
function
|
|
948
|
+
function it({ entry: e, questions: t, hiddenPartId: n }) {
|
|
913
949
|
let i = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), o = [];
|
|
914
950
|
for (let e of i) {
|
|
915
951
|
let t = o.at(-1);
|
|
@@ -921,21 +957,21 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
921
957
|
part: e
|
|
922
958
|
});
|
|
923
959
|
}
|
|
924
|
-
return /* @__PURE__ */
|
|
960
|
+
return /* @__PURE__ */ N("div", {
|
|
925
961
|
className: "space-y-2",
|
|
926
962
|
children: o.map((n) => {
|
|
927
|
-
if ("steps" in n) return /* @__PURE__ */
|
|
963
|
+
if ("steps" in n) return /* @__PURE__ */ N(tt, { steps: n.steps }, n.key);
|
|
928
964
|
let { part: i } = n;
|
|
929
|
-
return i.type === "text" ? i.text.trim() ? /* @__PURE__ */
|
|
965
|
+
return i.type === "text" ? i.text.trim() ? /* @__PURE__ */ N(r, {
|
|
930
966
|
content: i.text,
|
|
931
967
|
streaming: i.streaming,
|
|
932
968
|
className: "break-words text-xs leading-relaxed text-foreground"
|
|
933
|
-
}, n.key) : null : i.type === "reasoning" ? /* @__PURE__ */
|
|
969
|
+
}, n.key) : null : i.type === "reasoning" ? /* @__PURE__ */ N(a, {
|
|
934
970
|
content: i.text,
|
|
935
971
|
streaming: i.streaming,
|
|
936
972
|
duration: i.duration,
|
|
937
973
|
className: "my-0"
|
|
938
|
-
}, n.key) : /* @__PURE__ */
|
|
974
|
+
}, n.key) : /* @__PURE__ */ N(rt, {
|
|
939
975
|
entry: e,
|
|
940
976
|
part: i,
|
|
941
977
|
questions: t
|
|
@@ -943,52 +979,52 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
943
979
|
})
|
|
944
980
|
});
|
|
945
981
|
}
|
|
946
|
-
function
|
|
982
|
+
function at({ entry: e, questions: t, hiddenPartId: n }) {
|
|
947
983
|
let i = Q();
|
|
948
984
|
if (e.kind === "thinking" && e.parts) {
|
|
949
985
|
let r = e.status === "error" || e.status === "stopped" || e.status === "running" && e.parts.length === 0;
|
|
950
|
-
return /* @__PURE__ */
|
|
986
|
+
return /* @__PURE__ */ P("li", {
|
|
951
987
|
className: "text-xs text-muted-foreground",
|
|
952
|
-
children: [e.parts.length > 0 && /* @__PURE__ */
|
|
988
|
+
children: [e.parts.length > 0 && /* @__PURE__ */ N(it, {
|
|
953
989
|
entry: e,
|
|
954
990
|
questions: t,
|
|
955
991
|
hiddenPartId: n
|
|
956
|
-
}), r && /* @__PURE__ */
|
|
992
|
+
}), r && /* @__PURE__ */ P("div", {
|
|
957
993
|
className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
|
|
958
|
-
children: [/* @__PURE__ */
|
|
994
|
+
children: [/* @__PURE__ */ N("span", {
|
|
959
995
|
className: "pt-px",
|
|
960
|
-
children: /* @__PURE__ */
|
|
961
|
-
}), /* @__PURE__ */
|
|
996
|
+
children: /* @__PURE__ */ N(Xe, { status: e.status })
|
|
997
|
+
}), /* @__PURE__ */ N("span", {
|
|
962
998
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
963
|
-
children:
|
|
999
|
+
children: Ze(e, i)
|
|
964
1000
|
})]
|
|
965
1001
|
})]
|
|
966
1002
|
});
|
|
967
1003
|
}
|
|
968
|
-
let a = e.kind === "thinking" && e.detail ?
|
|
969
|
-
return /* @__PURE__ */
|
|
1004
|
+
let a = e.kind === "thinking" && e.detail ? qe(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? Ze(e, i) : e.label;
|
|
1005
|
+
return /* @__PURE__ */ P("li", {
|
|
970
1006
|
className: "text-xs text-muted-foreground",
|
|
971
1007
|
children: [
|
|
972
|
-
/* @__PURE__ */
|
|
1008
|
+
/* @__PURE__ */ P("div", {
|
|
973
1009
|
className: "flex items-start gap-1.5",
|
|
974
|
-
children: [/* @__PURE__ */
|
|
1010
|
+
children: [/* @__PURE__ */ N("span", {
|
|
975
1011
|
className: "pt-px",
|
|
976
|
-
children: /* @__PURE__ */
|
|
977
|
-
}), /* @__PURE__ */
|
|
1012
|
+
children: /* @__PURE__ */ N(Xe, { status: e.status })
|
|
1013
|
+
}), /* @__PURE__ */ N("span", {
|
|
978
1014
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
979
1015
|
children: c
|
|
980
1016
|
})]
|
|
981
1017
|
}),
|
|
982
|
-
o.length > 0 && /* @__PURE__ */
|
|
1018
|
+
o.length > 0 && /* @__PURE__ */ N("div", {
|
|
983
1019
|
className: "mt-1 ml-[18px] space-y-1",
|
|
984
|
-
children: o.map((e, t) => /* @__PURE__ */
|
|
1020
|
+
children: o.map((e, t) => /* @__PURE__ */ N(Je, {
|
|
985
1021
|
content: e.content,
|
|
986
1022
|
language: e.language
|
|
987
1023
|
}, t))
|
|
988
1024
|
}),
|
|
989
|
-
s.length > 0 && /* @__PURE__ */
|
|
1025
|
+
s.length > 0 && /* @__PURE__ */ N("div", {
|
|
990
1026
|
className: "mt-1 ml-[18px] space-y-2",
|
|
991
|
-
children: s.map((e, t) => /* @__PURE__ */
|
|
1027
|
+
children: s.map((e, t) => /* @__PURE__ */ N(r, {
|
|
992
1028
|
content: e.content.trim(),
|
|
993
1029
|
tone: "muted",
|
|
994
1030
|
className: "break-words text-xs leading-relaxed"
|
|
@@ -997,21 +1033,21 @@ function Ye({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
997
1033
|
]
|
|
998
1034
|
});
|
|
999
1035
|
}
|
|
1000
|
-
function
|
|
1036
|
+
function ot({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
1001
1037
|
if (e.length === 0) return null;
|
|
1002
1038
|
let i = [];
|
|
1003
1039
|
for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
|
|
1004
1040
|
user: t,
|
|
1005
1041
|
entries: []
|
|
1006
1042
|
} : { entries: [t] }) : i[i.length - 1].entries.push(t);
|
|
1007
|
-
return /* @__PURE__ */
|
|
1043
|
+
return /* @__PURE__ */ N("ul", {
|
|
1008
1044
|
className: "space-y-0.5",
|
|
1009
|
-
children: i.map((e) => /* @__PURE__ */
|
|
1045
|
+
children: i.map((e) => /* @__PURE__ */ P("li", { children: [e.user && /* @__PURE__ */ N($e, {
|
|
1010
1046
|
entry: e.user,
|
|
1011
1047
|
pinned: r
|
|
1012
|
-
}), e.entries.length > 0 && /* @__PURE__ */
|
|
1048
|
+
}), e.entries.length > 0 && /* @__PURE__ */ N("ul", {
|
|
1013
1049
|
className: "space-y-0.5",
|
|
1014
|
-
children: e.entries.map((e) => /* @__PURE__ */
|
|
1050
|
+
children: e.entries.map((e) => /* @__PURE__ */ N(at, {
|
|
1015
1051
|
entry: e,
|
|
1016
1052
|
questions: t,
|
|
1017
1053
|
hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
|
|
@@ -1021,56 +1057,56 @@ function Xe({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
|
1021
1057
|
}
|
|
1022
1058
|
//#endregion
|
|
1023
1059
|
//#region src/presentation/panelWidth.ts
|
|
1024
|
-
var
|
|
1025
|
-
function
|
|
1060
|
+
var st = 420, ct = 320, lt = "60vw", ut = "agentico:panel-width";
|
|
1061
|
+
function dt(e, t) {
|
|
1026
1062
|
if (typeof e == "number") return e;
|
|
1027
1063
|
let n = Number.parseFloat(e);
|
|
1028
1064
|
return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
|
|
1029
1065
|
}
|
|
1030
|
-
function
|
|
1066
|
+
function ft(e, t, n) {
|
|
1031
1067
|
return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
|
|
1032
1068
|
}
|
|
1033
|
-
function
|
|
1069
|
+
function pt() {
|
|
1034
1070
|
try {
|
|
1035
|
-
let e = window.localStorage.getItem(
|
|
1071
|
+
let e = window.localStorage.getItem(ut), t = e === null ? NaN : Number(e);
|
|
1036
1072
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
1037
1073
|
} catch {
|
|
1038
1074
|
return null;
|
|
1039
1075
|
}
|
|
1040
1076
|
}
|
|
1041
|
-
function
|
|
1077
|
+
function mt(e) {
|
|
1042
1078
|
try {
|
|
1043
|
-
e === null ? window.localStorage.removeItem(
|
|
1079
|
+
e === null ? window.localStorage.removeItem(ut) : window.localStorage.setItem(ut, String(e));
|
|
1044
1080
|
} catch {}
|
|
1045
1081
|
}
|
|
1046
|
-
function
|
|
1082
|
+
function ht() {
|
|
1047
1083
|
return typeof window > "u" ? Infinity : window.innerWidth;
|
|
1048
1084
|
}
|
|
1049
|
-
function
|
|
1050
|
-
let [i, a] =
|
|
1051
|
-
|
|
1085
|
+
function gt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = lt, onWidthChange: r }) {
|
|
1086
|
+
let [i, a] = j(ht), [o, s] = j(() => pt() ?? e);
|
|
1087
|
+
D(() => {
|
|
1052
1088
|
if (typeof window > "u") return;
|
|
1053
1089
|
let e = () => a(window.innerWidth);
|
|
1054
1090
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1055
1091
|
}, []);
|
|
1056
|
-
let c = t, l = Math.max(c,
|
|
1057
|
-
return
|
|
1092
|
+
let c = t, l = Math.max(c, dt(n, i)), u = ft(o, c, l);
|
|
1093
|
+
return D(() => {
|
|
1058
1094
|
r?.(u);
|
|
1059
1095
|
}, [u]), {
|
|
1060
1096
|
width: u,
|
|
1061
1097
|
min: c,
|
|
1062
1098
|
max: l,
|
|
1063
|
-
set:
|
|
1064
|
-
commit:
|
|
1065
|
-
reset:
|
|
1066
|
-
s(e),
|
|
1099
|
+
set: T((e) => s(ft(e, c, l)), [c, l]),
|
|
1100
|
+
commit: T((e) => mt(ft(e, c, l)), [c, l]),
|
|
1101
|
+
reset: T(() => {
|
|
1102
|
+
s(e), mt(null);
|
|
1067
1103
|
}, [e])
|
|
1068
1104
|
};
|
|
1069
1105
|
}
|
|
1070
1106
|
//#endregion
|
|
1071
1107
|
//#region src/presentation/AgenticoResizeHandle.tsx
|
|
1072
|
-
function
|
|
1073
|
-
let o = Q(), s =
|
|
1108
|
+
function _t({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
|
|
1109
|
+
let o = Q(), s = A(null), [c, l] = j(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
|
|
1074
1110
|
let t = s.current;
|
|
1075
1111
|
if (t && t.pointerId === e.pointerId) {
|
|
1076
1112
|
s.current = null, l(!1), document.body.style.removeProperty("cursor"), document.body.style.removeProperty("user-select");
|
|
@@ -1080,7 +1116,7 @@ function st({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1080
1116
|
i(t.last);
|
|
1081
1117
|
}
|
|
1082
1118
|
};
|
|
1083
|
-
return /* @__PURE__ */
|
|
1119
|
+
return /* @__PURE__ */ N("div", {
|
|
1084
1120
|
role: "separator",
|
|
1085
1121
|
"aria-orientation": "vertical",
|
|
1086
1122
|
"aria-label": o.resizePanel,
|
|
@@ -1119,7 +1155,7 @@ function st({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1119
1155
|
let c = u(s);
|
|
1120
1156
|
r(c), i(c);
|
|
1121
1157
|
},
|
|
1122
|
-
children: /* @__PURE__ */
|
|
1158
|
+
children: /* @__PURE__ */ N("span", {
|
|
1123
1159
|
"aria-hidden": !0,
|
|
1124
1160
|
className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
|
|
1125
1161
|
})
|
|
@@ -1127,9 +1163,9 @@ function st({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1127
1163
|
}
|
|
1128
1164
|
//#endregion
|
|
1129
1165
|
//#region src/presentation/AgenticoToggle.tsx
|
|
1130
|
-
function
|
|
1166
|
+
function vt({ className: e = "" }) {
|
|
1131
1167
|
let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
|
|
1132
|
-
return /* @__PURE__ */
|
|
1168
|
+
return /* @__PURE__ */ N(t, {
|
|
1133
1169
|
icon: "bot",
|
|
1134
1170
|
ariaLabel: n ? a.closePanel : a.openPanel,
|
|
1135
1171
|
title: n ? a.closePanel : a.openPanel,
|
|
@@ -1140,32 +1176,32 @@ function ct({ className: e = "" }) {
|
|
|
1140
1176
|
}
|
|
1141
1177
|
//#endregion
|
|
1142
1178
|
//#region src/presentation/useAIModelCatalog.ts
|
|
1143
|
-
var
|
|
1144
|
-
function
|
|
1179
|
+
var yt = "llmnative-cms.selectedAIModel";
|
|
1180
|
+
function bt() {
|
|
1145
1181
|
try {
|
|
1146
|
-
return localStorage.getItem(
|
|
1182
|
+
return localStorage.getItem(yt) ?? "";
|
|
1147
1183
|
} catch {
|
|
1148
1184
|
return "";
|
|
1149
1185
|
}
|
|
1150
1186
|
}
|
|
1151
|
-
function
|
|
1187
|
+
function xt(e) {
|
|
1152
1188
|
try {
|
|
1153
|
-
e ? localStorage.setItem(
|
|
1189
|
+
e ? localStorage.setItem(yt, e) : localStorage.removeItem(yt);
|
|
1154
1190
|
} catch {}
|
|
1155
1191
|
}
|
|
1156
|
-
function
|
|
1157
|
-
let e =
|
|
1158
|
-
return
|
|
1192
|
+
function St() {
|
|
1193
|
+
let e = b()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = j({}), [i, a] = j(!1), [o, s] = j(bt);
|
|
1194
|
+
return D(() => {
|
|
1159
1195
|
if (!t) {
|
|
1160
1196
|
r({});
|
|
1161
1197
|
return;
|
|
1162
1198
|
}
|
|
1163
1199
|
let n = !1;
|
|
1164
|
-
return a(!0),
|
|
1200
|
+
return a(!0), g(e).then((e) => {
|
|
1165
1201
|
if (n) return;
|
|
1166
1202
|
r(e.modelsByProvider);
|
|
1167
1203
|
let t = Object.values(e.modelsByProvider).flat();
|
|
1168
|
-
s((e) => t.some((t) => t.id === e) ? e : (
|
|
1204
|
+
s((e) => t.some((t) => t.id === e) ? e : (xt(""), ""));
|
|
1169
1205
|
}).catch((e) => {
|
|
1170
1206
|
console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
|
|
1171
1207
|
}).finally(() => {
|
|
@@ -1179,17 +1215,17 @@ function ft() {
|
|
|
1179
1215
|
modelsLoading: i,
|
|
1180
1216
|
selectedModel: o,
|
|
1181
1217
|
setSelectedModel: (e) => {
|
|
1182
|
-
|
|
1218
|
+
xt(e), s(e);
|
|
1183
1219
|
}
|
|
1184
1220
|
};
|
|
1185
1221
|
}
|
|
1186
1222
|
//#endregion
|
|
1187
1223
|
//#region src/domain/approval.ts
|
|
1188
|
-
var
|
|
1189
|
-
function
|
|
1224
|
+
var Ct = "approval";
|
|
1225
|
+
function wt(e, t) {
|
|
1190
1226
|
return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
|
|
1191
1227
|
}
|
|
1192
|
-
function
|
|
1228
|
+
function Tt(e, t, n) {
|
|
1193
1229
|
let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
|
|
1194
1230
|
return {
|
|
1195
1231
|
approved: r.includes(t) && !r.includes(n),
|
|
@@ -1198,44 +1234,44 @@ function ht(e, t, n) {
|
|
|
1198
1234
|
}
|
|
1199
1235
|
//#endregion
|
|
1200
1236
|
//#region src/presentation/useAgent.ts
|
|
1201
|
-
var
|
|
1202
|
-
function
|
|
1203
|
-
return e.filter((e) => !
|
|
1237
|
+
var Et = 20, Dt = 26e4;
|
|
1238
|
+
function Ot(e) {
|
|
1239
|
+
return e.filter((e) => !m.isTextAttachment(e.mimeType) || e.base64.length <= Dt);
|
|
1204
1240
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let { defaultEnabled: n = !1 } = t, [r, i] =
|
|
1207
|
-
|
|
1241
|
+
function kt(e, t = {}) {
|
|
1242
|
+
let { defaultEnabled: n = !1 } = t, [r, i] = j(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = St(), [u, d] = j(!1), [f, p] = j(null), [h, g] = j(!1), [_, y] = j([]), x = A([]), S = (e) => {
|
|
1243
|
+
y((t) => {
|
|
1208
1244
|
let n = typeof e == "function" ? e(t) : e;
|
|
1209
1245
|
return x.current = n, n;
|
|
1210
1246
|
});
|
|
1211
|
-
}, C =
|
|
1212
|
-
|
|
1213
|
-
let
|
|
1214
|
-
|
|
1215
|
-
},
|
|
1247
|
+
}, C = A(/* @__PURE__ */ new Map()), w = Q(), T = A(w);
|
|
1248
|
+
T.current = w;
|
|
1249
|
+
let E = A(null), D = A(!1), O = A(null), M = () => {
|
|
1250
|
+
O.current?.abort();
|
|
1251
|
+
}, N = b()?.registry ?? {}, [P, ee] = j(void 0), z = A(void 0), B = (e, t) => {
|
|
1216
1252
|
if (!t) return !1;
|
|
1217
1253
|
if (!e) return !0;
|
|
1218
|
-
let n =
|
|
1254
|
+
let n = v(t);
|
|
1219
1255
|
return !!n && e.includes(n.provider);
|
|
1220
|
-
},
|
|
1221
|
-
|
|
1222
|
-
},
|
|
1256
|
+
}, te = k(() => P ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => P.includes(e.provider))]).filter(([, e]) => e.length)) : o, [P, o]), V = B(P, c) ? c : Object.values(te).flat()[0]?.id ?? "", H = r && V ? v(V) : null, U = H ? N[H.provider] : null, W = e.executor, G = !!W?.alongside, q = !!W && !G, ne = A([]), J = (e) => !!e && ne.current.some((t) => t.value === e), Y = A(!1), [re, ie] = j([]), [ae, oe] = j(""), se = A(""), Z = (e) => {
|
|
1257
|
+
se.current = e, oe(e);
|
|
1258
|
+
}, ce = (e) => {
|
|
1223
1259
|
let t = W?.models?.(e) ?? [];
|
|
1224
|
-
|
|
1260
|
+
ne.current = t, ie(t);
|
|
1225
1261
|
let n = W?.catalogProviders?.(e);
|
|
1226
|
-
|
|
1227
|
-
let r = G && !
|
|
1228
|
-
|
|
1229
|
-
},
|
|
1230
|
-
let i =
|
|
1231
|
-
if (!i || !W) return
|
|
1262
|
+
z.current = n, ee(n);
|
|
1263
|
+
let r = G && !B(n, c) ? t[0]?.value : void 0;
|
|
1264
|
+
Z(W?.defaultModel?.(e) ?? r ?? "");
|
|
1265
|
+
}, le = async (e, t, n, r) => {
|
|
1266
|
+
let i = E.current;
|
|
1267
|
+
if (!i || !W) return p(T.current.noActiveSession), null;
|
|
1232
1268
|
let a = new AbortController();
|
|
1233
|
-
|
|
1269
|
+
O.current = a;
|
|
1234
1270
|
let o = crypto.randomUUID();
|
|
1235
1271
|
S((e) => [...e, {
|
|
1236
1272
|
id: o,
|
|
1237
1273
|
kind: "thinking",
|
|
1238
|
-
label:
|
|
1274
|
+
label: T.current.thinking,
|
|
1239
1275
|
status: "running",
|
|
1240
1276
|
parts: []
|
|
1241
1277
|
}]);
|
|
@@ -1245,14 +1281,14 @@ function yt(e, t = {}) {
|
|
|
1245
1281
|
duration: e.duration ?? c(e.id)
|
|
1246
1282
|
}), u = (e, t) => S((n) => n.map((n) => {
|
|
1247
1283
|
if (n.id !== o) return n;
|
|
1248
|
-
let r = e(n.parts ?? []), i =
|
|
1284
|
+
let r = e(n.parts ?? []), i = L(r);
|
|
1249
1285
|
return {
|
|
1250
1286
|
...n,
|
|
1251
1287
|
parts: r,
|
|
1252
1288
|
...t ? { status: t } : {},
|
|
1253
1289
|
...i ? { detail: i } : {}
|
|
1254
1290
|
};
|
|
1255
|
-
})), d = (e) => u((t) =>
|
|
1291
|
+
})), d = (e) => u((t) => I(t, e, l)), f = !1, m = (e, t) => {
|
|
1256
1292
|
t?.id && t.id !== "text" && (f = !0), d({
|
|
1257
1293
|
type: "text",
|
|
1258
1294
|
id: t?.id ?? "text",
|
|
@@ -1297,9 +1333,9 @@ function yt(e, t = {}) {
|
|
|
1297
1333
|
});
|
|
1298
1334
|
}));
|
|
1299
1335
|
}, x = (e, t) => {
|
|
1300
|
-
u((n) => (t && !f ?
|
|
1336
|
+
u((n) => (t && !f ? I(n, {
|
|
1301
1337
|
type: "text",
|
|
1302
|
-
id:
|
|
1338
|
+
id: F,
|
|
1303
1339
|
text: t,
|
|
1304
1340
|
streaming: !1
|
|
1305
1341
|
}, l) : n).map((t) => t.type === "reasoning" && t.streaming ? l(t) : t.type === "text" && t.streaming ? {
|
|
@@ -1319,12 +1355,12 @@ function yt(e, t = {}) {
|
|
|
1319
1355
|
text: e,
|
|
1320
1356
|
first: t,
|
|
1321
1357
|
signal: a.signal,
|
|
1322
|
-
...n ||
|
|
1358
|
+
...n || se.current ? { model: n || se.current } : {},
|
|
1323
1359
|
...r ? { answers: {
|
|
1324
1360
|
id: r.id,
|
|
1325
1361
|
answers: r.answers
|
|
1326
1362
|
} } : {},
|
|
1327
|
-
onText:
|
|
1363
|
+
onText: m,
|
|
1328
1364
|
onReasoning: h,
|
|
1329
1365
|
onStep: g,
|
|
1330
1366
|
onQuestions: b
|
|
@@ -1344,13 +1380,13 @@ function yt(e, t = {}) {
|
|
|
1344
1380
|
return i.history = [...i.history, ...w ? [{
|
|
1345
1381
|
role: "user",
|
|
1346
1382
|
content: w
|
|
1347
|
-
}] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"),
|
|
1383
|
+
}] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), p(pe(e)), null);
|
|
1348
1384
|
} finally {
|
|
1349
|
-
|
|
1385
|
+
O.current = null;
|
|
1350
1386
|
}
|
|
1351
|
-
},
|
|
1387
|
+
}, ue = async (e, t, n) => {
|
|
1352
1388
|
let r = x.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
1353
|
-
if (!r || r.type !== "questions") throw
|
|
1389
|
+
if (!r || r.type !== "questions") throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
1354
1390
|
let i = () => S((r) => r.map((r) => r.id === e ? {
|
|
1355
1391
|
...r,
|
|
1356
1392
|
parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
|
|
@@ -1359,30 +1395,30 @@ function yt(e, t = {}) {
|
|
|
1359
1395
|
} : e)
|
|
1360
1396
|
} : r)), a = `${e}:${t}`, o = C.current.get(a);
|
|
1361
1397
|
if (o) return C.current.delete(a), i(), o.resolve(n), null;
|
|
1362
|
-
if (
|
|
1363
|
-
if (!
|
|
1364
|
-
|
|
1398
|
+
if (D.current) throw p(T.current.requestInProgress), Error(T.current.requestInProgress);
|
|
1399
|
+
if (!q || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
1400
|
+
D.current = !0, d(!0), p(null), i();
|
|
1365
1401
|
try {
|
|
1366
|
-
return await
|
|
1402
|
+
return await le("", !1, void 0, {
|
|
1367
1403
|
id: t,
|
|
1368
1404
|
answers: n,
|
|
1369
|
-
historyText:
|
|
1405
|
+
historyText: R(r.questions, n)
|
|
1370
1406
|
});
|
|
1371
1407
|
} finally {
|
|
1372
|
-
|
|
1408
|
+
D.current = !1, d(!1);
|
|
1373
1409
|
}
|
|
1374
|
-
},
|
|
1375
|
-
let i =
|
|
1376
|
-
if (!c) return
|
|
1377
|
-
let l = s ?
|
|
1378
|
-
if (!u || !l) return
|
|
1410
|
+
}, de = async (t, n, r) => {
|
|
1411
|
+
let i = z.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && B(i, r) ? r : B(i, V) ? void 0 : a, c = E.current;
|
|
1412
|
+
if (!c) return p(T.current.noActiveSession), null;
|
|
1413
|
+
let l = s ? v(s) : H, u = l ? N[l.provider] : null;
|
|
1414
|
+
if (!u || !l) return p(T.current.noProviderAvailable), null;
|
|
1379
1415
|
n?.length && (c.attachmentsRef.current = [...c.attachmentsRef.current ?? [], ...n]);
|
|
1380
|
-
let
|
|
1416
|
+
let d = (n ?? []).filter((e) => m.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Dt ? `\n\n[File allegato: ${e.name}]\n${m.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(""), f = Ot(n ?? []), h = c.tools.map((e) => ({
|
|
1381
1417
|
name: e.name,
|
|
1382
1418
|
description: e.description,
|
|
1383
|
-
inputSchema:
|
|
1384
|
-
})),
|
|
1385
|
-
let i =
|
|
1419
|
+
inputSchema: K(e.inputSchema)
|
|
1420
|
+
})), g = (e, t, n, r) => {
|
|
1421
|
+
let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
|
|
1386
1422
|
S((e) => [...e, {
|
|
1387
1423
|
id: a,
|
|
1388
1424
|
kind: "thinking",
|
|
@@ -1390,7 +1426,7 @@ function yt(e, t = {}) {
|
|
|
1390
1426
|
status: "running",
|
|
1391
1427
|
parts: [{
|
|
1392
1428
|
type: "questions",
|
|
1393
|
-
id:
|
|
1429
|
+
id: Ct,
|
|
1394
1430
|
questions: [{
|
|
1395
1431
|
header: i.approvalHeader,
|
|
1396
1432
|
question: i.approveQuestion.replace("{action}", o),
|
|
@@ -1399,7 +1435,7 @@ function yt(e, t = {}) {
|
|
|
1399
1435
|
}]
|
|
1400
1436
|
}]
|
|
1401
1437
|
}]);
|
|
1402
|
-
let s = `${a}:${
|
|
1438
|
+
let s = `${a}:${Ct}`;
|
|
1403
1439
|
return new Promise((e, t) => {
|
|
1404
1440
|
let n = () => {
|
|
1405
1441
|
C.current.delete(s), b(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
|
|
@@ -1410,13 +1446,13 @@ function yt(e, t = {}) {
|
|
|
1410
1446
|
}
|
|
1411
1447
|
r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
|
|
1412
1448
|
resolve: (t) => {
|
|
1413
|
-
r.removeEventListener("abort", n), b(a, "done"), e(
|
|
1449
|
+
r.removeEventListener("abort", n), b(a, "done"), e(Tt(t, i.approve, i.reject));
|
|
1414
1450
|
},
|
|
1415
1451
|
reject: t
|
|
1416
1452
|
});
|
|
1417
1453
|
});
|
|
1418
|
-
},
|
|
1419
|
-
|
|
1454
|
+
}, _ = new Map(c.tools.map((e) => [e.name, e])), y = new AbortController();
|
|
1455
|
+
O.current = y;
|
|
1420
1456
|
let b = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
|
|
1421
1457
|
...i,
|
|
1422
1458
|
status: t,
|
|
@@ -1425,12 +1461,12 @@ function yt(e, t = {}) {
|
|
|
1425
1461
|
} : i));
|
|
1426
1462
|
try {
|
|
1427
1463
|
let n = c.history, r = t;
|
|
1428
|
-
for (let t = 0; t <
|
|
1464
|
+
for (let t = 0; t < Et; t++) {
|
|
1429
1465
|
let i = crypto.randomUUID();
|
|
1430
1466
|
S((e) => [...e, {
|
|
1431
1467
|
id: i,
|
|
1432
1468
|
kind: "thinking",
|
|
1433
|
-
label:
|
|
1469
|
+
label: T.current.thinking,
|
|
1434
1470
|
status: "running"
|
|
1435
1471
|
}]);
|
|
1436
1472
|
let a;
|
|
@@ -1439,21 +1475,21 @@ function yt(e, t = {}) {
|
|
|
1439
1475
|
prompt: r,
|
|
1440
1476
|
model: l.model,
|
|
1441
1477
|
history: n,
|
|
1442
|
-
tools:
|
|
1478
|
+
tools: h.length ? h : void 0,
|
|
1443
1479
|
signal: y.signal,
|
|
1444
|
-
attachments: t === 0 ?
|
|
1480
|
+
attachments: t === 0 ? f : void 0,
|
|
1445
1481
|
logId: c.logId
|
|
1446
1482
|
});
|
|
1447
1483
|
} catch (t) {
|
|
1448
1484
|
return c.history = [...n, ...r ? [{
|
|
1449
1485
|
role: "user",
|
|
1450
|
-
content: r +
|
|
1451
|
-
}] : []], y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"),
|
|
1486
|
+
content: r + d
|
|
1487
|
+
}] : []], y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), p(pe(t)), null);
|
|
1452
1488
|
}
|
|
1453
1489
|
if (c.history = [...n, ...r ? [{
|
|
1454
1490
|
role: "user",
|
|
1455
|
-
content: r +
|
|
1456
|
-
}] : []], !a) return y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"),
|
|
1491
|
+
content: r + d
|
|
1492
|
+
}] : []], !a) return y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), p(T.current.noProviderResponse), null);
|
|
1457
1493
|
if (a.type === "text") return b(i, "done", a.text), e.conversational && a.text.trim() && S((e) => e.map((e) => e.id === i ? {
|
|
1458
1494
|
...e,
|
|
1459
1495
|
parts: [{
|
|
@@ -1465,7 +1501,7 @@ function yt(e, t = {}) {
|
|
|
1465
1501
|
...n,
|
|
1466
1502
|
...r ? [{
|
|
1467
1503
|
role: "user",
|
|
1468
|
-
content: r +
|
|
1504
|
+
content: r + d
|
|
1469
1505
|
}] : [],
|
|
1470
1506
|
{
|
|
1471
1507
|
role: "assistant",
|
|
@@ -1475,23 +1511,23 @@ function yt(e, t = {}) {
|
|
|
1475
1511
|
responseLength: a.text.length,
|
|
1476
1512
|
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
1513
|
params: c.params
|
|
1478
|
-
}),
|
|
1514
|
+
}), p(T.current.invalidResponse), e.fallback(c.params, c.context));
|
|
1479
1515
|
let o = a.toolCalls.map((e) => {
|
|
1480
|
-
let t =
|
|
1516
|
+
let t = _.get(e.name);
|
|
1481
1517
|
return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
|
|
1482
1518
|
});
|
|
1483
1519
|
b(i, "done", a.text || void 0, a.text ? void 0 : o);
|
|
1484
1520
|
let s = /* @__PURE__ */ new Map();
|
|
1485
1521
|
for (let t of a.toolCalls) {
|
|
1486
|
-
let n =
|
|
1487
|
-
if (n &&
|
|
1488
|
-
s.set(t.id, await
|
|
1522
|
+
let n = _.get(t.name);
|
|
1523
|
+
if (n && wt(n, t.input)) try {
|
|
1524
|
+
s.set(t.id, await g(t.id, n, t.input, y.signal));
|
|
1489
1525
|
} catch {
|
|
1490
1526
|
return e.fallback(c.params, c.context);
|
|
1491
1527
|
}
|
|
1492
1528
|
}
|
|
1493
|
-
let
|
|
1494
|
-
let t =
|
|
1529
|
+
let m = await Promise.all(a.toolCalls.map(async (e) => {
|
|
1530
|
+
let t = _.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
|
|
1495
1531
|
if (r && !r.approved) {
|
|
1496
1532
|
S((t) => [...t, {
|
|
1497
1533
|
id: e.id,
|
|
@@ -1499,7 +1535,7 @@ function yt(e, t = {}) {
|
|
|
1499
1535
|
label: n,
|
|
1500
1536
|
status: "stopped"
|
|
1501
1537
|
}]);
|
|
1502
|
-
let t =
|
|
1538
|
+
let t = X().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
|
|
1503
1539
|
return {
|
|
1504
1540
|
toolCallId: e.id,
|
|
1505
1541
|
name: e.name,
|
|
@@ -1529,7 +1565,7 @@ function yt(e, t = {}) {
|
|
|
1529
1565
|
return b(e.id, "error"), {
|
|
1530
1566
|
toolCallId: e.id,
|
|
1531
1567
|
name: e.name,
|
|
1532
|
-
output:
|
|
1568
|
+
output: pe(t),
|
|
1533
1569
|
isError: !0
|
|
1534
1570
|
};
|
|
1535
1571
|
}
|
|
@@ -1538,7 +1574,7 @@ function yt(e, t = {}) {
|
|
|
1538
1574
|
...n,
|
|
1539
1575
|
...r ? [{
|
|
1540
1576
|
role: "user",
|
|
1541
|
-
content: r +
|
|
1577
|
+
content: r + d
|
|
1542
1578
|
}] : [],
|
|
1543
1579
|
{
|
|
1544
1580
|
role: "assistant",
|
|
@@ -1547,7 +1583,7 @@ function yt(e, t = {}) {
|
|
|
1547
1583
|
},
|
|
1548
1584
|
{
|
|
1549
1585
|
role: "tool_result",
|
|
1550
|
-
results:
|
|
1586
|
+
results: m
|
|
1551
1587
|
}
|
|
1552
1588
|
], r = "";
|
|
1553
1589
|
}
|
|
@@ -1555,13 +1591,13 @@ function yt(e, t = {}) {
|
|
|
1555
1591
|
S((e) => [...e, {
|
|
1556
1592
|
id: i,
|
|
1557
1593
|
kind: "thinking",
|
|
1558
|
-
label:
|
|
1594
|
+
label: T.current.thinking,
|
|
1559
1595
|
status: "running"
|
|
1560
1596
|
}]);
|
|
1561
1597
|
let a;
|
|
1562
1598
|
try {
|
|
1563
1599
|
a = await u.complete({
|
|
1564
|
-
prompt:
|
|
1600
|
+
prompt: fe(X().stopCallingTools, e.microPromptIds),
|
|
1565
1601
|
model: l.model,
|
|
1566
1602
|
history: n,
|
|
1567
1603
|
signal: y.signal,
|
|
@@ -1578,81 +1614,81 @@ function yt(e, t = {}) {
|
|
|
1578
1614
|
let t = e.parseResponse(a.text, c.params, c.context);
|
|
1579
1615
|
if (t) return t;
|
|
1580
1616
|
} else b(i, y.signal.aborted ? "stopped" : "error"), c.history = n;
|
|
1581
|
-
return y.signal.aborted ||
|
|
1617
|
+
return y.signal.aborted || p(T.current.tooManyToolTurns), e.fallback(c.params, c.context);
|
|
1582
1618
|
} finally {
|
|
1583
|
-
|
|
1619
|
+
O.current = null;
|
|
1584
1620
|
}
|
|
1585
1621
|
}, me = async (t, n) => {
|
|
1586
|
-
if (
|
|
1587
|
-
|
|
1622
|
+
if (D.current) return p(T.current.requestInProgress), null;
|
|
1623
|
+
D.current = !0, p(null), S(n?.openingMessage ? [{
|
|
1588
1624
|
id: crypto.randomUUID(),
|
|
1589
1625
|
kind: "user",
|
|
1590
1626
|
label: "Tu",
|
|
1591
1627
|
status: "done",
|
|
1592
1628
|
detail: n.openingMessage,
|
|
1593
1629
|
...n.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
|
|
1594
|
-
}] : []),
|
|
1630
|
+
}] : []), d(!0);
|
|
1595
1631
|
try {
|
|
1596
1632
|
let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
|
|
1597
|
-
if (
|
|
1633
|
+
if (E.current = {
|
|
1598
1634
|
params: t,
|
|
1599
1635
|
context: i,
|
|
1600
1636
|
tools: o,
|
|
1601
1637
|
history: [],
|
|
1602
1638
|
logId: crypto.randomUUID(),
|
|
1603
1639
|
attachmentsRef: a
|
|
1604
|
-
},
|
|
1640
|
+
}, q) return g(!0), ce(t), await le(n?.openingMessage ?? "", !0);
|
|
1605
1641
|
if (G) {
|
|
1606
|
-
|
|
1607
|
-
let e = n?.model ||
|
|
1608
|
-
if (
|
|
1642
|
+
ce(t), Y.current = !1;
|
|
1643
|
+
let e = n?.model || se.current;
|
|
1644
|
+
if (J(e)) return g(!0), Y.current = !0, await le(n?.openingMessage ?? "", !0, e);
|
|
1609
1645
|
}
|
|
1610
|
-
let s = n?.model || void 0, c = s ? !!
|
|
1646
|
+
let s = n?.model || void 0, c = s ? !!N[v(s)?.provider ?? ""] : !!U;
|
|
1611
1647
|
if (!r || !c) {
|
|
1612
|
-
|
|
1648
|
+
g(!1);
|
|
1613
1649
|
let n = e.fallback(t, i);
|
|
1614
1650
|
return S((t) => [...t, {
|
|
1615
1651
|
id: crypto.randomUUID(),
|
|
1616
1652
|
kind: "tool",
|
|
1617
1653
|
status: "done",
|
|
1618
|
-
label: e.describeFallback?.(n) ??
|
|
1654
|
+
label: e.describeFallback?.(n) ?? T.current.aiDisabledFallback
|
|
1619
1655
|
}]), n;
|
|
1620
1656
|
}
|
|
1621
|
-
|
|
1622
|
-
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) =>
|
|
1623
|
-
return await
|
|
1657
|
+
g(!0);
|
|
1658
|
+
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => m.fileToAttachment(e))) : void 0, u = fe(e.buildPrompt(t, i), e.microPromptIds);
|
|
1659
|
+
return await de(u, l, s);
|
|
1624
1660
|
} catch (e) {
|
|
1625
|
-
return
|
|
1661
|
+
return p(pe(e)), null;
|
|
1626
1662
|
} finally {
|
|
1627
|
-
|
|
1663
|
+
D.current = !1, d(!1);
|
|
1628
1664
|
}
|
|
1629
1665
|
}, he = async (t, n) => {
|
|
1630
|
-
if (
|
|
1631
|
-
|
|
1666
|
+
if (D.current) {
|
|
1667
|
+
p(T.current.requestInProgress);
|
|
1632
1668
|
return;
|
|
1633
1669
|
}
|
|
1634
|
-
|
|
1670
|
+
D.current = !0, p(null), S(n.activity), d(!0);
|
|
1635
1671
|
try {
|
|
1636
1672
|
let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
|
|
1637
|
-
|
|
1673
|
+
E.current = {
|
|
1638
1674
|
params: t,
|
|
1639
1675
|
context: i,
|
|
1640
1676
|
tools: o,
|
|
1641
1677
|
history: n.history,
|
|
1642
1678
|
logId: crypto.randomUUID(),
|
|
1643
1679
|
attachmentsRef: a
|
|
1644
|
-
}, (
|
|
1680
|
+
}, (q || G) && ce(t), Y.current = !1, g(q || G || r && !!U);
|
|
1645
1681
|
} catch (e) {
|
|
1646
|
-
|
|
1682
|
+
p(pe(e));
|
|
1647
1683
|
} finally {
|
|
1648
|
-
|
|
1684
|
+
D.current = !1, d(!1);
|
|
1649
1685
|
}
|
|
1650
1686
|
}, ge = async (t, n) => {
|
|
1651
|
-
if (
|
|
1652
|
-
if (
|
|
1653
|
-
let r =
|
|
1654
|
-
if (!r) return
|
|
1655
|
-
|
|
1687
|
+
if (D.current) return p(T.current.requestInProgress), null;
|
|
1688
|
+
if (p(null), !t.trim()) return p("Messaggio vuoto."), null;
|
|
1689
|
+
let r = E.current;
|
|
1690
|
+
if (!r) return p(T.current.noActiveSession), null;
|
|
1691
|
+
D.current = !0, d(!0), S((e) => [...e, {
|
|
1656
1692
|
id: crypto.randomUUID(),
|
|
1657
1693
|
kind: "user",
|
|
1658
1694
|
label: "Tu",
|
|
@@ -1661,80 +1697,80 @@ function yt(e, t = {}) {
|
|
|
1661
1697
|
...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
|
|
1662
1698
|
}]);
|
|
1663
1699
|
try {
|
|
1664
|
-
if (
|
|
1665
|
-
let i = n?.model || (G ?
|
|
1666
|
-
if (G &&
|
|
1667
|
-
let e = !
|
|
1668
|
-
return
|
|
1700
|
+
if (q) return await le(t, !1, n?.model || void 0);
|
|
1701
|
+
let i = n?.model || (G ? se.current : "");
|
|
1702
|
+
if (G && J(i)) {
|
|
1703
|
+
let e = !Y.current;
|
|
1704
|
+
return Y.current = !0, await le(t, e, i);
|
|
1669
1705
|
}
|
|
1670
|
-
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) =>
|
|
1671
|
-
return await
|
|
1706
|
+
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => m.fileToAttachment(e))) : void 0, o = fe(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
|
|
1707
|
+
return await de(o, a, n?.model || void 0);
|
|
1672
1708
|
} catch (e) {
|
|
1673
|
-
return
|
|
1709
|
+
return p(pe(e)), null;
|
|
1674
1710
|
} finally {
|
|
1675
|
-
|
|
1711
|
+
D.current = !1, d(!1);
|
|
1676
1712
|
}
|
|
1677
1713
|
}, _e = () => {
|
|
1678
|
-
let t =
|
|
1714
|
+
let t = E.current;
|
|
1679
1715
|
if (!t) return null;
|
|
1680
|
-
|
|
1716
|
+
p(null);
|
|
1681
1717
|
let n = e.fallback(t.params, t.context);
|
|
1682
1718
|
return S((t) => [...t, {
|
|
1683
1719
|
id: crypto.randomUUID(),
|
|
1684
1720
|
kind: "tool",
|
|
1685
1721
|
status: "done",
|
|
1686
|
-
label: e.describeFallback?.(n) ??
|
|
1722
|
+
label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
|
|
1687
1723
|
}]), n;
|
|
1688
|
-
}, ve = () =>
|
|
1689
|
-
history:
|
|
1690
|
-
activity:
|
|
1724
|
+
}, ve = () => E.current ? {
|
|
1725
|
+
history: E.current.history,
|
|
1726
|
+
activity: _
|
|
1691
1727
|
} : null;
|
|
1692
1728
|
return {
|
|
1693
1729
|
enabled: r,
|
|
1694
1730
|
setEnabled: i,
|
|
1695
1731
|
hasProviders: a,
|
|
1696
|
-
selectedModel:
|
|
1697
|
-
setSelectedModel:
|
|
1698
|
-
|
|
1732
|
+
selectedModel: q || G && ae ? ae : V,
|
|
1733
|
+
setSelectedModel: q ? Z : G ? (e) => {
|
|
1734
|
+
J(e) ? Z(e) : (Z(""), l(e));
|
|
1699
1735
|
} : l,
|
|
1700
|
-
modelsByProvider:
|
|
1736
|
+
modelsByProvider: te,
|
|
1701
1737
|
modelsLoading: s,
|
|
1702
1738
|
running: u,
|
|
1703
|
-
error:
|
|
1704
|
-
canContinue:
|
|
1705
|
-
remote:
|
|
1706
|
-
remoteModels:
|
|
1739
|
+
error: f,
|
|
1740
|
+
canContinue: h,
|
|
1741
|
+
remote: q,
|
|
1742
|
+
remoteModels: re,
|
|
1707
1743
|
alongside: G,
|
|
1708
1744
|
...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
|
|
1709
|
-
activity:
|
|
1745
|
+
activity: _,
|
|
1710
1746
|
run: me,
|
|
1711
1747
|
resume: he,
|
|
1712
1748
|
sendMessage: ge,
|
|
1713
|
-
stop:
|
|
1749
|
+
stop: M,
|
|
1714
1750
|
runFallback: _e,
|
|
1715
1751
|
snapshot: ve,
|
|
1716
|
-
answerQuestions:
|
|
1752
|
+
answerQuestions: ue
|
|
1717
1753
|
};
|
|
1718
1754
|
}
|
|
1719
1755
|
//#endregion
|
|
1720
1756
|
//#region src/domain/orchestrator/prompt.ts
|
|
1721
|
-
function
|
|
1722
|
-
let e =
|
|
1757
|
+
function At() {
|
|
1758
|
+
let e = X();
|
|
1723
1759
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
1724
1760
|
}
|
|
1725
|
-
function
|
|
1726
|
-
let r =
|
|
1761
|
+
function jt(e, t, n) {
|
|
1762
|
+
let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
1727
1763
|
return `${r.orchestratorIntro}
|
|
1728
1764
|
|
|
1729
1765
|
${r.toolsHeading}
|
|
1730
1766
|
${t}
|
|
1731
1767
|
${i}
|
|
1732
|
-
${
|
|
1768
|
+
${At()}
|
|
1733
1769
|
|
|
1734
1770
|
${r.userRequestHeading}
|
|
1735
1771
|
${e}`;
|
|
1736
1772
|
}
|
|
1737
|
-
function
|
|
1773
|
+
function Mt(e, t) {
|
|
1738
1774
|
return t ? {
|
|
1739
1775
|
kind: "handoff",
|
|
1740
1776
|
...t
|
|
@@ -1745,27 +1781,27 @@ function St(e, t) {
|
|
|
1745
1781
|
}
|
|
1746
1782
|
//#endregion
|
|
1747
1783
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
1748
|
-
function
|
|
1749
|
-
return
|
|
1784
|
+
function Nt(e) {
|
|
1785
|
+
return V().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
1750
1786
|
}
|
|
1751
|
-
function
|
|
1787
|
+
function Pt(e) {
|
|
1752
1788
|
return {
|
|
1753
1789
|
buildContext(e) {
|
|
1754
1790
|
return {
|
|
1755
|
-
cliCatalog:
|
|
1791
|
+
cliCatalog: le(Nt(e.scopedSubagentId)),
|
|
1756
1792
|
handoff: { current: null },
|
|
1757
1793
|
collected: {}
|
|
1758
1794
|
};
|
|
1759
1795
|
},
|
|
1760
1796
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
1761
|
-
return
|
|
1797
|
+
return jt(e, n, t);
|
|
1762
1798
|
},
|
|
1763
1799
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
1764
|
-
return `${e}\n\n${
|
|
1800
|
+
return `${e}\n\n${At()}\n\n${X().toolsHeading}\n${n}`;
|
|
1765
1801
|
},
|
|
1766
1802
|
parseResponse(e, t, n) {
|
|
1767
1803
|
let r = n.handoff.current;
|
|
1768
|
-
return n.handoff.current = null,
|
|
1804
|
+
return n.handoff.current = null, Mt(e, r);
|
|
1769
1805
|
},
|
|
1770
1806
|
fallback() {
|
|
1771
1807
|
return {
|
|
@@ -1777,16 +1813,16 @@ function wt(e) {
|
|
|
1777
1813
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
1778
1814
|
},
|
|
1779
1815
|
getTools(t, n, r) {
|
|
1780
|
-
let i =
|
|
1816
|
+
let i = G({
|
|
1781
1817
|
attachmentsRef: r,
|
|
1782
1818
|
collected: n.collected,
|
|
1783
|
-
proxyFetch:
|
|
1784
|
-
}), a = t.scopedSubagentId ?
|
|
1819
|
+
proxyFetch: y
|
|
1820
|
+
}), a = t.scopedSubagentId ? H(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Nt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
1785
1821
|
name: `${t.id}_${r.name}`,
|
|
1786
1822
|
description: `${t.label}: ${r.summary}`,
|
|
1787
1823
|
inputSchema: r.inputSchema,
|
|
1788
|
-
describeInvocation: () =>
|
|
1789
|
-
describeIntent:
|
|
1824
|
+
describeInvocation: () => _(e.preparing, { label: t.label }),
|
|
1825
|
+
describeIntent: _(e.collecting, { label: t.label }),
|
|
1790
1826
|
async execute(e) {
|
|
1791
1827
|
let i = t.withCollected ? t.withCollected({ ...e }, n.collected) : e;
|
|
1792
1828
|
return n.handoff.current = {
|
|
@@ -1795,7 +1831,7 @@ function wt(e) {
|
|
|
1795
1831
|
params: i
|
|
1796
1832
|
}, {
|
|
1797
1833
|
status: "queued",
|
|
1798
|
-
note:
|
|
1834
|
+
note: _(X().handoffQueued, { label: t.label })
|
|
1799
1835
|
};
|
|
1800
1836
|
}
|
|
1801
1837
|
})));
|
|
@@ -1805,22 +1841,22 @@ function wt(e) {
|
|
|
1805
1841
|
}
|
|
1806
1842
|
//#endregion
|
|
1807
1843
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
1808
|
-
function
|
|
1844
|
+
function Ft(e, t) {
|
|
1809
1845
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
1810
1846
|
}
|
|
1811
1847
|
//#endregion
|
|
1812
1848
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
1813
|
-
function
|
|
1814
|
-
let s = Q(), c = $(), l = c.scope, u =
|
|
1849
|
+
function It({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
1850
|
+
let s = Q(), c = $(), l = c.scope, u = C(), [d, f] = j(null), [p, m] = j(new Set(i ?? [])), [h, g] = j(null), v = be(), y = /* @__PURE__ */ new Map();
|
|
1815
1851
|
e.destinationIds.forEach((e) => {
|
|
1816
1852
|
let t = v[e];
|
|
1817
|
-
t &&
|
|
1818
|
-
}), (o ?? []).forEach((e) =>
|
|
1819
|
-
let
|
|
1820
|
-
f(i),
|
|
1853
|
+
t && y.set(e, t);
|
|
1854
|
+
}), (o ?? []).forEach((e) => y.set(e.id, e)), y.set(_e.id, _e);
|
|
1855
|
+
let b = Array.from(y.values()), x = async (i) => {
|
|
1856
|
+
f(i), g(null);
|
|
1821
1857
|
try {
|
|
1822
|
-
let o =
|
|
1823
|
-
if (!o) throw Error(
|
|
1858
|
+
let o = y.get(i);
|
|
1859
|
+
if (!o) throw Error(_(s.unknownDestination, { id: i }));
|
|
1824
1860
|
if (i !== "json-export" && !l) throw Error(s.destinationNoScope);
|
|
1825
1861
|
let d = await o.apply(t, {
|
|
1826
1862
|
scopeId: l?.id ?? "",
|
|
@@ -1828,66 +1864,66 @@ function Et({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
1828
1864
|
storageProvider: l?.storageProvider ?? null,
|
|
1829
1865
|
proxyFetch: u
|
|
1830
1866
|
}, n);
|
|
1831
|
-
|
|
1867
|
+
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Ft(e, n));
|
|
1832
1868
|
} catch (e) {
|
|
1833
|
-
|
|
1869
|
+
g(e instanceof Error ? e.message : String(e));
|
|
1834
1870
|
} finally {
|
|
1835
1871
|
f(null);
|
|
1836
1872
|
}
|
|
1837
1873
|
};
|
|
1838
|
-
return /* @__PURE__ */
|
|
1874
|
+
return /* @__PURE__ */ P("div", {
|
|
1839
1875
|
className: "space-y-2",
|
|
1840
1876
|
children: [
|
|
1841
|
-
/* @__PURE__ */
|
|
1877
|
+
/* @__PURE__ */ N("p", {
|
|
1842
1878
|
className: "text-xs font-medium text-muted-foreground",
|
|
1843
1879
|
children: s.destinationPickerTitle
|
|
1844
1880
|
}),
|
|
1845
|
-
/* @__PURE__ */
|
|
1881
|
+
/* @__PURE__ */ N("div", {
|
|
1846
1882
|
className: "flex flex-wrap gap-2",
|
|
1847
|
-
children:
|
|
1883
|
+
children: b.map((e) => /* @__PURE__ */ N("button", {
|
|
1848
1884
|
type: "button",
|
|
1849
1885
|
disabled: d !== null,
|
|
1850
|
-
onClick: () => void
|
|
1886
|
+
onClick: () => void x(e.id),
|
|
1851
1887
|
className: "cursor-pointer rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-60",
|
|
1852
1888
|
children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
|
|
1853
1889
|
}, e.id))
|
|
1854
1890
|
}),
|
|
1855
|
-
|
|
1891
|
+
h && /* @__PURE__ */ N("p", {
|
|
1856
1892
|
className: "text-xs text-destructive",
|
|
1857
|
-
children:
|
|
1893
|
+
children: h
|
|
1858
1894
|
})
|
|
1859
1895
|
]
|
|
1860
1896
|
});
|
|
1861
1897
|
}
|
|
1862
1898
|
//#endregion
|
|
1863
1899
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
1864
|
-
var
|
|
1865
|
-
function
|
|
1866
|
-
Object.assign(
|
|
1900
|
+
var Lt = {};
|
|
1901
|
+
function Rt(e) {
|
|
1902
|
+
Object.assign(Lt, e);
|
|
1867
1903
|
}
|
|
1868
|
-
function
|
|
1869
|
-
return
|
|
1904
|
+
function zt(e) {
|
|
1905
|
+
return Lt[e];
|
|
1870
1906
|
}
|
|
1871
1907
|
//#endregion
|
|
1872
1908
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
1873
|
-
function
|
|
1874
|
-
let [t, n] =
|
|
1875
|
-
return /* @__PURE__ */
|
|
1909
|
+
function Bt({ result: e }) {
|
|
1910
|
+
let [t, n] = j(!1);
|
|
1911
|
+
return /* @__PURE__ */ P("div", {
|
|
1876
1912
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
1877
1913
|
onClick: () => n((e) => !e),
|
|
1878
1914
|
title: t ? "Clic per comprimere" : "Clic per espandere",
|
|
1879
|
-
children: [/* @__PURE__ */
|
|
1915
|
+
children: [/* @__PURE__ */ N(s, {
|
|
1880
1916
|
language: "json",
|
|
1881
1917
|
showCopy: t,
|
|
1882
1918
|
background: "transparent",
|
|
1883
1919
|
className: "!text-[11px]",
|
|
1884
1920
|
children: JSON.stringify(e, null, 2)
|
|
1885
|
-
}), !t && /* @__PURE__ */
|
|
1921
|
+
}), !t && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
1886
1922
|
});
|
|
1887
1923
|
}
|
|
1888
1924
|
//#endregion
|
|
1889
1925
|
//#region src/presentation/liveAnchorDestination.ts
|
|
1890
|
-
function
|
|
1926
|
+
function Vt(e, t, n) {
|
|
1891
1927
|
return e.length === 0 ? null : {
|
|
1892
1928
|
id: "live-component",
|
|
1893
1929
|
label: "Applica al componente aperto",
|
|
@@ -1898,35 +1934,106 @@ function jt(e, t, n) {
|
|
|
1898
1934
|
}
|
|
1899
1935
|
//#endregion
|
|
1900
1936
|
//#region src/presentation/subagentControls.ts
|
|
1901
|
-
var
|
|
1902
|
-
function
|
|
1903
|
-
Object.assign(
|
|
1937
|
+
var Ht = {};
|
|
1938
|
+
function Ut(e) {
|
|
1939
|
+
Object.assign(Ht, e);
|
|
1904
1940
|
}
|
|
1905
|
-
function
|
|
1906
|
-
return
|
|
1941
|
+
function Wt(e) {
|
|
1942
|
+
return Ht[e];
|
|
1907
1943
|
}
|
|
1908
1944
|
//#endregion
|
|
1909
|
-
//#region src/presentation/
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1945
|
+
//#region src/presentation/chatTitles.ts
|
|
1946
|
+
function Gt(e, t = 6e3) {
|
|
1947
|
+
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim()).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
|
|
1948
|
+
return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
|
|
1949
|
+
}
|
|
1950
|
+
function Kt(e) {
|
|
1951
|
+
return (e.trim().split("\n").map((e) => e.trim()).find(Boolean) ?? "").replace(/^(title|titolo)\s*:\s*/i, "").replace(/^#+\s*/, "").replace(/^["'«“]+|["'»”]+$/g, "").replace(/[.。]+$/, "").trim().slice(0, 80);
|
|
1952
|
+
}
|
|
1953
|
+
function qt(e, t) {
|
|
1954
|
+
try {
|
|
1955
|
+
return e.definition.executor?.catalogProviders?.(e.toParams(t));
|
|
1956
|
+
} catch {
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
function Jt(e, t, n, r, i) {
|
|
1961
|
+
let a = qt(e, t), o = (e) => {
|
|
1962
|
+
let t = e ? v(e) : null;
|
|
1963
|
+
return !(!t || !i[t.provider] || a && !a.includes(t.provider));
|
|
1964
|
+
};
|
|
1965
|
+
return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
|
|
1966
|
+
}
|
|
1967
|
+
function Yt(e) {
|
|
1968
|
+
let t = b()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = St(), i = A({
|
|
1969
|
+
registry: t,
|
|
1970
|
+
modelsByProvider: n,
|
|
1971
|
+
selectedModel: r
|
|
1972
|
+
});
|
|
1973
|
+
i.current = {
|
|
1974
|
+
registry: t,
|
|
1975
|
+
modelsByProvider: n,
|
|
1976
|
+
selectedModel: r
|
|
1977
|
+
};
|
|
1978
|
+
let a = A(/* @__PURE__ */ new Set()), o = T(async (t, n, r) => {
|
|
1979
|
+
if (!e) return !1;
|
|
1980
|
+
let o = ke(e, t, n), s = H(t), c = `${e}:${t}:${n}`;
|
|
1981
|
+
if (!o || !s?.autoTitle || o.name || !Ne(o) || a.current.has(c)) return !1;
|
|
1982
|
+
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = Jt(s, o.params, r ?? d, u, l), p = f ? v(f) : null;
|
|
1983
|
+
if (!p) return !1;
|
|
1984
|
+
a.current.add(c);
|
|
1985
|
+
try {
|
|
1986
|
+
let r = await l[p.provider].complete({
|
|
1987
|
+
prompt: X().chatTitle.replace("{chat}", Gt(o.activity)),
|
|
1988
|
+
model: p.model,
|
|
1989
|
+
history: []
|
|
1990
|
+
}), i = r && r.type === "text" ? Kt(r.text) : "";
|
|
1991
|
+
return i ? Pe(e, t, n, i, "model") : !1;
|
|
1992
|
+
} catch {
|
|
1993
|
+
return !1;
|
|
1994
|
+
} finally {
|
|
1995
|
+
a.current.delete(c);
|
|
1996
|
+
}
|
|
1997
|
+
}, [e]), s = Object.keys(n).length > 0;
|
|
1998
|
+
return D(() => {
|
|
1999
|
+
e && s && !Xt.has(e) && (Xt.add(e), (async () => {
|
|
2000
|
+
for (let t of Le(e)) {
|
|
2001
|
+
let n = H(t.subagentId);
|
|
2002
|
+
if (n?.autoTitle) {
|
|
2003
|
+
if (n.definition.conversational && !Ne(t)) {
|
|
2004
|
+
Ie(e, t.subagentId, t.entityId);
|
|
2005
|
+
continue;
|
|
2006
|
+
}
|
|
2007
|
+
t.name || await o(t.subagentId, t.entityId);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
})());
|
|
2011
|
+
}, [
|
|
2012
|
+
e,
|
|
2013
|
+
s,
|
|
2014
|
+
o
|
|
2015
|
+
]), o;
|
|
2016
|
+
}
|
|
2017
|
+
var Xt = /* @__PURE__ */ new Set(), Zt = () => ({});
|
|
2018
|
+
function Qt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
2019
|
+
let c = kt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = C(), f = A(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = j(null), h = (t) => {
|
|
1913
2020
|
e.definition.conversational || m(t);
|
|
1914
|
-
}, [g, _] =
|
|
1915
|
-
p && p !==
|
|
1916
|
-
let
|
|
1917
|
-
|
|
1918
|
-
!
|
|
2021
|
+
}, [g, _] = j([]), [v, y] = j(null), b = zt(e.id), x = b?.kind === "selection" ? b : null, [S, w] = j(null), T = A(!1), E = A(0), O = A(null);
|
|
2022
|
+
p && p !== O.current && (O.current = p, E.current = (r?.length ?? 0) + c.activity.length);
|
|
2023
|
+
let F = A(!1), ee = c.remote || !c.hasProviders || c.selectedModel !== "";
|
|
2024
|
+
D(() => {
|
|
2025
|
+
!T.current && ee && (T.current = !0, a ? (W.current = !0, c.resume(e.toParams(t), a)) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
|
|
1919
2026
|
model: o,
|
|
1920
2027
|
openingMessage: s
|
|
1921
2028
|
}).then((e) => {
|
|
1922
2029
|
e && h(e);
|
|
1923
2030
|
})));
|
|
1924
|
-
}, [
|
|
2031
|
+
}, [ee]), D(() => {
|
|
1925
2032
|
if (!p || !u) return;
|
|
1926
|
-
let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i =
|
|
2033
|
+
let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = be();
|
|
1927
2034
|
n.forEach((n) => {
|
|
1928
2035
|
let a = i[n];
|
|
1929
|
-
a && (
|
|
2036
|
+
a && (y(null), a.apply(p, {
|
|
1930
2037
|
scopeId: u.id,
|
|
1931
2038
|
dataProvider: u.dataProvider,
|
|
1932
2039
|
storageProvider: u.storageProvider,
|
|
@@ -1935,89 +2042,95 @@ function It({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
1935
2042
|
...t,
|
|
1936
2043
|
pinnedEntityId: r
|
|
1937
2044
|
}).then((n) => {
|
|
1938
|
-
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t,
|
|
1939
|
-
}).catch((e) =>
|
|
2045
|
+
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Ft(e, t));
|
|
2046
|
+
}).catch((e) => y(e instanceof Error ? e.message : String(e))));
|
|
1940
2047
|
});
|
|
1941
2048
|
}, [
|
|
1942
2049
|
p,
|
|
1943
2050
|
c.activity,
|
|
1944
2051
|
u
|
|
1945
|
-
]),
|
|
1946
|
-
p &&
|
|
1947
|
-
}, [p,
|
|
1948
|
-
let
|
|
1949
|
-
|
|
2052
|
+
]), D(() => {
|
|
2053
|
+
p && x && w(x.defaultSelection(p));
|
|
2054
|
+
}, [p, x]);
|
|
2055
|
+
let I = (e, t) => {
|
|
2056
|
+
w((n) => n && {
|
|
1950
2057
|
...n,
|
|
1951
2058
|
[e]: t
|
|
1952
2059
|
});
|
|
1953
|
-
},
|
|
2060
|
+
}, L = (e) => h(e), R = k(() => p && x && S ? x.applySelection(p, S) : p, [
|
|
1954
2061
|
p,
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
]),
|
|
1958
|
-
|
|
2062
|
+
x,
|
|
2063
|
+
S
|
|
2064
|
+
]), z = k(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = k(() => Vt(z, t, f), [
|
|
2065
|
+
z,
|
|
1959
2066
|
t,
|
|
1960
2067
|
f
|
|
1961
|
-
]),
|
|
1962
|
-
|
|
1963
|
-
let n =
|
|
1964
|
-
if (
|
|
2068
|
+
]), te = k(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H = Yt(u?.id), U = A(!1), W = A(!1);
|
|
2069
|
+
D(() => {
|
|
2070
|
+
let n = U.current && !c.running;
|
|
2071
|
+
if (U.current = c.running, !n || !V || !u) return;
|
|
2072
|
+
if (W.current) {
|
|
2073
|
+
W.current = !1;
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
1965
2076
|
let i = c.snapshot();
|
|
1966
|
-
i
|
|
2077
|
+
if (!i) return;
|
|
2078
|
+
let a = [...r ?? [], ...i.activity];
|
|
2079
|
+
e.autoTitle && e.definition.conversational && !Ne({ activity: a }) || (Ae({
|
|
1967
2080
|
scopeId: u.id,
|
|
1968
2081
|
subagentId: e.id,
|
|
1969
|
-
entityId:
|
|
2082
|
+
entityId: V,
|
|
1970
2083
|
params: t,
|
|
1971
|
-
title:
|
|
2084
|
+
title: Ft(e, t),
|
|
1972
2085
|
history: i.history,
|
|
1973
|
-
activity:
|
|
1974
|
-
});
|
|
2086
|
+
activity: a
|
|
2087
|
+
}), e.autoTitle && H(e.id, V, c.selectedModel));
|
|
1975
2088
|
}, [c.running]);
|
|
1976
|
-
let
|
|
1977
|
-
|
|
1978
|
-
},
|
|
2089
|
+
let G = () => {
|
|
2090
|
+
F.current = !0, c.running && c.stop(), l.closeTask(f);
|
|
2091
|
+
}, K = A(Wt(e.id) ?? Zt).current, q = K({
|
|
1979
2092
|
params: t,
|
|
1980
2093
|
taskId: f,
|
|
1981
2094
|
running: c.running,
|
|
1982
|
-
close:
|
|
1983
|
-
}),
|
|
2095
|
+
close: G
|
|
2096
|
+
}), ne = (e) => {
|
|
1984
2097
|
_((t) => t.includes(e) ? t : [...t, e]);
|
|
1985
2098
|
};
|
|
1986
|
-
return
|
|
1987
|
-
|
|
2099
|
+
return D(() => {
|
|
2100
|
+
F.current || l.openTask({
|
|
1988
2101
|
id: f,
|
|
1989
|
-
title:
|
|
2102
|
+
title: Ft(e, t),
|
|
1990
2103
|
icon: e.icon,
|
|
1991
2104
|
agent: c,
|
|
1992
2105
|
onApplied: (e) => h(e),
|
|
1993
2106
|
precedingActivity: r,
|
|
1994
|
-
panelExtraAnchorIndex:
|
|
1995
|
-
onDismiss:
|
|
1996
|
-
...
|
|
1997
|
-
panelActions:
|
|
1998
|
-
composerActions:
|
|
1999
|
-
composerCommands:
|
|
2000
|
-
panelExtra: p ? /* @__PURE__ */
|
|
2001
|
-
|
|
2107
|
+
panelExtraAnchorIndex: E.current,
|
|
2108
|
+
onDismiss: G,
|
|
2109
|
+
...V ? { savedToDisk: !0 } : {},
|
|
2110
|
+
panelActions: q.content,
|
|
2111
|
+
composerActions: q.actions,
|
|
2112
|
+
composerCommands: q.commands,
|
|
2113
|
+
panelExtra: p ? /* @__PURE__ */ P(M, { children: [
|
|
2114
|
+
x && S ? /* @__PURE__ */ N(x.Report, {
|
|
2002
2115
|
result: p,
|
|
2003
|
-
selection:
|
|
2004
|
-
onChange:
|
|
2005
|
-
}) :
|
|
2116
|
+
selection: S,
|
|
2117
|
+
onChange: I
|
|
2118
|
+
}) : b?.kind === "editable" ? /* @__PURE__ */ N(b.Report, {
|
|
2006
2119
|
result: p,
|
|
2007
|
-
onResultChange:
|
|
2008
|
-
}) : /* @__PURE__ */
|
|
2009
|
-
v && /* @__PURE__ */
|
|
2120
|
+
onResultChange: L
|
|
2121
|
+
}) : /* @__PURE__ */ N(Bt, { result: R }),
|
|
2122
|
+
v && /* @__PURE__ */ P("p", {
|
|
2010
2123
|
className: "text-xs text-destructive",
|
|
2011
2124
|
children: ["Salvataggio automatico non riuscito: ", v]
|
|
2012
2125
|
}),
|
|
2013
|
-
/* @__PURE__ */
|
|
2126
|
+
/* @__PURE__ */ N(It, {
|
|
2014
2127
|
manifest: e,
|
|
2015
|
-
result:
|
|
2128
|
+
result: R,
|
|
2016
2129
|
meta: t,
|
|
2017
2130
|
taskId: f,
|
|
2018
2131
|
initiallyApplied: g,
|
|
2019
|
-
onApplied:
|
|
2020
|
-
extraDestinations:
|
|
2132
|
+
onApplied: ne,
|
|
2133
|
+
extraDestinations: te
|
|
2021
2134
|
})
|
|
2022
2135
|
] }) : void 0
|
|
2023
2136
|
});
|
|
@@ -2036,31 +2149,31 @@ function It({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2036
2149
|
e,
|
|
2037
2150
|
t,
|
|
2038
2151
|
p,
|
|
2039
|
-
|
|
2040
|
-
|
|
2152
|
+
R,
|
|
2153
|
+
S,
|
|
2041
2154
|
g,
|
|
2042
2155
|
n,
|
|
2043
2156
|
r,
|
|
2044
2157
|
v,
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
]),
|
|
2158
|
+
q.content,
|
|
2159
|
+
q.actions,
|
|
2160
|
+
q.commands
|
|
2161
|
+
]), D(() => () => {
|
|
2049
2162
|
l.closeTask(f);
|
|
2050
2163
|
}, [l.closeTask, f]), null;
|
|
2051
2164
|
}
|
|
2052
2165
|
//#endregion
|
|
2053
2166
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
2054
|
-
function
|
|
2055
|
-
let t = Q(), n =
|
|
2167
|
+
function $t({ userGoal: e }) {
|
|
2168
|
+
let t = Q(), n = kt(k(() => Pt({
|
|
2056
2169
|
unavailable: t.orchestratorUnavailable,
|
|
2057
2170
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
2058
2171
|
preparing: t.orchestratorPreparing,
|
|
2059
2172
|
collecting: t.orchestratorCollecting
|
|
2060
|
-
}), []), { defaultEnabled: !0 }), r = $(), [i, a] =
|
|
2061
|
-
e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(
|
|
2173
|
+
}), []), { defaultEnabled: !0 }), r = $(), [i, a] = j(null), o = A(!1), s = !n.hasProviders || n.selectedModel !== "", c = A(r.pendingExtraDestinations), l = A(r.pendingAttachments), u = A(r.pendingModel), d = A(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), f = A(r.pendingCarryOver), p = A(!1), m = (e) => {
|
|
2174
|
+
e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Ue));
|
|
2062
2175
|
};
|
|
2063
|
-
|
|
2176
|
+
D(() => {
|
|
2064
2177
|
!o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
|
|
2065
2178
|
userGoal: e,
|
|
2066
2179
|
pageContext: r.pageContext,
|
|
@@ -2072,9 +2185,9 @@ function Lt({ userGoal: e }) {
|
|
|
2072
2185
|
}).then((e) => {
|
|
2073
2186
|
e && m(e);
|
|
2074
2187
|
}));
|
|
2075
|
-
}, [s]),
|
|
2188
|
+
}, [s]), D(() => {
|
|
2076
2189
|
p.current || r.openTask({
|
|
2077
|
-
id:
|
|
2190
|
+
id: Ue,
|
|
2078
2191
|
title: "Agentico",
|
|
2079
2192
|
icon: "bot",
|
|
2080
2193
|
agent: n,
|
|
@@ -2082,7 +2195,7 @@ function Lt({ userGoal: e }) {
|
|
|
2082
2195
|
scopedSubagentId: d.current,
|
|
2083
2196
|
precedingActivity: f.current?.activity,
|
|
2084
2197
|
onDismiss: () => {
|
|
2085
|
-
p.current = !0, n.running && n.stop(), r.closeTask(
|
|
2198
|
+
p.current = !0, n.running && n.stop(), r.closeTask(Ue);
|
|
2086
2199
|
}
|
|
2087
2200
|
});
|
|
2088
2201
|
}, [
|
|
@@ -2094,13 +2207,13 @@ function Lt({ userGoal: e }) {
|
|
|
2094
2207
|
n.modelsByProvider,
|
|
2095
2208
|
n.hasProviders,
|
|
2096
2209
|
r.openTask
|
|
2097
|
-
]),
|
|
2098
|
-
r.closeTask(
|
|
2210
|
+
]), D(() => () => {
|
|
2211
|
+
r.closeTask(Ue);
|
|
2099
2212
|
}, [r.closeTask]);
|
|
2100
|
-
let h =
|
|
2213
|
+
let h = k(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
|
|
2101
2214
|
if (!i) return null;
|
|
2102
|
-
let g =
|
|
2103
|
-
return g ? /* @__PURE__ */
|
|
2215
|
+
let g = H(i.subagentId);
|
|
2216
|
+
return g ? /* @__PURE__ */ N(Qt, {
|
|
2104
2217
|
manifest: g,
|
|
2105
2218
|
params: i.params,
|
|
2106
2219
|
extraDestinations: c.current,
|
|
@@ -2111,8 +2224,8 @@ function Lt({ userGoal: e }) {
|
|
|
2111
2224
|
}
|
|
2112
2225
|
//#endregion
|
|
2113
2226
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
2114
|
-
function
|
|
2115
|
-
let r =
|
|
2227
|
+
function en({ manifest: e, extraDestinations: n }) {
|
|
2228
|
+
let r = kt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = A(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = j(null), [l, u] = j([]), d = zt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = j(null), [h, g] = j(null), _ = A(!1), v = (t) => {
|
|
2116
2229
|
if (!e.manualEntry) return;
|
|
2117
2230
|
let n;
|
|
2118
2231
|
try {
|
|
@@ -2125,7 +2238,7 @@ function Rt({ manifest: e, extraDestinations: n }) {
|
|
|
2125
2238
|
e && c(e);
|
|
2126
2239
|
});
|
|
2127
2240
|
};
|
|
2128
|
-
|
|
2241
|
+
D(() => {
|
|
2129
2242
|
s && f && m(f.defaultSelection(s));
|
|
2130
2243
|
}, [s, f]);
|
|
2131
2244
|
let y = (e, t) => {
|
|
@@ -2133,18 +2246,18 @@ function Rt({ manifest: e, extraDestinations: n }) {
|
|
|
2133
2246
|
...n,
|
|
2134
2247
|
[e]: t
|
|
2135
2248
|
});
|
|
2136
|
-
}, b = (e) => c(e), x =
|
|
2249
|
+
}, b = (e) => c(e), x = k(() => s && f && p ? f.applySelection(s, p) : s, [
|
|
2137
2250
|
s,
|
|
2138
2251
|
f,
|
|
2139
2252
|
p
|
|
2140
2253
|
]), S = (e) => {
|
|
2141
2254
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
2142
|
-
},
|
|
2143
|
-
|
|
2255
|
+
}, C = k(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = k(() => h ? Vt(C, h, o) : null, [
|
|
2256
|
+
C,
|
|
2144
2257
|
h,
|
|
2145
2258
|
o
|
|
2146
|
-
]),
|
|
2147
|
-
return
|
|
2259
|
+
]), T = k(() => w ? [w, ...n ?? []] : n, [w, n]);
|
|
2260
|
+
return D(() => {
|
|
2148
2261
|
_.current || a.openTask({
|
|
2149
2262
|
id: o,
|
|
2150
2263
|
title: e.label,
|
|
@@ -2158,27 +2271,27 @@ function Rt({ manifest: e, extraDestinations: n }) {
|
|
|
2158
2271
|
onDismiss: () => {
|
|
2159
2272
|
_.current = !0, r.running && r.stop(), a.closeTask(o);
|
|
2160
2273
|
},
|
|
2161
|
-
panelExtra: s ? /* @__PURE__ */
|
|
2274
|
+
panelExtra: s ? /* @__PURE__ */ P("div", {
|
|
2162
2275
|
className: "space-y-2",
|
|
2163
2276
|
children: [
|
|
2164
|
-
f && p ? /* @__PURE__ */
|
|
2277
|
+
f && p ? /* @__PURE__ */ N(f.Report, {
|
|
2165
2278
|
result: s,
|
|
2166
2279
|
selection: p,
|
|
2167
2280
|
onChange: y
|
|
2168
|
-
}) : d?.kind === "editable" ? /* @__PURE__ */
|
|
2281
|
+
}) : d?.kind === "editable" ? /* @__PURE__ */ N(d.Report, {
|
|
2169
2282
|
result: s,
|
|
2170
2283
|
onResultChange: b
|
|
2171
|
-
}) : /* @__PURE__ */
|
|
2172
|
-
/* @__PURE__ */
|
|
2284
|
+
}) : /* @__PURE__ */ N(Bt, { result: x }),
|
|
2285
|
+
/* @__PURE__ */ N(It, {
|
|
2173
2286
|
manifest: e,
|
|
2174
2287
|
result: x,
|
|
2175
2288
|
meta: h ?? {},
|
|
2176
2289
|
taskId: o,
|
|
2177
2290
|
initiallyApplied: l,
|
|
2178
2291
|
onApplied: S,
|
|
2179
|
-
extraDestinations:
|
|
2292
|
+
extraDestinations: T
|
|
2180
2293
|
}),
|
|
2181
|
-
r.hasProviders && /* @__PURE__ */
|
|
2294
|
+
r.hasProviders && /* @__PURE__ */ N(t, {
|
|
2182
2295
|
label: i.resumeWithAi,
|
|
2183
2296
|
variant: "outline-secondary",
|
|
2184
2297
|
className: "text-xs",
|
|
@@ -2200,13 +2313,13 @@ function Rt({ manifest: e, extraDestinations: n }) {
|
|
|
2200
2313
|
p,
|
|
2201
2314
|
l,
|
|
2202
2315
|
h
|
|
2203
|
-
]),
|
|
2316
|
+
]), D(() => () => {
|
|
2204
2317
|
a.closeTask(o);
|
|
2205
2318
|
}, []), null;
|
|
2206
2319
|
}
|
|
2207
2320
|
//#endregion
|
|
2208
2321
|
//#region src/presentation/Agentico.tsx
|
|
2209
|
-
function
|
|
2322
|
+
function tn(e, t) {
|
|
2210
2323
|
return Object.values(e).flat().map((e) => {
|
|
2211
2324
|
let n = t?.(e.provider, e.providerLabel ?? e.provider);
|
|
2212
2325
|
return {
|
|
@@ -2218,8 +2331,8 @@ function zt(e, t) {
|
|
|
2218
2331
|
};
|
|
2219
2332
|
});
|
|
2220
2333
|
}
|
|
2221
|
-
function
|
|
2222
|
-
let t = Q(), [n, r] =
|
|
2334
|
+
function nn({ task: e }) {
|
|
2335
|
+
let t = Q(), [n, r] = j(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
|
|
2223
2336
|
if (r(""), s) {
|
|
2224
2337
|
s.onSubmit(e.text);
|
|
2225
2338
|
return;
|
|
@@ -2230,8 +2343,8 @@ function Bt({ task: e }) {
|
|
|
2230
2343
|
}).then((e) => {
|
|
2231
2344
|
e && a(e);
|
|
2232
2345
|
});
|
|
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, ...
|
|
2234
|
-
return /* @__PURE__ */
|
|
2346
|
+
}, 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, ...tn(i.modelsByProvider, i.catalogGroup)] : tn(i.modelsByProvider);
|
|
2347
|
+
return /* @__PURE__ */ N(o, {
|
|
2235
2348
|
value: n,
|
|
2236
2349
|
onChange: r,
|
|
2237
2350
|
placeholder: s?.prompt ?? t.messagePlaceholder,
|
|
@@ -2250,21 +2363,21 @@ function Bt({ task: e }) {
|
|
|
2250
2363
|
maxHeight: 220
|
|
2251
2364
|
});
|
|
2252
2365
|
}
|
|
2253
|
-
function
|
|
2254
|
-
let { startOrchestrator: e } = $(), t = Q(), [n, r] =
|
|
2366
|
+
function rn() {
|
|
2367
|
+
let { startOrchestrator: e } = $(), t = Q(), [n, r] = j(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = St(), l = (t) => {
|
|
2255
2368
|
t.text.trim() && (e(t.text.trim(), {
|
|
2256
2369
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
2257
2370
|
model: t.model || void 0
|
|
2258
2371
|
}), r(""));
|
|
2259
2372
|
}, u = i && !s;
|
|
2260
|
-
return /* @__PURE__ */
|
|
2373
|
+
return /* @__PURE__ */ N(o, {
|
|
2261
2374
|
value: n,
|
|
2262
2375
|
onChange: r,
|
|
2263
2376
|
placeholder: t.orchestratorStarterPlaceholder,
|
|
2264
2377
|
disabled: !n.trim() || u,
|
|
2265
2378
|
onSubmit: l,
|
|
2266
2379
|
attachments: !0,
|
|
2267
|
-
models:
|
|
2380
|
+
models: tn(a),
|
|
2268
2381
|
selectedModel: s,
|
|
2269
2382
|
onModelChange: c,
|
|
2270
2383
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
@@ -2272,7 +2385,30 @@ function Vt() {
|
|
|
2272
2385
|
maxHeight: 220
|
|
2273
2386
|
});
|
|
2274
2387
|
}
|
|
2275
|
-
function
|
|
2388
|
+
function an({ chat: e, onClose: t }) {
|
|
2389
|
+
let n = Q(), r = x();
|
|
2390
|
+
return /* @__PURE__ */ N(p, {
|
|
2391
|
+
title: n.renameChat,
|
|
2392
|
+
size: "sm",
|
|
2393
|
+
onClose: t,
|
|
2394
|
+
onSave: () => (Pe(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? Me(e)), "person"), t(), Promise.resolve(!0)),
|
|
2395
|
+
children: /* @__PURE__ */ P(u, {
|
|
2396
|
+
appearance: "empty",
|
|
2397
|
+
controller: r,
|
|
2398
|
+
defaultValues: { title: Me(e) },
|
|
2399
|
+
footer: !1,
|
|
2400
|
+
children: [/* @__PURE__ */ N(f, {
|
|
2401
|
+
name: "title",
|
|
2402
|
+
label: n.chatTitleLabel,
|
|
2403
|
+
placeholder: e.title
|
|
2404
|
+
}), /* @__PURE__ */ N("p", {
|
|
2405
|
+
className: "text-xs text-muted-foreground",
|
|
2406
|
+
children: n.chatTitleHint
|
|
2407
|
+
})]
|
|
2408
|
+
})
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
function on(e, t, n = Date.now()) {
|
|
2276
2412
|
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
2277
2413
|
numeric: "auto",
|
|
2278
2414
|
style: "short"
|
|
@@ -2284,55 +2420,55 @@ function Ht(e, t, n = Date.now()) {
|
|
|
2284
2420
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
2285
2421
|
return i.format(0, "minute");
|
|
2286
2422
|
}
|
|
2287
|
-
function
|
|
2423
|
+
function sn({ card: e }) {
|
|
2288
2424
|
let t = Q();
|
|
2289
|
-
return e.humanSummaryOnly ? /* @__PURE__ */
|
|
2425
|
+
return e.humanSummaryOnly ? /* @__PURE__ */ P("div", {
|
|
2290
2426
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2291
|
-
children: [/* @__PURE__ */
|
|
2427
|
+
children: [/* @__PURE__ */ P("p", {
|
|
2292
2428
|
className: "text-xs font-medium text-foreground",
|
|
2293
2429
|
children: [
|
|
2294
2430
|
"\"",
|
|
2295
2431
|
e.label,
|
|
2296
2432
|
"\""
|
|
2297
2433
|
]
|
|
2298
|
-
}), /* @__PURE__ */
|
|
2434
|
+
}), /* @__PURE__ */ N("p", {
|
|
2299
2435
|
className: "text-xs text-muted-foreground",
|
|
2300
2436
|
children: e.humanSummary
|
|
2301
2437
|
})]
|
|
2302
|
-
}) : /* @__PURE__ */
|
|
2438
|
+
}) : /* @__PURE__ */ P("div", {
|
|
2303
2439
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2304
2440
|
children: [
|
|
2305
|
-
/* @__PURE__ */
|
|
2441
|
+
/* @__PURE__ */ N("p", {
|
|
2306
2442
|
className: "text-xs font-medium text-foreground",
|
|
2307
|
-
children:
|
|
2443
|
+
children: _(t.newInstance, { label: e.label })
|
|
2308
2444
|
}),
|
|
2309
|
-
/* @__PURE__ */
|
|
2445
|
+
/* @__PURE__ */ N("p", {
|
|
2310
2446
|
className: "text-xs text-muted-foreground",
|
|
2311
2447
|
children: e.humanSummary
|
|
2312
2448
|
}),
|
|
2313
|
-
e.fields.length > 0 && /* @__PURE__ */
|
|
2449
|
+
e.fields.length > 0 && /* @__PURE__ */ N("ul", {
|
|
2314
2450
|
className: "space-y-1",
|
|
2315
|
-
children: e.fields.map((e) => /* @__PURE__ */
|
|
2451
|
+
children: e.fields.map((e) => /* @__PURE__ */ P("li", {
|
|
2316
2452
|
className: "flex items-start gap-1.5 text-xs",
|
|
2317
|
-
children: [/* @__PURE__ */
|
|
2453
|
+
children: [/* @__PURE__ */ N(n, {
|
|
2318
2454
|
variant: e.required ? "primary" : "secondary",
|
|
2319
2455
|
className: "mt-px shrink-0",
|
|
2320
2456
|
children: e.required ? "richiesto" : "opzionale"
|
|
2321
|
-
}), /* @__PURE__ */
|
|
2457
|
+
}), /* @__PURE__ */ P("span", {
|
|
2322
2458
|
className: "min-w-0",
|
|
2323
|
-
children: [/* @__PURE__ */
|
|
2459
|
+
children: [/* @__PURE__ */ N("span", {
|
|
2324
2460
|
className: "font-mono text-foreground",
|
|
2325
2461
|
children: e.key
|
|
2326
|
-
}), e.humanDescription ? /* @__PURE__ */
|
|
2462
|
+
}), e.humanDescription ? /* @__PURE__ */ P("span", {
|
|
2327
2463
|
className: "text-muted-foreground",
|
|
2328
2464
|
children: [" — ", e.humanDescription]
|
|
2329
2465
|
}) : null]
|
|
2330
2466
|
})]
|
|
2331
2467
|
}, e.key))
|
|
2332
2468
|
}),
|
|
2333
|
-
e.example && /* @__PURE__ */
|
|
2469
|
+
e.example && /* @__PURE__ */ P("p", {
|
|
2334
2470
|
className: "text-xs text-muted-foreground",
|
|
2335
|
-
children: ["Esempio: ", /* @__PURE__ */
|
|
2471
|
+
children: ["Esempio: ", /* @__PURE__ */ N("span", {
|
|
2336
2472
|
className: "font-mono",
|
|
2337
2473
|
children: e.example
|
|
2338
2474
|
})]
|
|
@@ -2340,41 +2476,43 @@ function Ut({ card: e }) {
|
|
|
2340
2476
|
]
|
|
2341
2477
|
});
|
|
2342
2478
|
}
|
|
2343
|
-
function
|
|
2344
|
-
return /* @__PURE__ */
|
|
2479
|
+
function cn({ messages: e }) {
|
|
2480
|
+
return /* @__PURE__ */ N("div", {
|
|
2345
2481
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2346
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
2482
|
+
children: e.map((e, t) => /* @__PURE__ */ N("p", {
|
|
2347
2483
|
className: "text-xs text-muted-foreground",
|
|
2348
2484
|
children: e
|
|
2349
2485
|
}, t))
|
|
2350
2486
|
});
|
|
2351
2487
|
}
|
|
2352
|
-
function
|
|
2353
|
-
let
|
|
2488
|
+
function ln({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
2489
|
+
let u = Q(), { locale: f } = S(), [p, m] = j(""), [h, g] = j(0);
|
|
2490
|
+
D(() => Ee(() => g((e) => e + 1)), []);
|
|
2491
|
+
let _ = k(() => r ? Le(e) : [], [
|
|
2354
2492
|
e,
|
|
2355
2493
|
r,
|
|
2356
2494
|
h
|
|
2357
|
-
]), y = async (t) => {
|
|
2358
|
-
let r =
|
|
2495
|
+
]), [v, y] = j(null), b = async (t) => {
|
|
2496
|
+
let r = H(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
|
|
2359
2497
|
if (!i || window.confirm(i)) {
|
|
2360
2498
|
try {
|
|
2361
2499
|
await r?.onArchive?.(t.entityId, t.params);
|
|
2362
2500
|
} catch {
|
|
2363
2501
|
return;
|
|
2364
2502
|
}
|
|
2365
|
-
|
|
2503
|
+
Ie(e, t.subagentId, t.entityId), n === Re(t.subagentId, t.entityId) && s(), g((e) => e + 1);
|
|
2366
2504
|
}
|
|
2367
|
-
},
|
|
2505
|
+
}, x = k(() => {
|
|
2368
2506
|
let e = p.trim().toLowerCase();
|
|
2369
2507
|
return e ? _.filter((t) => {
|
|
2370
|
-
let n =
|
|
2371
|
-
return t.
|
|
2508
|
+
let n = H(t.subagentId)?.label ?? t.subagentId;
|
|
2509
|
+
return Me(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
2372
2510
|
}) : _;
|
|
2373
2511
|
}, [_, p]);
|
|
2374
|
-
return /* @__PURE__ */
|
|
2512
|
+
return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(c, {
|
|
2375
2513
|
trigger: {
|
|
2376
2514
|
icon: "history",
|
|
2377
|
-
title:
|
|
2515
|
+
title: u.chatHistory
|
|
2378
2516
|
},
|
|
2379
2517
|
triggerClassName: "!h-9 !w-9 !p-0 rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
2380
2518
|
open: r,
|
|
@@ -2382,219 +2520,224 @@ function Gt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2382
2520
|
position: "end",
|
|
2383
2521
|
strategy: "absolute",
|
|
2384
2522
|
menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
|
|
2385
|
-
header: /* @__PURE__ */
|
|
2523
|
+
header: /* @__PURE__ */ P("div", {
|
|
2386
2524
|
className: "flex items-center gap-2 px-1 pb-1.5",
|
|
2387
2525
|
children: [
|
|
2388
|
-
/* @__PURE__ */
|
|
2526
|
+
/* @__PURE__ */ N(d, {
|
|
2389
2527
|
name: "search",
|
|
2390
2528
|
size: 14,
|
|
2391
2529
|
className: "shrink-0 text-muted-foreground"
|
|
2392
2530
|
}),
|
|
2393
|
-
/* @__PURE__ */
|
|
2531
|
+
/* @__PURE__ */ N("input", {
|
|
2394
2532
|
autoFocus: !0,
|
|
2395
2533
|
value: p,
|
|
2396
2534
|
onChange: (e) => m(e.target.value),
|
|
2397
|
-
placeholder:
|
|
2535
|
+
placeholder: u.searchChats,
|
|
2398
2536
|
className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
2399
2537
|
}),
|
|
2400
|
-
/* @__PURE__ */
|
|
2538
|
+
/* @__PURE__ */ N(t, {
|
|
2401
2539
|
icon: "square-pen",
|
|
2402
|
-
ariaLabel:
|
|
2403
|
-
title:
|
|
2540
|
+
ariaLabel: u.newChat,
|
|
2541
|
+
title: u.newChat,
|
|
2404
2542
|
variant: "link",
|
|
2405
2543
|
className: "shrink-0",
|
|
2406
2544
|
onClick: o
|
|
2407
2545
|
})
|
|
2408
2546
|
]
|
|
2409
2547
|
}),
|
|
2410
|
-
children:
|
|
2548
|
+
children: x.length === 0 ? /* @__PURE__ */ N("p", {
|
|
2411
2549
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
2412
|
-
children: _.length === 0 ?
|
|
2413
|
-
}) :
|
|
2414
|
-
let t =
|
|
2415
|
-
return /* @__PURE__ */
|
|
2550
|
+
children: _.length === 0 ? u.noSavedChats : u.noResults
|
|
2551
|
+
}) : x.map((e) => {
|
|
2552
|
+
let t = H(e.subagentId), r = n === Re(e.subagentId, e.entityId);
|
|
2553
|
+
return /* @__PURE__ */ N(l, {
|
|
2416
2554
|
icon: r ? "check" : t?.icon ?? "bot",
|
|
2417
|
-
className: r ? "bg-accent font-
|
|
2555
|
+
className: r ? "bg-accent font-semibold text-primary" : void 0,
|
|
2418
2556
|
actions: [{
|
|
2557
|
+
icon: "pencil",
|
|
2558
|
+
label: u.renameChat,
|
|
2559
|
+
onClick: () => {
|
|
2560
|
+
i(!1), y(e);
|
|
2561
|
+
}
|
|
2562
|
+
}, {
|
|
2419
2563
|
icon: "archive",
|
|
2420
|
-
label:
|
|
2421
|
-
onClick: () => void
|
|
2564
|
+
label: u.archiveChat,
|
|
2565
|
+
onClick: () => void b(e)
|
|
2422
2566
|
}],
|
|
2423
2567
|
onClick: () => a(e.subagentId, e.entityId, e),
|
|
2424
|
-
children: /* @__PURE__ */
|
|
2568
|
+
children: /* @__PURE__ */ P("span", {
|
|
2425
2569
|
className: "flex min-w-0 flex-1 items-center justify-between gap-2",
|
|
2426
|
-
children: [/* @__PURE__ */
|
|
2570
|
+
children: [/* @__PURE__ */ N("span", {
|
|
2427
2571
|
className: "min-w-0 truncate",
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
children: t?.label ?? e.subagentId
|
|
2432
|
-
}),
|
|
2433
|
-
" · ",
|
|
2434
|
-
e.title || e.entityId
|
|
2435
|
-
]
|
|
2436
|
-
}), /* @__PURE__ */ k("span", {
|
|
2572
|
+
title: `${t?.label ?? e.subagentId} · ${Me(e)}`,
|
|
2573
|
+
children: Me(e)
|
|
2574
|
+
}), /* @__PURE__ */ N("span", {
|
|
2437
2575
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2438
|
-
title: `${
|
|
2439
|
-
children:
|
|
2576
|
+
title: `${u.chatStarted.replace("{at}", new Date(Fe(e)).toLocaleString(f))} · ${u.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(f))}`,
|
|
2577
|
+
children: on(Fe(e), f)
|
|
2440
2578
|
})]
|
|
2441
2579
|
})
|
|
2442
2580
|
}, `${e.subagentId}:${e.entityId}`);
|
|
2443
2581
|
})
|
|
2444
|
-
})
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2582
|
+
}), v && /* @__PURE__ */ N(an, {
|
|
2583
|
+
chat: v,
|
|
2584
|
+
onClose: () => y(null)
|
|
2585
|
+
})] });
|
|
2586
|
+
}
|
|
2587
|
+
function un({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
|
|
2588
|
+
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: C, scope: w } = $(), T = Q(), E = A(null), [O, k] = j(!1);
|
|
2589
|
+
Yt(w?.id);
|
|
2590
|
+
let F = gt({
|
|
2448
2591
|
defaultWidth: e,
|
|
2449
2592
|
minWidth: n,
|
|
2450
2593
|
maxWidth: r,
|
|
2451
2594
|
onWidthChange: i
|
|
2452
|
-
}),
|
|
2453
|
-
(!a || a.agent.running || a.savedToDisk || window.confirm(
|
|
2454
|
-
},
|
|
2595
|
+
}), ee = () => {
|
|
2596
|
+
(!a || a.agent.running || a.savedToDisk || window.confirm(T.unsavedConversationConfirm)) && (m(), k(!1));
|
|
2597
|
+
}, I = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], L = I.length, R = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? L, L)), z = I.slice(0, R), B = I.slice(R), te = !!(a && !a.agent.running && a.agent.error), V = new Set(a?.agent.activity.map((e) => e.id) ?? []), U = a ? {
|
|
2455
2598
|
canAnswer: (e) => V.has(e),
|
|
2456
2599
|
onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
|
|
2457
2600
|
e && a.onApplied(e);
|
|
2458
2601
|
})
|
|
2459
|
-
} : void 0,
|
|
2460
|
-
|
|
2461
|
-
let e =
|
|
2602
|
+
} : void 0, W = U ? nt(I, U.canAnswer) : null, G = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? H(a.scopedSubagentId) : void 0, K = G?.manualEntry ? G : null, q = A(!0);
|
|
2603
|
+
D(() => {
|
|
2604
|
+
let e = E.current;
|
|
2462
2605
|
if (!e) return;
|
|
2463
2606
|
let t = () => {
|
|
2464
|
-
|
|
2607
|
+
q.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
|
|
2465
2608
|
};
|
|
2466
2609
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
2467
|
-
}, [a?.id]),
|
|
2468
|
-
let e =
|
|
2469
|
-
e && (
|
|
2610
|
+
}, [a?.id]), D(() => {
|
|
2611
|
+
let e = E.current;
|
|
2612
|
+
e && (q.current = !0, e.scrollTop = e.scrollHeight);
|
|
2470
2613
|
}, [a?.id]);
|
|
2471
|
-
let
|
|
2472
|
-
|
|
2473
|
-
let e =
|
|
2474
|
-
e &&
|
|
2614
|
+
let ne = I.at(-1)?.detail?.length ?? 0;
|
|
2615
|
+
D(() => {
|
|
2616
|
+
let e = E.current;
|
|
2617
|
+
e && q.current && (e.scrollTop = e.scrollHeight);
|
|
2475
2618
|
}, [
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2619
|
+
L,
|
|
2620
|
+
te,
|
|
2621
|
+
ne
|
|
2479
2622
|
]);
|
|
2480
|
-
let
|
|
2481
|
-
|
|
2482
|
-
let e =
|
|
2623
|
+
let J = A(null);
|
|
2624
|
+
D(() => {
|
|
2625
|
+
let e = E.current, t = J.current;
|
|
2483
2626
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
2484
2627
|
let n = new ResizeObserver(() => {
|
|
2485
|
-
|
|
2628
|
+
q.current && (e.scrollTop = e.scrollHeight);
|
|
2486
2629
|
});
|
|
2487
2630
|
return n.observe(t), () => n.disconnect();
|
|
2488
2631
|
}, [a?.id, o]);
|
|
2489
|
-
let
|
|
2490
|
-
manifest:
|
|
2632
|
+
let Y = s ? /* @__PURE__ */ N($t, { userGoal: s }, c) : null, re = f ? H(f.subagentId) : void 0, ie = f && re ? /* @__PURE__ */ N(Qt, {
|
|
2633
|
+
manifest: re,
|
|
2491
2634
|
params: f.snapshot.params,
|
|
2492
|
-
taskId:
|
|
2635
|
+
taskId: Re(f.subagentId, f.entityId),
|
|
2493
2636
|
resumeSeed: {
|
|
2494
2637
|
history: f.snapshot.history,
|
|
2495
2638
|
activity: f.snapshot.activity
|
|
2496
2639
|
}
|
|
2497
|
-
}, p) : null,
|
|
2498
|
-
manifest:
|
|
2640
|
+
}, p) : null, X = g ? H(g.subagentId) : void 0, ae = g && X ? /* @__PURE__ */ N(en, {
|
|
2641
|
+
manifest: X,
|
|
2499
2642
|
extraDestinations: g.extraDestinations
|
|
2500
|
-
}, _) : null,
|
|
2501
|
-
manifest:
|
|
2643
|
+
}, _) : null, oe = b ? H(b.subagentId) : void 0, se = b && oe ? /* @__PURE__ */ N(Qt, {
|
|
2644
|
+
manifest: oe,
|
|
2502
2645
|
params: b.params,
|
|
2503
2646
|
extraDestinations: b.extraDestinations
|
|
2504
|
-
}, x) : null,
|
|
2505
|
-
manifest:
|
|
2647
|
+
}, x) : null, Z = S ? H(S.subagentId) : void 0, ce = S && Z ? /* @__PURE__ */ N(Qt, {
|
|
2648
|
+
manifest: Z,
|
|
2506
2649
|
params: S.params,
|
|
2507
2650
|
taskId: S.taskId,
|
|
2508
2651
|
openingMessage: S.openingMessage
|
|
2509
|
-
},
|
|
2510
|
-
return o ? /* @__PURE__ */
|
|
2652
|
+
}, C) : null;
|
|
2653
|
+
return o ? /* @__PURE__ */ P(M, { children: [
|
|
2654
|
+
Y,
|
|
2511
2655
|
ie,
|
|
2512
2656
|
ae,
|
|
2513
2657
|
se,
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
style: { width: P.width },
|
|
2658
|
+
ce,
|
|
2659
|
+
/* @__PURE__ */ P("div", {
|
|
2660
|
+
style: { width: F.width },
|
|
2518
2661
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
2519
2662
|
children: [
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
width:
|
|
2522
|
-
min:
|
|
2523
|
-
max:
|
|
2524
|
-
onResize:
|
|
2525
|
-
onCommit:
|
|
2526
|
-
onReset:
|
|
2663
|
+
/* @__PURE__ */ N(_t, {
|
|
2664
|
+
width: F.width,
|
|
2665
|
+
min: F.min,
|
|
2666
|
+
max: F.max,
|
|
2667
|
+
onResize: F.set,
|
|
2668
|
+
onCommit: F.commit,
|
|
2669
|
+
onReset: F.reset
|
|
2527
2670
|
}),
|
|
2528
|
-
/* @__PURE__ */
|
|
2671
|
+
/* @__PURE__ */ P("div", {
|
|
2529
2672
|
className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
|
|
2530
2673
|
children: [
|
|
2531
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ N("span", {
|
|
2532
2675
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
2533
2676
|
children: a ? a.title : "Agentico"
|
|
2534
2677
|
}),
|
|
2535
|
-
|
|
2536
|
-
scopeId:
|
|
2678
|
+
w && /* @__PURE__ */ N(ln, {
|
|
2679
|
+
scopeId: w.id,
|
|
2537
2680
|
currentTaskId: a?.id ?? null,
|
|
2538
|
-
open:
|
|
2539
|
-
onOpenChange:
|
|
2540
|
-
onNewChat:
|
|
2681
|
+
open: O,
|
|
2682
|
+
onOpenChange: k,
|
|
2683
|
+
onNewChat: ee,
|
|
2541
2684
|
onSelect: (e, t, n) => h(e, t, n),
|
|
2542
2685
|
onArchivedCurrent: m
|
|
2543
2686
|
}),
|
|
2544
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ N(vt, {})
|
|
2545
2688
|
]
|
|
2546
2689
|
}),
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
ref:
|
|
2549
|
-
className: `flex-1 overflow-y-auto px-3 pb-2 ${
|
|
2550
|
-
children: /* @__PURE__ */
|
|
2551
|
-
ref:
|
|
2690
|
+
/* @__PURE__ */ N("div", {
|
|
2691
|
+
ref: E,
|
|
2692
|
+
className: `flex-1 overflow-y-auto px-3 pb-2 ${W ? "min-h-24" : "min-h-0"}`,
|
|
2693
|
+
children: /* @__PURE__ */ N("div", {
|
|
2694
|
+
ref: J,
|
|
2552
2695
|
className: "pt-2",
|
|
2553
|
-
children: a ? /* @__PURE__ */
|
|
2554
|
-
a.manualEntry &&
|
|
2696
|
+
children: a ? /* @__PURE__ */ P(M, { children: [
|
|
2697
|
+
a.manualEntry && I.length === 0 && /* @__PURE__ */ N("p", {
|
|
2555
2698
|
className: "text-xs text-muted-foreground",
|
|
2556
2699
|
children: a.manualEntry.prompt
|
|
2557
2700
|
}),
|
|
2558
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ N(ot, {
|
|
2559
2702
|
activity: z,
|
|
2560
|
-
questions:
|
|
2561
|
-
docked:
|
|
2562
|
-
pinUserMessages: !
|
|
2703
|
+
questions: U,
|
|
2704
|
+
docked: W,
|
|
2705
|
+
pinUserMessages: !W
|
|
2563
2706
|
}),
|
|
2564
|
-
a.panelExtra && /* @__PURE__ */
|
|
2707
|
+
a.panelExtra && /* @__PURE__ */ N("div", {
|
|
2565
2708
|
className: "mt-3",
|
|
2566
2709
|
children: a.panelExtra
|
|
2567
2710
|
}),
|
|
2568
|
-
|
|
2569
|
-
activity:
|
|
2570
|
-
questions:
|
|
2571
|
-
docked:
|
|
2572
|
-
pinUserMessages: !
|
|
2711
|
+
B.length > 0 && /* @__PURE__ */ N(ot, {
|
|
2712
|
+
activity: B,
|
|
2713
|
+
questions: U,
|
|
2714
|
+
docked: W,
|
|
2715
|
+
pinUserMessages: !W
|
|
2573
2716
|
}),
|
|
2574
|
-
!a.agent.running && a.agent.error && /* @__PURE__ */
|
|
2717
|
+
!a.agent.running && a.agent.error && /* @__PURE__ */ P("div", {
|
|
2575
2718
|
className: "mt-2 flex items-center gap-2",
|
|
2576
2719
|
children: [
|
|
2577
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ N("p", {
|
|
2578
2721
|
className: "flex-1 text-xs text-destructive",
|
|
2579
2722
|
children: a.agent.error
|
|
2580
2723
|
}),
|
|
2581
|
-
/* @__PURE__ */
|
|
2582
|
-
label:
|
|
2724
|
+
/* @__PURE__ */ N(t, {
|
|
2725
|
+
label: T.retry,
|
|
2583
2726
|
variant: "secondary",
|
|
2584
2727
|
className: "shrink-0",
|
|
2585
2728
|
onClick: () => {
|
|
2586
|
-
a.agent.sendMessage(
|
|
2729
|
+
a.agent.sendMessage(T.retryMessage).then((e) => {
|
|
2587
2730
|
e && a.onApplied(e);
|
|
2588
2731
|
});
|
|
2589
2732
|
}
|
|
2590
2733
|
}),
|
|
2591
|
-
!a.agent.remote && /* @__PURE__ */
|
|
2592
|
-
label:
|
|
2734
|
+
!a.agent.remote && /* @__PURE__ */ N(t, {
|
|
2735
|
+
label: T.continueWithoutAi,
|
|
2593
2736
|
variant: "secondary",
|
|
2594
2737
|
className: "shrink-0",
|
|
2595
2738
|
onClick: () => {
|
|
2596
|
-
if (
|
|
2597
|
-
v(
|
|
2739
|
+
if (K) {
|
|
2740
|
+
v(K.id, y);
|
|
2598
2741
|
return;
|
|
2599
2742
|
}
|
|
2600
2743
|
let e = a.agent.runFallback();
|
|
@@ -2603,67 +2746,67 @@ function Kt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2603
2746
|
})
|
|
2604
2747
|
]
|
|
2605
2748
|
})
|
|
2606
|
-
] }) : d.length > 0 ? /* @__PURE__ */
|
|
2749
|
+
] }) : d.length > 0 ? /* @__PURE__ */ N(cn, { messages: d }) : u ? /* @__PURE__ */ N(sn, { card: u }) : /* @__PURE__ */ N("p", {
|
|
2607
2750
|
className: "text-xs text-muted-foreground",
|
|
2608
|
-
children: l ??
|
|
2751
|
+
children: l ?? T.orchestratorStarterHint
|
|
2609
2752
|
})
|
|
2610
2753
|
})
|
|
2611
2754
|
}),
|
|
2612
|
-
a &&
|
|
2613
|
-
"aria-label":
|
|
2755
|
+
a && W ? /* @__PURE__ */ P("section", {
|
|
2756
|
+
"aria-label": T.pendingQuestions,
|
|
2614
2757
|
className: "flex min-h-0 shrink flex-col border-t border-border/60",
|
|
2615
2758
|
children: [
|
|
2616
|
-
a.panelActions && /* @__PURE__ */
|
|
2759
|
+
a.panelActions && /* @__PURE__ */ N("div", {
|
|
2617
2760
|
className: "shrink-0 px-4 pt-3",
|
|
2618
2761
|
children: a.panelActions
|
|
2619
2762
|
}),
|
|
2620
|
-
/* @__PURE__ */
|
|
2763
|
+
/* @__PURE__ */ N("div", {
|
|
2621
2764
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
2622
|
-
children: /* @__PURE__ */
|
|
2623
|
-
entry:
|
|
2624
|
-
part:
|
|
2625
|
-
questions:
|
|
2765
|
+
children: /* @__PURE__ */ N(rt, {
|
|
2766
|
+
entry: W.entry,
|
|
2767
|
+
part: W.part,
|
|
2768
|
+
questions: U,
|
|
2626
2769
|
autoFocus: !0
|
|
2627
|
-
}, `${
|
|
2770
|
+
}, `${W.entry.id}:${W.part.id}`)
|
|
2628
2771
|
}),
|
|
2629
|
-
a.agent.running && /* @__PURE__ */
|
|
2772
|
+
a.agent.running && /* @__PURE__ */ N("div", {
|
|
2630
2773
|
className: "flex shrink-0 justify-end px-4 pb-3",
|
|
2631
|
-
children: /* @__PURE__ */
|
|
2774
|
+
children: /* @__PURE__ */ N(t, {
|
|
2632
2775
|
icon: "square",
|
|
2633
|
-
label:
|
|
2776
|
+
label: T.stop,
|
|
2634
2777
|
variant: "secondary",
|
|
2635
2778
|
onClick: a.agent.stop
|
|
2636
2779
|
})
|
|
2637
2780
|
})
|
|
2638
2781
|
]
|
|
2639
|
-
}) : /* @__PURE__ */
|
|
2782
|
+
}) : /* @__PURE__ */ P("div", {
|
|
2640
2783
|
className: "border-t border-border/60 px-4 py-3",
|
|
2641
|
-
children: [a?.panelActions && /* @__PURE__ */
|
|
2784
|
+
children: [a?.panelActions && /* @__PURE__ */ N("div", {
|
|
2642
2785
|
className: "mb-2",
|
|
2643
2786
|
children: a.panelActions
|
|
2644
|
-
}), a ? /* @__PURE__ */
|
|
2787
|
+
}), a ? /* @__PURE__ */ N(nn, { task: a }, a.id) : /* @__PURE__ */ N(rn, {})]
|
|
2645
2788
|
})
|
|
2646
2789
|
]
|
|
2647
2790
|
})
|
|
2648
|
-
] }) : /* @__PURE__ */
|
|
2791
|
+
] }) : /* @__PURE__ */ P(M, { children: [
|
|
2792
|
+
Y,
|
|
2649
2793
|
ie,
|
|
2650
2794
|
ae,
|
|
2651
2795
|
se,
|
|
2652
|
-
|
|
2653
|
-
le
|
|
2796
|
+
ce
|
|
2654
2797
|
] });
|
|
2655
2798
|
}
|
|
2656
2799
|
//#endregion
|
|
2657
2800
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
2658
|
-
function
|
|
2659
|
-
let { setPageContext: n } = $(), r =
|
|
2660
|
-
|
|
2801
|
+
function dn(e, t) {
|
|
2802
|
+
let { setPageContext: n } = $(), r = A(crypto.randomUUID()).current;
|
|
2803
|
+
D(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
2661
2804
|
}
|
|
2662
2805
|
//#endregion
|
|
2663
2806
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
2664
|
-
function
|
|
2665
|
-
let { registerComponentAnchor: o } = $(), s =
|
|
2666
|
-
c.current = n,
|
|
2807
|
+
function fn(e, t, n, r, i = !0, a) {
|
|
2808
|
+
let { registerComponentAnchor: o } = $(), s = A(crypto.randomUUID()).current, c = A(n);
|
|
2809
|
+
c.current = n, D(() => {
|
|
2667
2810
|
if (i) return o(s, {
|
|
2668
2811
|
subagentId: e,
|
|
2669
2812
|
componentKey: t,
|
|
@@ -2680,6 +2823,6 @@ function Jt(e, t, n, r, i = !0, a) {
|
|
|
2680
2823
|
]);
|
|
2681
2824
|
}
|
|
2682
2825
|
//#endregion
|
|
2683
|
-
export {
|
|
2826
|
+
export { lt as AGENTICO_MAX_WIDTH, ct as AGENTICO_MIN_WIDTH, st as AGENTICO_WIDTH, ut as AGENTICO_WIDTH_STORAGE_KEY, un as Agentico, Ge as AgenticoProvider, vt as AgenticoToggle, ee as DEFAULT_REASONING_PART_ID, F as DEFAULT_TEXT_PART_ID, ge as JSON_EXPORT_DESTINATION_ID, de as MICRO_PROMPT_REGISTRY, Ue as ORCHESTRATOR_TASK_ID, ue as SUMMARY_MICRO_PROMPT, ze as agenticoDe, Be as agenticoEn, Ve as agenticoIt, J as agenticoPromptsEn, Y as agenticoPromptsIt, He as agenticoTranslations, fe as applyMicroPrompts, Ne as chatHasPersonMessage, Fe as chatStartedAt, Me as chatTitle, ie as configureAgenticoPrompts, Se as configureEntityChatStore, G as createCrossAgentTools, z as defineSubagent, Re as entityChatTaskId, pe as extractErrorMessage, me as extractJsonBlock, H as findSubagentManifest, R as formatQuestionAnswers, X as getAgenticoPrompts, be as getDestinationRegistry, ke as getEntityChat, Wt as getSubagentControls, V as getSubagentRegistry, zt as getSubagentReport, _e as jsonExportDestination, Le as listEntityChats, L as messagePartsText, Ee as onEntityChatsChange, W as registerCrossAgentTools, ye as registerDestinations, Ut as registerSubagentControls, Rt as registerSubagentReports, te as registerSubagents, Ie as removeEntityChat, Pe as renameEntityChat, le as renderRegistryCli, ce as renderSubagentCli, ae as resetAgenticoPrompts, Ae as saveEntityChat, K as toJsonSchema, q as toMcpTool, I as upsertMessagePart, kt as useAgent, $ as useAgentico, Q as useAgenticoI18n, dn as useAgenticoPageContext, fn as useSubagentComponentContext };
|
|
2684
2827
|
|
|
2685
2828
|
//# sourceMappingURL=index.mjs.map
|