@arcteninc/core 0.0.177 → 0.0.179
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 +515 -458
- 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 S = c[y];
|
|
13
|
+
if (S && !m.has(S.name))
|
|
14
|
+
return { fn: u, meta: S };
|
|
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 S of g)
|
|
22
|
+
if (!m.has(S) && (i = c[S], 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 S = f.name, M = f[B] || S || "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: S,
|
|
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: $ = !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(() => $ ? async function() {
|
|
232
|
+
return { todos: Ae };
|
|
233
|
+
} : null, [$, Ae]), he = v(() => $ ? async function(e) {
|
|
234
|
+
return Le(e), { success: !0, todos: e };
|
|
235
|
+
} : null, [$]), 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)), $ && (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
|
+
$,
|
|
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 $ && 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, $]), 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" ? $ : Je.has(t.name)), [Pe, Je, J, $]), me = v(() => {
|
|
498
551
|
const t = /* @__PURE__ */ new Set();
|
|
499
|
-
return
|
|
552
|
+
return J && A?.autoExecute !== !1 && (t.add("searchDocs"), t.add("fetchDocContent")), $ && (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
|
+
}), S && Array.isArray(S) && S.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
|
-
|
|
519
|
-
|
|
567
|
+
E,
|
|
568
|
+
i,
|
|
569
|
+
S,
|
|
570
|
+
se,
|
|
571
|
+
J,
|
|
572
|
+
A,
|
|
573
|
+
$
|
|
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,44 +683,45 @@ 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
|
-
...
|
|
669
|
-
...e && { state: e }
|
|
722
|
+
...L && { ragFilters: L },
|
|
723
|
+
...e && { state: e },
|
|
724
|
+
...$ && { planning: !0 }
|
|
670
725
|
};
|
|
671
726
|
}
|
|
672
727
|
}),
|
|
@@ -674,43 +729,43 @@ function dt({
|
|
|
674
729
|
const e = t.messages;
|
|
675
730
|
if (e[e.length - 1]?.role !== "assistant")
|
|
676
731
|
return !1;
|
|
677
|
-
const n = [...e].reverse().find((
|
|
678
|
-
if (n &&
|
|
732
|
+
const n = [...e].reverse().find((a) => a.role === "user")?.id;
|
|
733
|
+
if (n && Ce.current === n)
|
|
679
734
|
return !1;
|
|
680
|
-
const s =
|
|
681
|
-
return s && n && (
|
|
735
|
+
const s = at(t);
|
|
736
|
+
return s && n && (Ce.current = n), s;
|
|
682
737
|
}
|
|
683
|
-
}),
|
|
684
|
-
(t) => (
|
|
685
|
-
[
|
|
686
|
-
), Q =
|
|
738
|
+
}), ze = Ve, Ke = ye(
|
|
739
|
+
(t) => (Ce.current = null, fe.current = /* @__PURE__ */ new Set(), ze(t)),
|
|
740
|
+
[ze]
|
|
741
|
+
), Q = ye(
|
|
687
742
|
(t, e, o) => {
|
|
688
|
-
|
|
743
|
+
Oe({
|
|
689
744
|
toolCallId: e,
|
|
690
745
|
tool: t,
|
|
691
746
|
output: o
|
|
692
747
|
});
|
|
693
748
|
},
|
|
694
|
-
[
|
|
749
|
+
[Oe]
|
|
695
750
|
);
|
|
696
751
|
R(() => {
|
|
697
|
-
|
|
752
|
+
P.forEach((t) => {
|
|
698
753
|
t.role === "assistant" && t.parts.forEach((e) => {
|
|
699
754
|
if (!e.type?.startsWith("tool-") || e.state !== "input-available") return;
|
|
700
755
|
const o = e.type.replace("tool-", ""), r = e.toolCallId;
|
|
701
|
-
if (
|
|
702
|
-
|
|
756
|
+
if (ue.current.has(r) || Ee.current.has(r)) {
|
|
757
|
+
j && console.log(
|
|
703
758
|
`[useAgent] Skipping ${o} (${r}) - already processing or completed`
|
|
704
759
|
);
|
|
705
760
|
return;
|
|
706
761
|
}
|
|
707
|
-
|
|
762
|
+
j && console.log(`[useAgent] Starting ${o} (${r})`), ue.current.add(r);
|
|
708
763
|
const n = (d) => {
|
|
709
|
-
|
|
710
|
-
}, s =
|
|
711
|
-
if (
|
|
712
|
-
|
|
713
|
-
`[useAgent] Skipping duplicate tool call: ${
|
|
764
|
+
j && console.log(`[useAgent] Completed ${o} (${d})`), Ee.current.add(d), ue.current.delete(d);
|
|
765
|
+
}, s = lt(e.input), a = `${o}:${JSON.stringify(s)}`;
|
|
766
|
+
if (fe.current.has(a)) {
|
|
767
|
+
j && console.log(
|
|
768
|
+
`[useAgent] Skipping duplicate tool call: ${a}`
|
|
714
769
|
), Q(
|
|
715
770
|
o,
|
|
716
771
|
r,
|
|
@@ -718,50 +773,50 @@ function dt({
|
|
|
718
773
|
), n(r);
|
|
719
774
|
return;
|
|
720
775
|
}
|
|
721
|
-
if (o.startsWith("workflow_") &&
|
|
776
|
+
if (o.startsWith("workflow_") && me.has(o)) {
|
|
722
777
|
(async () => {
|
|
723
778
|
try {
|
|
724
|
-
const
|
|
779
|
+
const l = re.find(
|
|
725
780
|
(h) => h.name === o
|
|
726
781
|
)?._workflow;
|
|
727
|
-
if (!
|
|
782
|
+
if (!l)
|
|
728
783
|
throw new Error(`Workflow metadata not found for ${o}`);
|
|
729
784
|
let b;
|
|
730
|
-
if (
|
|
785
|
+
if (l.webhook?.url) {
|
|
731
786
|
let h = s;
|
|
732
|
-
if (
|
|
733
|
-
let
|
|
734
|
-
Object.entries(s).forEach(([
|
|
735
|
-
|
|
736
|
-
new RegExp(`\\{\\{${
|
|
737
|
-
String(
|
|
787
|
+
if (l.webhook.bodyTemplate) {
|
|
788
|
+
let N = l.webhook.bodyTemplate;
|
|
789
|
+
Object.entries(s).forEach(([ge, rt]) => {
|
|
790
|
+
N = N.replace(
|
|
791
|
+
new RegExp(`\\{\\{${ge}\\}\\}`, "g"),
|
|
792
|
+
String(rt)
|
|
738
793
|
);
|
|
739
|
-
}), h = JSON.parse(
|
|
794
|
+
}), h = JSON.parse(N);
|
|
740
795
|
}
|
|
741
|
-
const p = await fetch(
|
|
742
|
-
method:
|
|
796
|
+
const p = await fetch(l.webhook.url, {
|
|
797
|
+
method: l.webhook.method || "POST",
|
|
743
798
|
headers: {
|
|
744
799
|
"Content-Type": "application/json",
|
|
745
|
-
...
|
|
800
|
+
...l.webhook.headers || {}
|
|
746
801
|
},
|
|
747
802
|
body: JSON.stringify(h)
|
|
748
803
|
});
|
|
749
804
|
if (p.ok)
|
|
750
805
|
b = { success: !0, data: await p.json().catch(() => ({ success: !0 })) };
|
|
751
806
|
else {
|
|
752
|
-
const
|
|
807
|
+
const N = await p.text();
|
|
753
808
|
b = {
|
|
754
809
|
success: !1,
|
|
755
|
-
error: `Webhook failed: ${p.status} ${
|
|
810
|
+
error: `Webhook failed: ${p.status} ${N}`
|
|
756
811
|
};
|
|
757
812
|
}
|
|
758
813
|
} else
|
|
759
814
|
b = {
|
|
760
815
|
success: !0,
|
|
761
|
-
message: `Workflow "${
|
|
762
|
-
instructions:
|
|
816
|
+
message: `Workflow "${l.name}" acknowledged. Follow the workflow instructions to proceed.`,
|
|
817
|
+
instructions: l.contentPlaintext
|
|
763
818
|
};
|
|
764
|
-
n(r), Q(o, r, b),
|
|
819
|
+
n(r), Q(o, r, b), fe.current.add(a);
|
|
765
820
|
} catch (d) {
|
|
766
821
|
console.error(
|
|
767
822
|
`[useAgent] Error executing workflow ${o}:`,
|
|
@@ -771,43 +826,43 @@ function dt({
|
|
|
771
826
|
})();
|
|
772
827
|
return;
|
|
773
828
|
}
|
|
774
|
-
if (
|
|
775
|
-
const d =
|
|
829
|
+
if (me.has(o)) {
|
|
830
|
+
const d = se.get(o);
|
|
776
831
|
d ? (async () => {
|
|
777
832
|
try {
|
|
778
|
-
const
|
|
833
|
+
const l = re.find(
|
|
779
834
|
(h) => h.name === o
|
|
780
835
|
);
|
|
781
836
|
let b;
|
|
782
|
-
if (
|
|
837
|
+
if (l && l.jsonSchema?.properties) {
|
|
783
838
|
const p = Object.keys(
|
|
784
|
-
|
|
839
|
+
l.jsonSchema.properties
|
|
785
840
|
).map(
|
|
786
|
-
(
|
|
841
|
+
(N) => s[N]
|
|
787
842
|
);
|
|
788
843
|
b = await d(...p);
|
|
789
844
|
} else
|
|
790
845
|
b = await d(...Object.values(s));
|
|
791
|
-
n(r), Q(o, r, b),
|
|
792
|
-
} catch (
|
|
846
|
+
n(r), Q(o, r, b), fe.current.add(a);
|
|
847
|
+
} catch (l) {
|
|
793
848
|
console.error(
|
|
794
849
|
`[useAgent] Error executing tool ${o}:`,
|
|
795
|
-
|
|
796
|
-
), n(r), Q(o, r, `Error: ${
|
|
850
|
+
l
|
|
851
|
+
), n(r), Q(o, r, `Error: ${l}`);
|
|
797
852
|
}
|
|
798
|
-
})() : (
|
|
853
|
+
})() : (j && console.warn(`[useAgent] Tool ${o} not found in toolsMap`), Q(
|
|
799
854
|
o,
|
|
800
855
|
r,
|
|
801
856
|
`Error: Tool "${o}" not found. The tool may not be registered or available.`
|
|
802
857
|
), n(r));
|
|
803
|
-
} else if (o.startsWith("workflow_") &&
|
|
804
|
-
|
|
858
|
+
} else if (o.startsWith("workflow_") && I)
|
|
859
|
+
I({ toolCall: {
|
|
805
860
|
toolCallId: r,
|
|
806
861
|
toolName: o,
|
|
807
862
|
args: s
|
|
808
863
|
} });
|
|
809
|
-
else if (
|
|
810
|
-
|
|
864
|
+
else if (I)
|
|
865
|
+
I({ toolCall: {
|
|
811
866
|
toolCallId: r,
|
|
812
867
|
toolName: o,
|
|
813
868
|
args: s
|
|
@@ -818,116 +873,116 @@ function dt({
|
|
|
818
873
|
toolName: o,
|
|
819
874
|
args: s
|
|
820
875
|
};
|
|
821
|
-
|
|
822
|
-
const b = new Map(
|
|
876
|
+
Se((l) => {
|
|
877
|
+
const b = new Map(l);
|
|
823
878
|
return b.set(r, d), b;
|
|
824
879
|
});
|
|
825
880
|
}
|
|
826
881
|
});
|
|
827
882
|
});
|
|
828
883
|
}, [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
884
|
+
P,
|
|
885
|
+
me,
|
|
886
|
+
se,
|
|
887
|
+
I,
|
|
833
888
|
Q,
|
|
834
|
-
|
|
889
|
+
re
|
|
835
890
|
]), R(() => {
|
|
836
|
-
if (
|
|
837
|
-
const t =
|
|
891
|
+
if (ve === "ready" && P.length > 0 && F) {
|
|
892
|
+
const t = P[P.length - 1];
|
|
838
893
|
t && t.role === "assistant" && F({
|
|
839
894
|
message: t,
|
|
840
|
-
messages:
|
|
895
|
+
messages: P,
|
|
841
896
|
isAbort: !1,
|
|
842
897
|
isDisconnect: !1,
|
|
843
|
-
isError: !!
|
|
898
|
+
isError: !!je
|
|
844
899
|
});
|
|
845
900
|
}
|
|
846
|
-
}, [
|
|
847
|
-
async function
|
|
848
|
-
if (!(!
|
|
849
|
-
|
|
901
|
+
}, [ve, P, je, F]);
|
|
902
|
+
async function Qe() {
|
|
903
|
+
if (!(!y?.id || !G)) {
|
|
904
|
+
le(!0);
|
|
850
905
|
try {
|
|
851
|
-
const e = await (await fetch(`${
|
|
906
|
+
const e = await (await fetch(`${w}/conversations`, {
|
|
852
907
|
headers: {
|
|
853
908
|
Authorization: `Bearer ${G}`
|
|
854
909
|
}
|
|
855
910
|
})).json();
|
|
856
|
-
|
|
911
|
+
De(e.conversations || []);
|
|
857
912
|
} catch (t) {
|
|
858
913
|
console.error("Failed to fetch conversations:", t);
|
|
859
914
|
} finally {
|
|
860
|
-
|
|
915
|
+
le(!1);
|
|
861
916
|
}
|
|
862
917
|
}
|
|
863
918
|
}
|
|
864
919
|
R(() => {
|
|
865
|
-
|
|
866
|
-
}, [JSON.stringify(
|
|
867
|
-
async function
|
|
868
|
-
|
|
920
|
+
y?.id && G && Qe();
|
|
921
|
+
}, [JSON.stringify(y), G, w]);
|
|
922
|
+
async function Xe(t) {
|
|
923
|
+
Ue(t), le(!0);
|
|
869
924
|
try {
|
|
870
925
|
const e = await fetch(
|
|
871
|
-
`${
|
|
926
|
+
`${w}/conversations/${t}/messages`,
|
|
872
927
|
{
|
|
873
928
|
headers: {
|
|
874
|
-
Authorization: `Bearer ${
|
|
929
|
+
Authorization: `Bearer ${C.current}`
|
|
875
930
|
}
|
|
876
931
|
}
|
|
877
932
|
);
|
|
878
933
|
if (!e.ok)
|
|
879
934
|
throw new Error(`Failed to fetch messages: ${e.statusText}`);
|
|
880
935
|
const r = (await e.json()).messages || [];
|
|
881
|
-
|
|
936
|
+
Ne(r);
|
|
882
937
|
} catch (e) {
|
|
883
938
|
console.error("Failed to load conversation messages:", e);
|
|
884
939
|
} finally {
|
|
885
|
-
|
|
940
|
+
le(!1);
|
|
886
941
|
}
|
|
887
942
|
}
|
|
888
|
-
async function
|
|
943
|
+
async function Ze(t) {
|
|
889
944
|
if (G)
|
|
890
945
|
try {
|
|
891
|
-
await fetch(`${
|
|
946
|
+
await fetch(`${w}/conversations/${t}`, {
|
|
892
947
|
method: "DELETE",
|
|
893
948
|
headers: {
|
|
894
949
|
Authorization: `Bearer ${G}`
|
|
895
950
|
}
|
|
896
|
-
}),
|
|
951
|
+
}), De(Re.filter((e) => e._id !== t)), t === Te && We();
|
|
897
952
|
} catch (e) {
|
|
898
953
|
console.error("Failed to delete conversation:", e);
|
|
899
954
|
}
|
|
900
955
|
}
|
|
901
|
-
function
|
|
956
|
+
function We() {
|
|
902
957
|
const t = crypto.randomUUID();
|
|
903
|
-
|
|
958
|
+
Ue(t), Ne([]), ue.current = /* @__PURE__ */ new Set(), Ee.current = /* @__PURE__ */ new Set();
|
|
904
959
|
}
|
|
905
960
|
function X(t) {
|
|
906
961
|
const e = t.tool || "unknown-tool";
|
|
907
|
-
|
|
962
|
+
Oe({
|
|
908
963
|
toolCallId: t.toolCallId,
|
|
909
964
|
tool: e,
|
|
910
965
|
output: t.output
|
|
911
966
|
});
|
|
912
967
|
}
|
|
913
|
-
async function
|
|
968
|
+
async function et(t, e, o) {
|
|
914
969
|
if (!e.startsWith("workflow_"))
|
|
915
970
|
throw new Error(`${e} is not a workflow tool`);
|
|
916
971
|
try {
|
|
917
|
-
const n =
|
|
972
|
+
const n = re.find((a) => a.name === e)?._workflow;
|
|
918
973
|
if (!n)
|
|
919
974
|
throw new Error(`Workflow metadata not found for ${e}`);
|
|
920
975
|
let s;
|
|
921
976
|
if (n.webhook?.url) {
|
|
922
|
-
let
|
|
977
|
+
let a = o;
|
|
923
978
|
if (n.webhook.bodyTemplate) {
|
|
924
|
-
let
|
|
979
|
+
let l = n.webhook.bodyTemplate;
|
|
925
980
|
Object.entries(o).forEach(([b, h]) => {
|
|
926
|
-
|
|
981
|
+
l = l.replace(
|
|
927
982
|
new RegExp(`\\{\\{${b}\\}\\}`, "g"),
|
|
928
983
|
String(h)
|
|
929
984
|
);
|
|
930
|
-
}),
|
|
985
|
+
}), a = JSON.parse(l);
|
|
931
986
|
}
|
|
932
987
|
const d = await fetch(n.webhook.url, {
|
|
933
988
|
method: n.webhook.method || "POST",
|
|
@@ -935,15 +990,15 @@ function dt({
|
|
|
935
990
|
"Content-Type": "application/json",
|
|
936
991
|
...n.webhook.headers || {}
|
|
937
992
|
},
|
|
938
|
-
body: JSON.stringify(
|
|
993
|
+
body: JSON.stringify(a)
|
|
939
994
|
});
|
|
940
995
|
if (d.ok)
|
|
941
996
|
s = { success: !0, data: await d.json().catch(() => ({ success: !0 })) };
|
|
942
997
|
else {
|
|
943
|
-
const
|
|
998
|
+
const l = await d.text();
|
|
944
999
|
s = {
|
|
945
1000
|
success: !1,
|
|
946
|
-
error: `Webhook failed: ${d.status} ${
|
|
1001
|
+
error: `Webhook failed: ${d.status} ${l}`
|
|
947
1002
|
};
|
|
948
1003
|
}
|
|
949
1004
|
} else
|
|
@@ -958,24 +1013,24 @@ function dt({
|
|
|
958
1013
|
throw X({ toolCallId: t, tool: e, output: n }), r;
|
|
959
1014
|
}
|
|
960
1015
|
}
|
|
961
|
-
async function
|
|
962
|
-
const e =
|
|
1016
|
+
async function tt(t) {
|
|
1017
|
+
const e = $e.get(t);
|
|
963
1018
|
if (!e) {
|
|
964
|
-
|
|
1019
|
+
j && console.warn(`[useAgent] Tool call ${t} not found in pending approvals`);
|
|
965
1020
|
return;
|
|
966
1021
|
}
|
|
967
|
-
|
|
1022
|
+
Se((r) => {
|
|
968
1023
|
const n = new Map(r);
|
|
969
1024
|
return n.delete(t), n;
|
|
970
1025
|
});
|
|
971
|
-
const o =
|
|
1026
|
+
const o = se.get(e.toolName);
|
|
972
1027
|
if (o)
|
|
973
1028
|
try {
|
|
974
|
-
const r =
|
|
1029
|
+
const r = re.find((s) => s.name === e.toolName);
|
|
975
1030
|
let n;
|
|
976
1031
|
if (r && r.jsonSchema?.properties) {
|
|
977
|
-
const
|
|
978
|
-
n = await o(...
|
|
1032
|
+
const a = Object.keys(r.jsonSchema.properties).map((d) => e.args[d]);
|
|
1033
|
+
n = await o(...a);
|
|
979
1034
|
} else
|
|
980
1035
|
n = await o(...Object.values(e.args));
|
|
981
1036
|
X({
|
|
@@ -991,19 +1046,19 @@ function dt({
|
|
|
991
1046
|
});
|
|
992
1047
|
}
|
|
993
1048
|
else
|
|
994
|
-
|
|
1049
|
+
j && console.warn(`[useAgent] Tool ${e.toolName} not found in toolsMap`), X({
|
|
995
1050
|
toolCallId: e.toolCallId,
|
|
996
1051
|
tool: e.toolName,
|
|
997
1052
|
output: `Error: Tool "${e.toolName}" not found`
|
|
998
1053
|
});
|
|
999
1054
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const e =
|
|
1055
|
+
function ot(t) {
|
|
1056
|
+
const e = $e.get(t);
|
|
1002
1057
|
if (!e) {
|
|
1003
|
-
|
|
1058
|
+
j && console.warn(`[useAgent] Tool call ${t} not found in pending approvals`);
|
|
1004
1059
|
return;
|
|
1005
1060
|
}
|
|
1006
|
-
|
|
1061
|
+
Se((o) => {
|
|
1007
1062
|
const r = new Map(o);
|
|
1008
1063
|
return r.delete(t), r;
|
|
1009
1064
|
}), X({
|
|
@@ -1013,151 +1068,153 @@ function dt({
|
|
|
1013
1068
|
});
|
|
1014
1069
|
}
|
|
1015
1070
|
return {
|
|
1016
|
-
id:
|
|
1017
|
-
messages:
|
|
1018
|
-
status:
|
|
1019
|
-
error:
|
|
1020
|
-
sendMessage:
|
|
1021
|
-
stop:
|
|
1071
|
+
id: Te,
|
|
1072
|
+
messages: P,
|
|
1073
|
+
status: ve,
|
|
1074
|
+
error: je,
|
|
1075
|
+
sendMessage: Ke,
|
|
1076
|
+
stop: Ye,
|
|
1022
1077
|
addToolOutput: X,
|
|
1023
|
-
executeWorkflowTool:
|
|
1078
|
+
executeWorkflowTool: et,
|
|
1024
1079
|
// Execute workflow tools that require approval
|
|
1025
|
-
setMessages:
|
|
1026
|
-
conversations:
|
|
1027
|
-
loadConversation:
|
|
1028
|
-
deleteConversation:
|
|
1029
|
-
startNewConversation:
|
|
1030
|
-
isLoadingConversations:
|
|
1080
|
+
setMessages: Ne,
|
|
1081
|
+
conversations: Re,
|
|
1082
|
+
loadConversation: Xe,
|
|
1083
|
+
deleteConversation: Ze,
|
|
1084
|
+
startNewConversation: We,
|
|
1085
|
+
isLoadingConversations: Fe,
|
|
1031
1086
|
clientToken: G,
|
|
1032
|
-
tokenError:
|
|
1087
|
+
tokenError: qe,
|
|
1033
1088
|
// Tool approval management
|
|
1034
|
-
pendingToolApprovals: Array.from(
|
|
1035
|
-
approveToolCall:
|
|
1036
|
-
denyToolCall:
|
|
1089
|
+
pendingToolApprovals: Array.from($e.values()),
|
|
1090
|
+
approveToolCall: tt,
|
|
1091
|
+
denyToolCall: ot,
|
|
1037
1092
|
// Tool safety classification (from server config or fallback to props)
|
|
1038
|
-
safeToolNames:
|
|
1093
|
+
safeToolNames: me,
|
|
1094
|
+
// Todo list planning (when planning=true)
|
|
1095
|
+
todos: Ae
|
|
1039
1096
|
};
|
|
1040
1097
|
}
|
|
1041
|
-
function
|
|
1098
|
+
function wt(u = {}) {
|
|
1042
1099
|
const {
|
|
1043
1100
|
apiBaseUrl: c = "https://api.arcten.com",
|
|
1044
1101
|
tokenEndpoint: m = "/token",
|
|
1045
|
-
clientToken:
|
|
1046
|
-
skipTokenFetch:
|
|
1047
|
-
} =
|
|
1102
|
+
clientToken: g,
|
|
1103
|
+
skipTokenFetch: y = !1
|
|
1104
|
+
} = u, [f, i] = _(!1), [S, x] = _(null), M = z(g || null);
|
|
1048
1105
|
R(() => {
|
|
1049
|
-
if (
|
|
1050
|
-
M.current =
|
|
1106
|
+
if (g) {
|
|
1107
|
+
M.current = g;
|
|
1051
1108
|
return;
|
|
1052
1109
|
}
|
|
1053
|
-
if (
|
|
1110
|
+
if (y) return;
|
|
1054
1111
|
(async () => {
|
|
1055
1112
|
try {
|
|
1056
|
-
const
|
|
1113
|
+
const T = await fetch(`${c}${m}`, {
|
|
1057
1114
|
method: "POST",
|
|
1058
1115
|
headers: { "Content-Type": "application/json" }
|
|
1059
1116
|
});
|
|
1060
|
-
if (
|
|
1061
|
-
const k = await
|
|
1117
|
+
if (T.ok) {
|
|
1118
|
+
const k = await T.json();
|
|
1062
1119
|
M.current = k.token;
|
|
1063
1120
|
}
|
|
1064
|
-
} catch (
|
|
1065
|
-
console.error("[useGenerate] Failed to fetch token:",
|
|
1121
|
+
} catch (T) {
|
|
1122
|
+
console.error("[useGenerate] Failed to fetch token:", T);
|
|
1066
1123
|
}
|
|
1067
1124
|
})();
|
|
1068
|
-
}, [c, m,
|
|
1069
|
-
const
|
|
1070
|
-
async (
|
|
1071
|
-
|
|
1125
|
+
}, [c, m, g, y]);
|
|
1126
|
+
const W = ye(
|
|
1127
|
+
async (D) => {
|
|
1128
|
+
i(!0), x(null);
|
|
1072
1129
|
try {
|
|
1073
|
-
const
|
|
1130
|
+
const T = {
|
|
1074
1131
|
"Content-Type": "application/json"
|
|
1075
1132
|
};
|
|
1076
|
-
M.current && (
|
|
1133
|
+
M.current && (T.Authorization = `Bearer ${M.current}`);
|
|
1077
1134
|
const k = await fetch(`${c}/generate`, {
|
|
1078
1135
|
method: "POST",
|
|
1079
|
-
headers:
|
|
1080
|
-
body: JSON.stringify(
|
|
1136
|
+
headers: T,
|
|
1137
|
+
body: JSON.stringify(D)
|
|
1081
1138
|
});
|
|
1082
1139
|
if (!k.ok) {
|
|
1083
1140
|
const ee = await k.json().catch(() => ({}));
|
|
1084
1141
|
throw new Error(ee.error || `HTTP ${k.status}`);
|
|
1085
1142
|
}
|
|
1086
1143
|
return await k.json();
|
|
1087
|
-
} catch (
|
|
1088
|
-
const k =
|
|
1089
|
-
throw x(k),
|
|
1144
|
+
} catch (T) {
|
|
1145
|
+
const k = T instanceof Error ? T.message : String(T);
|
|
1146
|
+
throw x(k), T;
|
|
1090
1147
|
} finally {
|
|
1091
|
-
|
|
1148
|
+
i(!1);
|
|
1092
1149
|
}
|
|
1093
1150
|
},
|
|
1094
1151
|
[c]
|
|
1095
|
-
), Z =
|
|
1096
|
-
async (
|
|
1097
|
-
|
|
1152
|
+
), Z = ye(
|
|
1153
|
+
async (D, T) => {
|
|
1154
|
+
i(!0), x(null);
|
|
1098
1155
|
try {
|
|
1099
1156
|
const k = {
|
|
1100
1157
|
"Content-Type": "application/json"
|
|
1101
1158
|
};
|
|
1102
1159
|
M.current && (k.Authorization = `Bearer ${M.current}`);
|
|
1103
|
-
const
|
|
1160
|
+
const U = await fetch(`${c}/generate/stream`, {
|
|
1104
1161
|
method: "POST",
|
|
1105
1162
|
headers: k,
|
|
1106
|
-
body: JSON.stringify(
|
|
1163
|
+
body: JSON.stringify(D)
|
|
1107
1164
|
});
|
|
1108
|
-
if (!
|
|
1109
|
-
const F = await
|
|
1110
|
-
throw new Error(F.error || `HTTP ${
|
|
1165
|
+
if (!U.ok) {
|
|
1166
|
+
const F = await U.json().catch(() => ({}));
|
|
1167
|
+
throw new Error(F.error || `HTTP ${U.status}`);
|
|
1111
1168
|
}
|
|
1112
|
-
const ee =
|
|
1169
|
+
const ee = U.body?.getReader();
|
|
1113
1170
|
if (!ee)
|
|
1114
1171
|
throw new Error("No response body");
|
|
1115
|
-
const
|
|
1116
|
-
let
|
|
1172
|
+
const q = new TextDecoder();
|
|
1173
|
+
let I = null;
|
|
1117
1174
|
for (; ; ) {
|
|
1118
|
-
const { done: F, value:
|
|
1175
|
+
const { done: F, value: O } = await ee.read();
|
|
1119
1176
|
if (F) break;
|
|
1120
|
-
const
|
|
1121
|
-
`).filter((
|
|
1122
|
-
for (const
|
|
1123
|
-
const
|
|
1124
|
-
if (
|
|
1177
|
+
const L = q.decode(O, { stream: !0 }).split(`
|
|
1178
|
+
`).filter(($) => $.startsWith("data: "));
|
|
1179
|
+
for (const $ of L) {
|
|
1180
|
+
const te = $.slice(6).trim();
|
|
1181
|
+
if (te)
|
|
1125
1182
|
try {
|
|
1126
|
-
const
|
|
1127
|
-
if (
|
|
1128
|
-
throw new Error(
|
|
1129
|
-
|
|
1130
|
-
object:
|
|
1131
|
-
usage:
|
|
1132
|
-
finishReason:
|
|
1133
|
-
} :
|
|
1183
|
+
const w = JSON.parse(te);
|
|
1184
|
+
if (w.error)
|
|
1185
|
+
throw new Error(w.error);
|
|
1186
|
+
w.done && w.object ? I = {
|
|
1187
|
+
object: w.object,
|
|
1188
|
+
usage: w.usage,
|
|
1189
|
+
finishReason: w.finishReason
|
|
1190
|
+
} : w.partial && T && T(w.partial);
|
|
1134
1191
|
} catch {
|
|
1135
1192
|
}
|
|
1136
1193
|
}
|
|
1137
1194
|
}
|
|
1138
|
-
if (!
|
|
1195
|
+
if (!I)
|
|
1139
1196
|
throw new Error("Stream ended without final result");
|
|
1140
|
-
return
|
|
1197
|
+
return I;
|
|
1141
1198
|
} catch (k) {
|
|
1142
|
-
const
|
|
1143
|
-
throw x(
|
|
1199
|
+
const U = k instanceof Error ? k.message : String(k);
|
|
1200
|
+
throw x(U), k;
|
|
1144
1201
|
} finally {
|
|
1145
|
-
|
|
1202
|
+
i(!1);
|
|
1146
1203
|
}
|
|
1147
1204
|
},
|
|
1148
1205
|
[c]
|
|
1149
1206
|
);
|
|
1150
1207
|
return {
|
|
1151
|
-
generate:
|
|
1208
|
+
generate: W,
|
|
1152
1209
|
streamGenerate: Z,
|
|
1153
|
-
isLoading:
|
|
1154
|
-
error:
|
|
1210
|
+
isLoading: f,
|
|
1211
|
+
error: S
|
|
1155
1212
|
};
|
|
1156
1213
|
}
|
|
1157
1214
|
export {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1215
|
+
B as ARCTEN_ORIGINAL_NAME,
|
|
1216
|
+
ct as extractToolsMetadata,
|
|
1217
|
+
gt as preserveToolName,
|
|
1218
|
+
yt as useAgent,
|
|
1219
|
+
wt as useGenerate
|
|
1163
1220
|
};
|