@arcteninc/core 0.0.177 → 0.0.178
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/dist/index.cjs +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +512 -456
- package/dist/lib/useAgent.d.ts +2 -1
- package/dist/lib/useAgent.d.ts.map +1 -1
- package/dist/types/use-agent.d.ts +8 -0
- package/dist/types/use-agent.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/arcten-cli.cjs +0 -0
- package/scripts/cli-extract-types-auto-wrapper.js +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,192 +1,193 @@
|
|
|
1
|
-
import { useRef as z, useState as
|
|
2
|
-
import { useChat as
|
|
3
|
-
import { DefaultChatTransport as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return
|
|
1
|
+
import { useRef as z, useState as _, useMemo as v, useEffect as R, useCallback as ye } from "react";
|
|
2
|
+
import { useChat as nt } from "@ai-sdk/react";
|
|
3
|
+
import { DefaultChatTransport as st, lastAssistantMessageIsCompleteWithToolCalls as at } from "ai";
|
|
4
|
+
const B = Symbol.for("@arcteninc/core:originalName");
|
|
5
|
+
function gt(u, c) {
|
|
6
|
+
return u[B] = c, u;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
if (typeof
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
return { fn:
|
|
8
|
+
function it(u, c, m, g) {
|
|
9
|
+
if (typeof u != "function") return null;
|
|
10
|
+
const y = u[B];
|
|
11
|
+
if (y) {
|
|
12
|
+
const $ = c[y];
|
|
13
|
+
if ($ && !m.has($.name))
|
|
14
|
+
return { fn: u, meta: $ };
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
20
|
-
if (
|
|
21
|
-
for (const
|
|
22
|
-
if (!m.has(
|
|
23
|
-
return
|
|
24
|
-
} else if (
|
|
16
|
+
const f = u.name;
|
|
17
|
+
let i;
|
|
18
|
+
if (f && (i = c[f], i && !m.has(i.name)))
|
|
19
|
+
return u[B] = i.name, { fn: u, meta: i };
|
|
20
|
+
if (g && g.length > 0) {
|
|
21
|
+
for (const $ of g)
|
|
22
|
+
if (!m.has($) && (i = c[$], i))
|
|
23
|
+
return u[B] = i.name, { fn: u, meta: i };
|
|
24
|
+
} else if (i = Object.values(c).find(
|
|
25
25
|
(x) => !m.has(x.name)
|
|
26
|
-
),
|
|
27
|
-
return
|
|
26
|
+
), i)
|
|
27
|
+
return u[B] = i.name, { fn: u, meta: i };
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function ct(u, c) {
|
|
31
31
|
if (!c)
|
|
32
32
|
return [];
|
|
33
|
-
let m,
|
|
33
|
+
let m, g;
|
|
34
34
|
if ("functions" in c && typeof c.functions == "object") {
|
|
35
|
-
const
|
|
36
|
-
m =
|
|
35
|
+
const f = c;
|
|
36
|
+
m = f.functions, g = f.toolOrder;
|
|
37
37
|
} else
|
|
38
|
-
m = c,
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
const
|
|
42
|
-
|
|
38
|
+
m = c, g = void 0;
|
|
39
|
+
const y = /* @__PURE__ */ new Set();
|
|
40
|
+
return u.map((f) => {
|
|
41
|
+
const i = it(
|
|
42
|
+
f,
|
|
43
43
|
m,
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
y,
|
|
45
|
+
g
|
|
46
46
|
);
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
47
|
+
if (!i) {
|
|
48
|
+
const $ = f.name, M = f[B] || $ || "unnamed";
|
|
49
49
|
return typeof process < "u" && (process.env.NODE_ENV === "development" || process.env.NODE_ENV !== "production") && typeof console < "u" && console.warn && console.warn(
|
|
50
50
|
`⚠️ [@arcteninc/core] No metadata found for tool "${M}". This tool will be excluded.
|
|
51
51
|
To fix: Run "arcten-extract-types ." and ensure "${M}" is used in ArctenAgent/useAgent.`
|
|
52
52
|
), null;
|
|
53
53
|
}
|
|
54
|
-
return
|
|
55
|
-
name:
|
|
54
|
+
return y.add(i.meta.name), {
|
|
55
|
+
name: i.meta.name,
|
|
56
56
|
// Use original name from metadata, not minified fn.name
|
|
57
|
-
description:
|
|
58
|
-
jsonSchema:
|
|
57
|
+
description: i.meta.description,
|
|
58
|
+
jsonSchema: i.meta.parameters
|
|
59
59
|
};
|
|
60
|
-
}).filter((
|
|
60
|
+
}).filter((f) => f !== null);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
function
|
|
64
|
-
if (typeof
|
|
62
|
+
const j = process.env.NODE_ENV === "development";
|
|
63
|
+
function ae(u) {
|
|
64
|
+
if (typeof u == "string")
|
|
65
65
|
try {
|
|
66
|
-
const c = JSON.parse(
|
|
67
|
-
return
|
|
66
|
+
const c = JSON.parse(u);
|
|
67
|
+
return ae(c);
|
|
68
68
|
} catch {
|
|
69
|
-
return
|
|
69
|
+
return u;
|
|
70
70
|
}
|
|
71
|
-
if (Array.isArray(
|
|
72
|
-
return
|
|
73
|
-
if (
|
|
71
|
+
if (Array.isArray(u))
|
|
72
|
+
return u.map(ae);
|
|
73
|
+
if (u && typeof u == "object") {
|
|
74
74
|
const c = {};
|
|
75
|
-
for (const [m,
|
|
76
|
-
c[m] =
|
|
75
|
+
for (const [m, g] of Object.entries(u))
|
|
76
|
+
c[m] = ae(g);
|
|
77
77
|
return c;
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return u;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
if (typeof
|
|
81
|
+
function lt(u) {
|
|
82
|
+
if (typeof u == "string") {
|
|
83
83
|
try {
|
|
84
|
-
const c = JSON.parse(
|
|
84
|
+
const c = JSON.parse(u);
|
|
85
85
|
if (c && typeof c == "object" && !Array.isArray(c))
|
|
86
|
-
return
|
|
86
|
+
return ae(c);
|
|
87
87
|
} catch {
|
|
88
88
|
}
|
|
89
89
|
return {};
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return u && typeof u == "object" && !Array.isArray(u) ? ae(u) : {};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (!
|
|
93
|
+
function ut(u, c) {
|
|
94
|
+
if (!u || u.length === 0)
|
|
95
95
|
return c;
|
|
96
96
|
const m = /* @__PURE__ */ new Map();
|
|
97
|
-
c.forEach((
|
|
98
|
-
const
|
|
99
|
-
|
|
97
|
+
c.forEach((f) => {
|
|
98
|
+
const i = f[B] || f.name;
|
|
99
|
+
i && m.set(i, f);
|
|
100
100
|
});
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
105
|
-
|
|
101
|
+
const g = new Map(u.map((f) => [f.name, f])), y = [];
|
|
102
|
+
return u.forEach((f) => {
|
|
103
|
+
const i = m.get(f.name);
|
|
104
|
+
if (!i) {
|
|
105
|
+
j && console.log(`[useAgent] Skipping server-only tool: ${f.name}`);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
if (!
|
|
109
|
-
|
|
110
|
-
`[useAgent] Blocking non-overridable disabled tool: ${
|
|
108
|
+
if (!f.isEnabled && !f.isOverridable) {
|
|
109
|
+
j && console.log(
|
|
110
|
+
`[useAgent] Blocking non-overridable disabled tool: ${f.name}`
|
|
111
111
|
);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
-
if (!
|
|
115
|
-
|
|
116
|
-
`[useAgent] Allowing overridable disabled tool with local implementation: ${
|
|
117
|
-
),
|
|
114
|
+
if (!f.isEnabled && f.isOverridable && i) {
|
|
115
|
+
j && console.log(
|
|
116
|
+
`[useAgent] Allowing overridable disabled tool with local implementation: ${f.name}`
|
|
117
|
+
), y.push(i);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
}), c.forEach((
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
`[useAgent] Allowing client-only tool (forward compatible): ${
|
|
125
|
-
),
|
|
126
|
-
}),
|
|
120
|
+
f.isEnabled && i && y.push(i);
|
|
121
|
+
}), c.forEach((f) => {
|
|
122
|
+
const i = f[B] || f.name;
|
|
123
|
+
i && !g.has(i) && (j && console.log(
|
|
124
|
+
`[useAgent] Allowing client-only tool (forward compatible): ${i}`
|
|
125
|
+
), y.push(f));
|
|
126
|
+
}), y;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
apiBaseUrl:
|
|
128
|
+
function yt({
|
|
129
|
+
apiBaseUrl: u = "https://api.arcten.com",
|
|
130
130
|
tokenEndpoint: c = "/api/arcten/token",
|
|
131
131
|
clientToken: m,
|
|
132
|
-
skipTokenFetch:
|
|
133
|
-
user:
|
|
134
|
-
tools:
|
|
135
|
-
safeTools:
|
|
136
|
-
safeToolNames:
|
|
132
|
+
skipTokenFetch: g = !1,
|
|
133
|
+
user: y,
|
|
134
|
+
tools: f = [],
|
|
135
|
+
safeTools: i = [],
|
|
136
|
+
safeToolNames: $,
|
|
137
137
|
toolMetadata: x,
|
|
138
138
|
// NOTE: systemPrompt is deprecated; prompts are managed server-side per project/agent.
|
|
139
139
|
systemPrompt: M = "",
|
|
140
|
-
agentId:
|
|
140
|
+
agentId: W,
|
|
141
141
|
agentName: Z,
|
|
142
|
-
projectId:
|
|
143
|
-
enableRemoteConfig:
|
|
142
|
+
projectId: D,
|
|
143
|
+
enableRemoteConfig: T,
|
|
144
144
|
remoteConfigUrl: k,
|
|
145
|
-
initialMessages:
|
|
145
|
+
initialMessages: U = [],
|
|
146
146
|
conversationId: ee,
|
|
147
|
-
state:
|
|
148
|
-
onToolCall:
|
|
147
|
+
state: q,
|
|
148
|
+
onToolCall: I,
|
|
149
149
|
onFinish: F,
|
|
150
|
-
sources:
|
|
151
|
-
ragConfig:
|
|
152
|
-
ragFilters:
|
|
150
|
+
sources: O,
|
|
151
|
+
ragConfig: ie,
|
|
152
|
+
ragFilters: L,
|
|
153
153
|
// Deprecated: use ragConfig or sources instead
|
|
154
|
+
planning: S = !1
|
|
154
155
|
} = {}) {
|
|
155
|
-
const
|
|
156
|
+
const te = z(q), w = u.replace(/\/+$/, ""), [E, we] = _(null), [ft, _e] = _(!1), [dt, xe] = _(
|
|
156
157
|
null
|
|
157
|
-
), ce =
|
|
158
|
-
const t =
|
|
158
|
+
), ce = v(() => {
|
|
159
|
+
const t = O || [], e = E?.config?.sources || [];
|
|
159
160
|
return [.../* @__PURE__ */ new Set([...t, ...e])];
|
|
160
|
-
}, [
|
|
161
|
+
}, [O, E]), A = v(() => ie !== void 0 ? ie : L ? { enabled: !0, filters: L } : ce && ce.length > 0 ? {
|
|
161
162
|
enabled: !0,
|
|
162
163
|
organizationId: ce[0],
|
|
163
164
|
// Use first source as default
|
|
164
165
|
autoExecute: !0,
|
|
165
166
|
filters: void 0
|
|
166
|
-
} : { enabled: !1 }, [ce,
|
|
167
|
+
} : { enabled: !1 }, [ce, ie, L]), Me = v(() => T === !1 ? !1 : !!D, [D, T]);
|
|
167
168
|
R(() => {
|
|
168
|
-
if (!
|
|
169
|
+
if (!Me || !C.current)
|
|
169
170
|
return;
|
|
170
171
|
(async () => {
|
|
171
|
-
|
|
172
|
+
_e(!0), xe(null);
|
|
172
173
|
try {
|
|
173
|
-
const o = `${k ||
|
|
174
|
+
const o = `${k || w.replace("/chat", "").replace(/\/$/, "")}/convex/api/query`, r = await fetch(o, {
|
|
174
175
|
method: "POST",
|
|
175
176
|
headers: {
|
|
176
177
|
"Content-Type": "application/json",
|
|
177
|
-
Authorization: `Bearer ${
|
|
178
|
+
Authorization: `Bearer ${C.current}`
|
|
178
179
|
},
|
|
179
180
|
body: JSON.stringify({
|
|
180
181
|
path: "agents:getConfigForClient",
|
|
181
|
-
args: { projectId:
|
|
182
|
+
args: { projectId: D, agentName: Z, agentId: W },
|
|
182
183
|
format: "json"
|
|
183
184
|
})
|
|
184
185
|
});
|
|
185
186
|
if (!r.ok) {
|
|
186
187
|
if (r.status === 404) {
|
|
187
|
-
|
|
188
|
+
j && console.warn(
|
|
188
189
|
"[useAgent] Remote config endpoint not found (404), using local tools only"
|
|
189
|
-
),
|
|
190
|
+
), we(null);
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
193
|
const s = await r.text().catch(() => "Unknown error");
|
|
@@ -195,50 +196,54 @@ function dt({
|
|
|
195
196
|
);
|
|
196
197
|
}
|
|
197
198
|
const n = await r.json();
|
|
198
|
-
|
|
199
|
+
we(n?.value || null), j && console.log(
|
|
199
200
|
"[useAgent] Remote config loaded successfully:",
|
|
200
201
|
n?.value
|
|
201
202
|
);
|
|
202
203
|
} catch (e) {
|
|
203
204
|
console.error("[useAgent] Failed to fetch remote config:", e);
|
|
204
205
|
const o = e instanceof Error ? e : new Error(String(e));
|
|
205
|
-
|
|
206
|
+
xe(o), we(null);
|
|
206
207
|
} finally {
|
|
207
|
-
|
|
208
|
+
_e(!1);
|
|
208
209
|
}
|
|
209
210
|
})();
|
|
210
211
|
}, [
|
|
211
|
-
|
|
212
|
-
|
|
212
|
+
Me,
|
|
213
|
+
D,
|
|
213
214
|
Z,
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
W,
|
|
216
|
+
w,
|
|
216
217
|
k
|
|
217
218
|
]);
|
|
218
|
-
const [G,
|
|
219
|
+
const [G, be] = _(
|
|
219
220
|
m || null
|
|
220
|
-
),
|
|
221
|
+
), C = z(m || null);
|
|
221
222
|
R(() => {
|
|
222
|
-
|
|
223
|
-
}, [
|
|
224
|
-
const [
|
|
223
|
+
te.current = q;
|
|
224
|
+
}, [q]);
|
|
225
|
+
const [qe, ne] = _(null), [oe, ke] = _(null), H = z(null), [Re, De] = _([]), [Te, Ue] = _(
|
|
225
226
|
ee || (typeof window < "u" ? crypto.randomUUID() : null)
|
|
226
|
-
), [
|
|
227
|
+
), [Fe, le] = _(!1), [$e, Se] = _(/* @__PURE__ */ new Map()), ue = z(/* @__PURE__ */ new Set()), Ee = z(/* @__PURE__ */ new Set()), fe = z(/* @__PURE__ */ new Set());
|
|
227
228
|
R(() => {
|
|
228
|
-
|
|
229
|
-
}, [
|
|
230
|
-
const
|
|
229
|
+
te.current = q;
|
|
230
|
+
}, [q]);
|
|
231
|
+
const [Ae, Le] = _([]), de = v(() => S ? async function() {
|
|
232
|
+
return { todos: Ae };
|
|
233
|
+
} : null, [S, Ae]), he = v(() => S ? async function(e) {
|
|
234
|
+
return Le(e), { success: !0, todos: e };
|
|
235
|
+
} : null, [S]), V = v(() => A?.enabled ? async function(e, o = 20, r) {
|
|
231
236
|
const n = {
|
|
232
|
-
...
|
|
237
|
+
...A.filters,
|
|
233
238
|
...r
|
|
234
239
|
};
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
(h) => fetch(`${
|
|
240
|
+
if (O && O.length > 1) {
|
|
241
|
+
const a = O.map(
|
|
242
|
+
(h) => fetch(`${w}/search`, {
|
|
238
243
|
method: "POST",
|
|
239
244
|
headers: {
|
|
240
245
|
"Content-Type": "application/json",
|
|
241
|
-
...
|
|
246
|
+
...C.current ? { Authorization: `Bearer ${C.current}` } : {}
|
|
242
247
|
},
|
|
243
248
|
body: JSON.stringify({
|
|
244
249
|
q: e,
|
|
@@ -247,21 +252,21 @@ function dt({
|
|
|
247
252
|
...Object.keys(n).length > 0 ? { filters: n } : {}
|
|
248
253
|
})
|
|
249
254
|
}).then((p) => p.ok ? p.json() : null)
|
|
250
|
-
), d = await Promise.all(
|
|
255
|
+
), d = await Promise.all(a), l = [];
|
|
251
256
|
for (const h of d)
|
|
252
|
-
h?.candidates &&
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
return (p.scores?.rerank || p.scores?.dense || 0) -
|
|
257
|
+
h?.candidates && l.push(...h.candidates);
|
|
258
|
+
l.sort((h, p) => {
|
|
259
|
+
const N = h.scores?.rerank || h.scores?.dense || 0;
|
|
260
|
+
return (p.scores?.rerank || p.scores?.dense || 0) - N;
|
|
256
261
|
});
|
|
257
|
-
const b =
|
|
258
|
-
const
|
|
262
|
+
const b = l.slice(0, o).map((h, p) => {
|
|
263
|
+
const N = h.citation || h.url;
|
|
259
264
|
return {
|
|
260
265
|
rank: p + 1,
|
|
261
266
|
doc_id: h.doc_id,
|
|
262
267
|
block_id: h.block_id,
|
|
263
268
|
url: h.url,
|
|
264
|
-
citation:
|
|
269
|
+
citation: N,
|
|
265
270
|
title: h.title || "Untitled",
|
|
266
271
|
snippet: h.snippet,
|
|
267
272
|
score: h.scores?.rerank || h.scores?.dense || 0,
|
|
@@ -275,43 +280,43 @@ function dt({
|
|
|
275
280
|
return {
|
|
276
281
|
success: !0,
|
|
277
282
|
query: e,
|
|
278
|
-
total:
|
|
283
|
+
total: l.length,
|
|
279
284
|
results: b,
|
|
280
|
-
summary: `Found ${
|
|
285
|
+
summary: `Found ${l.length} relevant results across ${O.length} source(s) for "${e}". Top result: ${b[0]?.title || "N/A"}`
|
|
281
286
|
};
|
|
282
287
|
}
|
|
283
|
-
const s =
|
|
288
|
+
const s = A.organizationId && A.organizationId !== "default" ? A.organizationId : O && O.length > 0 ? O[0] : void 0;
|
|
284
289
|
try {
|
|
285
|
-
const
|
|
290
|
+
const a = {
|
|
286
291
|
q: e,
|
|
287
292
|
k: Math.min(o, 100)
|
|
288
293
|
};
|
|
289
|
-
s && (
|
|
294
|
+
s && (a.organizationId = s), Object.keys(n).length > 0 && (a.filters = n);
|
|
290
295
|
const d = {
|
|
291
296
|
"Content-Type": "application/json"
|
|
292
297
|
};
|
|
293
|
-
|
|
294
|
-
const
|
|
298
|
+
C.current && (d.Authorization = `Bearer ${C.current}`);
|
|
299
|
+
const l = await fetch(`${w}/search`, {
|
|
295
300
|
method: "POST",
|
|
296
301
|
headers: d,
|
|
297
|
-
body: JSON.stringify(
|
|
302
|
+
body: JSON.stringify(a)
|
|
298
303
|
});
|
|
299
|
-
if (!
|
|
300
|
-
const p = await
|
|
304
|
+
if (!l.ok) {
|
|
305
|
+
const p = await l.text();
|
|
301
306
|
return {
|
|
302
307
|
success: !1,
|
|
303
|
-
error: `Search failed: ${
|
|
308
|
+
error: `Search failed: ${l.status} ${p}`
|
|
304
309
|
};
|
|
305
310
|
}
|
|
306
|
-
const b = await
|
|
307
|
-
(p,
|
|
308
|
-
const
|
|
311
|
+
const b = await l.json(), h = b.candidates.map(
|
|
312
|
+
(p, N) => {
|
|
313
|
+
const ge = p.citation || p.url;
|
|
309
314
|
return {
|
|
310
|
-
rank:
|
|
315
|
+
rank: N + 1,
|
|
311
316
|
doc_id: p.doc_id,
|
|
312
317
|
block_id: p.block_id,
|
|
313
318
|
url: p.url,
|
|
314
|
-
citation:
|
|
319
|
+
citation: ge,
|
|
315
320
|
title: p.title || "Untitled",
|
|
316
321
|
snippet: p.snippet,
|
|
317
322
|
score: p.scores?.rerank || p.scores?.dense || 0,
|
|
@@ -330,20 +335,20 @@ function dt({
|
|
|
330
335
|
results: h,
|
|
331
336
|
summary: `Found ${b.total} relevant results for "${e}". Top result: ${h[0]?.title || "N/A"}`
|
|
332
337
|
};
|
|
333
|
-
} catch (
|
|
338
|
+
} catch (a) {
|
|
334
339
|
return {
|
|
335
340
|
success: !1,
|
|
336
|
-
error:
|
|
341
|
+
error: a instanceof Error ? a.message : "Unknown error occurred"
|
|
337
342
|
};
|
|
338
343
|
}
|
|
339
|
-
} : null, [
|
|
340
|
-
const r =
|
|
344
|
+
} : null, [A, w, C]), Y = v(() => A?.enabled ? async function(e, o) {
|
|
345
|
+
const r = A.organizationId && A.organizationId !== "default" ? A.organizationId : O && O.length > 0 ? O[0] : void 0;
|
|
341
346
|
try {
|
|
342
347
|
const n = {
|
|
343
348
|
"Content-Type": "application/json"
|
|
344
349
|
};
|
|
345
|
-
|
|
346
|
-
const s = await fetch(`${
|
|
350
|
+
C.current && (n.Authorization = `Bearer ${C.current}`);
|
|
351
|
+
const s = await fetch(`${w}/fetch`, {
|
|
347
352
|
method: "POST",
|
|
348
353
|
headers: n,
|
|
349
354
|
body: JSON.stringify({
|
|
@@ -359,14 +364,14 @@ function dt({
|
|
|
359
364
|
error: `Fetch failed: ${s.status} ${d}`
|
|
360
365
|
};
|
|
361
366
|
}
|
|
362
|
-
const
|
|
367
|
+
const a = await s.json();
|
|
363
368
|
return {
|
|
364
369
|
success: !0,
|
|
365
|
-
blocks:
|
|
366
|
-
fullContent:
|
|
367
|
-
pageUrl:
|
|
368
|
-
pageTitle:
|
|
369
|
-
summary: `Fetched ${
|
|
370
|
+
blocks: a.blocks || [],
|
|
371
|
+
fullContent: a.fullContent || "",
|
|
372
|
+
pageUrl: a.pageUrl || "",
|
|
373
|
+
pageTitle: a.pageTitle || "",
|
|
374
|
+
summary: `Fetched ${a.blocks?.length || 0} blocks from ${a.pageTitle || e}`
|
|
370
375
|
};
|
|
371
376
|
} catch (n) {
|
|
372
377
|
return {
|
|
@@ -374,37 +379,37 @@ function dt({
|
|
|
374
379
|
error: n instanceof Error ? n.message : "Unknown error occurred"
|
|
375
380
|
};
|
|
376
381
|
}
|
|
377
|
-
} : null, [
|
|
378
|
-
if (
|
|
379
|
-
const t =
|
|
380
|
-
return
|
|
381
|
-
remoteToolCount:
|
|
382
|
-
localToolCount:
|
|
382
|
+
} : null, [A, w, C]), pe = v(() => {
|
|
383
|
+
if (E && E.config?.tools) {
|
|
384
|
+
const t = ut(E.config.tools, f);
|
|
385
|
+
return j && console.log("[useAgent] Merged remote config:", {
|
|
386
|
+
remoteToolCount: E.config.tools.length,
|
|
387
|
+
localToolCount: f.length,
|
|
383
388
|
mergedToolCount: t.length
|
|
384
389
|
}), t;
|
|
385
390
|
}
|
|
386
|
-
return
|
|
387
|
-
}, [
|
|
388
|
-
const t = [...
|
|
389
|
-
return
|
|
391
|
+
return f;
|
|
392
|
+
}, [E, f]), J = E?.enableRagTools ?? A?.enabled ?? !1, Ie = v(() => {
|
|
393
|
+
const t = [...pe, ...i];
|
|
394
|
+
return J && (V && t.push(V), Y && t.push(Y)), t;
|
|
390
395
|
}, [
|
|
391
|
-
|
|
392
|
-
|
|
396
|
+
pe,
|
|
397
|
+
i,
|
|
393
398
|
V,
|
|
394
399
|
Y,
|
|
395
|
-
|
|
396
|
-
]),
|
|
397
|
-
() => [...
|
|
398
|
-
[
|
|
399
|
-
), K =
|
|
400
|
-
() =>
|
|
401
|
-
[
|
|
402
|
-
),
|
|
400
|
+
J
|
|
401
|
+
]), Be = v(
|
|
402
|
+
() => [...pe, ...i],
|
|
403
|
+
[pe, i]
|
|
404
|
+
), K = v(
|
|
405
|
+
() => ct(Be, x),
|
|
406
|
+
[Be, x]
|
|
407
|
+
), se = v(() => {
|
|
403
408
|
const t = /* @__PURE__ */ new Map(), e = new Map(K.map((o) => [o.name, o]));
|
|
404
|
-
return
|
|
405
|
-
if (o === V || o === Y)
|
|
409
|
+
return A?.enabled && (V && t.set("searchDocs", V), Y && t.set("fetchDocContent", Y)), S && (de && t.set("todo_read", de), he && t.set("todo_write", he)), Ie.forEach((o) => {
|
|
410
|
+
if (o === V || o === Y || o === de || o === he)
|
|
406
411
|
return;
|
|
407
|
-
const r = o[
|
|
412
|
+
const r = o[B];
|
|
408
413
|
if (r) {
|
|
409
414
|
const s = e.get(r);
|
|
410
415
|
if (s) {
|
|
@@ -416,14 +421,17 @@ function dt({
|
|
|
416
421
|
n && t.set(n.name, o);
|
|
417
422
|
}), t;
|
|
418
423
|
}, [
|
|
419
|
-
|
|
424
|
+
Ie,
|
|
420
425
|
K,
|
|
421
426
|
V,
|
|
422
427
|
Y,
|
|
423
|
-
|
|
424
|
-
|
|
428
|
+
A,
|
|
429
|
+
S,
|
|
430
|
+
de,
|
|
431
|
+
he
|
|
432
|
+
]), Je = v(() => new Set(K.map((t) => t.name)), [K]), Pe = v(() => {
|
|
425
433
|
const t = [];
|
|
426
|
-
|
|
434
|
+
J && t.push(
|
|
427
435
|
{
|
|
428
436
|
name: "searchDocs",
|
|
429
437
|
description: "Search documentation using semantic search. Returns relevant results with snippets and scores. Use this first to find relevant documentation. Default returns 20 results - use higher k values (30-50) when you need to find many sources.",
|
|
@@ -475,51 +483,97 @@ function dt({
|
|
|
475
483
|
}
|
|
476
484
|
);
|
|
477
485
|
const e = [];
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
type:
|
|
483
|
-
description:
|
|
484
|
-
},
|
|
486
|
+
E?.config?.workflows && E.config.workflows.forEach((r) => {
|
|
487
|
+
const n = {}, s = [];
|
|
488
|
+
r.parameters && r.parameters.forEach((a) => {
|
|
489
|
+
n[a.name] = {
|
|
490
|
+
type: a.type || "string",
|
|
491
|
+
description: a.description
|
|
492
|
+
}, a.required && s.push(a.name);
|
|
485
493
|
}), e.push({
|
|
486
|
-
name: `workflow_${
|
|
487
|
-
description:
|
|
494
|
+
name: `workflow_${r.name.replace(/\s+/g, "_").toLowerCase()}`,
|
|
495
|
+
description: r.description || `Execute the "${r.name}" workflow. ${r.contentPlaintext?.slice(0, 200) || ""}`,
|
|
488
496
|
jsonSchema: {
|
|
489
497
|
type: "object",
|
|
490
|
-
properties:
|
|
491
|
-
required:
|
|
498
|
+
properties: n,
|
|
499
|
+
required: s
|
|
492
500
|
},
|
|
493
501
|
// Store workflow metadata for execution
|
|
494
|
-
_workflow:
|
|
502
|
+
_workflow: r
|
|
495
503
|
});
|
|
496
|
-
})
|
|
497
|
-
|
|
504
|
+
});
|
|
505
|
+
const o = [];
|
|
506
|
+
return S && o.push(
|
|
507
|
+
{
|
|
508
|
+
name: "todo_read",
|
|
509
|
+
description: "Read the current todo list. Returns all todo items with their status (pending, in_progress, completed).",
|
|
510
|
+
jsonSchema: {
|
|
511
|
+
type: "object",
|
|
512
|
+
properties: {},
|
|
513
|
+
required: []
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: "todo_write",
|
|
518
|
+
description: "Write/update the todo list. Pass the complete list of todos to replace the current list. Each todo must have id, content, and status (pending, in_progress, completed).",
|
|
519
|
+
jsonSchema: {
|
|
520
|
+
type: "object",
|
|
521
|
+
properties: {
|
|
522
|
+
todoList: {
|
|
523
|
+
type: "array",
|
|
524
|
+
description: "The complete list of todo items",
|
|
525
|
+
items: {
|
|
526
|
+
type: "object",
|
|
527
|
+
properties: {
|
|
528
|
+
id: {
|
|
529
|
+
type: "string",
|
|
530
|
+
description: "Unique identifier for the todo item"
|
|
531
|
+
},
|
|
532
|
+
content: {
|
|
533
|
+
type: "string",
|
|
534
|
+
description: "The content/description of the todo item"
|
|
535
|
+
},
|
|
536
|
+
status: {
|
|
537
|
+
type: "string",
|
|
538
|
+
enum: ["pending", "in_progress", "completed"],
|
|
539
|
+
description: "The current status of the todo item"
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
required: ["id", "content", "status"]
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
required: ["todoList"]
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
), [...K, ...t, ...e, ...o];
|
|
550
|
+
}, [K, J, E, S]), re = v(() => Pe.filter((t) => t.name === "searchDocs" || t.name === "fetchDocContent" ? J : t.name.startsWith("workflow_") ? !0 : t.name === "todo_read" || t.name === "todo_write" ? S : Je.has(t.name)), [Pe, Je, J, S]), me = v(() => {
|
|
498
551
|
const t = /* @__PURE__ */ new Set();
|
|
499
|
-
return
|
|
552
|
+
return J && A?.autoExecute !== !1 && (t.add("searchDocs"), t.add("fetchDocContent")), S && (t.add("todo_read"), t.add("todo_write")), E?.config?.tools ? E.config.tools.forEach((e) => {
|
|
500
553
|
e.isEnabled && !e.requiresApproval && t.add(e.name);
|
|
501
|
-
}) : (
|
|
502
|
-
for (const [o, r] of
|
|
554
|
+
}) : (i.forEach((e) => {
|
|
555
|
+
for (const [o, r] of se.entries())
|
|
503
556
|
if (r === e) {
|
|
504
557
|
t.add(o);
|
|
505
558
|
break;
|
|
506
559
|
}
|
|
507
|
-
}),
|
|
560
|
+
}), $ && Array.isArray($) && $.forEach((e) => {
|
|
508
561
|
typeof e == "string" && t.add(e);
|
|
509
|
-
})),
|
|
562
|
+
})), E?.config?.workflows && E.config.workflows.forEach((e) => {
|
|
510
563
|
const o = `workflow_${e.name.replace(/\s+/g, "_").toLowerCase()}`;
|
|
511
564
|
e.requiresApproval || t.add(o);
|
|
512
565
|
}), t;
|
|
513
566
|
}, [
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
567
|
+
E,
|
|
568
|
+
i,
|
|
569
|
+
$,
|
|
570
|
+
se,
|
|
571
|
+
J,
|
|
572
|
+
A,
|
|
519
573
|
S
|
|
520
574
|
]);
|
|
521
575
|
R(() => {
|
|
522
|
-
if (
|
|
576
|
+
if (g || m)
|
|
523
577
|
return;
|
|
524
578
|
let t = !1, e = null;
|
|
525
579
|
const o = async (r = 1, n = 3) => {
|
|
@@ -531,24 +585,24 @@ function dt({
|
|
|
531
585
|
"Content-Type": "application/json"
|
|
532
586
|
},
|
|
533
587
|
body: JSON.stringify({
|
|
534
|
-
user:
|
|
588
|
+
user: y
|
|
535
589
|
})
|
|
536
590
|
});
|
|
537
591
|
if (!s.ok)
|
|
538
592
|
throw new Error("Failed to fetch token");
|
|
539
|
-
const
|
|
540
|
-
t || (
|
|
593
|
+
const a = await s.json();
|
|
594
|
+
t || (be(a.clientToken), C.current = a.clientToken, ke(a.expiresAt), ne(null));
|
|
541
595
|
} catch (s) {
|
|
542
596
|
if (console.error(
|
|
543
597
|
`[useAgent] Token fetch failed (attempt ${r}/${n}):`,
|
|
544
598
|
s
|
|
545
599
|
), r < n && !t) {
|
|
546
|
-
const
|
|
600
|
+
const a = Math.pow(2, r - 1) * 1e3;
|
|
547
601
|
e = setTimeout(
|
|
548
602
|
() => o(r + 1, n),
|
|
549
|
-
|
|
603
|
+
a
|
|
550
604
|
);
|
|
551
|
-
} else t ||
|
|
605
|
+
} else t || ne(
|
|
552
606
|
s instanceof Error ? s.message : "Failed to fetch token"
|
|
553
607
|
);
|
|
554
608
|
}
|
|
@@ -556,11 +610,11 @@ function dt({
|
|
|
556
610
|
return o(), () => {
|
|
557
611
|
t = !0, e && clearTimeout(e), H.current && clearTimeout(H.current);
|
|
558
612
|
};
|
|
559
|
-
}, [c, JSON.stringify(
|
|
560
|
-
if (!
|
|
613
|
+
}, [c, JSON.stringify(y), g, m]), R(() => {
|
|
614
|
+
if (!oe || g || m)
|
|
561
615
|
return;
|
|
562
616
|
H.current && clearTimeout(H.current);
|
|
563
|
-
const t = async (s = 1,
|
|
617
|
+
const t = async (s = 1, a = 3) => {
|
|
564
618
|
try {
|
|
565
619
|
const d = await fetch(c, {
|
|
566
620
|
method: "POST",
|
|
@@ -568,26 +622,26 @@ function dt({
|
|
|
568
622
|
"Content-Type": "application/json"
|
|
569
623
|
},
|
|
570
624
|
body: JSON.stringify({
|
|
571
|
-
user:
|
|
625
|
+
user: y
|
|
572
626
|
})
|
|
573
627
|
});
|
|
574
628
|
if (!d.ok)
|
|
575
629
|
throw new Error("Failed to refresh token");
|
|
576
|
-
const
|
|
577
|
-
|
|
630
|
+
const l = await d.json();
|
|
631
|
+
be(l.clientToken), C.current = l.clientToken, ke(l.expiresAt), ne(null);
|
|
578
632
|
} catch (d) {
|
|
579
633
|
if (console.error(
|
|
580
|
-
`[useAgent] Token refresh failed (attempt ${s}/${
|
|
634
|
+
`[useAgent] Token refresh failed (attempt ${s}/${a}):`,
|
|
581
635
|
d
|
|
582
|
-
), s <
|
|
583
|
-
const
|
|
584
|
-
setTimeout(() => t(s + 1,
|
|
636
|
+
), s < a) {
|
|
637
|
+
const l = Math.pow(2, s - 1) * 1e3;
|
|
638
|
+
setTimeout(() => t(s + 1, a), l);
|
|
585
639
|
} else
|
|
586
|
-
|
|
640
|
+
ne(
|
|
587
641
|
d instanceof Error ? d.message : "Failed to refresh token"
|
|
588
642
|
);
|
|
589
643
|
}
|
|
590
|
-
}, e = Math.floor(Date.now() / 1e3), o =
|
|
644
|
+
}, e = Math.floor(Date.now() / 1e3), o = oe - e, n = Math.max(0, o - 5);
|
|
591
645
|
return H.current = setTimeout(
|
|
592
646
|
() => t(),
|
|
593
647
|
n * 1e3
|
|
@@ -595,28 +649,28 @@ function dt({
|
|
|
595
649
|
H.current && clearTimeout(H.current);
|
|
596
650
|
};
|
|
597
651
|
}, [
|
|
598
|
-
|
|
652
|
+
oe,
|
|
599
653
|
c,
|
|
600
|
-
JSON.stringify(
|
|
601
|
-
|
|
654
|
+
JSON.stringify(y),
|
|
655
|
+
g,
|
|
602
656
|
m
|
|
603
657
|
]), R(() => {
|
|
604
|
-
if (
|
|
658
|
+
if (g || m)
|
|
605
659
|
return;
|
|
606
660
|
const t = async () => {
|
|
607
661
|
if (document.visibilityState !== "visible") return;
|
|
608
662
|
const e = Math.floor(Date.now() / 1e3);
|
|
609
|
-
if (!
|
|
610
|
-
|
|
663
|
+
if (!oe || oe <= e + 5) {
|
|
664
|
+
j && console.log("[useAgent] Tab visible, token expired - refreshing");
|
|
611
665
|
try {
|
|
612
666
|
const r = await fetch(c, {
|
|
613
667
|
method: "POST",
|
|
614
668
|
headers: { "Content-Type": "application/json" },
|
|
615
|
-
body: JSON.stringify({ user:
|
|
669
|
+
body: JSON.stringify({ user: y })
|
|
616
670
|
});
|
|
617
671
|
if (r.ok) {
|
|
618
672
|
const n = await r.json();
|
|
619
|
-
|
|
673
|
+
be(n.clientToken), C.current = n.clientToken, ke(n.expiresAt), ne(null);
|
|
620
674
|
}
|
|
621
675
|
} catch (r) {
|
|
622
676
|
console.error(
|
|
@@ -629,43 +683,43 @@ function dt({
|
|
|
629
683
|
return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
|
|
630
684
|
}, [
|
|
631
685
|
c,
|
|
632
|
-
JSON.stringify(
|
|
633
|
-
|
|
634
|
-
|
|
686
|
+
JSON.stringify(y),
|
|
687
|
+
oe,
|
|
688
|
+
g,
|
|
635
689
|
m
|
|
636
690
|
]);
|
|
637
|
-
const
|
|
691
|
+
const Ge = async (t, e = {}) => {
|
|
638
692
|
const o = e.headers ? new Headers(e.headers) : new Headers();
|
|
639
693
|
return o.delete("user-agent"), o.delete("User-Agent"), fetch(t, { ...e, headers: o });
|
|
640
|
-
},
|
|
641
|
-
messages:
|
|
642
|
-
sendMessage:
|
|
643
|
-
status:
|
|
644
|
-
error:
|
|
645
|
-
stop:
|
|
646
|
-
addToolResult:
|
|
647
|
-
setMessages:
|
|
648
|
-
} =
|
|
649
|
-
id:
|
|
650
|
-
messages:
|
|
651
|
-
transport: new
|
|
652
|
-
api:
|
|
653
|
-
fetch:
|
|
694
|
+
}, Ce = z(null), He = `${w}/chat`, {
|
|
695
|
+
messages: P,
|
|
696
|
+
sendMessage: Ve,
|
|
697
|
+
status: ve,
|
|
698
|
+
error: je,
|
|
699
|
+
stop: Ye,
|
|
700
|
+
addToolResult: Oe,
|
|
701
|
+
setMessages: Ne
|
|
702
|
+
} = nt({
|
|
703
|
+
id: Te || void 0,
|
|
704
|
+
messages: U,
|
|
705
|
+
transport: new st({
|
|
706
|
+
api: He,
|
|
707
|
+
fetch: Ge,
|
|
654
708
|
headers: () => {
|
|
655
709
|
const t = {};
|
|
656
|
-
return
|
|
710
|
+
return C.current && (t.Authorization = `Bearer ${C.current}`), t;
|
|
657
711
|
},
|
|
658
712
|
body: () => {
|
|
659
|
-
const t =
|
|
713
|
+
const t = re.map((o) => ({
|
|
660
714
|
name: o.name,
|
|
661
715
|
description: o.description,
|
|
662
716
|
inputSchema: o.jsonSchema
|
|
663
|
-
})), e =
|
|
717
|
+
})), e = te.current;
|
|
664
718
|
return {
|
|
665
719
|
tools: t,
|
|
666
|
-
...
|
|
720
|
+
...W && { agentId: W },
|
|
667
721
|
...Z && { agentName: Z },
|
|
668
|
-
...
|
|
722
|
+
...L && { ragFilters: L },
|
|
669
723
|
...e && { state: e }
|
|
670
724
|
};
|
|
671
725
|
}
|
|
@@ -674,43 +728,43 @@ function dt({
|
|
|
674
728
|
const e = t.messages;
|
|
675
729
|
if (e[e.length - 1]?.role !== "assistant")
|
|
676
730
|
return !1;
|
|
677
|
-
const n = [...e].reverse().find((
|
|
678
|
-
if (n &&
|
|
731
|
+
const n = [...e].reverse().find((a) => a.role === "user")?.id;
|
|
732
|
+
if (n && Ce.current === n)
|
|
679
733
|
return !1;
|
|
680
|
-
const s =
|
|
681
|
-
return s && n && (
|
|
734
|
+
const s = at(t);
|
|
735
|
+
return s && n && (Ce.current = n), s;
|
|
682
736
|
}
|
|
683
|
-
}),
|
|
684
|
-
(t) => (
|
|
685
|
-
[
|
|
686
|
-
), Q =
|
|
737
|
+
}), ze = Ve, Ke = ye(
|
|
738
|
+
(t) => (Ce.current = null, fe.current = /* @__PURE__ */ new Set(), ze(t)),
|
|
739
|
+
[ze]
|
|
740
|
+
), Q = ye(
|
|
687
741
|
(t, e, o) => {
|
|
688
|
-
|
|
742
|
+
Oe({
|
|
689
743
|
toolCallId: e,
|
|
690
744
|
tool: t,
|
|
691
745
|
output: o
|
|
692
746
|
});
|
|
693
747
|
},
|
|
694
|
-
[
|
|
748
|
+
[Oe]
|
|
695
749
|
);
|
|
696
750
|
R(() => {
|
|
697
|
-
|
|
751
|
+
P.forEach((t) => {
|
|
698
752
|
t.role === "assistant" && t.parts.forEach((e) => {
|
|
699
753
|
if (!e.type?.startsWith("tool-") || e.state !== "input-available") return;
|
|
700
754
|
const o = e.type.replace("tool-", ""), r = e.toolCallId;
|
|
701
|
-
if (
|
|
702
|
-
|
|
755
|
+
if (ue.current.has(r) || Ee.current.has(r)) {
|
|
756
|
+
j && console.log(
|
|
703
757
|
`[useAgent] Skipping ${o} (${r}) - already processing or completed`
|
|
704
758
|
);
|
|
705
759
|
return;
|
|
706
760
|
}
|
|
707
|
-
|
|
761
|
+
j && console.log(`[useAgent] Starting ${o} (${r})`), ue.current.add(r);
|
|
708
762
|
const n = (d) => {
|
|
709
|
-
|
|
710
|
-
}, s =
|
|
711
|
-
if (
|
|
712
|
-
|
|
713
|
-
`[useAgent] Skipping duplicate tool call: ${
|
|
763
|
+
j && console.log(`[useAgent] Completed ${o} (${d})`), Ee.current.add(d), ue.current.delete(d);
|
|
764
|
+
}, s = lt(e.input), a = `${o}:${JSON.stringify(s)}`;
|
|
765
|
+
if (fe.current.has(a)) {
|
|
766
|
+
j && console.log(
|
|
767
|
+
`[useAgent] Skipping duplicate tool call: ${a}`
|
|
714
768
|
), Q(
|
|
715
769
|
o,
|
|
716
770
|
r,
|
|
@@ -718,50 +772,50 @@ function dt({
|
|
|
718
772
|
), n(r);
|
|
719
773
|
return;
|
|
720
774
|
}
|
|
721
|
-
if (o.startsWith("workflow_") &&
|
|
775
|
+
if (o.startsWith("workflow_") && me.has(o)) {
|
|
722
776
|
(async () => {
|
|
723
777
|
try {
|
|
724
|
-
const
|
|
778
|
+
const l = re.find(
|
|
725
779
|
(h) => h.name === o
|
|
726
780
|
)?._workflow;
|
|
727
|
-
if (!
|
|
781
|
+
if (!l)
|
|
728
782
|
throw new Error(`Workflow metadata not found for ${o}`);
|
|
729
783
|
let b;
|
|
730
|
-
if (
|
|
784
|
+
if (l.webhook?.url) {
|
|
731
785
|
let h = s;
|
|
732
|
-
if (
|
|
733
|
-
let
|
|
734
|
-
Object.entries(s).forEach(([
|
|
735
|
-
|
|
736
|
-
new RegExp(`\\{\\{${
|
|
737
|
-
String(
|
|
786
|
+
if (l.webhook.bodyTemplate) {
|
|
787
|
+
let N = l.webhook.bodyTemplate;
|
|
788
|
+
Object.entries(s).forEach(([ge, rt]) => {
|
|
789
|
+
N = N.replace(
|
|
790
|
+
new RegExp(`\\{\\{${ge}\\}\\}`, "g"),
|
|
791
|
+
String(rt)
|
|
738
792
|
);
|
|
739
|
-
}), h = JSON.parse(
|
|
793
|
+
}), h = JSON.parse(N);
|
|
740
794
|
}
|
|
741
|
-
const p = await fetch(
|
|
742
|
-
method:
|
|
795
|
+
const p = await fetch(l.webhook.url, {
|
|
796
|
+
method: l.webhook.method || "POST",
|
|
743
797
|
headers: {
|
|
744
798
|
"Content-Type": "application/json",
|
|
745
|
-
...
|
|
799
|
+
...l.webhook.headers || {}
|
|
746
800
|
},
|
|
747
801
|
body: JSON.stringify(h)
|
|
748
802
|
});
|
|
749
803
|
if (p.ok)
|
|
750
804
|
b = { success: !0, data: await p.json().catch(() => ({ success: !0 })) };
|
|
751
805
|
else {
|
|
752
|
-
const
|
|
806
|
+
const N = await p.text();
|
|
753
807
|
b = {
|
|
754
808
|
success: !1,
|
|
755
|
-
error: `Webhook failed: ${p.status} ${
|
|
809
|
+
error: `Webhook failed: ${p.status} ${N}`
|
|
756
810
|
};
|
|
757
811
|
}
|
|
758
812
|
} else
|
|
759
813
|
b = {
|
|
760
814
|
success: !0,
|
|
761
|
-
message: `Workflow "${
|
|
762
|
-
instructions:
|
|
815
|
+
message: `Workflow "${l.name}" acknowledged. Follow the workflow instructions to proceed.`,
|
|
816
|
+
instructions: l.contentPlaintext
|
|
763
817
|
};
|
|
764
|
-
n(r), Q(o, r, b),
|
|
818
|
+
n(r), Q(o, r, b), fe.current.add(a);
|
|
765
819
|
} catch (d) {
|
|
766
820
|
console.error(
|
|
767
821
|
`[useAgent] Error executing workflow ${o}:`,
|
|
@@ -771,43 +825,43 @@ function dt({
|
|
|
771
825
|
})();
|
|
772
826
|
return;
|
|
773
827
|
}
|
|
774
|
-
if (
|
|
775
|
-
const d =
|
|
828
|
+
if (me.has(o)) {
|
|
829
|
+
const d = se.get(o);
|
|
776
830
|
d ? (async () => {
|
|
777
831
|
try {
|
|
778
|
-
const
|
|
832
|
+
const l = re.find(
|
|
779
833
|
(h) => h.name === o
|
|
780
834
|
);
|
|
781
835
|
let b;
|
|
782
|
-
if (
|
|
836
|
+
if (l && l.jsonSchema?.properties) {
|
|
783
837
|
const p = Object.keys(
|
|
784
|
-
|
|
838
|
+
l.jsonSchema.properties
|
|
785
839
|
).map(
|
|
786
|
-
(
|
|
840
|
+
(N) => s[N]
|
|
787
841
|
);
|
|
788
842
|
b = await d(...p);
|
|
789
843
|
} else
|
|
790
844
|
b = await d(...Object.values(s));
|
|
791
|
-
n(r), Q(o, r, b),
|
|
792
|
-
} catch (
|
|
845
|
+
n(r), Q(o, r, b), fe.current.add(a);
|
|
846
|
+
} catch (l) {
|
|
793
847
|
console.error(
|
|
794
848
|
`[useAgent] Error executing tool ${o}:`,
|
|
795
|
-
|
|
796
|
-
), n(r), Q(o, r, `Error: ${
|
|
849
|
+
l
|
|
850
|
+
), n(r), Q(o, r, `Error: ${l}`);
|
|
797
851
|
}
|
|
798
|
-
})() : (
|
|
852
|
+
})() : (j && console.warn(`[useAgent] Tool ${o} not found in toolsMap`), Q(
|
|
799
853
|
o,
|
|
800
854
|
r,
|
|
801
855
|
`Error: Tool "${o}" not found. The tool may not be registered or available.`
|
|
802
856
|
), n(r));
|
|
803
|
-
} else if (o.startsWith("workflow_") &&
|
|
804
|
-
|
|
857
|
+
} else if (o.startsWith("workflow_") && I)
|
|
858
|
+
I({ toolCall: {
|
|
805
859
|
toolCallId: r,
|
|
806
860
|
toolName: o,
|
|
807
861
|
args: s
|
|
808
862
|
} });
|
|
809
|
-
else if (
|
|
810
|
-
|
|
863
|
+
else if (I)
|
|
864
|
+
I({ toolCall: {
|
|
811
865
|
toolCallId: r,
|
|
812
866
|
toolName: o,
|
|
813
867
|
args: s
|
|
@@ -818,116 +872,116 @@ function dt({
|
|
|
818
872
|
toolName: o,
|
|
819
873
|
args: s
|
|
820
874
|
};
|
|
821
|
-
|
|
822
|
-
const b = new Map(
|
|
875
|
+
Se((l) => {
|
|
876
|
+
const b = new Map(l);
|
|
823
877
|
return b.set(r, d), b;
|
|
824
878
|
});
|
|
825
879
|
}
|
|
826
880
|
});
|
|
827
881
|
});
|
|
828
882
|
}, [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
883
|
+
P,
|
|
884
|
+
me,
|
|
885
|
+
se,
|
|
886
|
+
I,
|
|
833
887
|
Q,
|
|
834
|
-
|
|
888
|
+
re
|
|
835
889
|
]), R(() => {
|
|
836
|
-
if (
|
|
837
|
-
const t =
|
|
890
|
+
if (ve === "ready" && P.length > 0 && F) {
|
|
891
|
+
const t = P[P.length - 1];
|
|
838
892
|
t && t.role === "assistant" && F({
|
|
839
893
|
message: t,
|
|
840
|
-
messages:
|
|
894
|
+
messages: P,
|
|
841
895
|
isAbort: !1,
|
|
842
896
|
isDisconnect: !1,
|
|
843
|
-
isError: !!
|
|
897
|
+
isError: !!je
|
|
844
898
|
});
|
|
845
899
|
}
|
|
846
|
-
}, [
|
|
847
|
-
async function
|
|
848
|
-
if (!(!
|
|
849
|
-
|
|
900
|
+
}, [ve, P, je, F]);
|
|
901
|
+
async function Qe() {
|
|
902
|
+
if (!(!y?.id || !G)) {
|
|
903
|
+
le(!0);
|
|
850
904
|
try {
|
|
851
|
-
const e = await (await fetch(`${
|
|
905
|
+
const e = await (await fetch(`${w}/conversations`, {
|
|
852
906
|
headers: {
|
|
853
907
|
Authorization: `Bearer ${G}`
|
|
854
908
|
}
|
|
855
909
|
})).json();
|
|
856
|
-
|
|
910
|
+
De(e.conversations || []);
|
|
857
911
|
} catch (t) {
|
|
858
912
|
console.error("Failed to fetch conversations:", t);
|
|
859
913
|
} finally {
|
|
860
|
-
|
|
914
|
+
le(!1);
|
|
861
915
|
}
|
|
862
916
|
}
|
|
863
917
|
}
|
|
864
918
|
R(() => {
|
|
865
|
-
|
|
866
|
-
}, [JSON.stringify(
|
|
867
|
-
async function
|
|
868
|
-
|
|
919
|
+
y?.id && G && Qe();
|
|
920
|
+
}, [JSON.stringify(y), G, w]);
|
|
921
|
+
async function Xe(t) {
|
|
922
|
+
Ue(t), le(!0);
|
|
869
923
|
try {
|
|
870
924
|
const e = await fetch(
|
|
871
|
-
`${
|
|
925
|
+
`${w}/conversations/${t}/messages`,
|
|
872
926
|
{
|
|
873
927
|
headers: {
|
|
874
|
-
Authorization: `Bearer ${
|
|
928
|
+
Authorization: `Bearer ${C.current}`
|
|
875
929
|
}
|
|
876
930
|
}
|
|
877
931
|
);
|
|
878
932
|
if (!e.ok)
|
|
879
933
|
throw new Error(`Failed to fetch messages: ${e.statusText}`);
|
|
880
934
|
const r = (await e.json()).messages || [];
|
|
881
|
-
|
|
935
|
+
Ne(r);
|
|
882
936
|
} catch (e) {
|
|
883
937
|
console.error("Failed to load conversation messages:", e);
|
|
884
938
|
} finally {
|
|
885
|
-
|
|
939
|
+
le(!1);
|
|
886
940
|
}
|
|
887
941
|
}
|
|
888
|
-
async function
|
|
942
|
+
async function Ze(t) {
|
|
889
943
|
if (G)
|
|
890
944
|
try {
|
|
891
|
-
await fetch(`${
|
|
945
|
+
await fetch(`${w}/conversations/${t}`, {
|
|
892
946
|
method: "DELETE",
|
|
893
947
|
headers: {
|
|
894
948
|
Authorization: `Bearer ${G}`
|
|
895
949
|
}
|
|
896
|
-
}),
|
|
950
|
+
}), De(Re.filter((e) => e._id !== t)), t === Te && We();
|
|
897
951
|
} catch (e) {
|
|
898
952
|
console.error("Failed to delete conversation:", e);
|
|
899
953
|
}
|
|
900
954
|
}
|
|
901
|
-
function
|
|
955
|
+
function We() {
|
|
902
956
|
const t = crypto.randomUUID();
|
|
903
|
-
|
|
957
|
+
Ue(t), Ne([]), ue.current = /* @__PURE__ */ new Set(), Ee.current = /* @__PURE__ */ new Set();
|
|
904
958
|
}
|
|
905
959
|
function X(t) {
|
|
906
960
|
const e = t.tool || "unknown-tool";
|
|
907
|
-
|
|
961
|
+
Oe({
|
|
908
962
|
toolCallId: t.toolCallId,
|
|
909
963
|
tool: e,
|
|
910
964
|
output: t.output
|
|
911
965
|
});
|
|
912
966
|
}
|
|
913
|
-
async function
|
|
967
|
+
async function et(t, e, o) {
|
|
914
968
|
if (!e.startsWith("workflow_"))
|
|
915
969
|
throw new Error(`${e} is not a workflow tool`);
|
|
916
970
|
try {
|
|
917
|
-
const n =
|
|
971
|
+
const n = re.find((a) => a.name === e)?._workflow;
|
|
918
972
|
if (!n)
|
|
919
973
|
throw new Error(`Workflow metadata not found for ${e}`);
|
|
920
974
|
let s;
|
|
921
975
|
if (n.webhook?.url) {
|
|
922
|
-
let
|
|
976
|
+
let a = o;
|
|
923
977
|
if (n.webhook.bodyTemplate) {
|
|
924
|
-
let
|
|
978
|
+
let l = n.webhook.bodyTemplate;
|
|
925
979
|
Object.entries(o).forEach(([b, h]) => {
|
|
926
|
-
|
|
980
|
+
l = l.replace(
|
|
927
981
|
new RegExp(`\\{\\{${b}\\}\\}`, "g"),
|
|
928
982
|
String(h)
|
|
929
983
|
);
|
|
930
|
-
}),
|
|
984
|
+
}), a = JSON.parse(l);
|
|
931
985
|
}
|
|
932
986
|
const d = await fetch(n.webhook.url, {
|
|
933
987
|
method: n.webhook.method || "POST",
|
|
@@ -935,15 +989,15 @@ function dt({
|
|
|
935
989
|
"Content-Type": "application/json",
|
|
936
990
|
...n.webhook.headers || {}
|
|
937
991
|
},
|
|
938
|
-
body: JSON.stringify(
|
|
992
|
+
body: JSON.stringify(a)
|
|
939
993
|
});
|
|
940
994
|
if (d.ok)
|
|
941
995
|
s = { success: !0, data: await d.json().catch(() => ({ success: !0 })) };
|
|
942
996
|
else {
|
|
943
|
-
const
|
|
997
|
+
const l = await d.text();
|
|
944
998
|
s = {
|
|
945
999
|
success: !1,
|
|
946
|
-
error: `Webhook failed: ${d.status} ${
|
|
1000
|
+
error: `Webhook failed: ${d.status} ${l}`
|
|
947
1001
|
};
|
|
948
1002
|
}
|
|
949
1003
|
} else
|
|
@@ -958,24 +1012,24 @@ function dt({
|
|
|
958
1012
|
throw X({ toolCallId: t, tool: e, output: n }), r;
|
|
959
1013
|
}
|
|
960
1014
|
}
|
|
961
|
-
async function
|
|
962
|
-
const e =
|
|
1015
|
+
async function tt(t) {
|
|
1016
|
+
const e = $e.get(t);
|
|
963
1017
|
if (!e) {
|
|
964
|
-
|
|
1018
|
+
j && console.warn(`[useAgent] Tool call ${t} not found in pending approvals`);
|
|
965
1019
|
return;
|
|
966
1020
|
}
|
|
967
|
-
|
|
1021
|
+
Se((r) => {
|
|
968
1022
|
const n = new Map(r);
|
|
969
1023
|
return n.delete(t), n;
|
|
970
1024
|
});
|
|
971
|
-
const o =
|
|
1025
|
+
const o = se.get(e.toolName);
|
|
972
1026
|
if (o)
|
|
973
1027
|
try {
|
|
974
|
-
const r =
|
|
1028
|
+
const r = re.find((s) => s.name === e.toolName);
|
|
975
1029
|
let n;
|
|
976
1030
|
if (r && r.jsonSchema?.properties) {
|
|
977
|
-
const
|
|
978
|
-
n = await o(...
|
|
1031
|
+
const a = Object.keys(r.jsonSchema.properties).map((d) => e.args[d]);
|
|
1032
|
+
n = await o(...a);
|
|
979
1033
|
} else
|
|
980
1034
|
n = await o(...Object.values(e.args));
|
|
981
1035
|
X({
|
|
@@ -991,19 +1045,19 @@ function dt({
|
|
|
991
1045
|
});
|
|
992
1046
|
}
|
|
993
1047
|
else
|
|
994
|
-
|
|
1048
|
+
j && console.warn(`[useAgent] Tool ${e.toolName} not found in toolsMap`), X({
|
|
995
1049
|
toolCallId: e.toolCallId,
|
|
996
1050
|
tool: e.toolName,
|
|
997
1051
|
output: `Error: Tool "${e.toolName}" not found`
|
|
998
1052
|
});
|
|
999
1053
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const e =
|
|
1054
|
+
function ot(t) {
|
|
1055
|
+
const e = $e.get(t);
|
|
1002
1056
|
if (!e) {
|
|
1003
|
-
|
|
1057
|
+
j && console.warn(`[useAgent] Tool call ${t} not found in pending approvals`);
|
|
1004
1058
|
return;
|
|
1005
1059
|
}
|
|
1006
|
-
|
|
1060
|
+
Se((o) => {
|
|
1007
1061
|
const r = new Map(o);
|
|
1008
1062
|
return r.delete(t), r;
|
|
1009
1063
|
}), X({
|
|
@@ -1013,151 +1067,153 @@ function dt({
|
|
|
1013
1067
|
});
|
|
1014
1068
|
}
|
|
1015
1069
|
return {
|
|
1016
|
-
id:
|
|
1017
|
-
messages:
|
|
1018
|
-
status:
|
|
1019
|
-
error:
|
|
1020
|
-
sendMessage:
|
|
1021
|
-
stop:
|
|
1070
|
+
id: Te,
|
|
1071
|
+
messages: P,
|
|
1072
|
+
status: ve,
|
|
1073
|
+
error: je,
|
|
1074
|
+
sendMessage: Ke,
|
|
1075
|
+
stop: Ye,
|
|
1022
1076
|
addToolOutput: X,
|
|
1023
|
-
executeWorkflowTool:
|
|
1077
|
+
executeWorkflowTool: et,
|
|
1024
1078
|
// Execute workflow tools that require approval
|
|
1025
|
-
setMessages:
|
|
1026
|
-
conversations:
|
|
1027
|
-
loadConversation:
|
|
1028
|
-
deleteConversation:
|
|
1029
|
-
startNewConversation:
|
|
1030
|
-
isLoadingConversations:
|
|
1079
|
+
setMessages: Ne,
|
|
1080
|
+
conversations: Re,
|
|
1081
|
+
loadConversation: Xe,
|
|
1082
|
+
deleteConversation: Ze,
|
|
1083
|
+
startNewConversation: We,
|
|
1084
|
+
isLoadingConversations: Fe,
|
|
1031
1085
|
clientToken: G,
|
|
1032
|
-
tokenError:
|
|
1086
|
+
tokenError: qe,
|
|
1033
1087
|
// Tool approval management
|
|
1034
|
-
pendingToolApprovals: Array.from(
|
|
1035
|
-
approveToolCall:
|
|
1036
|
-
denyToolCall:
|
|
1088
|
+
pendingToolApprovals: Array.from($e.values()),
|
|
1089
|
+
approveToolCall: tt,
|
|
1090
|
+
denyToolCall: ot,
|
|
1037
1091
|
// Tool safety classification (from server config or fallback to props)
|
|
1038
|
-
safeToolNames:
|
|
1092
|
+
safeToolNames: me,
|
|
1093
|
+
// Todo list planning (when planning=true)
|
|
1094
|
+
todos: Ae
|
|
1039
1095
|
};
|
|
1040
1096
|
}
|
|
1041
|
-
function
|
|
1097
|
+
function wt(u = {}) {
|
|
1042
1098
|
const {
|
|
1043
1099
|
apiBaseUrl: c = "https://api.arcten.com",
|
|
1044
1100
|
tokenEndpoint: m = "/token",
|
|
1045
|
-
clientToken:
|
|
1046
|
-
skipTokenFetch:
|
|
1047
|
-
} =
|
|
1101
|
+
clientToken: g,
|
|
1102
|
+
skipTokenFetch: y = !1
|
|
1103
|
+
} = u, [f, i] = _(!1), [$, x] = _(null), M = z(g || null);
|
|
1048
1104
|
R(() => {
|
|
1049
|
-
if (
|
|
1050
|
-
M.current =
|
|
1105
|
+
if (g) {
|
|
1106
|
+
M.current = g;
|
|
1051
1107
|
return;
|
|
1052
1108
|
}
|
|
1053
|
-
if (
|
|
1109
|
+
if (y) return;
|
|
1054
1110
|
(async () => {
|
|
1055
1111
|
try {
|
|
1056
|
-
const
|
|
1112
|
+
const T = await fetch(`${c}${m}`, {
|
|
1057
1113
|
method: "POST",
|
|
1058
1114
|
headers: { "Content-Type": "application/json" }
|
|
1059
1115
|
});
|
|
1060
|
-
if (
|
|
1061
|
-
const k = await
|
|
1116
|
+
if (T.ok) {
|
|
1117
|
+
const k = await T.json();
|
|
1062
1118
|
M.current = k.token;
|
|
1063
1119
|
}
|
|
1064
|
-
} catch (
|
|
1065
|
-
console.error("[useGenerate] Failed to fetch token:",
|
|
1120
|
+
} catch (T) {
|
|
1121
|
+
console.error("[useGenerate] Failed to fetch token:", T);
|
|
1066
1122
|
}
|
|
1067
1123
|
})();
|
|
1068
|
-
}, [c, m,
|
|
1069
|
-
const
|
|
1070
|
-
async (
|
|
1071
|
-
|
|
1124
|
+
}, [c, m, g, y]);
|
|
1125
|
+
const W = ye(
|
|
1126
|
+
async (D) => {
|
|
1127
|
+
i(!0), x(null);
|
|
1072
1128
|
try {
|
|
1073
|
-
const
|
|
1129
|
+
const T = {
|
|
1074
1130
|
"Content-Type": "application/json"
|
|
1075
1131
|
};
|
|
1076
|
-
M.current && (
|
|
1132
|
+
M.current && (T.Authorization = `Bearer ${M.current}`);
|
|
1077
1133
|
const k = await fetch(`${c}/generate`, {
|
|
1078
1134
|
method: "POST",
|
|
1079
|
-
headers:
|
|
1080
|
-
body: JSON.stringify(
|
|
1135
|
+
headers: T,
|
|
1136
|
+
body: JSON.stringify(D)
|
|
1081
1137
|
});
|
|
1082
1138
|
if (!k.ok) {
|
|
1083
1139
|
const ee = await k.json().catch(() => ({}));
|
|
1084
1140
|
throw new Error(ee.error || `HTTP ${k.status}`);
|
|
1085
1141
|
}
|
|
1086
1142
|
return await k.json();
|
|
1087
|
-
} catch (
|
|
1088
|
-
const k =
|
|
1089
|
-
throw x(k),
|
|
1143
|
+
} catch (T) {
|
|
1144
|
+
const k = T instanceof Error ? T.message : String(T);
|
|
1145
|
+
throw x(k), T;
|
|
1090
1146
|
} finally {
|
|
1091
|
-
|
|
1147
|
+
i(!1);
|
|
1092
1148
|
}
|
|
1093
1149
|
},
|
|
1094
1150
|
[c]
|
|
1095
|
-
), Z =
|
|
1096
|
-
async (
|
|
1097
|
-
|
|
1151
|
+
), Z = ye(
|
|
1152
|
+
async (D, T) => {
|
|
1153
|
+
i(!0), x(null);
|
|
1098
1154
|
try {
|
|
1099
1155
|
const k = {
|
|
1100
1156
|
"Content-Type": "application/json"
|
|
1101
1157
|
};
|
|
1102
1158
|
M.current && (k.Authorization = `Bearer ${M.current}`);
|
|
1103
|
-
const
|
|
1159
|
+
const U = await fetch(`${c}/generate/stream`, {
|
|
1104
1160
|
method: "POST",
|
|
1105
1161
|
headers: k,
|
|
1106
|
-
body: JSON.stringify(
|
|
1162
|
+
body: JSON.stringify(D)
|
|
1107
1163
|
});
|
|
1108
|
-
if (!
|
|
1109
|
-
const F = await
|
|
1110
|
-
throw new Error(F.error || `HTTP ${
|
|
1164
|
+
if (!U.ok) {
|
|
1165
|
+
const F = await U.json().catch(() => ({}));
|
|
1166
|
+
throw new Error(F.error || `HTTP ${U.status}`);
|
|
1111
1167
|
}
|
|
1112
|
-
const ee =
|
|
1168
|
+
const ee = U.body?.getReader();
|
|
1113
1169
|
if (!ee)
|
|
1114
1170
|
throw new Error("No response body");
|
|
1115
|
-
const
|
|
1116
|
-
let
|
|
1171
|
+
const q = new TextDecoder();
|
|
1172
|
+
let I = null;
|
|
1117
1173
|
for (; ; ) {
|
|
1118
|
-
const { done: F, value:
|
|
1174
|
+
const { done: F, value: O } = await ee.read();
|
|
1119
1175
|
if (F) break;
|
|
1120
|
-
const
|
|
1121
|
-
`).filter((
|
|
1122
|
-
for (const
|
|
1123
|
-
const
|
|
1124
|
-
if (
|
|
1176
|
+
const L = q.decode(O, { stream: !0 }).split(`
|
|
1177
|
+
`).filter((S) => S.startsWith("data: "));
|
|
1178
|
+
for (const S of L) {
|
|
1179
|
+
const te = S.slice(6).trim();
|
|
1180
|
+
if (te)
|
|
1125
1181
|
try {
|
|
1126
|
-
const
|
|
1127
|
-
if (
|
|
1128
|
-
throw new Error(
|
|
1129
|
-
|
|
1130
|
-
object:
|
|
1131
|
-
usage:
|
|
1132
|
-
finishReason:
|
|
1133
|
-
} :
|
|
1182
|
+
const w = JSON.parse(te);
|
|
1183
|
+
if (w.error)
|
|
1184
|
+
throw new Error(w.error);
|
|
1185
|
+
w.done && w.object ? I = {
|
|
1186
|
+
object: w.object,
|
|
1187
|
+
usage: w.usage,
|
|
1188
|
+
finishReason: w.finishReason
|
|
1189
|
+
} : w.partial && T && T(w.partial);
|
|
1134
1190
|
} catch {
|
|
1135
1191
|
}
|
|
1136
1192
|
}
|
|
1137
1193
|
}
|
|
1138
|
-
if (!
|
|
1194
|
+
if (!I)
|
|
1139
1195
|
throw new Error("Stream ended without final result");
|
|
1140
|
-
return
|
|
1196
|
+
return I;
|
|
1141
1197
|
} catch (k) {
|
|
1142
|
-
const
|
|
1143
|
-
throw x(
|
|
1198
|
+
const U = k instanceof Error ? k.message : String(k);
|
|
1199
|
+
throw x(U), k;
|
|
1144
1200
|
} finally {
|
|
1145
|
-
|
|
1201
|
+
i(!1);
|
|
1146
1202
|
}
|
|
1147
1203
|
},
|
|
1148
1204
|
[c]
|
|
1149
1205
|
);
|
|
1150
1206
|
return {
|
|
1151
|
-
generate:
|
|
1207
|
+
generate: W,
|
|
1152
1208
|
streamGenerate: Z,
|
|
1153
|
-
isLoading:
|
|
1154
|
-
error:
|
|
1209
|
+
isLoading: f,
|
|
1210
|
+
error: $
|
|
1155
1211
|
};
|
|
1156
1212
|
}
|
|
1157
1213
|
export {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1214
|
+
B as ARCTEN_ORIGINAL_NAME,
|
|
1215
|
+
ct as extractToolsMetadata,
|
|
1216
|
+
gt as preserveToolName,
|
|
1217
|
+
yt as useAgent,
|
|
1218
|
+
wt as useGenerate
|
|
1163
1219
|
};
|