@tangle-network/sandbox 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -0
- package/README.md +71 -0
- package/dist/agent/index.d.ts +433 -0
- package/dist/agent/index.js +1 -0
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -271
- package/dist/client-CygjzF3v.js +1 -0
- package/dist/{errors-BI75IXOM.d.ts → client-DM2pIli7.d.ts} +2 -129
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -2
- package/dist/collaboration-CRyb5e8F.js +1 -201
- package/dist/core.d.ts +3 -2
- package/dist/core.js +1 -4
- package/dist/errors-1Se5ATyZ.d.ts +128 -0
- package/dist/errors-CljiGR__.js +1 -262
- package/dist/{index-DhNGZ0h4.d.ts → index-CTj81tF9.d.ts} +1 -1
- package/dist/index.d.ts +256 -7
- package/dist/index.js +1 -825
- package/dist/openai/index.d.ts +21 -6
- package/dist/openai/index.js +1 -1721
- package/dist/{sandbox-aBpWqler.d.ts → sandbox-CBmfYqMQ.d.ts} +291 -117
- package/dist/sandbox-DTup2jzz.js +1 -0
- package/dist/session-gateway/index.js +1 -667
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -2
- package/dist/tangle-CnYnTRi6.js +1 -0
- package/package.json +50 -78
- package/dist/client-Uve6A5C6.js +0 -2280
- package/dist/platform-integrations.d.ts +0 -2
- package/dist/platform-integrations.js +0 -2
- package/dist/sandbox-ksXTNlo-.js +0 -3394
- package/dist/tangle-DQ05paN7.js +0 -826
- /package/dist/{index-Dpj1oB5i.d.ts → index-D-2pH_70.d.ts} +0 -0
- /package/dist/{index-CCsA3S0D.d.ts → index-D7bwmNs8.d.ts} +0 -0
package/dist/openai/index.js
CHANGED
|
@@ -1,1721 +1 @@
|
|
|
1
|
-
//#region src/openai/hooks.ts
|
|
2
|
-
/**
|
|
3
|
-
* Sequential hook composer. Hooks run in registration order; `block` and
|
|
4
|
-
* `terminate` short-circuit. `rewrite` and `override` thread their
|
|
5
|
-
* mutated payloads through to the remaining hooks so subsequent hooks
|
|
6
|
-
* observe the rewritten args / overridden result.
|
|
7
|
-
*/
|
|
8
|
-
var HookChain = class {
|
|
9
|
-
hooks;
|
|
10
|
-
constructor(hooks = []) {
|
|
11
|
-
this.hooks = hooks;
|
|
12
|
-
}
|
|
13
|
-
/** Number of hooks in the chain. */
|
|
14
|
-
get size() {
|
|
15
|
-
return this.hooks.length;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Run every `beforeToolCall` in registration order. Returns the first
|
|
19
|
-
* non-`allow` outcome (block/rewrite), or `allow` if the chain ran
|
|
20
|
-
* clean. `rewrite` outcomes are threaded forward so later hooks see
|
|
21
|
-
* the mutated args.
|
|
22
|
-
*/
|
|
23
|
-
async runBefore(ctx) {
|
|
24
|
-
let current = ctx;
|
|
25
|
-
let lastRewrite = null;
|
|
26
|
-
for (const hook of this.hooks) {
|
|
27
|
-
if (!hook.beforeToolCall) continue;
|
|
28
|
-
const outcome = await hook.beforeToolCall(current);
|
|
29
|
-
if (outcome.action === "block") return outcome;
|
|
30
|
-
if (outcome.action === "rewrite") {
|
|
31
|
-
current = {
|
|
32
|
-
...current,
|
|
33
|
-
args: outcome.args
|
|
34
|
-
};
|
|
35
|
-
lastRewrite = outcome;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return lastRewrite ?? { action: "allow" };
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Run every `afterToolCall` in registration order. Returns the first
|
|
42
|
-
* `terminate` outcome immediately. `override` outcomes are threaded
|
|
43
|
-
* forward so later hooks see the mutated result; the final result is
|
|
44
|
-
* surfaced as the last `override`, or `pass` if no hook overrode.
|
|
45
|
-
*/
|
|
46
|
-
async runAfter(ctx, result) {
|
|
47
|
-
let current = result;
|
|
48
|
-
let lastOverride = null;
|
|
49
|
-
for (const hook of this.hooks) {
|
|
50
|
-
if (!hook.afterToolCall) continue;
|
|
51
|
-
const outcome = await hook.afterToolCall(ctx, current);
|
|
52
|
-
if (outcome.action === "terminate") return outcome;
|
|
53
|
-
if (outcome.action === "override") {
|
|
54
|
-
current = outcome.result;
|
|
55
|
-
lastOverride = outcome;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return lastOverride ?? { action: "pass" };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Emits a structured `AuditEvent` for every tool call (before + after).
|
|
63
|
-
* Default sink is `console.info`. The route layer swaps the sink for
|
|
64
|
-
* the eval-runs DuckDB writer.
|
|
65
|
-
*/
|
|
66
|
-
function auditLogHook(opts = {}) {
|
|
67
|
-
const sink = opts.sink ?? ((event) => {
|
|
68
|
-
console.info("[audit]", event);
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
async beforeToolCall(ctx) {
|
|
72
|
-
await sink({
|
|
73
|
-
phase: "before",
|
|
74
|
-
runId: ctx.runId,
|
|
75
|
-
threadId: ctx.threadId,
|
|
76
|
-
partnerId: ctx.partnerId,
|
|
77
|
-
toolName: ctx.toolName,
|
|
78
|
-
callId: ctx.callId,
|
|
79
|
-
timestamp: ctx.timestamp,
|
|
80
|
-
args: ctx.args
|
|
81
|
-
});
|
|
82
|
-
return { action: "allow" };
|
|
83
|
-
},
|
|
84
|
-
async afterToolCall(ctx, result) {
|
|
85
|
-
await sink({
|
|
86
|
-
phase: "after",
|
|
87
|
-
runId: ctx.runId,
|
|
88
|
-
threadId: ctx.threadId,
|
|
89
|
-
partnerId: ctx.partnerId,
|
|
90
|
-
toolName: ctx.toolName,
|
|
91
|
-
callId: ctx.callId,
|
|
92
|
-
timestamp: ctx.timestamp,
|
|
93
|
-
result
|
|
94
|
-
});
|
|
95
|
-
return { action: "pass" };
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const NETWORK_TOOL_REGEX = /^(fetch|http|https|browser|playwright|curl|wget|computer-use:click|computer-use:type)/i;
|
|
100
|
-
const URL_FIELD_NAMES = new Set([
|
|
101
|
-
"url",
|
|
102
|
-
"uri",
|
|
103
|
-
"endpoint",
|
|
104
|
-
"href",
|
|
105
|
-
"src",
|
|
106
|
-
"target",
|
|
107
|
-
"address"
|
|
108
|
-
]);
|
|
109
|
-
function extractUrlsFromArgs(args) {
|
|
110
|
-
const out = [];
|
|
111
|
-
const visit = (val) => {
|
|
112
|
-
if (typeof val === "string") {
|
|
113
|
-
if (/^https?:\/\//i.test(val)) try {
|
|
114
|
-
const u = new URL(val);
|
|
115
|
-
out.push({
|
|
116
|
-
raw: val,
|
|
117
|
-
host: u.host
|
|
118
|
-
});
|
|
119
|
-
} catch {
|
|
120
|
-
out.push({
|
|
121
|
-
raw: val,
|
|
122
|
-
host: null
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (val === null || typeof val !== "object") return;
|
|
128
|
-
if (Array.isArray(val)) {
|
|
129
|
-
for (const item of val) visit(item);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
for (const [k, v] of Object.entries(val)) {
|
|
133
|
-
if (URL_FIELD_NAMES.has(k.toLowerCase()) && typeof v === "string") {
|
|
134
|
-
try {
|
|
135
|
-
const u = new URL(v);
|
|
136
|
-
out.push({
|
|
137
|
-
raw: v,
|
|
138
|
-
host: u.host
|
|
139
|
-
});
|
|
140
|
-
} catch {
|
|
141
|
-
out.push({
|
|
142
|
-
raw: v,
|
|
143
|
-
host: null
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
visit(v);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
visit(args);
|
|
152
|
-
return out;
|
|
153
|
-
}
|
|
154
|
-
function isNetworkLike(ctx, urls) {
|
|
155
|
-
if (NETWORK_TOOL_REGEX.test(ctx.toolName)) return true;
|
|
156
|
-
return urls.length > 0;
|
|
157
|
-
}
|
|
158
|
-
function hostMatches(host, pattern) {
|
|
159
|
-
if (pattern === host) return true;
|
|
160
|
-
if (pattern.startsWith("*.")) {
|
|
161
|
-
const suffix = pattern.slice(1);
|
|
162
|
-
return host.endsWith(suffix);
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Best-effort allow/deny filter for tool-call URLs.
|
|
168
|
-
*
|
|
169
|
-
* Block tool calls that look network-ish (toolName matches the network
|
|
170
|
-
* regex OR args contain url-like fields) when the resolved host hits
|
|
171
|
-
* the deny list. The allow list is treated as an explicit allowance —
|
|
172
|
-
* when set, only listed hosts pass; unmatched hosts are blocked.
|
|
173
|
-
* `allowFn` overrides both lists when present.
|
|
174
|
-
*
|
|
175
|
-
* **What this hook does NOT catch.** It inspects URL-shaped strings in
|
|
176
|
-
* the tool-call arguments only. The following bypass it silently:
|
|
177
|
-
*
|
|
178
|
-
* - URLs encoded as base64 / hex / `Buffer.from(...)` literals
|
|
179
|
-
* - URLs assembled at execution time from string fragments
|
|
180
|
-
* - URLs reached via redirects, DNS rebinding, or proxy hosts that
|
|
181
|
-
* match the allow list but forward to denied destinations
|
|
182
|
-
* - Network calls made by spawned subprocesses, generated code, or
|
|
183
|
-
* tools whose argument schema does not name a URL field
|
|
184
|
-
*
|
|
185
|
-
* Treat this hook as a UX guardrail (clearer error messages,
|
|
186
|
-
* short-circuiting obvious mistakes) on top of a real egress boundary
|
|
187
|
-
* — not as one. When egress containment is a security requirement
|
|
188
|
-
* (exfil prevention, data residency), enforce it at the runtime
|
|
189
|
-
* sandbox layer (egress firewall, CNI policy, outbound proxy with
|
|
190
|
-
* mTLS) where the agent cannot evade it.
|
|
191
|
-
*/
|
|
192
|
-
function egressPolicyHook(opts = {}) {
|
|
193
|
-
const denyList = opts.denyList ?? [];
|
|
194
|
-
const allowList = opts.allowList;
|
|
195
|
-
return { async beforeToolCall(ctx) {
|
|
196
|
-
const urls = extractUrlsFromArgs(ctx.args);
|
|
197
|
-
if (!isNetworkLike(ctx, urls)) return { action: "allow" };
|
|
198
|
-
if (opts.allowFn) return await opts.allowFn(ctx) ? { action: "allow" } : {
|
|
199
|
-
action: "block",
|
|
200
|
-
reason: "egress denied by allowFn"
|
|
201
|
-
};
|
|
202
|
-
for (const u of urls) {
|
|
203
|
-
if (!u.host) continue;
|
|
204
|
-
for (const pat of denyList) if (hostMatches(u.host, pat)) return {
|
|
205
|
-
action: "block",
|
|
206
|
-
reason: `egress denied: host "${u.host}" matches deny pattern "${pat}"`
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
if (allowList && allowList.length > 0) for (const u of urls) {
|
|
210
|
-
const host = u.host;
|
|
211
|
-
if (!host) return {
|
|
212
|
-
action: "block",
|
|
213
|
-
reason: "egress denied: unparseable url"
|
|
214
|
-
};
|
|
215
|
-
if (!allowList.some((pat) => hostMatches(host, pat))) return {
|
|
216
|
-
action: "block",
|
|
217
|
-
reason: `egress denied: host "${host}" is not on the allow list`
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
return { action: "allow" };
|
|
221
|
-
} };
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Terminates the run when the partner's accumulated cost is at or
|
|
225
|
-
* above `ceiling`. The cost lookup is injected so any usage ledger can
|
|
226
|
-
* back it.
|
|
227
|
-
*/
|
|
228
|
-
function costCapHook(opts) {
|
|
229
|
-
const getCurrentCost = opts.getCurrentCost ?? (async () => 0);
|
|
230
|
-
return {
|
|
231
|
-
async beforeToolCall(ctx) {
|
|
232
|
-
const current = await getCurrentCost(ctx.partnerId);
|
|
233
|
-
if (current >= opts.ceiling) return {
|
|
234
|
-
action: "block",
|
|
235
|
-
reason: `cost cap reached: ${current} >= ${opts.ceiling}`
|
|
236
|
-
};
|
|
237
|
-
return { action: "allow" };
|
|
238
|
-
},
|
|
239
|
-
async afterToolCall(ctx) {
|
|
240
|
-
const current = await getCurrentCost(ctx.partnerId);
|
|
241
|
-
if (current >= opts.ceiling) return {
|
|
242
|
-
action: "terminate",
|
|
243
|
-
reason: `cost cap reached after tool call: ${current} >= ${opts.ceiling}`
|
|
244
|
-
};
|
|
245
|
-
return { action: "pass" };
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Token-bucket rate limiter scoped per session id (`runId`) over
|
|
251
|
-
* `computer-use:*` tool calls. Excess calls are blocked with a clear
|
|
252
|
-
* reason. Non-`computer-use` tools pass through untouched.
|
|
253
|
-
*/
|
|
254
|
-
function actionRateLimitHook(opts) {
|
|
255
|
-
const now = opts.now ?? Date.now;
|
|
256
|
-
const capacity = Math.max(1, Math.floor(opts.perSecondPerSession));
|
|
257
|
-
const refillPerMs = opts.perSecondPerSession / 1e3;
|
|
258
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
259
|
-
return { async beforeToolCall(ctx) {
|
|
260
|
-
if (!ctx.toolName.startsWith("computer-use:")) return { action: "allow" };
|
|
261
|
-
const key = ctx.runId;
|
|
262
|
-
const t = now();
|
|
263
|
-
const bucket = buckets.get(key) ?? {
|
|
264
|
-
tokens: capacity,
|
|
265
|
-
lastRefillMs: t
|
|
266
|
-
};
|
|
267
|
-
const elapsed = Math.max(0, t - bucket.lastRefillMs);
|
|
268
|
-
bucket.tokens = Math.min(capacity, bucket.tokens + elapsed * refillPerMs);
|
|
269
|
-
bucket.lastRefillMs = t;
|
|
270
|
-
if (bucket.tokens < 1) {
|
|
271
|
-
buckets.set(key, bucket);
|
|
272
|
-
return {
|
|
273
|
-
action: "block",
|
|
274
|
-
reason: `action rate limit exceeded: ${opts.perSecondPerSession}/s`
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
bucket.tokens -= 1;
|
|
278
|
-
buckets.set(key, bucket);
|
|
279
|
-
return { action: "allow" };
|
|
280
|
-
} };
|
|
281
|
-
}
|
|
282
|
-
function readScreenshotPayload(result) {
|
|
283
|
-
const candidates = [
|
|
284
|
-
result.content,
|
|
285
|
-
result.details?.screenshot,
|
|
286
|
-
result.details
|
|
287
|
-
];
|
|
288
|
-
for (const c of candidates) if (c && typeof c === "object") {
|
|
289
|
-
if (typeof c.pngBase64 === "string") return c;
|
|
290
|
-
}
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Applied AFTER `computer-use:screenshot`. v1 ships without the
|
|
295
|
-
* `sharp` dependency: when regions are configured, we surface a warning
|
|
296
|
-
* exactly once per process and pass the screenshot through untouched.
|
|
297
|
-
* Pixel-blur lands in a follow-up that introduces `sharp` deliberately.
|
|
298
|
-
*/
|
|
299
|
-
function screenshotRedactionHook(opts = {}) {
|
|
300
|
-
const warn = opts.warn ?? ((msg) => console.warn(msg));
|
|
301
|
-
const hasRegions = (opts.regions?.length ?? 0) > 0;
|
|
302
|
-
let warned = false;
|
|
303
|
-
return { async afterToolCall(ctx, result) {
|
|
304
|
-
if (ctx.toolName !== "computer-use:screenshot") return { action: "pass" };
|
|
305
|
-
if (!hasRegions) return { action: "pass" };
|
|
306
|
-
if (!readScreenshotPayload(result)) return { action: "pass" };
|
|
307
|
-
if (!warned) {
|
|
308
|
-
warned = true;
|
|
309
|
-
warn("[screenshotRedactionHook] regions configured but `sharp` is not a dependency in v1; passing screenshot through unmodified");
|
|
310
|
-
}
|
|
311
|
-
return { action: "pass" };
|
|
312
|
-
} };
|
|
313
|
-
}
|
|
314
|
-
const TYPE_TEXT_FIELDS = [
|
|
315
|
-
"text",
|
|
316
|
-
"value",
|
|
317
|
-
"input",
|
|
318
|
-
"query"
|
|
319
|
-
];
|
|
320
|
-
const CLICK_LABEL_FIELDS = [
|
|
321
|
-
"label",
|
|
322
|
-
"alt",
|
|
323
|
-
"title",
|
|
324
|
-
"ariaLabel",
|
|
325
|
-
"near"
|
|
326
|
-
];
|
|
327
|
-
function readStringField(args, fields) {
|
|
328
|
-
if (!args || typeof args !== "object") return null;
|
|
329
|
-
const a = args;
|
|
330
|
-
for (const f of fields) {
|
|
331
|
-
const v = a[f];
|
|
332
|
-
if (typeof v === "string" && v.length > 0) return v;
|
|
333
|
-
}
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Block before-execute when a `computer-use:type` text or
|
|
338
|
-
* `computer-use:click` label matches any deny pattern. Mitigates
|
|
339
|
-
* destructive-action sequences (e.g. "delete account", "wire transfer")
|
|
340
|
-
* before they hit the OS.
|
|
341
|
-
*/
|
|
342
|
-
function destructiveActionGuardHook(opts) {
|
|
343
|
-
const patterns = opts.denyPatterns;
|
|
344
|
-
return { async beforeToolCall(ctx) {
|
|
345
|
-
let candidate = null;
|
|
346
|
-
if (ctx.toolName === "computer-use:type") candidate = readStringField(ctx.args, TYPE_TEXT_FIELDS);
|
|
347
|
-
else if (ctx.toolName === "computer-use:click") candidate = readStringField(ctx.args, CLICK_LABEL_FIELDS);
|
|
348
|
-
else return { action: "allow" };
|
|
349
|
-
if (!candidate) return { action: "allow" };
|
|
350
|
-
for (const re of patterns) if (re.test(candidate)) return {
|
|
351
|
-
action: "block",
|
|
352
|
-
reason: `destructive action denied: input matches ${re.toString()}`
|
|
353
|
-
};
|
|
354
|
-
return { action: "allow" };
|
|
355
|
-
} };
|
|
356
|
-
}
|
|
357
|
-
//#endregion
|
|
358
|
-
//#region src/openai/responses-store.ts
|
|
359
|
-
var InMemoryResponseStore = class {
|
|
360
|
-
chains = /* @__PURE__ */ new Map();
|
|
361
|
-
async getPriorTurns(responseId) {
|
|
362
|
-
const turns = this.chains.get(responseId);
|
|
363
|
-
return turns ? turns.map((t) => ({ ...t })) : null;
|
|
364
|
-
}
|
|
365
|
-
async putPriorTurns(responseId, priorTurns) {
|
|
366
|
-
this.chains.set(responseId, priorTurns.map((t) => ({ ...t })));
|
|
367
|
-
}
|
|
368
|
-
/** Convenience accessor for tests / debug; not part of `ResponseStore`. */
|
|
369
|
-
size() {
|
|
370
|
-
return this.chains.size;
|
|
371
|
-
}
|
|
372
|
-
/** Drop a chain. */
|
|
373
|
-
delete(responseId) {
|
|
374
|
-
return this.chains.delete(responseId);
|
|
375
|
-
}
|
|
376
|
-
/** Drop everything. Useful between test cases. */
|
|
377
|
-
clear() {
|
|
378
|
-
this.chains.clear();
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
//#endregion
|
|
382
|
-
//#region src/openai/runs.ts
|
|
383
|
-
const TERMINAL_STATUSES = new Set([
|
|
384
|
-
"completed",
|
|
385
|
-
"failed",
|
|
386
|
-
"cancelled",
|
|
387
|
-
"expired"
|
|
388
|
-
]);
|
|
389
|
-
function isTerminal(status) {
|
|
390
|
-
return TERMINAL_STATUSES.has(status);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Pure async iterator over the underlying source. No state, no
|
|
394
|
-
* buffering. Iteration ends when the source closes or yields a
|
|
395
|
-
* terminal frame; the iterator itself does not classify frames.
|
|
396
|
-
*/
|
|
397
|
-
async function* runEvents(threadId, runId, source) {
|
|
398
|
-
for await (const event of source.open(threadId, runId)) yield event;
|
|
399
|
-
}
|
|
400
|
-
function readToolCallFromFrame(event) {
|
|
401
|
-
if (event.type === "requires_action" || event.type === "tool_call_requested") {
|
|
402
|
-
const data = event.data ?? event;
|
|
403
|
-
const id = String(data.callId ?? data.call_id ?? data.id ?? "");
|
|
404
|
-
const name = String(data.toolName ?? data.tool_name ?? data.name ?? "");
|
|
405
|
-
if (!id || !name) return null;
|
|
406
|
-
return {
|
|
407
|
-
callId: id,
|
|
408
|
-
toolName: name,
|
|
409
|
-
args: data.args ?? data.arguments ?? data.input ?? {},
|
|
410
|
-
requiresAction: true
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
if (event.type !== "raw") return null;
|
|
414
|
-
const data = event.data ?? event;
|
|
415
|
-
const inner = typeof data.type === "string" ? data.type : "";
|
|
416
|
-
if (!(inner === "tool-invocation" || inner === "tool_call" || inner === "computer-use" || inner === "computer_call")) return null;
|
|
417
|
-
const ti = data.toolInvocation ?? data.tool_invocation ?? data.computerUse ?? data.computer_use ?? data;
|
|
418
|
-
const id = String(ti.toolCallId ?? ti.tool_call_id ?? ti.callId ?? ti.id ?? "");
|
|
419
|
-
const name = inner === "computer-use" || inner === "computer_call" ? `computer-use:${String(ti.action?.type ?? "action")}` : String(ti.toolName ?? ti.tool_name ?? ti.name ?? "");
|
|
420
|
-
if (!id || !name) return null;
|
|
421
|
-
return {
|
|
422
|
-
callId: id,
|
|
423
|
-
toolName: name,
|
|
424
|
-
args: ti.args ?? ti.arguments ?? ti.input ?? {},
|
|
425
|
-
requiresAction: false
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
function readTerminal(event) {
|
|
429
|
-
if (event.type === "done") {
|
|
430
|
-
const outcome = typeof event.outcome === "string" && event.outcome || "success";
|
|
431
|
-
if (outcome === "success" || outcome === "completed" || outcome === "succeeded" || outcome === "done") return { status: "completed" };
|
|
432
|
-
return {
|
|
433
|
-
status: "failed",
|
|
434
|
-
reason: typeof event.error === "string" ? event.error : outcome
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
if (event.type === "error") return {
|
|
438
|
-
status: "failed",
|
|
439
|
-
reason: typeof event.message === "string" && event.message || typeof event.error === "string" && event.error || "stream error"
|
|
440
|
-
};
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Internal queue helper: an async iterable backed by a bounded
|
|
445
|
-
* pending-list with a settle promise that resolves whenever a new
|
|
446
|
-
* event lands or the queue closes.
|
|
447
|
-
*
|
|
448
|
-
* Each iterator returned by `iterator()` shares the queue's buffer
|
|
449
|
-
* and waiter list. Two concurrent iterators would therefore steal
|
|
450
|
-
* events from each other (whichever called `next()` first wins),
|
|
451
|
-
* which silently drops events for the second consumer. Because there
|
|
452
|
-
* is only ever one consumer of `Run.events()` by design, this class
|
|
453
|
-
* enforces single-consumption explicitly: a second `iterator()` call
|
|
454
|
-
* throws so the contract violation is loud rather than silent.
|
|
455
|
-
*/
|
|
456
|
-
var EventQueue = class {
|
|
457
|
-
buffer = [];
|
|
458
|
-
waiters = [];
|
|
459
|
-
closed = false;
|
|
460
|
-
iteratorCreated = false;
|
|
461
|
-
push(value) {
|
|
462
|
-
if (this.closed) return;
|
|
463
|
-
const w = this.waiters.shift();
|
|
464
|
-
if (w) {
|
|
465
|
-
w({
|
|
466
|
-
value,
|
|
467
|
-
done: false
|
|
468
|
-
});
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
this.buffer.push(value);
|
|
472
|
-
}
|
|
473
|
-
close() {
|
|
474
|
-
if (this.closed) return;
|
|
475
|
-
this.closed = true;
|
|
476
|
-
while (this.waiters.length > 0) this.waiters.shift()?.({
|
|
477
|
-
value: void 0,
|
|
478
|
-
done: true
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
iterator() {
|
|
482
|
-
if (this.iteratorCreated) throw new Error("Run.events() may only be consumed once. Multiple iterators on the same Run share state and would interleave/steal events.");
|
|
483
|
-
this.iteratorCreated = true;
|
|
484
|
-
const self = this;
|
|
485
|
-
return {
|
|
486
|
-
[Symbol.asyncIterator]() {
|
|
487
|
-
return this;
|
|
488
|
-
},
|
|
489
|
-
next() {
|
|
490
|
-
if (self.buffer.length > 0) {
|
|
491
|
-
const value = self.buffer.shift();
|
|
492
|
-
return Promise.resolve({
|
|
493
|
-
value,
|
|
494
|
-
done: false
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
if (self.closed) return Promise.resolve({
|
|
498
|
-
value: void 0,
|
|
499
|
-
done: true
|
|
500
|
-
});
|
|
501
|
-
return new Promise((resolve) => {
|
|
502
|
-
self.waiters.push(resolve);
|
|
503
|
-
});
|
|
504
|
-
},
|
|
505
|
-
return() {
|
|
506
|
-
self.close();
|
|
507
|
-
return Promise.resolve({
|
|
508
|
-
value: void 0,
|
|
509
|
-
done: true
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
/**
|
|
516
|
-
* High-level `Run`. Drives the underlying `RunEventSource`, manages
|
|
517
|
-
* status transitions, dispatches tool calls through the hook chain,
|
|
518
|
-
* and surfaces a typed `RunEvent` stream to consumers.
|
|
519
|
-
*/
|
|
520
|
-
var Run = class {
|
|
521
|
-
id;
|
|
522
|
-
threadId;
|
|
523
|
-
partnerId;
|
|
524
|
-
_status = "queued";
|
|
525
|
-
source;
|
|
526
|
-
hooks;
|
|
527
|
-
executeTool;
|
|
528
|
-
onStatusChange;
|
|
529
|
-
queue = new EventQueue();
|
|
530
|
-
startPromise = null;
|
|
531
|
-
pendingCalls = /* @__PURE__ */ new Map();
|
|
532
|
-
cancelRequested = false;
|
|
533
|
-
constructor(opts) {
|
|
534
|
-
this.id = opts.id;
|
|
535
|
-
this.threadId = opts.threadId;
|
|
536
|
-
this.partnerId = opts.partnerId;
|
|
537
|
-
this.source = opts.source;
|
|
538
|
-
this.hooks = opts.hooks;
|
|
539
|
-
this.executeTool = opts.executeTool;
|
|
540
|
-
this.onStatusChange = opts.onStatusChange;
|
|
541
|
-
}
|
|
542
|
-
get status() {
|
|
543
|
-
return this._status;
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Subscribe to typed events. May only be consumed once per Run.
|
|
547
|
-
*
|
|
548
|
-
* The single-consumer constraint is permanent for the lifetime of
|
|
549
|
-
* the Run instance, including AFTER the run completes — calling
|
|
550
|
-
* `events()` a second time always throws, even if the first
|
|
551
|
-
* consumer drained the iterator to completion. This is intentional:
|
|
552
|
-
* the queue is a one-shot stream, not a re-readable buffer, and
|
|
553
|
-
* events are dropped after delivery to avoid unbounded retention.
|
|
554
|
-
* Callers that need to revisit terminal state should keep a handle
|
|
555
|
-
* to the original iterator's drained values, or use the Run's
|
|
556
|
-
* status/result accessors.
|
|
557
|
-
*/
|
|
558
|
-
events() {
|
|
559
|
-
return this.queue.iterator();
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Drive the underlying stream to completion. Idempotent: subsequent
|
|
563
|
-
* calls return the same in-flight promise.
|
|
564
|
-
*/
|
|
565
|
-
start() {
|
|
566
|
-
if (this.startPromise) return this.startPromise;
|
|
567
|
-
this.startPromise = this.driveStream();
|
|
568
|
-
return this.startPromise;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Cancel an in-flight run. Sets status to `cancelled` and closes
|
|
572
|
-
* the event queue. Tries the source-level cancel hint as a
|
|
573
|
-
* best-effort heads-up to the upstream stream.
|
|
574
|
-
*/
|
|
575
|
-
async cancel(reason) {
|
|
576
|
-
if (isTerminal(this._status)) return;
|
|
577
|
-
this.cancelRequested = true;
|
|
578
|
-
if (this.source.cancel) try {
|
|
579
|
-
await this.source.cancel(this.threadId, this.id);
|
|
580
|
-
} catch {}
|
|
581
|
-
this.transition("cancelled");
|
|
582
|
-
this.queue.push({
|
|
583
|
-
type: "cancelled",
|
|
584
|
-
reason
|
|
585
|
-
});
|
|
586
|
-
this.queue.close();
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Append a user message to the thread and restart the stream. The
|
|
590
|
-
* source's `steer` hook is invoked when present; otherwise we throw
|
|
591
|
-
* because a stateless source cannot honor a steer.
|
|
592
|
-
*/
|
|
593
|
-
async steer(message) {
|
|
594
|
-
if (!this.source.steer) throw new Error("RunEventSource does not support steer");
|
|
595
|
-
if (isTerminal(this._status)) throw new Error(`cannot steer a ${this._status} run`);
|
|
596
|
-
await this.source.steer(this.threadId, this.id, message);
|
|
597
|
-
if (this._status === "requires_action") this.transition("in_progress");
|
|
598
|
-
this.startPromise = this.driveStream();
|
|
599
|
-
await this.startPromise;
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Resume a `requires_action` run by submitting tool outputs. The
|
|
603
|
-
* outputs are forwarded to the source so the upstream agent can
|
|
604
|
-
* continue. Status transitions back to `in_progress`.
|
|
605
|
-
*/
|
|
606
|
-
async submitToolOutputs(outputs) {
|
|
607
|
-
if (this._status !== "requires_action") throw new Error(`cannot submit tool outputs in status ${this._status}`);
|
|
608
|
-
if (!this.source.submitToolOutputs) throw new Error("RunEventSource does not support submitToolOutputs");
|
|
609
|
-
for (const o of outputs) this.pendingCalls.delete(o.toolCallId);
|
|
610
|
-
await this.source.submitToolOutputs(this.threadId, this.id, outputs);
|
|
611
|
-
this.transition("in_progress");
|
|
612
|
-
this.startPromise = this.driveStream();
|
|
613
|
-
await this.startPromise;
|
|
614
|
-
}
|
|
615
|
-
/** Externally drive the run into the `expired` terminal status. */
|
|
616
|
-
expire() {
|
|
617
|
-
if (isTerminal(this._status)) return;
|
|
618
|
-
this.transition("expired");
|
|
619
|
-
this.queue.push({
|
|
620
|
-
type: "failed",
|
|
621
|
-
reason: "expired"
|
|
622
|
-
});
|
|
623
|
-
this.queue.close();
|
|
624
|
-
}
|
|
625
|
-
transition(next) {
|
|
626
|
-
if (this._status === next) return;
|
|
627
|
-
const prev = this._status;
|
|
628
|
-
this._status = next;
|
|
629
|
-
this.queue.push({
|
|
630
|
-
type: "status",
|
|
631
|
-
status: next,
|
|
632
|
-
previous: prev
|
|
633
|
-
});
|
|
634
|
-
this.onStatusChange?.(next, prev);
|
|
635
|
-
}
|
|
636
|
-
async driveStream() {
|
|
637
|
-
try {
|
|
638
|
-
for await (const event of runEvents(this.threadId, this.id, this.source)) {
|
|
639
|
-
if (this.cancelRequested) return;
|
|
640
|
-
if (this._status === "queued") this.transition("in_progress");
|
|
641
|
-
this.queue.push({
|
|
642
|
-
type: "stream",
|
|
643
|
-
event
|
|
644
|
-
});
|
|
645
|
-
const tool = readToolCallFromFrame(event);
|
|
646
|
-
if (tool) {
|
|
647
|
-
const handled = await this.handleToolCall(tool);
|
|
648
|
-
if (handled === "terminate") return;
|
|
649
|
-
if (handled === "requires_action") return;
|
|
650
|
-
continue;
|
|
651
|
-
}
|
|
652
|
-
const terminal = readTerminal(event);
|
|
653
|
-
if (terminal) {
|
|
654
|
-
if (terminal.status === "completed") {
|
|
655
|
-
this.transition("completed");
|
|
656
|
-
this.queue.push({ type: "completed" });
|
|
657
|
-
} else {
|
|
658
|
-
this.transition("failed");
|
|
659
|
-
this.queue.push({
|
|
660
|
-
type: "failed",
|
|
661
|
-
reason: terminal.reason ?? "unknown failure"
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
this.queue.close();
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
if (!isTerminal(this._status)) {
|
|
669
|
-
this.transition("completed");
|
|
670
|
-
this.queue.push({ type: "completed" });
|
|
671
|
-
this.queue.close();
|
|
672
|
-
}
|
|
673
|
-
} catch (err) {
|
|
674
|
-
if (isTerminal(this._status)) return;
|
|
675
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
676
|
-
this.transition("failed");
|
|
677
|
-
this.queue.push({
|
|
678
|
-
type: "failed",
|
|
679
|
-
reason
|
|
680
|
-
});
|
|
681
|
-
this.queue.close();
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
async handleToolCall(tool) {
|
|
685
|
-
const ctx = {
|
|
686
|
-
runId: this.id,
|
|
687
|
-
threadId: this.threadId,
|
|
688
|
-
partnerId: this.partnerId,
|
|
689
|
-
toolName: tool.toolName,
|
|
690
|
-
args: tool.args,
|
|
691
|
-
callId: tool.callId,
|
|
692
|
-
timestamp: Date.now()
|
|
693
|
-
};
|
|
694
|
-
let dispatchCtx = ctx;
|
|
695
|
-
if (this.hooks && this.hooks.size > 0) {
|
|
696
|
-
const before = await this.hooks.runBefore(ctx);
|
|
697
|
-
if (before.action === "block") {
|
|
698
|
-
const blockedResult = {
|
|
699
|
-
content: { error: before.reason },
|
|
700
|
-
isError: true,
|
|
701
|
-
details: { blockedBy: "beforeToolCall" }
|
|
702
|
-
};
|
|
703
|
-
this.queue.push({
|
|
704
|
-
type: "tool_blocked",
|
|
705
|
-
ctx,
|
|
706
|
-
reason: before.reason
|
|
707
|
-
});
|
|
708
|
-
this.queue.push({
|
|
709
|
-
type: "tool_result",
|
|
710
|
-
ctx,
|
|
711
|
-
result: blockedResult
|
|
712
|
-
});
|
|
713
|
-
if (tool.requiresAction) {
|
|
714
|
-
this.pendingCalls.set(tool.callId, ctx);
|
|
715
|
-
this.transition("requires_action");
|
|
716
|
-
this.queue.push({
|
|
717
|
-
type: "requires_action",
|
|
718
|
-
pendingCallIds: Array.from(this.pendingCalls.keys())
|
|
719
|
-
});
|
|
720
|
-
return "requires_action";
|
|
721
|
-
}
|
|
722
|
-
return "continue";
|
|
723
|
-
}
|
|
724
|
-
if (before.action === "rewrite") dispatchCtx = {
|
|
725
|
-
...ctx,
|
|
726
|
-
args: before.args
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
if (tool.requiresAction) {
|
|
730
|
-
this.pendingCalls.set(tool.callId, dispatchCtx);
|
|
731
|
-
this.transition("requires_action");
|
|
732
|
-
this.queue.push({
|
|
733
|
-
type: "tool_call",
|
|
734
|
-
ctx: dispatchCtx
|
|
735
|
-
});
|
|
736
|
-
this.queue.push({
|
|
737
|
-
type: "requires_action",
|
|
738
|
-
pendingCallIds: Array.from(this.pendingCalls.keys())
|
|
739
|
-
});
|
|
740
|
-
return "requires_action";
|
|
741
|
-
}
|
|
742
|
-
if (!this.executeTool) {
|
|
743
|
-
this.queue.push({
|
|
744
|
-
type: "tool_call",
|
|
745
|
-
ctx: dispatchCtx
|
|
746
|
-
});
|
|
747
|
-
return "continue";
|
|
748
|
-
}
|
|
749
|
-
this.queue.push({
|
|
750
|
-
type: "tool_call",
|
|
751
|
-
ctx: dispatchCtx
|
|
752
|
-
});
|
|
753
|
-
let result;
|
|
754
|
-
try {
|
|
755
|
-
result = await this.executeTool(dispatchCtx);
|
|
756
|
-
} catch (err) {
|
|
757
|
-
result = {
|
|
758
|
-
content: { error: err instanceof Error ? err.message : String(err) },
|
|
759
|
-
isError: true
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
let finalResult = result;
|
|
763
|
-
if (this.hooks && this.hooks.size > 0) {
|
|
764
|
-
const after = await this.hooks.runAfter(dispatchCtx, result);
|
|
765
|
-
if (after.action === "terminate") {
|
|
766
|
-
this.queue.push({
|
|
767
|
-
type: "tool_result",
|
|
768
|
-
ctx: dispatchCtx,
|
|
769
|
-
result
|
|
770
|
-
});
|
|
771
|
-
this.transition("failed");
|
|
772
|
-
this.queue.push({
|
|
773
|
-
type: "failed",
|
|
774
|
-
reason: after.reason
|
|
775
|
-
});
|
|
776
|
-
this.queue.close();
|
|
777
|
-
return "terminate";
|
|
778
|
-
}
|
|
779
|
-
if (after.action === "override") finalResult = after.result;
|
|
780
|
-
}
|
|
781
|
-
this.queue.push({
|
|
782
|
-
type: "tool_result",
|
|
783
|
-
ctx: dispatchCtx,
|
|
784
|
-
result: finalResult
|
|
785
|
-
});
|
|
786
|
-
return "continue";
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
//#endregion
|
|
790
|
-
//#region src/openai/translate/finish-reason.ts
|
|
791
|
-
function outcomeToFinishReason(outcome, hasToolCall) {
|
|
792
|
-
switch (outcome) {
|
|
793
|
-
case "success":
|
|
794
|
-
case "succeeded":
|
|
795
|
-
case "completed":
|
|
796
|
-
case "done": return hasToolCall ? "tool_calls" : "stop";
|
|
797
|
-
case "length_exceeded":
|
|
798
|
-
case "length":
|
|
799
|
-
case "max_tokens": return "length";
|
|
800
|
-
case "content_filtered":
|
|
801
|
-
case "content_filter":
|
|
802
|
-
case "filtered": return "content_filter";
|
|
803
|
-
default: return "stop";
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
//#endregion
|
|
807
|
-
//#region src/openai/translate/chunks.ts
|
|
808
|
-
/**
|
|
809
|
-
* Read the text token from a `token` event. Tangle emits the delta as
|
|
810
|
-
* either `delta`, `text`, or `token`; tolerate all three so the
|
|
811
|
-
* translator stays decoupled from minor runtime variations.
|
|
812
|
-
*/
|
|
813
|
-
function readTokenDelta(event) {
|
|
814
|
-
if (typeof event.delta === "string") return event.delta;
|
|
815
|
-
if (typeof event.text === "string") return event.text;
|
|
816
|
-
if (typeof event.token === "string") return event.token;
|
|
817
|
-
return null;
|
|
818
|
-
}
|
|
819
|
-
function readToolInvocation(event) {
|
|
820
|
-
if (event.type !== "raw") return null;
|
|
821
|
-
const data = event.data ?? event;
|
|
822
|
-
const inner = typeof data.type === "string" ? data.type : typeof event.type === "string" ? event.type : "";
|
|
823
|
-
if (!(inner === "tool-invocation" || inner === "tool_call" || typeof data.toolInvocation === "object" || typeof data.tool_invocation === "object")) return null;
|
|
824
|
-
const ti = data.toolInvocation ?? data.tool_invocation ?? data;
|
|
825
|
-
const id = typeof ti.toolCallId === "string" ? ti.toolCallId : typeof ti.tool_call_id === "string" ? ti.tool_call_id : typeof ti.id === "string" ? ti.id : typeof ti.callId === "string" ? ti.callId : "";
|
|
826
|
-
const name = typeof ti.toolName === "string" ? ti.toolName : typeof ti.tool_name === "string" ? ti.tool_name : typeof ti.name === "string" ? ti.name : "";
|
|
827
|
-
const args = ti.args ?? ti.arguments ?? ti.input ?? {};
|
|
828
|
-
if (!id || !name) return null;
|
|
829
|
-
return {
|
|
830
|
-
id,
|
|
831
|
-
name,
|
|
832
|
-
arguments: typeof args === "string" ? args : JSON.stringify(args)
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
|
-
* Read a usage payload from a `done` event. The runtime emits usage
|
|
837
|
-
* either at the top level or under a `usage` key; try both.
|
|
838
|
-
*/
|
|
839
|
-
function readUsage(event) {
|
|
840
|
-
const u = event.usage ?? event;
|
|
841
|
-
const prompt = Number(u.prompt_tokens ?? u.input_tokens ?? u.inputTokens ?? 0);
|
|
842
|
-
const completion = Number(u.completion_tokens ?? u.output_tokens ?? u.outputTokens ?? 0);
|
|
843
|
-
if (prompt === 0 && completion === 0) return null;
|
|
844
|
-
return {
|
|
845
|
-
prompt_tokens: prompt,
|
|
846
|
-
completion_tokens: completion,
|
|
847
|
-
total_tokens: Number(u.total_tokens ?? prompt + completion)
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
function readOutcome(event) {
|
|
851
|
-
if (typeof event.outcome === "string") return event.outcome;
|
|
852
|
-
if (typeof event.status === "string") return event.status;
|
|
853
|
-
if (event.success === false) return "failure";
|
|
854
|
-
return "success";
|
|
855
|
-
}
|
|
856
|
-
function chatBaseChunk(ctx) {
|
|
857
|
-
ctx.chunkIndex += 1;
|
|
858
|
-
return {
|
|
859
|
-
id: ctx.runId,
|
|
860
|
-
created: ctx.createdAt,
|
|
861
|
-
model: ctx.modelId,
|
|
862
|
-
object: "chat.completion.chunk"
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
function sandboxEventToChatChunk(event, ctx) {
|
|
866
|
-
switch (event.type) {
|
|
867
|
-
case "start": return null;
|
|
868
|
-
case "execution.started": return null;
|
|
869
|
-
case "status": return null;
|
|
870
|
-
case "session.updated": return null;
|
|
871
|
-
case "message.part.updated": return null;
|
|
872
|
-
case "token": {
|
|
873
|
-
const delta = readTokenDelta(event);
|
|
874
|
-
if (delta == null || delta.length === 0) return null;
|
|
875
|
-
return {
|
|
876
|
-
...chatBaseChunk(ctx),
|
|
877
|
-
choices: [{
|
|
878
|
-
index: 0,
|
|
879
|
-
delta: {
|
|
880
|
-
role: "assistant",
|
|
881
|
-
content: delta
|
|
882
|
-
},
|
|
883
|
-
finish_reason: null
|
|
884
|
-
}]
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
case "raw": {
|
|
888
|
-
const tool = readToolInvocation(event);
|
|
889
|
-
if (!tool) return null;
|
|
890
|
-
const existing = ctx.toolCallBuffer.get(tool.id);
|
|
891
|
-
const index = existing ? existing.index : ctx.toolCallBuffer.size;
|
|
892
|
-
ctx.toolCallBuffer.set(tool.id, {
|
|
893
|
-
index,
|
|
894
|
-
id: tool.id,
|
|
895
|
-
name: tool.name,
|
|
896
|
-
arguments: tool.arguments
|
|
897
|
-
});
|
|
898
|
-
return {
|
|
899
|
-
...chatBaseChunk(ctx),
|
|
900
|
-
choices: [{
|
|
901
|
-
index: 0,
|
|
902
|
-
delta: {
|
|
903
|
-
role: "assistant",
|
|
904
|
-
tool_calls: [{
|
|
905
|
-
index,
|
|
906
|
-
id: tool.id,
|
|
907
|
-
type: "function",
|
|
908
|
-
function: {
|
|
909
|
-
name: tool.name,
|
|
910
|
-
arguments: tool.arguments
|
|
911
|
-
}
|
|
912
|
-
}]
|
|
913
|
-
},
|
|
914
|
-
finish_reason: null
|
|
915
|
-
}]
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
case "error": {
|
|
919
|
-
const hasToolCall = ctx.toolCallBuffer.size > 0;
|
|
920
|
-
return {
|
|
921
|
-
...chatBaseChunk(ctx),
|
|
922
|
-
choices: [{
|
|
923
|
-
index: 0,
|
|
924
|
-
delta: {},
|
|
925
|
-
finish_reason: outcomeToFinishReason("error", hasToolCall)
|
|
926
|
-
}]
|
|
927
|
-
};
|
|
928
|
-
}
|
|
929
|
-
case "done": {
|
|
930
|
-
const hasToolCall = ctx.toolCallBuffer.size > 0;
|
|
931
|
-
const finish = outcomeToFinishReason(readOutcome(event), hasToolCall);
|
|
932
|
-
const usage = readUsage(event);
|
|
933
|
-
const chunk = {
|
|
934
|
-
...chatBaseChunk(ctx),
|
|
935
|
-
choices: [{
|
|
936
|
-
index: 0,
|
|
937
|
-
delta: {},
|
|
938
|
-
finish_reason: finish
|
|
939
|
-
}]
|
|
940
|
-
};
|
|
941
|
-
if (usage) chunk.usage = usage;
|
|
942
|
-
return chunk;
|
|
943
|
-
}
|
|
944
|
-
default: return null;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
function completionBaseChunk(ctx) {
|
|
948
|
-
ctx.chunkIndex += 1;
|
|
949
|
-
return {
|
|
950
|
-
id: ctx.runId,
|
|
951
|
-
created: ctx.createdAt,
|
|
952
|
-
model: ctx.modelId,
|
|
953
|
-
object: "text_completion"
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
function sandboxEventToCompletionChunk(event, ctx) {
|
|
957
|
-
switch (event.type) {
|
|
958
|
-
case "start":
|
|
959
|
-
case "execution.started":
|
|
960
|
-
case "status":
|
|
961
|
-
case "session.updated":
|
|
962
|
-
case "message.part.updated":
|
|
963
|
-
case "raw":
|
|
964
|
-
if (event.type === "raw") {
|
|
965
|
-
const tool = readToolInvocation(event);
|
|
966
|
-
if (tool) {
|
|
967
|
-
const existing = ctx.toolCallBuffer.get(tool.id);
|
|
968
|
-
const index = existing ? existing.index : ctx.toolCallBuffer.size;
|
|
969
|
-
ctx.toolCallBuffer.set(tool.id, {
|
|
970
|
-
index,
|
|
971
|
-
id: tool.id,
|
|
972
|
-
name: tool.name,
|
|
973
|
-
arguments: tool.arguments
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
return null;
|
|
978
|
-
case "token": {
|
|
979
|
-
const delta = readTokenDelta(event);
|
|
980
|
-
if (delta == null || delta.length === 0) return null;
|
|
981
|
-
return {
|
|
982
|
-
...completionBaseChunk(ctx),
|
|
983
|
-
choices: [{
|
|
984
|
-
index: 0,
|
|
985
|
-
text: delta,
|
|
986
|
-
finish_reason: null,
|
|
987
|
-
logprobs: null
|
|
988
|
-
}]
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
case "error":
|
|
992
|
-
case "done": {
|
|
993
|
-
const finish = outcomeToFinishReason(event.type === "error" ? "error" : readOutcome(event), false);
|
|
994
|
-
const reason = finish === "tool_calls" ? "stop" : finish;
|
|
995
|
-
const usage = readUsage(event);
|
|
996
|
-
const chunk = {
|
|
997
|
-
...completionBaseChunk(ctx),
|
|
998
|
-
choices: [{
|
|
999
|
-
index: 0,
|
|
1000
|
-
text: "",
|
|
1001
|
-
finish_reason: reason,
|
|
1002
|
-
logprobs: null
|
|
1003
|
-
}]
|
|
1004
|
-
};
|
|
1005
|
-
if (usage) chunk.usage = usage;
|
|
1006
|
-
return chunk;
|
|
1007
|
-
}
|
|
1008
|
-
default: return null;
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
function getResponsesExtras(ctx) {
|
|
1012
|
-
const slot = ctx;
|
|
1013
|
-
if (!slot.__responsesExtras) slot.__responsesExtras = {
|
|
1014
|
-
sequence: 0,
|
|
1015
|
-
toolOutputIndex: /* @__PURE__ */ new Map()
|
|
1016
|
-
};
|
|
1017
|
-
return slot.__responsesExtras;
|
|
1018
|
-
}
|
|
1019
|
-
function nextSeq(extras) {
|
|
1020
|
-
extras.sequence += 1;
|
|
1021
|
-
return extras.sequence;
|
|
1022
|
-
}
|
|
1023
|
-
function emptyResponseUsage() {
|
|
1024
|
-
return {
|
|
1025
|
-
input_tokens: 0,
|
|
1026
|
-
output_tokens: 0,
|
|
1027
|
-
total_tokens: 0,
|
|
1028
|
-
input_tokens_details: { cached_tokens: 0 },
|
|
1029
|
-
output_tokens_details: { reasoning_tokens: 0 }
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
function usageFromTokens(usage) {
|
|
1033
|
-
return {
|
|
1034
|
-
input_tokens: usage.prompt_tokens,
|
|
1035
|
-
output_tokens: usage.completion_tokens,
|
|
1036
|
-
total_tokens: usage.total_tokens,
|
|
1037
|
-
input_tokens_details: { cached_tokens: 0 },
|
|
1038
|
-
output_tokens_details: { reasoning_tokens: 0 }
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
function sandboxEventToResponsesEvent(event, ctx) {
|
|
1042
|
-
const extras = getResponsesExtras(ctx);
|
|
1043
|
-
switch (event.type) {
|
|
1044
|
-
case "start": return null;
|
|
1045
|
-
case "execution.started": return null;
|
|
1046
|
-
case "status": return null;
|
|
1047
|
-
case "session.updated": return null;
|
|
1048
|
-
case "message.part.updated": return null;
|
|
1049
|
-
case "token": {
|
|
1050
|
-
const delta = readTokenDelta(event);
|
|
1051
|
-
if (delta == null || delta.length === 0) return null;
|
|
1052
|
-
ctx.chunkIndex += 1;
|
|
1053
|
-
if (extras.messageOutputIndex === void 0) extras.messageOutputIndex = ctx.toolCallBuffer.size;
|
|
1054
|
-
return {
|
|
1055
|
-
type: "response.output_text.delta",
|
|
1056
|
-
content_index: 0,
|
|
1057
|
-
delta,
|
|
1058
|
-
item_id: `msg_${ctx.runId}`,
|
|
1059
|
-
logprobs: [],
|
|
1060
|
-
output_index: extras.messageOutputIndex,
|
|
1061
|
-
sequence_number: nextSeq(extras)
|
|
1062
|
-
};
|
|
1063
|
-
}
|
|
1064
|
-
case "raw": {
|
|
1065
|
-
const tool = readToolInvocation(event);
|
|
1066
|
-
if (!tool) return null;
|
|
1067
|
-
ctx.chunkIndex += 1;
|
|
1068
|
-
const existing = ctx.toolCallBuffer.get(tool.id);
|
|
1069
|
-
const index = existing ? existing.index : ctx.toolCallBuffer.size;
|
|
1070
|
-
ctx.toolCallBuffer.set(tool.id, {
|
|
1071
|
-
index,
|
|
1072
|
-
id: tool.id,
|
|
1073
|
-
name: tool.name,
|
|
1074
|
-
arguments: tool.arguments
|
|
1075
|
-
});
|
|
1076
|
-
const outputIndex = extras.toolOutputIndex.get(tool.id) ?? extras.toolOutputIndex.size;
|
|
1077
|
-
extras.toolOutputIndex.set(tool.id, outputIndex);
|
|
1078
|
-
return {
|
|
1079
|
-
type: "response.output_item.added",
|
|
1080
|
-
item: {
|
|
1081
|
-
type: "function_call",
|
|
1082
|
-
id: `fc_${tool.id}`,
|
|
1083
|
-
call_id: tool.id,
|
|
1084
|
-
name: tool.name,
|
|
1085
|
-
arguments: tool.arguments,
|
|
1086
|
-
status: "completed"
|
|
1087
|
-
},
|
|
1088
|
-
output_index: outputIndex,
|
|
1089
|
-
sequence_number: nextSeq(extras)
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
case "error": {
|
|
1093
|
-
const outputIndex = extras.messageOutputIndex ?? 0;
|
|
1094
|
-
return {
|
|
1095
|
-
type: "response.output_item.done",
|
|
1096
|
-
item: {
|
|
1097
|
-
type: "message",
|
|
1098
|
-
id: `msg_${ctx.runId}`,
|
|
1099
|
-
role: "assistant",
|
|
1100
|
-
status: "incomplete",
|
|
1101
|
-
content: []
|
|
1102
|
-
},
|
|
1103
|
-
output_index: outputIndex,
|
|
1104
|
-
sequence_number: nextSeq(extras)
|
|
1105
|
-
};
|
|
1106
|
-
}
|
|
1107
|
-
case "done": {
|
|
1108
|
-
const tokens = readUsage(event);
|
|
1109
|
-
const usage = tokens ? usageFromTokens(tokens) : emptyResponseUsage();
|
|
1110
|
-
return {
|
|
1111
|
-
type: "response.completed",
|
|
1112
|
-
sequence_number: nextSeq(extras),
|
|
1113
|
-
response: {
|
|
1114
|
-
id: ctx.runId,
|
|
1115
|
-
object: "response",
|
|
1116
|
-
created_at: ctx.createdAt,
|
|
1117
|
-
output_text: "",
|
|
1118
|
-
error: null,
|
|
1119
|
-
incomplete_details: null,
|
|
1120
|
-
instructions: null,
|
|
1121
|
-
metadata: null,
|
|
1122
|
-
model: ctx.modelId,
|
|
1123
|
-
output: [],
|
|
1124
|
-
parallel_tool_calls: false,
|
|
1125
|
-
temperature: null,
|
|
1126
|
-
tool_choice: "auto",
|
|
1127
|
-
tools: [],
|
|
1128
|
-
top_p: null,
|
|
1129
|
-
status: "completed",
|
|
1130
|
-
usage
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
default: return null;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
//#endregion
|
|
1138
|
-
//#region src/openai/translate/embeddings.ts
|
|
1139
|
-
/**
|
|
1140
|
-
* Error shape used for rejecting embedding requests. The route layer
|
|
1141
|
-
* lifts these into OpenAI's `{ error: { type, code, message } }` body.
|
|
1142
|
-
*/
|
|
1143
|
-
var EmbeddingValidationError = class extends Error {
|
|
1144
|
-
type = "invalid_request_error";
|
|
1145
|
-
code;
|
|
1146
|
-
param;
|
|
1147
|
-
constructor(message, code, param) {
|
|
1148
|
-
super(message);
|
|
1149
|
-
this.name = "EmbeddingValidationError";
|
|
1150
|
-
this.code = code;
|
|
1151
|
-
this.param = param;
|
|
1152
|
-
}
|
|
1153
|
-
};
|
|
1154
|
-
const MAX_BATCH = 2048;
|
|
1155
|
-
function reject(message, code, param) {
|
|
1156
|
-
throw new EmbeddingValidationError(message, code, param);
|
|
1157
|
-
}
|
|
1158
|
-
function normalizeInput(input) {
|
|
1159
|
-
if (typeof input === "string") {
|
|
1160
|
-
if (input.length === 0) reject("Input string must not be empty", "empty_input", "input");
|
|
1161
|
-
return {
|
|
1162
|
-
kind: "text",
|
|
1163
|
-
values: [input]
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
if (!Array.isArray(input)) reject("Input must be a string, array of strings, or array of token arrays", "invalid_input_type", "input");
|
|
1167
|
-
if (input.length === 0) reject("Input array must not be empty", "empty_input", "input");
|
|
1168
|
-
if (input.length > MAX_BATCH) reject(`Input array exceeds maximum batch size of ${MAX_BATCH}`, "batch_too_large", "input");
|
|
1169
|
-
const first = input[0];
|
|
1170
|
-
if (typeof first === "string") {
|
|
1171
|
-
const values = [];
|
|
1172
|
-
for (let i = 0; i < input.length; i++) {
|
|
1173
|
-
const v = input[i];
|
|
1174
|
-
if (typeof v !== "string") reject(`Input array must be homogeneous; index ${i} is not a string`, "mixed_input_types", "input");
|
|
1175
|
-
if (v.length === 0) reject(`Input string at index ${i} must not be empty`, "empty_input", "input");
|
|
1176
|
-
values.push(v);
|
|
1177
|
-
}
|
|
1178
|
-
return {
|
|
1179
|
-
kind: "text",
|
|
1180
|
-
values
|
|
1181
|
-
};
|
|
1182
|
-
}
|
|
1183
|
-
if (typeof first === "number") {
|
|
1184
|
-
for (let i = 0; i < input.length; i++) if (typeof input[i] !== "number") reject(`Token array must contain only numbers; index ${i} is ${typeof input[i]}`, "invalid_token_type", "input");
|
|
1185
|
-
return {
|
|
1186
|
-
kind: "tokens",
|
|
1187
|
-
values: [input]
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
if (Array.isArray(first)) {
|
|
1191
|
-
const values = [];
|
|
1192
|
-
for (let i = 0; i < input.length; i++) {
|
|
1193
|
-
const row = input[i];
|
|
1194
|
-
if (!Array.isArray(row)) reject(`Input array must be homogeneous; index ${i} is not an array`, "mixed_input_types", "input");
|
|
1195
|
-
if (row.length === 0) reject(`Token array at index ${i} must not be empty`, "empty_input", "input");
|
|
1196
|
-
for (let j = 0; j < row.length; j++) if (typeof row[j] !== "number") reject(`Token array at index ${i} must contain only numbers; element ${j} is ${typeof row[j]}`, "invalid_token_type", "input");
|
|
1197
|
-
values.push(row);
|
|
1198
|
-
}
|
|
1199
|
-
return {
|
|
1200
|
-
kind: "tokens",
|
|
1201
|
-
values
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
reject("Input must be a string, array of strings, or array of token arrays", "invalid_input_type", "input");
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
* Validate and normalize an embedding request. Throws
|
|
1208
|
-
* `EmbeddingValidationError` on any rejection.
|
|
1209
|
-
*/
|
|
1210
|
-
function validateEmbeddingRequest(req) {
|
|
1211
|
-
if (!req || typeof req !== "object") reject("Request body must be an object", "invalid_request", void 0);
|
|
1212
|
-
if (typeof req.model !== "string" || req.model.length === 0) reject("Model is required", "model_required", "model");
|
|
1213
|
-
if (req.dimensions !== void 0) {
|
|
1214
|
-
if (typeof req.dimensions !== "number" || !Number.isInteger(req.dimensions) || req.dimensions <= 0) reject("Dimensions must be a positive integer", "invalid_dimensions", "dimensions");
|
|
1215
|
-
}
|
|
1216
|
-
const encodingFormat = req.encoding_format ?? "float";
|
|
1217
|
-
if (encodingFormat !== "float" && encodingFormat !== "base64") reject("encoding_format must be 'float' or 'base64'", "invalid_encoding_format", "encoding_format");
|
|
1218
|
-
const input = normalizeInput(req.input);
|
|
1219
|
-
const out = {
|
|
1220
|
-
model: req.model,
|
|
1221
|
-
input,
|
|
1222
|
-
encodingFormat
|
|
1223
|
-
};
|
|
1224
|
-
if (req.dimensions !== void 0) out.dimensions = req.dimensions;
|
|
1225
|
-
if (req.user !== void 0) out.user = req.user;
|
|
1226
|
-
return out;
|
|
1227
|
-
}
|
|
1228
|
-
//#endregion
|
|
1229
|
-
//#region src/openai/translate/messages.ts
|
|
1230
|
-
/**
|
|
1231
|
-
* Strip the leading `tangle/` namespace from a model id and split off an
|
|
1232
|
-
* optional variant. Examples:
|
|
1233
|
-
* - `tangle/claude-code` → `{ provider: "claude-code" }`
|
|
1234
|
-
* - `tangle/opencode/sonnet` → `{ provider: "opencode", variant: "sonnet" }`
|
|
1235
|
-
* - `claude-code` → `{ provider: "claude-code" }` (no prefix)
|
|
1236
|
-
*/
|
|
1237
|
-
function resolveProviderId(model) {
|
|
1238
|
-
const trimmed = model.trim();
|
|
1239
|
-
const withoutPrefix = trimmed.startsWith("tangle/") ? trimmed.slice(7) : trimmed;
|
|
1240
|
-
if (!withoutPrefix) throw new Error(`Invalid model id: ${JSON.stringify(model)}`);
|
|
1241
|
-
const slash = withoutPrefix.indexOf("/");
|
|
1242
|
-
if (slash === -1) return { provider: withoutPrefix };
|
|
1243
|
-
const provider = withoutPrefix.slice(0, slash);
|
|
1244
|
-
const variant = withoutPrefix.slice(slash + 1);
|
|
1245
|
-
if (!provider || !variant) throw new Error(`Invalid model id: ${JSON.stringify(model)}`);
|
|
1246
|
-
return {
|
|
1247
|
-
provider,
|
|
1248
|
-
variant
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Coerce an OpenAI chat content field into a normalized text + parts pair.
|
|
1253
|
-
* Refusal parts are dropped — they only appear on assistant turns and the
|
|
1254
|
-
* sandbox runtime does not consume them; assistant text is the only field
|
|
1255
|
-
* we need from the assistant side.
|
|
1256
|
-
*/
|
|
1257
|
-
function normalizeContent(content) {
|
|
1258
|
-
if (content == null) return {
|
|
1259
|
-
text: "",
|
|
1260
|
-
parts: []
|
|
1261
|
-
};
|
|
1262
|
-
if (typeof content === "string") return {
|
|
1263
|
-
text: content,
|
|
1264
|
-
parts: []
|
|
1265
|
-
};
|
|
1266
|
-
const parts = [];
|
|
1267
|
-
const textPieces = [];
|
|
1268
|
-
for (const part of content) if (part.type === "text") {
|
|
1269
|
-
textPieces.push(part.text);
|
|
1270
|
-
parts.push({
|
|
1271
|
-
type: "text",
|
|
1272
|
-
text: part.text
|
|
1273
|
-
});
|
|
1274
|
-
} else if (part.type === "image_url") parts.push({
|
|
1275
|
-
type: "image_url",
|
|
1276
|
-
image_url: {
|
|
1277
|
-
url: part.image_url.url,
|
|
1278
|
-
detail: part.image_url.detail
|
|
1279
|
-
}
|
|
1280
|
-
});
|
|
1281
|
-
else if (part.type === "input_audio") parts.push({
|
|
1282
|
-
type: "input_audio",
|
|
1283
|
-
input_audio: {
|
|
1284
|
-
data: part.input_audio.data,
|
|
1285
|
-
format: part.input_audio.format
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
return {
|
|
1289
|
-
text: textPieces.join("\n"),
|
|
1290
|
-
parts
|
|
1291
|
-
};
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Read assistant text content. Assistant messages can carry an array of
|
|
1295
|
-
* text + refusal parts; refusal text is preserved as plain text so the
|
|
1296
|
-
* provider sees the full assistant turn.
|
|
1297
|
-
*/
|
|
1298
|
-
function readAssistantText(content) {
|
|
1299
|
-
if (content == null) return "";
|
|
1300
|
-
if (typeof content === "string") return content;
|
|
1301
|
-
const pieces = [];
|
|
1302
|
-
for (const part of content) if (part.type === "text") pieces.push(part.text);
|
|
1303
|
-
else if (part.type === "refusal") pieces.push(part.refusal);
|
|
1304
|
-
return pieces.join("\n");
|
|
1305
|
-
}
|
|
1306
|
-
/** Read tool message content (string or array of text parts). */
|
|
1307
|
-
function readToolContent(content) {
|
|
1308
|
-
if (typeof content === "string") return content;
|
|
1309
|
-
return content.map((p) => p.text).join("\n");
|
|
1310
|
-
}
|
|
1311
|
-
/**
|
|
1312
|
-
* Convert an OpenAI tool-spec array into the SDK's internal forwarding
|
|
1313
|
-
* shape. Custom (non-function) tools are dropped at this layer because
|
|
1314
|
-
* downstream providers only accept function-shaped tools; the route
|
|
1315
|
-
* layer is responsible for surfacing a 400 if the caller requested
|
|
1316
|
-
* something the provider can't run.
|
|
1317
|
-
*/
|
|
1318
|
-
function convertTools(tools) {
|
|
1319
|
-
if (!tools || tools.length === 0) return void 0;
|
|
1320
|
-
const out = [];
|
|
1321
|
-
for (const tool of tools) if (tool.type === "function") out.push({
|
|
1322
|
-
type: "function",
|
|
1323
|
-
function: {
|
|
1324
|
-
name: tool.function.name,
|
|
1325
|
-
description: tool.function.description,
|
|
1326
|
-
parameters: tool.function.parameters ?? null,
|
|
1327
|
-
strict: tool.function.strict ?? null
|
|
1328
|
-
}
|
|
1329
|
-
});
|
|
1330
|
-
return out.length > 0 ? out : void 0;
|
|
1331
|
-
}
|
|
1332
|
-
/**
|
|
1333
|
-
* Translate an OpenAI chat-shape message thread into a SandboxRunInput.
|
|
1334
|
-
*
|
|
1335
|
-
* @param messages Ordered messages as the OpenAI client would send them.
|
|
1336
|
-
* @param tools Optional function tool descriptors to forward unchanged.
|
|
1337
|
-
* @param model Caller-supplied model id (`tangle/<provider>[/<variant>]`).
|
|
1338
|
-
*
|
|
1339
|
-
* @throws when the resolved provider id is empty, when the message thread
|
|
1340
|
-
* lacks any user message, or when an `assistant` `tool_calls` item
|
|
1341
|
-
* is malformed (missing id/name/arguments).
|
|
1342
|
-
*/
|
|
1343
|
-
function openaiMessagesToSandboxInput(messages, tools, model) {
|
|
1344
|
-
const { provider, variant } = resolveProviderId(model);
|
|
1345
|
-
const instructionsPieces = [];
|
|
1346
|
-
const userPieces = [];
|
|
1347
|
-
const priorTurns = [];
|
|
1348
|
-
let pendingTurn = null;
|
|
1349
|
-
let pendingUserParts = [];
|
|
1350
|
-
let trailingUserParts = [];
|
|
1351
|
-
let multimodal = false;
|
|
1352
|
-
const flushPending = () => {
|
|
1353
|
-
if (pendingTurn) {
|
|
1354
|
-
priorTurns.push(pendingTurn);
|
|
1355
|
-
pendingTurn = null;
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
let lastUserIndex = -1;
|
|
1359
|
-
for (let i = messages.length - 1; i >= 0; i--) if (messages[i].role === "user") {
|
|
1360
|
-
lastUserIndex = i;
|
|
1361
|
-
break;
|
|
1362
|
-
}
|
|
1363
|
-
if (lastUserIndex === -1) throw new Error("openaiMessagesToSandboxInput: messages must contain at least one user message");
|
|
1364
|
-
for (let i = 0; i < messages.length; i++) {
|
|
1365
|
-
const msg = messages[i];
|
|
1366
|
-
switch (msg.role) {
|
|
1367
|
-
case "system":
|
|
1368
|
-
case "developer": {
|
|
1369
|
-
const { text } = normalizeContent(msg.content);
|
|
1370
|
-
if (text) instructionsPieces.push(text);
|
|
1371
|
-
break;
|
|
1372
|
-
}
|
|
1373
|
-
case "user": {
|
|
1374
|
-
const { text, parts } = normalizeContent(msg.content);
|
|
1375
|
-
if (parts.some((p) => p.type !== "text")) multimodal = true;
|
|
1376
|
-
if (i === lastUserIndex) {
|
|
1377
|
-
userPieces.push(text);
|
|
1378
|
-
if (parts.length > 0) trailingUserParts = parts;
|
|
1379
|
-
} else {
|
|
1380
|
-
flushPending();
|
|
1381
|
-
if (parts.length > 0) {
|
|
1382
|
-
pendingTurn = { userParts: parts };
|
|
1383
|
-
pendingUserParts = parts;
|
|
1384
|
-
} else {
|
|
1385
|
-
pendingTurn = {};
|
|
1386
|
-
pendingUserParts = [];
|
|
1387
|
-
}
|
|
1388
|
-
if (text) userPieces.push(text);
|
|
1389
|
-
}
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1392
|
-
case "assistant": {
|
|
1393
|
-
if (!pendingTurn) pendingTurn = {};
|
|
1394
|
-
const text = readAssistantText(msg.content);
|
|
1395
|
-
if (text) pendingTurn.assistantText = text;
|
|
1396
|
-
if (msg.tool_calls && msg.tool_calls.length > 0) {
|
|
1397
|
-
const calls = [];
|
|
1398
|
-
for (const call of msg.tool_calls) {
|
|
1399
|
-
if (call.type !== "function") continue;
|
|
1400
|
-
if (!call.id || !call.function?.name || typeof call.function.arguments !== "string") throw new Error(`openaiMessagesToSandboxInput: malformed assistant tool_call at index ${i}`);
|
|
1401
|
-
calls.push({
|
|
1402
|
-
id: call.id,
|
|
1403
|
-
name: call.function.name,
|
|
1404
|
-
arguments: call.function.arguments
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
if (calls.length > 0) pendingTurn.toolCalls = calls;
|
|
1408
|
-
}
|
|
1409
|
-
if (pendingUserParts.length > 0 && !pendingTurn.userParts) pendingTurn.userParts = pendingUserParts;
|
|
1410
|
-
break;
|
|
1411
|
-
}
|
|
1412
|
-
case "tool": {
|
|
1413
|
-
const result = {
|
|
1414
|
-
toolCallId: msg.tool_call_id,
|
|
1415
|
-
content: readToolContent(msg.content)
|
|
1416
|
-
};
|
|
1417
|
-
let attached = false;
|
|
1418
|
-
if (pendingTurn?.toolCalls?.some((c) => c.id === msg.tool_call_id)) {
|
|
1419
|
-
if (!pendingTurn.toolResults) pendingTurn.toolResults = [];
|
|
1420
|
-
pendingTurn.toolResults.push(result);
|
|
1421
|
-
attached = true;
|
|
1422
|
-
} else for (let j = priorTurns.length - 1; j >= 0; j--) {
|
|
1423
|
-
const turn = priorTurns[j];
|
|
1424
|
-
if (turn.toolCalls?.some((c) => c.id === msg.tool_call_id)) {
|
|
1425
|
-
if (!turn.toolResults) turn.toolResults = [];
|
|
1426
|
-
turn.toolResults.push(result);
|
|
1427
|
-
attached = true;
|
|
1428
|
-
break;
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
if (!attached) throw new Error(`openaiMessagesToSandboxInput: tool message references unknown tool_call_id ${msg.tool_call_id}`);
|
|
1432
|
-
break;
|
|
1433
|
-
}
|
|
1434
|
-
case "function": break;
|
|
1435
|
-
}
|
|
1436
|
-
if (i === lastUserIndex) flushPending();
|
|
1437
|
-
}
|
|
1438
|
-
flushPending();
|
|
1439
|
-
const result = {
|
|
1440
|
-
provider,
|
|
1441
|
-
task: userPieces.join("\n\n")
|
|
1442
|
-
};
|
|
1443
|
-
if (variant) result.variant = variant;
|
|
1444
|
-
const instructions = instructionsPieces.join("\n\n");
|
|
1445
|
-
if (instructions) result.instructions = instructions;
|
|
1446
|
-
if (trailingUserParts.length > 0) result.taskParts = trailingUserParts;
|
|
1447
|
-
if (priorTurns.length > 0) result.priorTurns = priorTurns;
|
|
1448
|
-
const toolSpecs = convertTools(tools);
|
|
1449
|
-
if (toolSpecs) result.tools = toolSpecs;
|
|
1450
|
-
if (multimodal) result.multimodal = true;
|
|
1451
|
-
return result;
|
|
1452
|
-
}
|
|
1453
|
-
//#endregion
|
|
1454
|
-
//#region src/openai/translate/responses.ts
|
|
1455
|
-
/**
|
|
1456
|
-
* Resolve a `previous_response_id` into the prior-turns prefix that
|
|
1457
|
-
* gets prepended to the new request. Throws when the id is supplied but
|
|
1458
|
-
* unknown — silently dropping it would corrupt conversation continuity.
|
|
1459
|
-
*/
|
|
1460
|
-
async function resolvePreviousResponseId(prevId, store) {
|
|
1461
|
-
if (!prevId) return { priorTurns: [] };
|
|
1462
|
-
const turns = await store.getPriorTurns(prevId);
|
|
1463
|
-
if (turns === null) throw new Error(`Unknown previous_response_id: ${prevId}`);
|
|
1464
|
-
return { priorTurns: turns };
|
|
1465
|
-
}
|
|
1466
|
-
function emptyUsage() {
|
|
1467
|
-
return {
|
|
1468
|
-
input_tokens: 0,
|
|
1469
|
-
output_tokens: 0,
|
|
1470
|
-
total_tokens: 0,
|
|
1471
|
-
input_tokens_details: { cached_tokens: 0 },
|
|
1472
|
-
output_tokens_details: { reasoning_tokens: 0 }
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
function readUsageFromEvent(event) {
|
|
1476
|
-
const u = event.usage ?? event;
|
|
1477
|
-
const input = Number(u.input_tokens ?? u.prompt_tokens ?? u.inputTokens ?? 0);
|
|
1478
|
-
const output = Number(u.output_tokens ?? u.completion_tokens ?? u.outputTokens ?? 0);
|
|
1479
|
-
if (input === 0 && output === 0 && !("total_tokens" in u)) return null;
|
|
1480
|
-
const total = Number(u.total_tokens ?? input + output);
|
|
1481
|
-
const cached = Number(u.input_tokens_details?.cached_tokens ?? u.cached_tokens ?? 0);
|
|
1482
|
-
const reasoning = Number(u.output_tokens_details?.reasoning_tokens ?? u.reasoning_tokens ?? 0);
|
|
1483
|
-
return {
|
|
1484
|
-
input_tokens: input,
|
|
1485
|
-
output_tokens: output,
|
|
1486
|
-
total_tokens: total,
|
|
1487
|
-
input_tokens_details: { cached_tokens: cached },
|
|
1488
|
-
output_tokens_details: { reasoning_tokens: reasoning }
|
|
1489
|
-
};
|
|
1490
|
-
}
|
|
1491
|
-
function readToolInvocationFromRaw(event) {
|
|
1492
|
-
if (event.type !== "raw") return null;
|
|
1493
|
-
const data = event.data ?? event;
|
|
1494
|
-
const inner = typeof data.type === "string" ? data.type : "";
|
|
1495
|
-
const isComputerUse = inner === "computer-use" || inner === "computer_call" || typeof data.computerUse === "object" || typeof data.computer_use === "object";
|
|
1496
|
-
if (!(inner === "tool-invocation" || inner === "tool_call" || typeof data.toolInvocation === "object" || typeof data.tool_invocation === "object") && !isComputerUse) return null;
|
|
1497
|
-
const ti = data.toolInvocation ?? data.tool_invocation ?? data.computerUse ?? data.computer_use ?? data;
|
|
1498
|
-
const id = typeof ti.toolCallId === "string" ? ti.toolCallId : typeof ti.tool_call_id === "string" ? ti.tool_call_id : typeof ti.id === "string" ? ti.id : typeof ti.callId === "string" ? ti.callId : "";
|
|
1499
|
-
const name = isComputerUse ? "computer_use" : typeof ti.toolName === "string" ? ti.toolName : typeof ti.tool_name === "string" ? ti.tool_name : typeof ti.name === "string" ? ti.name : "";
|
|
1500
|
-
const args = ti.args ?? ti.arguments ?? ti.input ?? {};
|
|
1501
|
-
if (!id || !name) return null;
|
|
1502
|
-
return {
|
|
1503
|
-
id,
|
|
1504
|
-
name,
|
|
1505
|
-
arguments: typeof args === "string" ? args : JSON.stringify(args),
|
|
1506
|
-
isComputerUse,
|
|
1507
|
-
computerAction: isComputerUse ? ti.action ?? void 0 : void 0
|
|
1508
|
-
};
|
|
1509
|
-
}
|
|
1510
|
-
function readReasoningFromPart(event) {
|
|
1511
|
-
if (event.type !== "message.part.updated") return null;
|
|
1512
|
-
const part = event.part ?? event;
|
|
1513
|
-
if (part.type !== "reasoning" && part.type !== "thinking") return null;
|
|
1514
|
-
if (typeof part.text === "string") return part.text;
|
|
1515
|
-
if (typeof part.content === "string") return part.content;
|
|
1516
|
-
return null;
|
|
1517
|
-
}
|
|
1518
|
-
/**
|
|
1519
|
-
* Aggregate a Tangle SSE event sequence into the Responses-API output[]
|
|
1520
|
-
* array plus a usage envelope. This is the non-streaming path: callers
|
|
1521
|
-
* collect every event, hand them all in, and get back a settled response
|
|
1522
|
-
* payload ready to return as JSON.
|
|
1523
|
-
*/
|
|
1524
|
-
function assembleResponseOutput(events) {
|
|
1525
|
-
const accum = {
|
|
1526
|
-
textPieces: [],
|
|
1527
|
-
toolCalls: /* @__PURE__ */ new Map(),
|
|
1528
|
-
toolCallOrder: [],
|
|
1529
|
-
computerCalls: [],
|
|
1530
|
-
reasoningPieces: [],
|
|
1531
|
-
usage: emptyUsage(),
|
|
1532
|
-
hasUsage: false
|
|
1533
|
-
};
|
|
1534
|
-
for (const event of events) switch (event.type) {
|
|
1535
|
-
case "token": {
|
|
1536
|
-
const delta = typeof event.delta === "string" && event.delta || typeof event.text === "string" && event.text || typeof event.token === "string" && event.token || "";
|
|
1537
|
-
if (delta) accum.textPieces.push(delta);
|
|
1538
|
-
break;
|
|
1539
|
-
}
|
|
1540
|
-
case "raw": {
|
|
1541
|
-
const tool = readToolInvocationFromRaw(event);
|
|
1542
|
-
if (!tool) break;
|
|
1543
|
-
if (tool.isComputerUse) accum.computerCalls.push({
|
|
1544
|
-
type: "computer_call",
|
|
1545
|
-
id: `cc_${tool.id}`,
|
|
1546
|
-
call_id: tool.id,
|
|
1547
|
-
status: "completed",
|
|
1548
|
-
pending_safety_checks: [],
|
|
1549
|
-
...tool.computerAction ? { action: tool.computerAction } : {}
|
|
1550
|
-
});
|
|
1551
|
-
else {
|
|
1552
|
-
if (!accum.toolCalls.has(tool.id)) accum.toolCallOrder.push(tool.id);
|
|
1553
|
-
accum.toolCalls.set(tool.id, {
|
|
1554
|
-
type: "function_call",
|
|
1555
|
-
id: `fc_${tool.id}`,
|
|
1556
|
-
call_id: tool.id,
|
|
1557
|
-
name: tool.name,
|
|
1558
|
-
arguments: tool.arguments,
|
|
1559
|
-
status: "completed"
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
break;
|
|
1563
|
-
}
|
|
1564
|
-
case "message.part.updated": {
|
|
1565
|
-
const reasoning = readReasoningFromPart(event);
|
|
1566
|
-
if (reasoning) accum.reasoningPieces.push(reasoning);
|
|
1567
|
-
break;
|
|
1568
|
-
}
|
|
1569
|
-
case "done": {
|
|
1570
|
-
const usage = readUsageFromEvent(event);
|
|
1571
|
-
if (usage) {
|
|
1572
|
-
accum.usage = foldUsage(accum.usage, usage);
|
|
1573
|
-
accum.hasUsage = true;
|
|
1574
|
-
}
|
|
1575
|
-
break;
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
const output = [];
|
|
1579
|
-
if (accum.reasoningPieces.length > 0) {
|
|
1580
|
-
const reasoning = {
|
|
1581
|
-
type: "reasoning",
|
|
1582
|
-
id: "rs_0",
|
|
1583
|
-
summary: [],
|
|
1584
|
-
content: accum.reasoningPieces.map((text) => ({
|
|
1585
|
-
type: "reasoning_text",
|
|
1586
|
-
text
|
|
1587
|
-
})),
|
|
1588
|
-
status: "completed"
|
|
1589
|
-
};
|
|
1590
|
-
output.push(reasoning);
|
|
1591
|
-
}
|
|
1592
|
-
if (accum.textPieces.length > 0) {
|
|
1593
|
-
const message = {
|
|
1594
|
-
type: "message",
|
|
1595
|
-
id: "msg_0",
|
|
1596
|
-
role: "assistant",
|
|
1597
|
-
status: "completed",
|
|
1598
|
-
content: [{
|
|
1599
|
-
type: "output_text",
|
|
1600
|
-
text: accum.textPieces.join(""),
|
|
1601
|
-
annotations: []
|
|
1602
|
-
}]
|
|
1603
|
-
};
|
|
1604
|
-
output.push(message);
|
|
1605
|
-
}
|
|
1606
|
-
for (const id of accum.toolCallOrder) {
|
|
1607
|
-
const call = accum.toolCalls.get(id);
|
|
1608
|
-
if (call) output.push(call);
|
|
1609
|
-
}
|
|
1610
|
-
for (const cc of accum.computerCalls) output.push(cc);
|
|
1611
|
-
return {
|
|
1612
|
-
output,
|
|
1613
|
-
usage: accum.usage
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
function foldUsage(a, b) {
|
|
1617
|
-
return {
|
|
1618
|
-
input_tokens: a.input_tokens + b.input_tokens,
|
|
1619
|
-
output_tokens: a.output_tokens + b.output_tokens,
|
|
1620
|
-
total_tokens: a.total_tokens + b.total_tokens,
|
|
1621
|
-
input_tokens_details: { cached_tokens: a.input_tokens_details.cached_tokens + b.input_tokens_details.cached_tokens },
|
|
1622
|
-
output_tokens_details: { reasoning_tokens: a.output_tokens_details.reasoning_tokens + b.output_tokens_details.reasoning_tokens }
|
|
1623
|
-
};
|
|
1624
|
-
}
|
|
1625
|
-
/**
|
|
1626
|
-
* Fold every usage frame in a Tangle event sequence into a single
|
|
1627
|
-
* ResponseUsage envelope. Multiple `done` events are tolerated (e.g.
|
|
1628
|
-
* during retries) by summing.
|
|
1629
|
-
*/
|
|
1630
|
-
function usageFromEvents(events) {
|
|
1631
|
-
let total = emptyUsage();
|
|
1632
|
-
for (const event of events) {
|
|
1633
|
-
if (event.type !== "done") continue;
|
|
1634
|
-
const u = readUsageFromEvent(event);
|
|
1635
|
-
if (u) total = foldUsage(total, u);
|
|
1636
|
-
}
|
|
1637
|
-
return total;
|
|
1638
|
-
}
|
|
1639
|
-
const SUPPORTED_TOOL_TYPES = new Set([
|
|
1640
|
-
"function",
|
|
1641
|
-
"computer_use_preview",
|
|
1642
|
-
"code_interpreter"
|
|
1643
|
-
]);
|
|
1644
|
-
const REJECTED_TOOL_TYPES = new Set([
|
|
1645
|
-
"web_search",
|
|
1646
|
-
"web_search_preview",
|
|
1647
|
-
"file_search"
|
|
1648
|
-
]);
|
|
1649
|
-
var ResponsesValidationError = class extends Error {
|
|
1650
|
-
type = "invalid_request_error";
|
|
1651
|
-
code;
|
|
1652
|
-
param;
|
|
1653
|
-
constructor(message, code, param) {
|
|
1654
|
-
super(message);
|
|
1655
|
-
this.name = "ResponsesValidationError";
|
|
1656
|
-
this.code = code;
|
|
1657
|
-
this.param = param;
|
|
1658
|
-
}
|
|
1659
|
-
};
|
|
1660
|
-
/**
|
|
1661
|
-
* Reject Responses requests that ask for tool types Tangle cannot
|
|
1662
|
-
* service. Function tools, the OpenAI computer-use preview tool, and
|
|
1663
|
-
* the code interpreter (every Tangle sandbox can run code) are
|
|
1664
|
-
* accepted; web_search and file_search are explicitly rejected with
|
|
1665
|
-
* the OpenAI error shape.
|
|
1666
|
-
*/
|
|
1667
|
-
function validateResponsesRequest(req) {
|
|
1668
|
-
const tools = req.tools;
|
|
1669
|
-
if (!tools || tools.length === 0) return;
|
|
1670
|
-
for (let i = 0; i < tools.length; i++) {
|
|
1671
|
-
const type = tools[i].type;
|
|
1672
|
-
if (typeof type !== "string") throw new ResponsesValidationError(`tools[${i}] is missing a type discriminator`, "invalid_tool", `tools[${i}].type`);
|
|
1673
|
-
if (REJECTED_TOOL_TYPES.has(type)) throw new ResponsesValidationError(`Tool type "${type}" is not supported by this endpoint`, "unsupported_tool", `tools[${i}].type`);
|
|
1674
|
-
if (!SUPPORTED_TOOL_TYPES.has(type)) throw new ResponsesValidationError(`Tool type "${type}" is not recognized`, "unsupported_tool", `tools[${i}].type`);
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
/**
|
|
1678
|
-
* Build a settled `Response` shell from an aggregated output + usage.
|
|
1679
|
-
* Caller fills in the runtime-specific fields (id, model, created_at,
|
|
1680
|
-
* status, instructions, etc.) to avoid having to re-derive them inside
|
|
1681
|
-
* the translator.
|
|
1682
|
-
*/
|
|
1683
|
-
function buildResponseShell(args) {
|
|
1684
|
-
const outputText = args.output.filter((item) => item.type === "message").flatMap((m) => m.content).filter((c) => c.type === "output_text").map((c) => c.text).join("");
|
|
1685
|
-
return {
|
|
1686
|
-
id: args.id,
|
|
1687
|
-
object: "response",
|
|
1688
|
-
created_at: args.createdAt,
|
|
1689
|
-
output_text: outputText,
|
|
1690
|
-
error: null,
|
|
1691
|
-
incomplete_details: null,
|
|
1692
|
-
instructions: args.instructions ?? null,
|
|
1693
|
-
metadata: null,
|
|
1694
|
-
model: args.model,
|
|
1695
|
-
output: args.output,
|
|
1696
|
-
parallel_tool_calls: false,
|
|
1697
|
-
temperature: null,
|
|
1698
|
-
tool_choice: "auto",
|
|
1699
|
-
tools: [],
|
|
1700
|
-
top_p: null,
|
|
1701
|
-
status: "completed",
|
|
1702
|
-
usage: args.usage,
|
|
1703
|
-
previous_response_id: args.previousResponseId ?? null
|
|
1704
|
-
};
|
|
1705
|
-
}
|
|
1706
|
-
//#endregion
|
|
1707
|
-
//#region src/openai/types.ts
|
|
1708
|
-
/**
|
|
1709
|
-
* Construct a fresh translator context. The factory is deliberately tiny
|
|
1710
|
-
* — call sites that need to override fields can do so via the partial.
|
|
1711
|
-
*/
|
|
1712
|
-
function createTranslatorContext(init) {
|
|
1713
|
-
return {
|
|
1714
|
-
chunkIndex: 0,
|
|
1715
|
-
toolCallBuffer: /* @__PURE__ */ new Map(),
|
|
1716
|
-
createdAt: Math.floor(Date.now() / 1e3),
|
|
1717
|
-
...init
|
|
1718
|
-
};
|
|
1719
|
-
}
|
|
1720
|
-
//#endregion
|
|
1721
|
-
export { EmbeddingValidationError, HookChain, InMemoryResponseStore, ResponsesValidationError, Run, actionRateLimitHook, assembleResponseOutput, auditLogHook, buildResponseShell, costCapHook, createTranslatorContext, destructiveActionGuardHook, egressPolicyHook, openaiMessagesToSandboxInput, outcomeToFinishReason, resolvePreviousResponseId, runEvents, sandboxEventToChatChunk, sandboxEventToCompletionChunk, sandboxEventToResponsesEvent, screenshotRedactionHook, usageFromEvents, validateEmbeddingRequest, validateResponsesRequest };
|
|
1
|
+
const a0_0x486ab8=a0_0x20fc;(function(_0x1ee8f0,_0x13b5d5){const _0x1a4c46=a0_0x20fc,_0x487065=_0x1ee8f0();while(!![]){try{const _0x43e0a2=parseInt(_0x1a4c46(0x31a))/0x1*(-parseInt(_0x1a4c46(0x264))/0x2)+parseInt(_0x1a4c46(0x1de))/0x3*(parseInt(_0x1a4c46(0x24a))/0x4)+parseInt(_0x1a4c46(0x198))/0x5+parseInt(_0x1a4c46(0x1e4))/0x6*(-parseInt(_0x1a4c46(0x342))/0x7)+parseInt(_0x1a4c46(0x324))/0x8*(parseInt(_0x1a4c46(0x238))/0x9)+-parseInt(_0x1a4c46(0x1a1))/0xa*(-parseInt(_0x1a4c46(0x1f3))/0xb)+-parseInt(_0x1a4c46(0x2c6))/0xc*(parseInt(_0x1a4c46(0x208))/0xd);if(_0x43e0a2===_0x13b5d5)break;else _0x487065['push'](_0x487065['shift']());}catch(_0x121b1f){_0x487065['push'](_0x487065['shift']());}}}(a0_0x58b8,0x1dd32));var HookChain=class{[a0_0x486ab8(0x195)];constructor(_0x2518f3=[]){const _0x1bbe6c=a0_0x486ab8;this[_0x1bbe6c(0x195)]=_0x2518f3;}get[a0_0x486ab8(0x348)](){const _0x21445b=a0_0x486ab8;return this[_0x21445b(0x195)][_0x21445b(0x1d2)];}async[a0_0x486ab8(0x172)](_0x1f7ea0){const _0x198716=a0_0x486ab8,_0x3d0598={'\x56\x70\x72\x64\x48':'\x72\x65\x77\x72\x69\x74\x65','\x4b\x52\x67\x73\x63':function(_0x3d79d4,_0xdad38){return _0x3d79d4??_0xdad38;}};let _0x1b471b=_0x1f7ea0,_0x1c5137=null;for(const _0x5cf3f0 of this[_0x198716(0x195)]){if(!_0x5cf3f0[_0x198716(0x2e1)])continue;const _0x57e535=await _0x5cf3f0[_0x198716(0x2e1)](_0x1b471b);if(_0x57e535['\x61\x63\x74\x69\x6f\x6e']===_0x198716(0x2d4))return _0x57e535;_0x57e535['\x61\x63\x74\x69\x6f\x6e']===_0x3d0598[_0x198716(0x1d0)]&&(_0x1b471b={..._0x1b471b,'\x61\x72\x67\x73':_0x57e535[_0x198716(0x322)]},_0x1c5137=_0x57e535);}return _0x3d0598[_0x198716(0x261)](_0x1c5137,{'\x61\x63\x74\x69\x6f\x6e':_0x198716(0x1c1)});}async[a0_0x486ab8(0x2a5)](_0x1f5be6,_0x4b389d){const _0x1bc1a9=a0_0x486ab8,_0x47b8bf={'\x56\x77\x58\x4a\x77':function(_0x354304,_0x2e31c4){return _0x354304===_0x2e31c4;},'\x72\x57\x72\x63\x6d':_0x1bc1a9(0x2eb),'\x41\x68\x47\x6f\x57':function(_0x5f4e0a,_0x293463){return _0x5f4e0a??_0x293463;}};let _0x3854e0=_0x4b389d,_0x1e8fdb=null;for(const _0x35b640 of this[_0x1bc1a9(0x195)]){if(!_0x35b640[_0x1bc1a9(0x30e)])continue;const _0x4c590a=await _0x35b640['\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'](_0x1f5be6,_0x3854e0);if(_0x47b8bf[_0x1bc1a9(0x30a)](_0x4c590a['\x61\x63\x74\x69\x6f\x6e'],_0x47b8bf['\x72\x57\x72\x63\x6d']))return _0x4c590a;_0x47b8bf[_0x1bc1a9(0x30a)](_0x4c590a[_0x1bc1a9(0x1fd)],_0x1bc1a9(0x19c))&&(_0x3854e0=_0x4c590a[_0x1bc1a9(0x277)],_0x1e8fdb=_0x4c590a);}return _0x47b8bf[_0x1bc1a9(0x1b7)](_0x1e8fdb,{'\x61\x63\x74\x69\x6f\x6e':_0x1bc1a9(0x26e)});}};function auditLogHook(_0x28179={}){const _0x530e1d=a0_0x486ab8,_0x55cc73={'\x42\x64\x48\x4a\x49':function(_0x41b695,_0x4791b6){return _0x41b695(_0x4791b6);}},_0x16bf6a=_0x28179[_0x530e1d(0x1b0)]??(_0x346379=>{const _0x380f8d=_0x530e1d;console[_0x380f8d(0x1cc)](_0x380f8d(0x31c),_0x346379);});return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x355a92){const _0x3250b8=_0x530e1d;return await _0x55cc73[_0x3250b8(0x314)](_0x16bf6a,{'\x70\x68\x61\x73\x65':_0x3250b8(0x206),'\x72\x75\x6e\x49\x64':_0x355a92[_0x3250b8(0x17a)],'\x74\x68\x72\x65\x61\x64\x49\x64':_0x355a92[_0x3250b8(0x255)],'\x70\x61\x72\x74\x6e\x65\x72\x49\x64':_0x355a92[_0x3250b8(0x269)],'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x355a92[_0x3250b8(0x1c6)],'\x63\x61\x6c\x6c\x49\x64':_0x355a92['\x63\x61\x6c\x6c\x49\x64'],'\x74\x69\x6d\x65\x73\x74\x61\x6d\x70':_0x355a92['\x74\x69\x6d\x65\x73\x74\x61\x6d\x70'],'\x61\x72\x67\x73':_0x355a92[_0x3250b8(0x322)]}),{'\x61\x63\x74\x69\x6f\x6e':'\x61\x6c\x6c\x6f\x77'};},async '\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x99701,_0x14a25b){const _0x2a5d86=_0x530e1d;return await _0x55cc73[_0x2a5d86(0x314)](_0x16bf6a,{'\x70\x68\x61\x73\x65':_0x2a5d86(0x343),'\x72\x75\x6e\x49\x64':_0x99701[_0x2a5d86(0x17a)],'\x74\x68\x72\x65\x61\x64\x49\x64':_0x99701[_0x2a5d86(0x255)],'\x70\x61\x72\x74\x6e\x65\x72\x49\x64':_0x99701['\x70\x61\x72\x74\x6e\x65\x72\x49\x64'],'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x99701[_0x2a5d86(0x1c6)],'\x63\x61\x6c\x6c\x49\x64':_0x99701[_0x2a5d86(0x27b)],'\x74\x69\x6d\x65\x73\x74\x61\x6d\x70':_0x99701[_0x2a5d86(0x237)],'\x72\x65\x73\x75\x6c\x74':_0x14a25b}),{'\x61\x63\x74\x69\x6f\x6e':'\x70\x61\x73\x73'};}};}const NETWORK_TOOL_REGEX=/^(fetch|http|https|browser|playwright|curl|wget|computer-use:click|computer-use:type)/i,URL_FIELD_NAMES=new Set(['\x75\x72\x6c',a0_0x486ab8(0x2b3),a0_0x486ab8(0x256),a0_0x486ab8(0x231),'\x73\x72\x63',a0_0x486ab8(0x329),a0_0x486ab8(0x309)]);function extractUrlsFromArgs(_0xda21a9){const _0x9e95ab=a0_0x486ab8,_0x3dbd63={'\x4e\x43\x55\x70\x63':function(_0x1e3ef6,_0x2a9c74){return _0x1e3ef6===_0x2a9c74;},'\x5a\x46\x74\x53\x74':_0x9e95ab(0x2cd),'\x70\x74\x77\x78\x47':'\x6f\x62\x6a\x65\x63\x74','\x59\x66\x62\x73\x44':function(_0x450f51,_0x3895e0){return _0x450f51(_0x3895e0);}},_0x164fbc=[],_0x10a6cc=_0x5eec15=>{const _0xf097db=_0x9e95ab;if(_0x3dbd63[_0xf097db(0x177)](typeof _0x5eec15,_0x3dbd63[_0xf097db(0x230)])){if(/^https?:\/\//i[_0xf097db(0x211)](_0x5eec15))try{const _0x38f57e=new URL(_0x5eec15);_0x164fbc[_0xf097db(0x245)]({'\x72\x61\x77':_0x5eec15,'\x68\x6f\x73\x74':_0x38f57e[_0xf097db(0x204)]});}catch{_0x164fbc[_0xf097db(0x245)]({'\x72\x61\x77':_0x5eec15,'\x68\x6f\x73\x74':null});}return;}if(_0x3dbd63[_0xf097db(0x177)](_0x5eec15,null)||typeof _0x5eec15!==_0x3dbd63['\x70\x74\x77\x78\x47'])return;if(Array['\x69\x73\x41\x72\x72\x61\x79'](_0x5eec15)){for(const _0x4beb34 of _0x5eec15)_0x10a6cc(_0x4beb34);return;}for(const [_0x8ad7f4,_0x491768]of Object[_0xf097db(0x194)](_0x5eec15)){if(URL_FIELD_NAMES[_0xf097db(0x22e)](_0x8ad7f4[_0xf097db(0x2d9)]())&&typeof _0x491768===_0xf097db(0x2cd)){try{const _0x38c059=new URL(_0x491768);_0x164fbc['\x70\x75\x73\x68']({'\x72\x61\x77':_0x491768,'\x68\x6f\x73\x74':_0x38c059[_0xf097db(0x204)]});}catch{_0x164fbc[_0xf097db(0x245)]({'\x72\x61\x77':_0x491768,'\x68\x6f\x73\x74':null});}continue;}_0x10a6cc(_0x491768);}};return _0x3dbd63[_0x9e95ab(0x32f)](_0x10a6cc,_0xda21a9),_0x164fbc;}function isNetworkLike(_0x1c8c68,_0x504d9d){const _0x431f0e=a0_0x486ab8;if(NETWORK_TOOL_REGEX[_0x431f0e(0x211)](_0x1c8c68[_0x431f0e(0x1c6)]))return!![];return _0x504d9d[_0x431f0e(0x1d2)]>0x0;}function hostMatches(_0x16d4c2,_0x3f44a9){const _0x56d388=a0_0x486ab8;if(_0x3f44a9===_0x16d4c2)return!![];if(_0x3f44a9[_0x56d388(0x2ff)]('\x2a\x2e')){const _0x3c7c8b=_0x3f44a9[_0x56d388(0x18b)](0x1);return _0x16d4c2['\x65\x6e\x64\x73\x57\x69\x74\x68'](_0x3c7c8b);}return![];}function egressPolicyHook(_0x2f4621={}){const _0x2791c1=a0_0x486ab8,_0x5bb717={'\x49\x5a\x65\x54\x73':_0x2791c1(0x2d4),'\x7a\x4f\x48\x6c\x4f':function(_0x1fab9d,_0x47d6c1){return _0x1fab9d>_0x47d6c1;},'\x6b\x49\x6c\x43\x66':_0x2791c1(0x1c1)},_0x17db33=_0x2f4621['\x64\x65\x6e\x79\x4c\x69\x73\x74']??[],_0x4c65dc=_0x2f4621[_0x2791c1(0x31f)];return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x29d5fc){const _0x4c17f8=_0x2791c1,_0x2085cb=extractUrlsFromArgs(_0x29d5fc[_0x4c17f8(0x322)]);if(!isNetworkLike(_0x29d5fc,_0x2085cb))return{'\x61\x63\x74\x69\x6f\x6e':_0x4c17f8(0x1c1)};if(_0x2f4621[_0x4c17f8(0x271)])return await _0x2f4621[_0x4c17f8(0x271)](_0x29d5fc)?{'\x61\x63\x74\x69\x6f\x6e':'\x61\x6c\x6c\x6f\x77'}:{'\x61\x63\x74\x69\x6f\x6e':_0x5bb717[_0x4c17f8(0x272)],'\x72\x65\x61\x73\x6f\x6e':_0x4c17f8(0x306)};for(const _0x8c0a03 of _0x2085cb){if(!_0x8c0a03[_0x4c17f8(0x204)])continue;for(const _0x2b3807 of _0x17db33)if(hostMatches(_0x8c0a03['\x68\x6f\x73\x74'],_0x2b3807))return{'\x61\x63\x74\x69\x6f\x6e':'\x62\x6c\x6f\x63\x6b','\x72\x65\x61\x73\x6f\x6e':_0x4c17f8(0x1b1)+_0x8c0a03[_0x4c17f8(0x204)]+_0x4c17f8(0x341)+_0x2b3807+'\x22'};}if(_0x4c65dc&&_0x5bb717[_0x4c17f8(0x32c)](_0x4c65dc[_0x4c17f8(0x1d2)],0x0))for(const _0x183890 of _0x2085cb){const _0x464a89=_0x183890['\x68\x6f\x73\x74'];if(!_0x464a89)return{'\x61\x63\x74\x69\x6f\x6e':_0x5bb717['\x49\x5a\x65\x54\x73'],'\x72\x65\x61\x73\x6f\x6e':_0x4c17f8(0x32a)};if(!_0x4c65dc[_0x4c17f8(0x273)](_0x5f1fdf=>hostMatches(_0x464a89,_0x5f1fdf)))return{'\x61\x63\x74\x69\x6f\x6e':_0x5bb717[_0x4c17f8(0x272)],'\x72\x65\x61\x73\x6f\x6e':_0x4c17f8(0x1b1)+_0x464a89+_0x4c17f8(0x346)};}return{'\x61\x63\x74\x69\x6f\x6e':_0x5bb717['\x6b\x49\x6c\x43\x66']};}};}function costCapHook(_0x4f4bff){const _0x4a01ad=a0_0x486ab8,_0x574d49={'\x69\x67\x58\x68\x58':function(_0x41535e,_0x1dd48a){return _0x41535e>=_0x1dd48a;},'\x41\x6f\x62\x42\x57':_0x4a01ad(0x1c1),'\x56\x6a\x58\x42\x4e':function(_0x51c156,_0x2843e4){return _0x51c156(_0x2843e4);}},_0x28defb=_0x4f4bff[_0x4a01ad(0x33c)]??(async()=>0x0);return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x15358e){const _0x1dbd1b=_0x4a01ad,_0x411161=await _0x28defb(_0x15358e[_0x1dbd1b(0x269)]);if(_0x574d49[_0x1dbd1b(0x335)](_0x411161,_0x4f4bff['\x63\x65\x69\x6c\x69\x6e\x67']))return{'\x61\x63\x74\x69\x6f\x6e':'\x62\x6c\x6f\x63\x6b','\x72\x65\x61\x73\x6f\x6e':_0x1dbd1b(0x1be)+_0x411161+_0x1dbd1b(0x1b5)+_0x4f4bff['\x63\x65\x69\x6c\x69\x6e\x67']};return{'\x61\x63\x74\x69\x6f\x6e':_0x574d49[_0x1dbd1b(0x302)]};},async '\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x57ebaa){const _0x1f00bd=_0x4a01ad,_0x1e38a8=await _0x574d49[_0x1f00bd(0x2ca)](_0x28defb,_0x57ebaa[_0x1f00bd(0x269)]);if(_0x574d49['\x69\x67\x58\x68\x58'](_0x1e38a8,_0x4f4bff[_0x1f00bd(0x30d)]))return{'\x61\x63\x74\x69\x6f\x6e':_0x1f00bd(0x2eb),'\x72\x65\x61\x73\x6f\x6e':_0x1f00bd(0x2f7)+_0x1e38a8+_0x1f00bd(0x1b5)+_0x4f4bff['\x63\x65\x69\x6c\x69\x6e\x67']};return{'\x61\x63\x74\x69\x6f\x6e':'\x70\x61\x73\x73'};}};}function actionRateLimitHook(_0x5248fd){const _0x15aa7a=a0_0x486ab8,_0x23ab1b={'\x54\x5a\x61\x68\x47':function(_0xe695f9){return _0xe695f9();},'\x59\x59\x61\x68\x4e':function(_0x19aa01,_0x182675){return _0x19aa01-_0x182675;},'\x4a\x62\x6a\x42\x6d':function(_0x3882f2,_0x1f9bcc){return _0x3882f2*_0x1f9bcc;},'\x46\x4a\x42\x65\x54':_0x15aa7a(0x1c1)},_0x190aa6=_0x5248fd[_0x15aa7a(0x326)]??Date['\x6e\x6f\x77'],_0x2d684d=Math[_0x15aa7a(0x246)](0x1,Math['\x66\x6c\x6f\x6f\x72'](_0x5248fd['\x70\x65\x72\x53\x65\x63\x6f\x6e\x64\x50\x65\x72\x53\x65\x73\x73\x69\x6f\x6e'])),_0x54c494=_0x5248fd[_0x15aa7a(0x2e2)]/0x3e8,_0x513bdf=new Map();return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x39627a){const _0x2c7ef9=_0x15aa7a;if(!_0x39627a[_0x2c7ef9(0x1c6)][_0x2c7ef9(0x2ff)](_0x2c7ef9(0x17d)))return{'\x61\x63\x74\x69\x6f\x6e':_0x2c7ef9(0x1c1)};const _0x31bc19=_0x39627a[_0x2c7ef9(0x17a)],_0x2332a3=_0x23ab1b[_0x2c7ef9(0x21d)](_0x190aa6),_0x26014b=_0x513bdf[_0x2c7ef9(0x176)](_0x31bc19)??{'\x74\x6f\x6b\x65\x6e\x73':_0x2d684d,'\x6c\x61\x73\x74\x52\x65\x66\x69\x6c\x6c\x4d\x73':_0x2332a3},_0x2269ce=Math['\x6d\x61\x78'](0x0,_0x23ab1b[_0x2c7ef9(0x26a)](_0x2332a3,_0x26014b[_0x2c7ef9(0x2be)]));_0x26014b[_0x2c7ef9(0x19f)]=Math[_0x2c7ef9(0x298)](_0x2d684d,_0x26014b[_0x2c7ef9(0x19f)]+_0x23ab1b[_0x2c7ef9(0x184)](_0x2269ce,_0x54c494)),_0x26014b[_0x2c7ef9(0x2be)]=_0x2332a3;if(_0x26014b[_0x2c7ef9(0x19f)]<0x1)return _0x513bdf['\x73\x65\x74'](_0x31bc19,_0x26014b),{'\x61\x63\x74\x69\x6f\x6e':_0x2c7ef9(0x2d4),'\x72\x65\x61\x73\x6f\x6e':_0x2c7ef9(0x197)+_0x5248fd[_0x2c7ef9(0x2e2)]+'\x2f\x73'};return _0x26014b[_0x2c7ef9(0x19f)]-=0x1,_0x513bdf['\x73\x65\x74'](_0x31bc19,_0x26014b),{'\x61\x63\x74\x69\x6f\x6e':_0x23ab1b[_0x2c7ef9(0x33f)]};}};}function readScreenshotPayload(_0x55bd50){const _0x2af032=a0_0x486ab8,_0x271be7={'\x55\x73\x75\x4c\x47':'\x6f\x62\x6a\x65\x63\x74','\x71\x4a\x43\x51\x67':function(_0x130472,_0x56aaa1){return _0x130472===_0x56aaa1;}},_0x2618b8=[_0x55bd50[_0x2af032(0x1ce)],_0x55bd50['\x64\x65\x74\x61\x69\x6c\x73']?.[_0x2af032(0x2ee)],_0x55bd50[_0x2af032(0x183)]];for(const _0x7877ed of _0x2618b8)if(_0x7877ed&&typeof _0x7877ed===_0x271be7[_0x2af032(0x286)]){if(_0x271be7[_0x2af032(0x192)](typeof _0x7877ed[_0x2af032(0x29c)],_0x2af032(0x2cd)))return _0x7877ed;}return null;}function screenshotRedactionHook(_0xdba435={}){const _0x31b9b=a0_0x486ab8,_0x1fe93f={'\x68\x53\x6d\x73\x41':_0x31b9b(0x19d),'\x4d\x78\x7a\x49\x4c':_0x31b9b(0x26e),'\x43\x44\x42\x72\x45':function(_0x2f321d,_0x824a96){return _0x2f321d(_0x824a96);},'\x6a\x50\x77\x46\x62':function(_0x124641,_0x1cc3dc){return _0x124641>_0x1cc3dc;}},_0xbc811b=_0xdba435['\x77\x61\x72\x6e']??(_0x5cae47=>console[_0x31b9b(0x20b)](_0x5cae47)),_0x410377=_0x1fe93f[_0x31b9b(0x18d)](_0xdba435[_0x31b9b(0x23d)]?.[_0x31b9b(0x1d2)]??0x0,0x0);let _0x3ef069=![];return{async '\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x5367f7,_0x1c69a6){const _0x13457c=_0x31b9b;if(_0x5367f7[_0x13457c(0x1c6)]!==_0x1fe93f[_0x13457c(0x1e8)])return{'\x61\x63\x74\x69\x6f\x6e':_0x1fe93f['\x4d\x78\x7a\x49\x4c']};if(!_0x410377)return{'\x61\x63\x74\x69\x6f\x6e':'\x70\x61\x73\x73'};if(!_0x1fe93f['\x43\x44\x42\x72\x45'](readScreenshotPayload,_0x1c69a6))return{'\x61\x63\x74\x69\x6f\x6e':_0x13457c(0x26e)};return!_0x3ef069&&(_0x3ef069=!![],_0x1fe93f['\x43\x44\x42\x72\x45'](_0xbc811b,_0x13457c(0x2b0))),{'\x61\x63\x74\x69\x6f\x6e':_0x13457c(0x26e)};}};}const TYPE_TEXT_FIELDS=[a0_0x486ab8(0x2d5),a0_0x486ab8(0x244),a0_0x486ab8(0x349),a0_0x486ab8(0x1d3)],CLICK_LABEL_FIELDS=[a0_0x486ab8(0x228),a0_0x486ab8(0x290),a0_0x486ab8(0x301),'\x61\x72\x69\x61\x4c\x61\x62\x65\x6c',a0_0x486ab8(0x2b4)];function readStringField(_0xa1d944,_0x9d67b2){const _0x2ff13d=a0_0x486ab8,_0x5ba031={'\x4c\x43\x59\x70\x71':function(_0xe80890,_0x1f3bed){return _0xe80890!==_0x1f3bed;},'\x64\x64\x54\x72\x61':_0x2ff13d(0x232),'\x4d\x6c\x77\x4e\x47':function(_0x3f0298,_0x459d4c){return _0x3f0298===_0x459d4c;},'\x76\x4b\x4a\x43\x54':_0x2ff13d(0x2cd)};if(!_0xa1d944||_0x5ba031[_0x2ff13d(0x193)](typeof _0xa1d944,_0x5ba031[_0x2ff13d(0x316)]))return null;const _0x23b5dc=_0xa1d944;for(const _0x29b873 of _0x9d67b2){const _0x475b7c=_0x23b5dc[_0x29b873];if(_0x5ba031[_0x2ff13d(0x1bb)](typeof _0x475b7c,_0x5ba031[_0x2ff13d(0x303)])&&_0x475b7c[_0x2ff13d(0x1d2)]>0x0)return _0x475b7c;}return null;}function destructiveActionGuardHook(_0x1df59f){const _0x39dccf=a0_0x486ab8,_0x20702d={'\x59\x51\x79\x75\x51':function(_0x21f6b0,_0x397102){return _0x21f6b0===_0x397102;},'\x4e\x57\x52\x4f\x6c':function(_0x584a4f,_0x35b028){return _0x584a4f===_0x35b028;},'\x52\x54\x56\x6b\x71':'\x61\x6c\x6c\x6f\x77'},_0x26cf85=_0x1df59f[_0x39dccf(0x18f)];return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x56a754){const _0x40515d=_0x39dccf;let _0x10b95c=null;if(_0x20702d[_0x40515d(0x32d)](_0x56a754[_0x40515d(0x1c6)],_0x40515d(0x325)))_0x10b95c=readStringField(_0x56a754[_0x40515d(0x322)],TYPE_TEXT_FIELDS);else{if(_0x20702d[_0x40515d(0x2f2)](_0x56a754['\x74\x6f\x6f\x6c\x4e\x61\x6d\x65'],_0x40515d(0x1f4)))_0x10b95c=readStringField(_0x56a754[_0x40515d(0x322)],CLICK_LABEL_FIELDS);else return{'\x61\x63\x74\x69\x6f\x6e':'\x61\x6c\x6c\x6f\x77'};}if(!_0x10b95c)return{'\x61\x63\x74\x69\x6f\x6e':_0x20702d[_0x40515d(0x251)]};for(const _0x49d45b of _0x26cf85)if(_0x49d45b[_0x40515d(0x211)](_0x10b95c))return{'\x61\x63\x74\x69\x6f\x6e':_0x40515d(0x2d4),'\x72\x65\x61\x73\x6f\x6e':_0x40515d(0x34e)+_0x49d45b[_0x40515d(0x315)]()};return{'\x61\x63\x74\x69\x6f\x6e':_0x20702d[_0x40515d(0x251)]};}};}var InMemoryResponseStore=class{[a0_0x486ab8(0x258)]=new Map();async[a0_0x486ab8(0x26d)](_0x50d61e){const _0x4b23e8=a0_0x486ab8,_0x5b8da8=this[_0x4b23e8(0x258)]['\x67\x65\x74'](_0x50d61e);return _0x5b8da8?_0x5b8da8[_0x4b23e8(0x1ba)](_0x62e3f5=>({..._0x62e3f5})):null;}async[a0_0x486ab8(0x1e2)](_0x36a65c,_0x4adc31){const _0x12919f=a0_0x486ab8;this[_0x12919f(0x258)][_0x12919f(0x18a)](_0x36a65c,_0x4adc31[_0x12919f(0x1ba)](_0x1c66bd=>({..._0x1c66bd})));}['\x73\x69\x7a\x65'](){const _0x590895=a0_0x486ab8;return this[_0x590895(0x258)][_0x590895(0x348)];}[a0_0x486ab8(0x2ce)](_0x458ebe){const _0x390498=a0_0x486ab8;return this[_0x390498(0x258)][_0x390498(0x2ce)](_0x458ebe);}[a0_0x486ab8(0x278)](){const _0x1030f4=a0_0x486ab8;this[_0x1030f4(0x258)][_0x1030f4(0x278)]();}};const TERMINAL_STATUSES=new Set([a0_0x486ab8(0x2b9),a0_0x486ab8(0x215),'\x63\x61\x6e\x63\x65\x6c\x6c\x65\x64','\x65\x78\x70\x69\x72\x65\x64']);function isTerminal(_0xecda40){const _0x1da04b=a0_0x486ab8;return TERMINAL_STATUSES[_0x1da04b(0x22e)](_0xecda40);}async function*runEvents(_0x5a1f2b,_0x482791,_0xd9b3c8){const _0x4d7f1c=a0_0x486ab8;for await(const _0x211842 of _0xd9b3c8[_0x4d7f1c(0x292)](_0x5a1f2b,_0x482791))yield _0x211842;}function readToolCallFromFrame(_0x2d4b49){const _0x2439ae=a0_0x486ab8,_0x30e430={'\x43\x76\x6d\x51\x67':function(_0x414d91,_0x55011e){return _0x414d91===_0x55011e;},'\x64\x65\x4b\x44\x75':function(_0x44984a,_0x7c14a8){return _0x44984a(_0x7c14a8);},'\x48\x71\x70\x56\x4f':function(_0x13ed36,_0x4f7aa){return _0x13ed36===_0x4f7aa;},'\x59\x68\x51\x43\x76':function(_0x6fe015,_0xfce79d){return _0x6fe015===_0xfce79d;},'\x59\x53\x4a\x50\x79':function(_0x18fe10,_0x44c9b8){return _0x18fe10===_0x44c9b8;},'\x62\x63\x54\x52\x48':_0x2439ae(0x2bd),'\x45\x49\x52\x77\x4d':function(_0xb5f2ed,_0xa6eeda){return _0xb5f2ed===_0xa6eeda;},'\x72\x72\x62\x56\x48':function(_0x6ca6eb,_0x17a828){return _0x6ca6eb(_0x17a828);},'\x73\x66\x6e\x73\x51':_0x2439ae(0x181)};if(_0x30e430['\x43\x76\x6d\x51\x67'](_0x2d4b49[_0x2439ae(0x199)],'\x72\x65\x71\x75\x69\x72\x65\x73\x5f\x61\x63\x74\x69\x6f\x6e')||_0x2d4b49[_0x2439ae(0x199)]===_0x2439ae(0x19a)){const _0x1bc566=_0x2d4b49[_0x2439ae(0x2d8)]??_0x2d4b49,_0x13bd0d=_0x30e430[_0x2439ae(0x321)](String,_0x1bc566[_0x2439ae(0x27b)]??_0x1bc566[_0x2439ae(0x300)]??_0x1bc566['\x69\x64']??''),_0x40be6c=String(_0x1bc566[_0x2439ae(0x1c6)]??_0x1bc566[_0x2439ae(0x2c8)]??_0x1bc566[_0x2439ae(0x30c)]??'');if(!_0x13bd0d||!_0x40be6c)return null;return{'\x63\x61\x6c\x6c\x49\x64':_0x13bd0d,'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x40be6c,'\x61\x72\x67\x73':_0x1bc566['\x61\x72\x67\x73']??_0x1bc566[_0x2439ae(0x2b2)]??_0x1bc566[_0x2439ae(0x349)]??{},'\x72\x65\x71\x75\x69\x72\x65\x73\x41\x63\x74\x69\x6f\x6e':!![]};}if(_0x2d4b49['\x74\x79\x70\x65']!==_0x2439ae(0x281))return null;const _0xde8dcb=_0x2d4b49[_0x2439ae(0x2d8)]??_0x2d4b49,_0x3f0dae=_0x30e430[_0x2439ae(0x2c5)](typeof _0xde8dcb['\x74\x79\x70\x65'],_0x2439ae(0x2cd))?_0xde8dcb[_0x2439ae(0x199)]:'';if(!(_0x3f0dae===_0x2439ae(0x1c3)||_0x30e430['\x59\x68\x51\x43\x76'](_0x3f0dae,_0x2439ae(0x2a7))||_0x30e430[_0x2439ae(0x1df)](_0x3f0dae,_0x30e430[_0x2439ae(0x1d5)])||_0x30e430[_0x2439ae(0x2bb)](_0x3f0dae,_0x2439ae(0x181))))return null;const _0x24109a=_0xde8dcb[_0x2439ae(0x2ac)]??_0xde8dcb[_0x2439ae(0x1a5)]??_0xde8dcb[_0x2439ae(0x1ee)]??_0xde8dcb[_0x2439ae(0x1d4)]??_0xde8dcb,_0x321422=_0x30e430['\x72\x72\x62\x56\x48'](String,_0x24109a[_0x2439ae(0x22d)]??_0x24109a[_0x2439ae(0x313)]??_0x24109a[_0x2439ae(0x27b)]??_0x24109a['\x69\x64']??''),_0x1fda7e=_0x30e430[_0x2439ae(0x284)](_0x3f0dae,_0x30e430[_0x2439ae(0x1d5)])||_0x3f0dae===_0x30e430[_0x2439ae(0x2f9)]?_0x2439ae(0x17d)+String(_0x24109a[_0x2439ae(0x1fd)]?.['\x74\x79\x70\x65']??'\x61\x63\x74\x69\x6f\x6e'):String(_0x24109a[_0x2439ae(0x1c6)]??_0x24109a[_0x2439ae(0x2c8)]??_0x24109a[_0x2439ae(0x30c)]??'');if(!_0x321422||!_0x1fda7e)return null;return{'\x63\x61\x6c\x6c\x49\x64':_0x321422,'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x1fda7e,'\x61\x72\x67\x73':_0x24109a[_0x2439ae(0x322)]??_0x24109a[_0x2439ae(0x2b2)]??_0x24109a['\x69\x6e\x70\x75\x74']??{},'\x72\x65\x71\x75\x69\x72\x65\x73\x41\x63\x74\x69\x6f\x6e':![]};}function readTerminal(_0x657e66){const _0x4ba597=a0_0x486ab8,_0x44bc72={'\x67\x52\x43\x6d\x72':_0x4ba597(0x2b9),'\x5a\x55\x6a\x4d\x52':_0x4ba597(0x215),'\x64\x42\x73\x5a\x4d':_0x4ba597(0x2cd),'\x5a\x6e\x48\x6c\x71':'\x65\x72\x72\x6f\x72','\x6f\x48\x51\x64\x54':function(_0x36bab9,_0x37cbb8){return _0x36bab9===_0x37cbb8;}};if(_0x657e66[_0x4ba597(0x199)]==='\x64\x6f\x6e\x65'){const _0x445266=typeof _0x657e66['\x6f\x75\x74\x63\x6f\x6d\x65']==='\x73\x74\x72\x69\x6e\x67'&&_0x657e66['\x6f\x75\x74\x63\x6f\x6d\x65']||'\x73\x75\x63\x63\x65\x73\x73';if(_0x445266===_0x4ba597(0x21e)||_0x445266===_0x44bc72[_0x4ba597(0x207)]||_0x445266===_0x4ba597(0x30f)||_0x445266===_0x4ba597(0x27a))return{'\x73\x74\x61\x74\x75\x73':_0x44bc72[_0x4ba597(0x207)]};return{'\x73\x74\x61\x74\x75\x73':_0x44bc72[_0x4ba597(0x20f)],'\x72\x65\x61\x73\x6f\x6e':typeof _0x657e66[_0x4ba597(0x254)]===_0x44bc72[_0x4ba597(0x263)]?_0x657e66[_0x4ba597(0x254)]:_0x445266};}if(_0x657e66[_0x4ba597(0x199)]===_0x44bc72[_0x4ba597(0x250)])return{'\x73\x74\x61\x74\x75\x73':'\x66\x61\x69\x6c\x65\x64','\x72\x65\x61\x73\x6f\x6e':_0x44bc72[_0x4ba597(0x1ad)](typeof _0x657e66['\x6d\x65\x73\x73\x61\x67\x65'],_0x44bc72['\x64\x42\x73\x5a\x4d'])&&_0x657e66[_0x4ba597(0x2e6)]||typeof _0x657e66[_0x4ba597(0x254)]===_0x4ba597(0x2cd)&&_0x657e66[_0x4ba597(0x254)]||_0x4ba597(0x189)};return null;}var EventQueue=class{[a0_0x486ab8(0x287)]=[];[a0_0x486ab8(0x190)]=[];['\x63\x6c\x6f\x73\x65\x64']=![];['\x69\x74\x65\x72\x61\x74\x6f\x72\x43\x72\x65\x61\x74\x65\x64']=![];[a0_0x486ab8(0x245)](_0x17be15){const _0x1efc5d=a0_0x486ab8;if(this[_0x1efc5d(0x2fa)])return;const _0x857124=this[_0x1efc5d(0x190)][_0x1efc5d(0x1ec)]();if(_0x857124){_0x857124({'\x76\x61\x6c\x75\x65':_0x17be15,'\x64\x6f\x6e\x65':![]});return;}this['\x62\x75\x66\x66\x65\x72'][_0x1efc5d(0x245)](_0x17be15);}['\x63\x6c\x6f\x73\x65'](){const _0xdbe504=a0_0x486ab8,_0x885d7d={'\x7a\x45\x45\x74\x45':function(_0x5f383e,_0x49c31d){return _0x5f383e>_0x49c31d;}};if(this['\x63\x6c\x6f\x73\x65\x64'])return;this[_0xdbe504(0x2fa)]=!![];while(_0x885d7d[_0xdbe504(0x29a)](this[_0xdbe504(0x190)][_0xdbe504(0x1d2)],0x0))this[_0xdbe504(0x190)][_0xdbe504(0x1ec)]()?.({'\x76\x61\x6c\x75\x65':void 0x0,'\x64\x6f\x6e\x65':!![]});}[a0_0x486ab8(0x2dd)](){const _0x3c71fb=a0_0x486ab8,_0x18714e={'\x58\x6f\x63\x78\x54':function(_0x385356,_0x30245a){return _0x385356>_0x30245a;},'\x71\x45\x75\x41\x52':'\x52\x75\x6e\x2e\x65\x76\x65\x6e\x74\x73\x28\x29\x20\x6d\x61\x79\x20\x6f\x6e\x6c\x79\x20\x62\x65\x20\x63\x6f\x6e\x73\x75\x6d\x65\x64\x20\x6f\x6e\x63\x65\x2e\x20\x4d\x75\x6c\x74\x69\x70\x6c\x65\x20\x69\x74\x65\x72\x61\x74\x6f\x72\x73\x20\x6f\x6e\x20\x74\x68\x65\x20\x73\x61\x6d\x65\x20\x52\x75\x6e\x20\x73\x68\x61\x72\x65\x20\x73\x74\x61\x74\x65\x20\x61\x6e\x64\x20\x77\x6f\x75\x6c\x64\x20\x69\x6e\x74\x65\x72\x6c\x65\x61\x76\x65\x2f\x73\x74\x65\x61\x6c\x20\x65\x76\x65\x6e\x74\x73\x2e'};if(this[_0x3c71fb(0x299)])throw new Error(_0x18714e[_0x3c71fb(0x1a2)]);this['\x69\x74\x65\x72\x61\x74\x6f\x72\x43\x72\x65\x61\x74\x65\x64']=!![];const _0x113300=this;return{[Symbol[_0x3c71fb(0x21a)]](){return this;},'\x6e\x65\x78\x74'(){const _0x15ebe6=_0x3c71fb;if(_0x18714e[_0x15ebe6(0x2fc)](_0x113300[_0x15ebe6(0x287)][_0x15ebe6(0x1d2)],0x0)){const _0x25c6d4=_0x113300[_0x15ebe6(0x287)][_0x15ebe6(0x1ec)]();return Promise[_0x15ebe6(0x27f)]({'\x76\x61\x6c\x75\x65':_0x25c6d4,'\x64\x6f\x6e\x65':![]});}if(_0x113300[_0x15ebe6(0x2fa)])return Promise['\x72\x65\x73\x6f\x6c\x76\x65']({'\x76\x61\x6c\x75\x65':void 0x0,'\x64\x6f\x6e\x65':!![]});return new Promise(_0x5c2df0=>{const _0x523556=_0x15ebe6;_0x113300['\x77\x61\x69\x74\x65\x72\x73'][_0x523556(0x245)](_0x5c2df0);});},'\x72\x65\x74\x75\x72\x6e'(){const _0x4be879=_0x3c71fb;return _0x113300['\x63\x6c\x6f\x73\x65'](),Promise[_0x4be879(0x27f)]({'\x76\x61\x6c\x75\x65':void 0x0,'\x64\x6f\x6e\x65':!![]});}};}},Run=class{['\x69\x64'];[a0_0x486ab8(0x255)];[a0_0x486ab8(0x269)];[a0_0x486ab8(0x2f1)]=a0_0x486ab8(0x200);[a0_0x486ab8(0x1b6)];[a0_0x486ab8(0x195)];[a0_0x486ab8(0x1e7)];['\x6f\x6e\x53\x74\x61\x74\x75\x73\x43\x68\x61\x6e\x67\x65'];[a0_0x486ab8(0x29f)]=new EventQueue();[a0_0x486ab8(0x2b7)]=null;[a0_0x486ab8(0x296)]=new Map();[a0_0x486ab8(0x1fc)]=![];constructor(_0x12652d){const _0x1392b2=a0_0x486ab8,_0x210382={'\x6c\x6e\x70\x64\x6e':_0x1392b2(0x345)},_0x2d4253=_0x210382['\x6c\x6e\x70\x64\x6e']['\x73\x70\x6c\x69\x74']('\x7c');let _0x789f7=0x0;while(!![]){switch(_0x2d4253[_0x789f7++]){case'\x30':this[_0x1392b2(0x255)]=_0x12652d[_0x1392b2(0x255)];continue;case'\x31':this[_0x1392b2(0x17f)]=_0x12652d[_0x1392b2(0x17f)];continue;case'\x32':this[_0x1392b2(0x195)]=_0x12652d[_0x1392b2(0x195)];continue;case'\x33':this['\x70\x61\x72\x74\x6e\x65\x72\x49\x64']=_0x12652d[_0x1392b2(0x269)];continue;case'\x34':this[_0x1392b2(0x1b6)]=_0x12652d['\x73\x6f\x75\x72\x63\x65'];continue;case'\x35':this['\x69\x64']=_0x12652d['\x69\x64'];continue;case'\x36':this[_0x1392b2(0x1e7)]=_0x12652d[_0x1392b2(0x1e7)];continue;}break;}}get[a0_0x486ab8(0x243)](){const _0x24032d=a0_0x486ab8;return this[_0x24032d(0x2f1)];}[a0_0x486ab8(0x2fd)](){const _0x5aadea=a0_0x486ab8;return this[_0x5aadea(0x29f)]['\x69\x74\x65\x72\x61\x74\x6f\x72']();}[a0_0x486ab8(0x31b)](){const _0x38a116=a0_0x486ab8;if(this[_0x38a116(0x2b7)])return this[_0x38a116(0x2b7)];return this[_0x38a116(0x2b7)]=this[_0x38a116(0x2f3)](),this[_0x38a116(0x2b7)];}async[a0_0x486ab8(0x220)](_0x224067){const _0x4c3cd3=a0_0x486ab8,_0x2ed1b4={'\x69\x46\x50\x48\x76':function(_0x473137,_0x3c8b8f){return _0x473137(_0x3c8b8f);}};if(_0x2ed1b4[_0x4c3cd3(0x1eb)](isTerminal,this[_0x4c3cd3(0x2f1)]))return;this[_0x4c3cd3(0x1fc)]=!![];if(this[_0x4c3cd3(0x1b6)][_0x4c3cd3(0x220)])try{await this[_0x4c3cd3(0x1b6)][_0x4c3cd3(0x220)](this['\x74\x68\x72\x65\x61\x64\x49\x64'],this['\x69\x64']);}catch{}this[_0x4c3cd3(0x18e)]('\x63\x61\x6e\x63\x65\x6c\x6c\x65\x64'),this[_0x4c3cd3(0x29f)][_0x4c3cd3(0x245)]({'\x74\x79\x70\x65':_0x4c3cd3(0x240),'\x72\x65\x61\x73\x6f\x6e':_0x224067}),this[_0x4c3cd3(0x29f)]['\x63\x6c\x6f\x73\x65']();}async['\x73\x74\x65\x65\x72'](_0x39ce1f){const _0x4d3310=a0_0x486ab8,_0x190584={'\x75\x59\x50\x4e\x58':function(_0x22818c,_0x1e6910){return _0x22818c(_0x1e6910);},'\x62\x75\x54\x69\x5a':function(_0x58d056,_0x1c15db){return _0x58d056===_0x1c15db;}};if(!this[_0x4d3310(0x1b6)][_0x4d3310(0x28b)])throw new Error(_0x4d3310(0x201));if(_0x190584[_0x4d3310(0x23f)](isTerminal,this['\x5f\x73\x74\x61\x74\x75\x73']))throw new Error('\x63\x61\x6e\x6e\x6f\x74\x20\x73\x74\x65\x65\x72\x20\x61\x20'+this[_0x4d3310(0x2f1)]+_0x4d3310(0x339));await this[_0x4d3310(0x1b6)]['\x73\x74\x65\x65\x72'](this[_0x4d3310(0x255)],this['\x69\x64'],_0x39ce1f);if(_0x190584[_0x4d3310(0x2c9)](this[_0x4d3310(0x2f1)],'\x72\x65\x71\x75\x69\x72\x65\x73\x5f\x61\x63\x74\x69\x6f\x6e'))this[_0x4d3310(0x18e)]('\x69\x6e\x5f\x70\x72\x6f\x67\x72\x65\x73\x73');this[_0x4d3310(0x2b7)]=this['\x64\x72\x69\x76\x65\x53\x74\x72\x65\x61\x6d'](),await this[_0x4d3310(0x2b7)];}async[a0_0x486ab8(0x17b)](_0x43c0a0){const _0x427c3f=a0_0x486ab8,_0x450930={'\x64\x79\x4e\x63\x4d':function(_0x5a49f8,_0x2aef52){return _0x5a49f8!==_0x2aef52;}};if(_0x450930['\x64\x79\x4e\x63\x4d'](this[_0x427c3f(0x2f1)],_0x427c3f(0x20a)))throw new Error(_0x427c3f(0x31e)+this[_0x427c3f(0x2f1)]);if(!this[_0x427c3f(0x1b6)]['\x73\x75\x62\x6d\x69\x74\x54\x6f\x6f\x6c\x4f\x75\x74\x70\x75\x74\x73'])throw new Error(_0x427c3f(0x23b));for(const _0x2b48d8 of _0x43c0a0)this['\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x73'][_0x427c3f(0x2ce)](_0x2b48d8['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x49\x64']);await this[_0x427c3f(0x1b6)][_0x427c3f(0x17b)](this[_0x427c3f(0x255)],this['\x69\x64'],_0x43c0a0),this[_0x427c3f(0x18e)]('\x69\x6e\x5f\x70\x72\x6f\x67\x72\x65\x73\x73'),this['\x73\x74\x61\x72\x74\x50\x72\x6f\x6d\x69\x73\x65']=this[_0x427c3f(0x2f3)](),await this[_0x427c3f(0x2b7)];}[a0_0x486ab8(0x275)](){const _0x1756a2=a0_0x486ab8,_0x2fc942={'\x61\x61\x72\x59\x54':_0x1756a2(0x215),'\x54\x64\x66\x54\x7a':'\x65\x78\x70\x69\x72\x65\x64'};if(isTerminal(this['\x5f\x73\x74\x61\x74\x75\x73']))return;this['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e'](_0x1756a2(0x18c)),this[_0x1756a2(0x29f)][_0x1756a2(0x245)]({'\x74\x79\x70\x65':_0x2fc942[_0x1756a2(0x2ef)],'\x72\x65\x61\x73\x6f\x6e':_0x2fc942[_0x1756a2(0x31d)]}),this[_0x1756a2(0x29f)][_0x1756a2(0x28c)]();}['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e'](_0x1f5b41){const _0x4aa8ce=a0_0x486ab8;if(this[_0x4aa8ce(0x2f1)]===_0x1f5b41)return;const _0x1572bf=this[_0x4aa8ce(0x2f1)];this[_0x4aa8ce(0x2f1)]=_0x1f5b41,this[_0x4aa8ce(0x29f)][_0x4aa8ce(0x245)]({'\x74\x79\x70\x65':'\x73\x74\x61\x74\x75\x73','\x73\x74\x61\x74\x75\x73':_0x1f5b41,'\x70\x72\x65\x76\x69\x6f\x75\x73':_0x1572bf}),this[_0x4aa8ce(0x17f)]?.(_0x1f5b41,_0x1572bf);}async[a0_0x486ab8(0x2f3)](){const _0xd90cee=a0_0x486ab8,_0x396075={'\x45\x42\x45\x42\x46':function(_0x438981,_0x1a4e59,_0x37a3d6,_0x1c4f58){return _0x438981(_0x1a4e59,_0x37a3d6,_0x1c4f58);},'\x62\x58\x71\x6b\x68':function(_0x6935b3,_0x58c6e0){return _0x6935b3(_0x58c6e0);},'\x62\x66\x55\x7a\x72':function(_0x54dbf9,_0x4ddfa5){return _0x54dbf9===_0x4ddfa5;},'\x64\x4b\x4f\x59\x70':_0xd90cee(0x2b9),'\x68\x4f\x76\x79\x4a':'\x66\x61\x69\x6c\x65\x64','\x53\x72\x51\x66\x6a':_0xd90cee(0x32b),'\x74\x6b\x65\x69\x56':function(_0x359f56,_0x235927){return _0x359f56 instanceof _0x235927;}};try{for await(const _0x30e0bd of _0x396075[_0xd90cee(0x1f8)](runEvents,this[_0xd90cee(0x255)],this['\x69\x64'],this['\x73\x6f\x75\x72\x63\x65'])){if(this['\x63\x61\x6e\x63\x65\x6c\x52\x65\x71\x75\x65\x73\x74\x65\x64'])return;if(this['\x5f\x73\x74\x61\x74\x75\x73']===_0xd90cee(0x200))this[_0xd90cee(0x18e)]('\x69\x6e\x5f\x70\x72\x6f\x67\x72\x65\x73\x73');this[_0xd90cee(0x29f)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':'\x73\x74\x72\x65\x61\x6d','\x65\x76\x65\x6e\x74':_0x30e0bd});const _0x406847=_0x396075[_0xd90cee(0x25b)](readToolCallFromFrame,_0x30e0bd);if(_0x406847){const _0x1513d1=await this['\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'](_0x406847);if(_0x1513d1===_0xd90cee(0x2eb))return;if(_0x396075[_0xd90cee(0x288)](_0x1513d1,'\x72\x65\x71\x75\x69\x72\x65\x73\x5f\x61\x63\x74\x69\x6f\x6e'))return;continue;}const _0x45026b=_0x396075[_0xd90cee(0x25b)](readTerminal,_0x30e0bd);if(_0x45026b){_0x45026b[_0xd90cee(0x243)]===_0x396075[_0xd90cee(0x1c9)]?(this['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e']('\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64'),this[_0xd90cee(0x29f)][_0xd90cee(0x245)]({'\x74\x79\x70\x65':'\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64'})):(this[_0xd90cee(0x18e)](_0x396075[_0xd90cee(0x1a8)]),this[_0xd90cee(0x29f)][_0xd90cee(0x245)]({'\x74\x79\x70\x65':_0xd90cee(0x215),'\x72\x65\x61\x73\x6f\x6e':_0x45026b['\x72\x65\x61\x73\x6f\x6e']??_0x396075[_0xd90cee(0x2e0)]}));this['\x71\x75\x65\x75\x65'][_0xd90cee(0x28c)]();return;}}!_0x396075[_0xd90cee(0x25b)](isTerminal,this[_0xd90cee(0x2f1)])&&(this[_0xd90cee(0x18e)](_0x396075[_0xd90cee(0x1c9)]),this[_0xd90cee(0x29f)][_0xd90cee(0x245)]({'\x74\x79\x70\x65':_0x396075[_0xd90cee(0x1c9)]}),this[_0xd90cee(0x29f)][_0xd90cee(0x28c)]());}catch(_0x4303ae){if(isTerminal(this[_0xd90cee(0x2f1)]))return;const _0x3b0cd4=_0x396075[_0xd90cee(0x1b4)](_0x4303ae,Error)?_0x4303ae[_0xd90cee(0x2e6)]:_0x396075['\x62\x58\x71\x6b\x68'](String,_0x4303ae);this[_0xd90cee(0x18e)](_0x396075[_0xd90cee(0x1a8)]),this[_0xd90cee(0x29f)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x396075['\x68\x4f\x76\x79\x4a'],'\x72\x65\x61\x73\x6f\x6e':_0x3b0cd4}),this[_0xd90cee(0x29f)][_0xd90cee(0x28c)]();}}async['\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'](_0x22a9a2){const _0x11d64d=a0_0x486ab8,_0x43f4c7={'\x52\x74\x56\x64\x78':function(_0x53d7f5,_0x4ba698){return _0x53d7f5===_0x4ba698;},'\x69\x56\x69\x47\x4f':_0x11d64d(0x20a),'\x78\x64\x54\x4f\x48':'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c','\x57\x53\x57\x73\x6e':function(_0x3c51ee,_0x3c703d){return _0x3c51ee>_0x3c703d;},'\x5a\x4e\x77\x77\x4f':_0x11d64d(0x2eb),'\x79\x78\x76\x6c\x43':function(_0xde79e2,_0x467ad1){return _0xde79e2===_0x467ad1;},'\x67\x4a\x77\x62\x55':_0x11d64d(0x268)},_0xae6aed={'\x72\x75\x6e\x49\x64':this['\x69\x64'],'\x74\x68\x72\x65\x61\x64\x49\x64':this[_0x11d64d(0x255)],'\x70\x61\x72\x74\x6e\x65\x72\x49\x64':this[_0x11d64d(0x269)],'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x22a9a2[_0x11d64d(0x1c6)],'\x61\x72\x67\x73':_0x22a9a2[_0x11d64d(0x322)],'\x63\x61\x6c\x6c\x49\x64':_0x22a9a2[_0x11d64d(0x27b)],'\x74\x69\x6d\x65\x73\x74\x61\x6d\x70':Date[_0x11d64d(0x326)]()};let _0x5e5b84=_0xae6aed;if(this[_0x11d64d(0x195)]&&this[_0x11d64d(0x195)][_0x11d64d(0x348)]>0x0){const _0x36842d=await this[_0x11d64d(0x195)][_0x11d64d(0x172)](_0xae6aed);if(_0x43f4c7[_0x11d64d(0x227)](_0x36842d[_0x11d64d(0x1fd)],_0x11d64d(0x2d4))){const _0x4306ad={'\x63\x6f\x6e\x74\x65\x6e\x74':{'\x65\x72\x72\x6f\x72':_0x36842d[_0x11d64d(0x257)]},'\x69\x73\x45\x72\x72\x6f\x72':!![],'\x64\x65\x74\x61\x69\x6c\x73':{'\x62\x6c\x6f\x63\x6b\x65\x64\x42\x79':_0x11d64d(0x2e1)}};this['\x71\x75\x65\x75\x65'][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x11d64d(0x191),'\x63\x74\x78':_0xae6aed,'\x72\x65\x61\x73\x6f\x6e':_0x36842d[_0x11d64d(0x257)]}),this['\x71\x75\x65\x75\x65'][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x11d64d(0x196),'\x63\x74\x78':_0xae6aed,'\x72\x65\x73\x75\x6c\x74':_0x4306ad});if(_0x22a9a2[_0x11d64d(0x234)])return this[_0x11d64d(0x296)]['\x73\x65\x74'](_0x22a9a2[_0x11d64d(0x27b)],_0xae6aed),this[_0x11d64d(0x18e)](_0x11d64d(0x20a)),this[_0x11d64d(0x29f)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':'\x72\x65\x71\x75\x69\x72\x65\x73\x5f\x61\x63\x74\x69\x6f\x6e','\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x49\x64\x73':Array[_0x11d64d(0x27e)](this[_0x11d64d(0x296)]['\x6b\x65\x79\x73']())}),_0x43f4c7[_0x11d64d(0x2d1)];return _0x11d64d(0x268);}if(_0x36842d[_0x11d64d(0x1fd)]===_0x11d64d(0x1fa))_0x5e5b84={..._0xae6aed,'\x61\x72\x67\x73':_0x36842d[_0x11d64d(0x322)]};}if(_0x22a9a2['\x72\x65\x71\x75\x69\x72\x65\x73\x41\x63\x74\x69\x6f\x6e'])return this[_0x11d64d(0x296)][_0x11d64d(0x18a)](_0x22a9a2['\x63\x61\x6c\x6c\x49\x64'],_0x5e5b84),this[_0x11d64d(0x18e)](_0x43f4c7['\x69\x56\x69\x47\x4f']),this['\x71\x75\x65\x75\x65']['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x11d64d(0x2a7),'\x63\x74\x78':_0x5e5b84}),this[_0x11d64d(0x29f)][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x11d64d(0x20a),'\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x49\x64\x73':Array['\x66\x72\x6f\x6d'](this[_0x11d64d(0x296)][_0x11d64d(0x2a1)]())}),_0x11d64d(0x20a);if(!this[_0x11d64d(0x1e7)])return this['\x71\x75\x65\x75\x65'][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x11d64d(0x2a7),'\x63\x74\x78':_0x5e5b84}),_0x11d64d(0x268);this['\x71\x75\x65\x75\x65'][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x43f4c7['\x78\x64\x54\x4f\x48'],'\x63\x74\x78':_0x5e5b84});let _0x4a848b;try{_0x4a848b=await this[_0x11d64d(0x1e7)](_0x5e5b84);}catch(_0x2b66a6){_0x4a848b={'\x63\x6f\x6e\x74\x65\x6e\x74':{'\x65\x72\x72\x6f\x72':_0x2b66a6 instanceof Error?_0x2b66a6[_0x11d64d(0x2e6)]:String(_0x2b66a6)},'\x69\x73\x45\x72\x72\x6f\x72':!![]};}let _0x533eb3=_0x4a848b;if(this[_0x11d64d(0x195)]&&_0x43f4c7[_0x11d64d(0x25f)](this[_0x11d64d(0x195)][_0x11d64d(0x348)],0x0)){const _0x465c9f=await this[_0x11d64d(0x195)]['\x72\x75\x6e\x41\x66\x74\x65\x72'](_0x5e5b84,_0x4a848b);if(_0x465c9f['\x61\x63\x74\x69\x6f\x6e']===_0x43f4c7[_0x11d64d(0x25e)])return this['\x71\x75\x65\x75\x65'][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x11d64d(0x196),'\x63\x74\x78':_0x5e5b84,'\x72\x65\x73\x75\x6c\x74':_0x4a848b}),this[_0x11d64d(0x18e)]('\x66\x61\x69\x6c\x65\x64'),this[_0x11d64d(0x29f)][_0x11d64d(0x245)]({'\x74\x79\x70\x65':_0x11d64d(0x215),'\x72\x65\x61\x73\x6f\x6e':_0x465c9f[_0x11d64d(0x257)]}),this[_0x11d64d(0x29f)][_0x11d64d(0x28c)](),_0x11d64d(0x2eb);if(_0x43f4c7['\x79\x78\x76\x6c\x43'](_0x465c9f[_0x11d64d(0x1fd)],_0x11d64d(0x19c)))_0x533eb3=_0x465c9f[_0x11d64d(0x277)];}return this[_0x11d64d(0x29f)][_0x11d64d(0x245)]({'\x74\x79\x70\x65':'\x74\x6f\x6f\x6c\x5f\x72\x65\x73\x75\x6c\x74','\x63\x74\x78':_0x5e5b84,'\x72\x65\x73\x75\x6c\x74':_0x533eb3}),_0x43f4c7['\x67\x4a\x77\x62\x55'];}};function outcomeToFinishReason(_0x1b91ce,_0x1b1d4a){const _0x32fc9e=a0_0x486ab8,_0x153d03={'\x4a\x75\x6c\x62\x55':'\x73\x75\x63\x63\x65\x73\x73','\x49\x62\x43\x4c\x58':_0x32fc9e(0x30f),'\x7a\x70\x61\x64\x55':_0x32fc9e(0x27a),'\x69\x43\x44\x50\x57':_0x32fc9e(0x266),'\x6f\x67\x75\x76\x69':_0x32fc9e(0x180),'\x52\x46\x41\x77\x6d':_0x32fc9e(0x1d2),'\x63\x4d\x73\x59\x69':'\x66\x69\x6c\x74\x65\x72\x65\x64'};switch(_0x1b91ce){case _0x153d03[_0x32fc9e(0x2a6)]:case _0x153d03[_0x32fc9e(0x2b8)]:case _0x32fc9e(0x2b9):case _0x153d03['\x7a\x70\x61\x64\x55']:return _0x1b1d4a?'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73':_0x153d03[_0x32fc9e(0x1ac)];case _0x153d03[_0x32fc9e(0x30b)]:case _0x153d03[_0x32fc9e(0x33d)]:case _0x32fc9e(0x2e9):return'\x6c\x65\x6e\x67\x74\x68';case _0x32fc9e(0x331):case _0x32fc9e(0x1e9):case _0x153d03[_0x32fc9e(0x24e)]:return _0x32fc9e(0x1e9);default:return'\x73\x74\x6f\x70';}}function readTokenDelta(_0x121bbd){const _0x1f3945=a0_0x486ab8;if(typeof _0x121bbd[_0x1f3945(0x2dc)]===_0x1f3945(0x2cd))return _0x121bbd['\x64\x65\x6c\x74\x61'];if(typeof _0x121bbd[_0x1f3945(0x2d5)]===_0x1f3945(0x2cd))return _0x121bbd[_0x1f3945(0x2d5)];if(typeof _0x121bbd['\x74\x6f\x6b\x65\x6e']===_0x1f3945(0x2cd))return _0x121bbd[_0x1f3945(0x267)];return null;}function readToolInvocation(_0x166ec6){const _0x8de7d2=a0_0x486ab8,_0x11e67e={'\x6e\x6e\x4a\x53\x44':function(_0x43013f,_0x55ec6a){return _0x43013f!==_0x55ec6a;},'\x77\x76\x58\x4c\x4b':function(_0x4570fa,_0x14944d){return _0x4570fa===_0x14944d;},'\x73\x6b\x48\x51\x74':_0x8de7d2(0x2cd),'\x43\x6f\x6b\x54\x62':function(_0x2f6923,_0x5b5eca){return _0x2f6923===_0x5b5eca;},'\x69\x6d\x6d\x59\x6a':_0x8de7d2(0x2a7),'\x76\x57\x74\x4a\x49':function(_0x462c58,_0x2e2068){return _0x462c58===_0x2e2068;}};if(_0x11e67e[_0x8de7d2(0x218)](_0x166ec6['\x74\x79\x70\x65'],'\x72\x61\x77'))return null;const _0x5a8905=_0x166ec6['\x64\x61\x74\x61']??_0x166ec6,_0x381d5f=_0x11e67e[_0x8de7d2(0x344)](typeof _0x5a8905[_0x8de7d2(0x199)],_0x11e67e[_0x8de7d2(0x186)])?_0x5a8905[_0x8de7d2(0x199)]:typeof _0x166ec6['\x74\x79\x70\x65']===_0x8de7d2(0x2cd)?_0x166ec6[_0x8de7d2(0x199)]:'';if(!(_0x11e67e[_0x8de7d2(0x2a8)](_0x381d5f,_0x8de7d2(0x1c3))||_0x381d5f===_0x11e67e[_0x8de7d2(0x247)]||_0x11e67e[_0x8de7d2(0x2a8)](typeof _0x5a8905[_0x8de7d2(0x2ac)],_0x8de7d2(0x232))||typeof _0x5a8905[_0x8de7d2(0x1a5)]===_0x8de7d2(0x232)))return null;const _0x23c50b=_0x5a8905[_0x8de7d2(0x2ac)]??_0x5a8905[_0x8de7d2(0x1a5)]??_0x5a8905,_0x5035ad=typeof _0x23c50b['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x49\x64']===_0x8de7d2(0x2cd)?_0x23c50b[_0x8de7d2(0x22d)]:typeof _0x23c50b[_0x8de7d2(0x313)]===_0x11e67e['\x73\x6b\x48\x51\x74']?_0x23c50b[_0x8de7d2(0x313)]:_0x11e67e['\x76\x57\x74\x4a\x49'](typeof _0x23c50b['\x69\x64'],_0x11e67e[_0x8de7d2(0x186)])?_0x23c50b['\x69\x64']:_0x11e67e[_0x8de7d2(0x28d)](typeof _0x23c50b[_0x8de7d2(0x27b)],_0x8de7d2(0x2cd))?_0x23c50b[_0x8de7d2(0x27b)]:'',_0x1a944e=typeof _0x23c50b[_0x8de7d2(0x1c6)]===_0x8de7d2(0x2cd)?_0x23c50b[_0x8de7d2(0x1c6)]:typeof _0x23c50b[_0x8de7d2(0x2c8)]===_0x8de7d2(0x2cd)?_0x23c50b[_0x8de7d2(0x2c8)]:typeof _0x23c50b[_0x8de7d2(0x30c)]===_0x11e67e['\x73\x6b\x48\x51\x74']?_0x23c50b[_0x8de7d2(0x30c)]:'',_0x127d0d=_0x23c50b[_0x8de7d2(0x322)]??_0x23c50b[_0x8de7d2(0x2b2)]??_0x23c50b['\x69\x6e\x70\x75\x74']??{};if(!_0x5035ad||!_0x1a944e)return null;return{'\x69\x64':_0x5035ad,'\x6e\x61\x6d\x65':_0x1a944e,'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':typeof _0x127d0d===_0x8de7d2(0x2cd)?_0x127d0d:JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79'](_0x127d0d)};}function readUsage(_0x1d7c48){const _0x39be77=a0_0x486ab8,_0x5d3da8=_0x1d7c48[_0x39be77(0x242)]??_0x1d7c48,_0x229e05=Number(_0x5d3da8[_0x39be77(0x1b9)]??_0x5d3da8[_0x39be77(0x1e3)]??_0x5d3da8['\x69\x6e\x70\x75\x74\x54\x6f\x6b\x65\x6e\x73']??0x0),_0x4bb0be=Number(_0x5d3da8[_0x39be77(0x2a2)]??_0x5d3da8[_0x39be77(0x213)]??_0x5d3da8[_0x39be77(0x1c0)]??0x0);if(_0x229e05===0x0&&_0x4bb0be===0x0)return null;return{'\x70\x72\x6f\x6d\x70\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x229e05,'\x63\x6f\x6d\x70\x6c\x65\x74\x69\x6f\x6e\x5f\x74\x6f\x6b\x65\x6e\x73':_0x4bb0be,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':Number(_0x5d3da8[_0x39be77(0x249)]??_0x229e05+_0x4bb0be)};}function readOutcome(_0x173f0a){const _0x4ca496=a0_0x486ab8,_0x3bf84d={'\x42\x42\x4c\x6b\x47':function(_0x2b3972,_0x589a4f){return _0x2b3972===_0x589a4f;},'\x4c\x4a\x65\x62\x64':_0x4ca496(0x2cd),'\x52\x6e\x58\x61\x74':_0x4ca496(0x1fe)};if(_0x3bf84d[_0x4ca496(0x203)](typeof _0x173f0a[_0x4ca496(0x1ff)],_0x4ca496(0x2cd)))return _0x173f0a[_0x4ca496(0x1ff)];if(_0x3bf84d[_0x4ca496(0x203)](typeof _0x173f0a[_0x4ca496(0x243)],_0x3bf84d[_0x4ca496(0x262)]))return _0x173f0a[_0x4ca496(0x243)];if(_0x3bf84d[_0x4ca496(0x203)](_0x173f0a[_0x4ca496(0x21e)],![]))return _0x3bf84d['\x52\x6e\x58\x61\x74'];return _0x4ca496(0x21e);}function chatBaseChunk(_0x22e8dd){const _0x5522a2=a0_0x486ab8;return _0x22e8dd[_0x5522a2(0x283)]+=0x1,{'\x69\x64':_0x22e8dd[_0x5522a2(0x17a)],'\x63\x72\x65\x61\x74\x65\x64':_0x22e8dd['\x63\x72\x65\x61\x74\x65\x64\x41\x74'],'\x6d\x6f\x64\x65\x6c':_0x22e8dd[_0x5522a2(0x1f9)],'\x6f\x62\x6a\x65\x63\x74':'\x63\x68\x61\x74\x2e\x63\x6f\x6d\x70\x6c\x65\x74\x69\x6f\x6e\x2e\x63\x68\x75\x6e\x6b'};}function sandboxEventToChatChunk(_0x43727d,_0x52dcb5){const _0x3c3a8b=a0_0x486ab8,_0x15ed25={'\x41\x66\x4a\x4f\x54':_0x3c3a8b(0x31b),'\x52\x6f\x56\x72\x4f':'\x73\x74\x61\x74\x75\x73','\x75\x4c\x68\x4b\x57':function(_0x523bdb,_0x295f53){return _0x523bdb===_0x295f53;},'\x6c\x4d\x5a\x43\x65':function(_0x553b0b,_0xb0e0bf){return _0x553b0b(_0xb0e0bf);},'\x76\x44\x53\x44\x79':'\x65\x72\x72\x6f\x72','\x59\x4a\x54\x76\x65':function(_0x45e35a,_0x17410e,_0x18a5e0){return _0x45e35a(_0x17410e,_0x18a5e0);},'\x6b\x4a\x65\x6f\x64':_0x3c3a8b(0x27a)};switch(_0x43727d['\x74\x79\x70\x65']){case _0x15ed25[_0x3c3a8b(0x1b3)]:return null;case _0x3c3a8b(0x1cf):return null;case _0x15ed25[_0x3c3a8b(0x2ed)]:return null;case _0x3c3a8b(0x17c):return null;case'\x6d\x65\x73\x73\x61\x67\x65\x2e\x70\x61\x72\x74\x2e\x75\x70\x64\x61\x74\x65\x64':return null;case _0x3c3a8b(0x267):{const _0x1d76f1=readTokenDelta(_0x43727d);if(_0x1d76f1==null||_0x15ed25[_0x3c3a8b(0x216)](_0x1d76f1[_0x3c3a8b(0x1d2)],0x0))return null;return{...chatBaseChunk(_0x52dcb5),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':{'\x72\x6f\x6c\x65':_0x3c3a8b(0x282),'\x63\x6f\x6e\x74\x65\x6e\x74':_0x1d76f1},'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':null}]};}case _0x3c3a8b(0x281):{const _0x2507ac=readToolInvocation(_0x43727d);if(!_0x2507ac)return null;const _0x21c01c=_0x52dcb5[_0x3c3a8b(0x2fe)][_0x3c3a8b(0x176)](_0x2507ac['\x69\x64']),_0x1d84e2=_0x21c01c?_0x21c01c[_0x3c3a8b(0x1a0)]:_0x52dcb5['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72'][_0x3c3a8b(0x348)];return _0x52dcb5[_0x3c3a8b(0x2fe)][_0x3c3a8b(0x18a)](_0x2507ac['\x69\x64'],{'\x69\x6e\x64\x65\x78':_0x1d84e2,'\x69\x64':_0x2507ac['\x69\x64'],'\x6e\x61\x6d\x65':_0x2507ac['\x6e\x61\x6d\x65'],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x2507ac[_0x3c3a8b(0x2b2)]}),{..._0x15ed25[_0x3c3a8b(0x32e)](chatBaseChunk,_0x52dcb5),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':{'\x72\x6f\x6c\x65':_0x3c3a8b(0x282),'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73':[{'\x69\x6e\x64\x65\x78':_0x1d84e2,'\x69\x64':_0x2507ac['\x69\x64'],'\x74\x79\x70\x65':'\x66\x75\x6e\x63\x74\x69\x6f\x6e','\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x2507ac[_0x3c3a8b(0x30c)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x2507ac[_0x3c3a8b(0x2b2)]}}]},'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':null}]};}case _0x15ed25[_0x3c3a8b(0x310)]:{const _0x111913=_0x52dcb5['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72'][_0x3c3a8b(0x348)]>0x0;return{...chatBaseChunk(_0x52dcb5),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':{},'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':_0x15ed25[_0x3c3a8b(0x2ba)](outcomeToFinishReason,_0x15ed25[_0x3c3a8b(0x310)],_0x111913)}]};}case _0x15ed25[_0x3c3a8b(0x1ef)]:{const _0x282d39=_0x52dcb5[_0x3c3a8b(0x2fe)][_0x3c3a8b(0x348)]>0x0,_0x21ab9b=outcomeToFinishReason(readOutcome(_0x43727d),_0x282d39),_0x2f3ce7=readUsage(_0x43727d),_0x5e5df3={..._0x15ed25[_0x3c3a8b(0x32e)](chatBaseChunk,_0x52dcb5),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':{},'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':_0x21ab9b}]};if(_0x2f3ce7)_0x5e5df3[_0x3c3a8b(0x242)]=_0x2f3ce7;return _0x5e5df3;}default:return null;}}function completionBaseChunk(_0x4db47f){const _0x1042b2=a0_0x486ab8,_0x1b5544={'\x45\x4e\x70\x45\x62':_0x1042b2(0x2e4)};return _0x4db47f[_0x1042b2(0x283)]+=0x1,{'\x69\x64':_0x4db47f['\x72\x75\x6e\x49\x64'],'\x63\x72\x65\x61\x74\x65\x64':_0x4db47f[_0x1042b2(0x26c)],'\x6d\x6f\x64\x65\x6c':_0x4db47f[_0x1042b2(0x1f9)],'\x6f\x62\x6a\x65\x63\x74':_0x1b5544[_0x1042b2(0x212)]};}function sandboxEventToCompletionChunk(_0x2fbfe3,_0xb31a78){const _0x4c6210=a0_0x486ab8,_0x202a9e={'\x65\x42\x44\x49\x78':'\x73\x74\x61\x72\x74','\x48\x49\x79\x52\x66':'\x73\x74\x61\x74\x75\x73','\x50\x61\x67\x7a\x4c':_0x4c6210(0x1c2),'\x72\x42\x42\x70\x46':function(_0x22c40b,_0x2fbb28){return _0x22c40b===_0x2fbb28;},'\x59\x4b\x48\x69\x4b':_0x4c6210(0x267),'\x53\x6e\x6c\x79\x54':function(_0x3f119c,_0x45a3d3){return _0x3f119c(_0x45a3d3);},'\x70\x52\x72\x48\x75':function(_0x5e2248,_0x2e3bc6){return _0x5e2248==_0x2e3bc6;},'\x45\x69\x51\x5a\x4f':_0x4c6210(0x254),'\x59\x6f\x6b\x69\x7a':_0x4c6210(0x27a),'\x55\x63\x69\x7a\x75':function(_0x370aaf,_0x5e9119,_0x56ec12){return _0x370aaf(_0x5e9119,_0x56ec12);},'\x66\x4d\x73\x74\x59':'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73','\x78\x59\x5a\x41\x41':_0x4c6210(0x266)};switch(_0x2fbfe3[_0x4c6210(0x199)]){case _0x202a9e[_0x4c6210(0x1da)]:case'\x65\x78\x65\x63\x75\x74\x69\x6f\x6e\x2e\x73\x74\x61\x72\x74\x65\x64':case _0x202a9e[_0x4c6210(0x24d)]:case _0x4c6210(0x17c):case _0x202a9e[_0x4c6210(0x1ae)]:case _0x4c6210(0x281):if(_0x202a9e[_0x4c6210(0x2a0)](_0x2fbfe3[_0x4c6210(0x199)],_0x4c6210(0x281))){const _0x58c88e=readToolInvocation(_0x2fbfe3);if(_0x58c88e){const _0x1011c4=_0xb31a78[_0x4c6210(0x2fe)][_0x4c6210(0x176)](_0x58c88e['\x69\x64']),_0x116555=_0x1011c4?_0x1011c4[_0x4c6210(0x1a0)]:_0xb31a78[_0x4c6210(0x2fe)][_0x4c6210(0x348)];_0xb31a78[_0x4c6210(0x2fe)]['\x73\x65\x74'](_0x58c88e['\x69\x64'],{'\x69\x6e\x64\x65\x78':_0x116555,'\x69\x64':_0x58c88e['\x69\x64'],'\x6e\x61\x6d\x65':_0x58c88e[_0x4c6210(0x30c)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x58c88e[_0x4c6210(0x2b2)]});}}return null;case _0x202a9e['\x59\x4b\x48\x69\x4b']:{const _0x225d13=_0x202a9e[_0x4c6210(0x323)](readTokenDelta,_0x2fbfe3);if(_0x202a9e[_0x4c6210(0x1f2)](_0x225d13,null)||_0x225d13[_0x4c6210(0x1d2)]===0x0)return null;return{..._0x202a9e['\x53\x6e\x6c\x79\x54'](completionBaseChunk,_0xb31a78),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x74\x65\x78\x74':_0x225d13,'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':null,'\x6c\x6f\x67\x70\x72\x6f\x62\x73':null}]};}case _0x202a9e[_0x4c6210(0x1bd)]:case _0x202a9e[_0x4c6210(0x1ed)]:{const _0x1b256f=_0x202a9e[_0x4c6210(0x2b1)](outcomeToFinishReason,_0x2fbfe3[_0x4c6210(0x199)]===_0x4c6210(0x254)?_0x202a9e[_0x4c6210(0x1bd)]:readOutcome(_0x2fbfe3),![]),_0x4f43a3=_0x1b256f===_0x202a9e[_0x4c6210(0x25a)]?_0x202a9e['\x78\x59\x5a\x41\x41']:_0x1b256f,_0x35b6d4=_0x202a9e[_0x4c6210(0x323)](readUsage,_0x2fbfe3),_0x3993fd={...completionBaseChunk(_0xb31a78),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x74\x65\x78\x74':'','\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':_0x4f43a3,'\x6c\x6f\x67\x70\x72\x6f\x62\x73':null}]};if(_0x35b6d4)_0x3993fd[_0x4c6210(0x242)]=_0x35b6d4;return _0x3993fd;}default:return null;}}function a0_0x58b8(){const _0x1a16d2=['\x7a\x31\x50\x71\x72\x33\x6d','\x44\x67\x39\x30\x79\x77\x58\x46\x44\x67\x39\x52\x7a\x77\x35\x5a','\x6d\x74\x7a\x77\x44\x33\x50\x76\x72\x77\x65','\x44\x67\x66\x5a\x41\x31\x62\x48\x43\x4e\x72\x5a','\x43\x33\x4c\x5a\x44\x67\x76\x54','\x73\x65\x4c\x35\x75\x4d\x79','\x79\x30\x31\x5a\x77\x77\x4b','\x41\x78\x6e\x62\x43\x4e\x6a\x48\x45\x71','\x77\x4d\x35\x69\x42\x68\x65','\x75\x4c\x72\x77\x41\x33\x65','\x71\x4b\x35\x77\x75\x32\x30','\x43\x67\x66\x59\x79\x77\x30','\x7a\x78\x6a\x59\x42\x33\x69','\x44\x67\x48\x59\x7a\x77\x66\x4b\x73\x77\x71','\x7a\x77\x35\x4b\x43\x67\x39\x50\x42\x4e\x71','\x43\x4d\x76\x48\x43\x32\x39\x55','\x79\x32\x48\x48\x41\x77\x35\x5a','\x77\x67\x31\x6e\x7a\x67\x65','\x7a\x4b\x31\x5a\x44\x66\x4b','\x79\x4c\x48\x58\x41\x32\x47','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75','\x41\x67\x66\x5a\x76\x78\x6e\x48\x7a\x32\x75','\x77\x4b\x35\x33\x44\x30\x38','\x76\x31\x6e\x78\x43\x32\x34','\x43\x4d\x76\x48\x43\x32\x39\x55\x41\x77\x35\x4e\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x73\x31\x6a\x4e\x43\x32\x6d','\x74\x65\x50\x4c\x79\x4d\x71','\x7a\x65\x6a\x5a\x77\x4b\x30','\x6e\x4d\x6a\x6e\x43\x4c\x66\x41\x72\x47','\x7a\x68\x4c\x52\x42\x33\x71','\x43\x33\x72\x56\x43\x61','\x44\x67\x39\x52\x7a\x77\x34','\x79\x32\x39\x55\x44\x67\x4c\x55\x44\x77\x75','\x43\x67\x66\x59\x44\x67\x35\x4c\x43\x4b\x4c\x4b','\x77\x76\x4c\x48\x41\x65\x34','\x76\x4d\x6a\x31\x41\x30\x79','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x7a\x65\x66\x30','\x7a\x32\x76\x30\x75\x68\x6a\x50\x42\x33\x6a\x75\x44\x78\x6a\x55\x43\x57','\x43\x67\x66\x5a\x43\x57','\x43\x32\x76\x48\x43\x4d\x6e\x4f\x78\x32\x6e\x56\x42\x4e\x72\x4c\x45\x68\x72\x46\x43\x32\x4c\x36\x7a\x71','\x42\x4e\x76\x54\x79\x4d\x76\x59','\x79\x77\x58\x53\x42\x33\x44\x67\x42\x47','\x73\x76\x50\x4c\x76\x68\x6d','\x43\x32\x39\x54\x7a\x71','\x45\x4b\x72\x62\x76\x4d\x34','\x7a\x78\x48\x57\x41\x78\x6a\x4c','\x41\x77\x35\x4a\x42\x32\x31\x57\x42\x67\x76\x30\x7a\x71','\x43\x4d\x76\x5a\x44\x77\x58\x30','\x79\x32\x58\x4c\x79\x78\x69','\x42\x33\x76\x30\x43\x68\x76\x30\x78\x33\x72\x56\x41\x32\x76\x55\x43\x31\x39\x4b\x7a\x78\x72\x48\x41\x77\x58\x5a','\x7a\x67\x39\x55\x7a\x71','\x79\x32\x66\x53\x42\x65\x4c\x4b','\x42\x78\x76\x53\x44\x67\x4c\x54\x42\x32\x72\x48\x42\x61','\x71\x4c\x6e\x65\x44\x76\x4f','\x7a\x4e\x6a\x56\x42\x71','\x43\x4d\x76\x5a\x42\x32\x58\x32\x7a\x71','\x42\x77\x39\x4b\x7a\x77\x57','\x43\x4d\x66\x33','\x79\x78\x6e\x5a\x41\x78\x6e\x30\x79\x77\x35\x30','\x79\x32\x48\x31\x42\x4d\x54\x6a\x42\x4d\x72\x4c\x45\x61','\x77\x77\x48\x72\x71\x33\x79','\x42\x33\x62\x4c\x42\x4d\x66\x50\x74\x77\x76\x5a\x43\x32\x66\x4e\x7a\x78\x6e\x75\x42\x31\x6e\x48\x42\x4d\x72\x49\x42\x33\x48\x6a\x42\x4e\x62\x31\x44\x64\x4f\x47\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x78\x6d\x47\x42\x78\x76\x5a\x44\x63\x62\x4a\x42\x32\x35\x30\x79\x77\x4c\x55\x69\x67\x66\x30\x69\x67\x58\x4c\x79\x78\x6e\x30\x69\x67\x39\x55\x7a\x73\x62\x31\x43\x32\x76\x59\x69\x67\x31\x4c\x43\x33\x6e\x48\x7a\x32\x75','\x76\x78\x6e\x31\x74\x65\x43','\x79\x4e\x76\x4d\x7a\x4d\x76\x59','\x79\x4d\x7a\x76\x45\x4e\x69','\x44\x32\x76\x7a\x42\x68\x6d','\x41\x78\x6e\x6a\x42\x4e\x72\x4c\x7a\x32\x76\x59','\x43\x33\x72\x4c\x7a\x78\x69','\x79\x32\x58\x56\x43\x32\x75','\x44\x4c\x44\x30\x73\x4b\x4b','\x44\x67\x39\x56\x42\x68\x6d','\x7a\x67\x76\x30\x79\x77\x4c\x53','\x79\x77\x58\x30','\x41\x67\x4c\x4e\x41\x61','\x42\x33\x62\x4c\x42\x47','\x72\x66\x6e\x48\x73\x68\x43','\x79\x33\x62\x57\x75\x66\x79','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x62\x79\x33\x72\x50\x42\x32\x34','\x43\x67\x76\x55\x7a\x67\x4c\x55\x7a\x30\x6e\x48\x42\x67\x58\x5a','\x42\x77\x66\x34\x75\x4d\x76\x5a\x44\x77\x58\x30\x43\x57','\x42\x77\x4c\x55','\x41\x78\x72\x4c\x43\x4d\x66\x30\x42\x33\x6a\x64\x43\x4d\x76\x48\x44\x67\x76\x4b','\x45\x4b\x76\x66\x44\x65\x75','\x7a\x4e\x66\x71\x41\x75\x6d','\x43\x67\x35\x4e\x71\x4d\x66\x5a\x7a\x74\x79\x30','\x42\x33\x76\x30\x43\x68\x76\x30\x78\x33\x72\x4c\x45\x68\x71','\x41\x77\x31\x48\x7a\x32\x76\x46\x44\x78\x6a\x53','\x43\x78\x76\x4c\x44\x77\x75','\x43\x4b\x6a\x63\x43\x65\x79','\x41\x32\x76\x35\x43\x57','\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x4c\x56\x42\x4c\x39\x30\x42\x32\x54\x4c\x42\x4e\x6d','\x77\x65\x35\x6f\x42\x33\x65','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x64\x79\x77\x58\x53\x43\x57','\x43\x4e\x76\x55\x71\x77\x7a\x30\x7a\x78\x69','\x73\x4e\x76\x53\x79\x4c\x75','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53','\x71\x32\x39\x52\x76\x67\x69','\x43\x68\x6a\x56\x44\x4d\x4c\x4b\x7a\x78\x69','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x73\x33\x6a\x65\x44\x4c\x4b','\x44\x67\x39\x56\x42\x65\x4c\x55\x44\x4d\x39\x4a\x79\x78\x72\x50\x42\x32\x34','\x45\x76\x62\x79\x74\x76\x71','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75\x55\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x76\x4b','\x44\x67\x39\x56\x42\x66\x6a\x4c\x43\x33\x76\x53\x44\x68\x6d','\x77\x33\x6e\x4a\x43\x4d\x76\x4c\x42\x4e\x6e\x4f\x42\x33\x72\x73\x7a\x77\x72\x48\x79\x33\x72\x50\x42\x32\x35\x69\x42\x32\x39\x52\x78\x73\x62\x59\x7a\x77\x44\x50\x42\x32\x35\x5a\x69\x67\x6e\x56\x42\x4d\x7a\x50\x7a\x33\x76\x59\x7a\x77\x71\x47\x79\x4e\x76\x30\x69\x67\x62\x5a\x41\x67\x66\x59\x43\x67\x61\x47\x41\x78\x6d\x47\x42\x4d\x39\x30\x69\x67\x65\x47\x7a\x67\x76\x57\x7a\x77\x35\x4b\x7a\x77\x35\x4a\x45\x73\x62\x50\x42\x49\x62\x32\x6d\x74\x53\x47\x43\x67\x66\x5a\x43\x32\x4c\x55\x7a\x59\x62\x5a\x79\x33\x6a\x4c\x7a\x77\x35\x5a\x41\x67\x39\x30\x69\x68\x72\x4f\x43\x4d\x39\x31\x7a\x32\x47\x47\x44\x77\x35\x54\x42\x32\x72\x50\x7a\x4d\x4c\x4c\x7a\x61','\x76\x77\x6e\x50\x45\x4e\x75','\x79\x78\x6a\x4e\x44\x77\x31\x4c\x42\x4e\x72\x5a','\x44\x78\x6a\x50','\x42\x4d\x76\x48\x43\x47','\x43\x4e\x6e\x46\x6d\x61','\x7a\x4d\x4c\x53\x7a\x76\x39\x5a\x7a\x77\x66\x59\x79\x32\x47','\x43\x33\x72\x48\x43\x4e\x72\x71\x43\x4d\x39\x54\x41\x78\x6e\x4c','\x73\x77\x6a\x64\x74\x66\x47','\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x76\x4b','\x77\x75\x50\x75\x44\x4d\x75','\x72\x75\x4c\x73\x44\x30\x30','\x7a\x4d\x6e\x48\x7a\x31\x4f','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c','\x42\x67\x66\x5a\x44\x66\x6a\x4c\x7a\x4d\x4c\x53\x42\x65\x31\x5a','\x41\x4b\x6a\x72\x72\x4b\x57','\x7a\x4d\x39\x59\x42\x77\x66\x30','\x43\x31\x6a\x4b\x41\x30\x65','\x7a\x4d\x58\x56\x42\x33\x69','\x73\x77\x35\x32\x79\x77\x58\x50\x7a\x63\x62\x54\x42\x32\x72\x4c\x42\x63\x62\x50\x7a\x64\x4f\x47','\x41\x4d\x72\x49\x71\x78\x4f','\x73\x68\x66\x57\x76\x4b\x38','\x6d\x4a\x71\x32\x6e\x4a\x47\x30\x43\x66\x76\x32\x72\x65\x35\x7a','\x42\x68\x48\x6f\x76\x4c\x43','\x44\x67\x39\x56\x42\x66\x39\x55\x79\x77\x31\x4c','\x79\x4e\x76\x75\x41\x76\x4f','\x76\x4d\x50\x79\x71\x4b\x34','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x46\x44\x78\x6e\x4c\x78\x33\x62\x59\x7a\x78\x7a\x50\x7a\x78\x43','\x74\x33\x44\x49\x7a\x4d\x79','\x43\x33\x72\x59\x41\x77\x35\x4e','\x7a\x67\x76\x53\x7a\x78\x72\x4c','\x42\x33\x62\x4c\x42\x4e\x6a\x56\x44\x78\x72\x4c\x43\x4a\x50\x33\x7a\x77\x6a\x46\x43\x32\x76\x48\x43\x4d\x6e\x4f','\x7a\x4d\x58\x56\x79\x78\x71','\x41\x76\x7a\x50\x72\x30\x38','\x73\x77\x35\x57\x44\x78\x71\x47\x43\x33\x72\x59\x41\x77\x35\x4e\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6a\x4c\x69\x67\x76\x54\x43\x68\x72\x35','\x79\x4e\x6a\x30\x75\x78\x75','\x79\x4d\x58\x56\x79\x32\x53','\x44\x67\x76\x34\x44\x61','\x73\x77\x35\x57\x44\x78\x71\x47\x42\x78\x76\x5a\x44\x63\x62\x49\x7a\x73\x62\x48\x69\x68\x6e\x30\x43\x4d\x4c\x55\x7a\x59\x57\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x42\x32\x79\x47\x43\x33\x72\x59\x41\x77\x35\x4e\x43\x59\x57\x47\x42\x33\x69\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x42\x32\x79\x47\x44\x67\x39\x52\x7a\x77\x34\x47\x79\x78\x6a\x59\x79\x78\x4c\x5a','\x7a\x67\x44\x58\x45\x4b\x4b','\x7a\x67\x66\x30\x79\x71','\x44\x67\x39\x6d\x42\x33\x44\x4c\x43\x4b\x6e\x48\x43\x32\x75','\x71\x33\x48\x4b\x43\x33\x61','\x43\x4d\x39\x53\x7a\x71','\x7a\x67\x76\x53\x44\x67\x65','\x41\x78\x72\x4c\x43\x4d\x66\x30\x42\x33\x69','\x72\x4b\x6a\x72\x75\x30\x53','\x42\x65\x35\x6f\x41\x75\x69','\x75\x33\x6a\x72\x7a\x4d\x4f','\x79\x4d\x76\x4d\x42\x33\x6a\x4c\x76\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x57','\x43\x67\x76\x59\x75\x32\x76\x4a\x42\x32\x35\x4b\x75\x67\x76\x59\x75\x32\x76\x5a\x43\x32\x4c\x56\x42\x47','\x78\x31\x39\x59\x7a\x78\x6e\x57\x42\x32\x35\x5a\x7a\x78\x6e\x66\x45\x68\x72\x59\x79\x78\x6d','\x44\x67\x76\x34\x44\x66\x39\x4a\x42\x32\x31\x57\x42\x67\x76\x30\x41\x77\x39\x55','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x30\x42\x32\x39\x53','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x7a\x68\x44\x48\x72\x76\x79','\x75\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x76\x5a\x76\x4d\x66\x53\x41\x77\x72\x48\x44\x67\x4c\x56\x42\x4b\x76\x59\x43\x4d\x39\x59','\x42\x77\x66\x34\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x44\x67\x39\x56\x42\x65\x39\x31\x44\x68\x62\x31\x44\x65\x4c\x55\x7a\x67\x76\x34','\x44\x67\x76\x59\x42\x77\x4c\x55\x79\x78\x72\x4c','\x44\x32\x76\x49\x78\x33\x6e\x4c\x79\x78\x6a\x4a\x41\x61','\x75\x4d\x39\x77\x43\x4b\x38','\x43\x32\x6e\x59\x7a\x77\x76\x55\x43\x32\x48\x56\x44\x61','\x79\x77\x66\x59\x77\x76\x71','\x69\x67\x31\x31\x43\x33\x71\x47\x79\x32\x39\x55\x44\x67\x66\x50\x42\x49\x62\x56\x42\x4d\x58\x35\x69\x67\x35\x31\x42\x77\x6a\x4c\x43\x4e\x6d\x37\x69\x67\x76\x53\x7a\x77\x31\x4c\x42\x4e\x71\x47','\x78\x33\x6e\x30\x79\x78\x72\x31\x43\x57','\x74\x4c\x44\x73\x74\x32\x57','\x7a\x68\x6a\x50\x44\x4d\x76\x74\x44\x68\x6a\x4c\x79\x77\x30','\x79\x4e\x44\x4b\x43\x4e\x69','\x44\x77\x35\x5a\x44\x78\x62\x57\x42\x33\x6a\x30\x7a\x77\x72\x46\x44\x67\x39\x56\x42\x61','\x41\x78\x6e\x64\x42\x32\x31\x57\x44\x78\x72\x4c\x43\x4c\x76\x5a\x7a\x71','\x79\x32\x39\x5a\x44\x63\x62\x4a\x79\x78\x61\x47\x43\x4d\x76\x48\x79\x32\x48\x4c\x7a\x63\x62\x48\x7a\x4e\x72\x4c\x43\x49\x62\x30\x42\x32\x39\x53\x69\x67\x6e\x48\x42\x67\x57\x36\x69\x61','\x79\x32\x39\x4b\x7a\x71','\x43\x32\x7a\x55\x43\x31\x65','\x79\x32\x58\x56\x43\x32\x76\x4b','\x72\x78\x48\x59\x44\x78\x4f','\x77\x67\x39\x4a\x45\x66\x71','\x7a\x78\x7a\x4c\x42\x4e\x72\x5a','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x63\x44\x77\x7a\x4d\x7a\x78\x69','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x79\x32\x66\x53\x42\x66\x39\x50\x7a\x61','\x44\x67\x4c\x30\x42\x67\x75','\x71\x77\x39\x49\x71\x4c\x43','\x44\x4b\x54\x6b\x71\x31\x71','\x42\x77\x66\x34\x76\x67\x39\x30\x79\x77\x58\x73\x7a\x78\x6e\x31\x42\x68\x72\x5a','\x73\x77\x35\x57\x44\x78\x71\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x42\x78\x76\x5a\x44\x63\x62\x49\x7a\x73\x62\x4f\x42\x32\x31\x56\x7a\x32\x76\x55\x7a\x77\x39\x31\x43\x5a\x53\x47\x41\x77\x35\x4b\x7a\x78\x47\x47','\x7a\x77\x44\x59\x7a\x78\x6e\x5a\x69\x67\x72\x4c\x42\x4d\x4c\x4c\x7a\x63\x62\x49\x45\x73\x62\x48\x42\x67\x58\x56\x44\x30\x7a\x55','\x41\x77\x35\x57\x44\x78\x72\x75\x42\x32\x54\x4c\x42\x4e\x6d','\x72\x32\x6a\x51\x7a\x66\x43','\x79\x77\x72\x4b\x43\x4d\x76\x5a\x43\x57','\x76\x4e\x44\x79\x73\x4e\x43','\x42\x32\x44\x31\x44\x4d\x4b','\x42\x4d\x66\x54\x7a\x71','\x79\x32\x76\x50\x42\x67\x4c\x55\x7a\x57','\x79\x77\x7a\x30\x7a\x78\x6a\x75\x42\x32\x39\x53\x71\x32\x66\x53\x42\x61','\x43\x33\x76\x4a\x79\x32\x76\x4c\x7a\x67\x76\x4b','\x44\x4b\x72\x74\x72\x68\x4b','\x77\x75\x39\x48\x42\x30\x34','\x72\x33\x4c\x4f\x79\x4e\x65','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53\x78\x32\x4c\x4b','\x71\x4d\x72\x69\x73\x4b\x4b','\x44\x67\x39\x74\x44\x68\x6a\x50\x42\x4d\x43','\x7a\x67\x72\x75\x43\x4d\x65','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75\x55\x42\x33\x76\x30\x43\x68\x76\x30\x78\x33\x72\x4c\x45\x68\x71\x55\x7a\x67\x76\x53\x44\x67\x65','\x73\x67\x4c\x6d\x43\x65\x71','\x73\x76\x76\x69\x77\x66\x43','\x6e\x74\x71\x31\x6d\x67\x6a\x74\x71\x76\x62\x4b\x75\x57','\x43\x33\x72\x48\x43\x4e\x71','\x77\x32\x66\x31\x7a\x67\x4c\x30\x78\x71','\x76\x67\x72\x4d\x76\x68\x4f','\x79\x32\x66\x55\x42\x4d\x39\x30\x69\x68\x6e\x31\x79\x4d\x31\x50\x44\x63\x62\x30\x42\x32\x39\x53\x69\x67\x39\x31\x44\x68\x62\x31\x44\x68\x6d\x47\x41\x77\x34\x47\x43\x33\x72\x48\x44\x68\x76\x5a\x69\x61','\x79\x77\x58\x53\x42\x33\x44\x6d\x41\x78\x6e\x30','\x72\x33\x6e\x75\x75\x33\x43','\x7a\x67\x76\x6c\x72\x68\x75','\x79\x78\x6a\x4e\x43\x57','\x75\x32\x35\x53\x45\x76\x71','\x6d\x5a\x47\x5a\x6e\x5a\x43\x32\x79\x31\x66\x49\x71\x30\x6a\x4d','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c\x6f\x4e\x72\x35\x43\x67\x75','\x42\x4d\x39\x33','\x42\x78\x6e\x4e\x78\x57','\x43\x67\x66\x59\x79\x77\x31\x4c\x44\x67\x76\x59\x43\x57','\x44\x67\x66\x59\x7a\x32\x76\x30','\x7a\x77\x44\x59\x7a\x78\x6e\x5a\x69\x67\x72\x4c\x42\x4d\x4c\x4c\x7a\x64\x4f\x47\x44\x77\x35\x57\x79\x78\x6a\x5a\x7a\x77\x66\x49\x42\x67\x75\x47\x44\x78\x6a\x53','\x44\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x4d\x79\x77\x4c\x53\x44\x78\x6a\x4c','\x45\x4b\x39\x69\x42\x65\x38','\x77\x76\x66\x35\x44\x76\x65','\x42\x65\x31\x41\x71\x32\x75','\x77\x77\x7a\x49\x43\x30\x71','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x35\x46\x79\x32\x66\x53\x42\x61','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x66\x39\x4d\x41\x77\x58\x30\x7a\x78\x6a\x4c\x7a\x61','\x43\x4d\x76\x48\x43\x32\x39\x55\x41\x77\x35\x4e\x78\x33\x72\x4c\x45\x68\x71','\x73\x75\x4c\x66\x72\x4d\x38','\x43\x68\x6a\x50\x42\x33\x6a\x75\x44\x78\x6a\x55\x43\x57','\x41\x77\x44\x79\x41\x66\x47','\x43\x4d\x76\x48\x43\x32\x39\x55\x41\x77\x35\x4e\x75\x67\x4c\x4c\x79\x32\x76\x5a','\x44\x67\x6e\x64\x75\x30\x4f','\x74\x4e\x72\x31\x44\x33\x79','\x69\x68\x6a\x31\x42\x47','\x41\x77\x35\x5a\x44\x68\x6a\x31\x79\x33\x72\x50\x42\x32\x35\x5a','\x74\x67\x31\x64\x42\x31\x61','\x7a\x32\x76\x30\x71\x33\x76\x59\x43\x4d\x76\x55\x44\x65\x6e\x56\x43\x33\x71','\x75\x4b\x7a\x62\x44\x32\x30','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x50\x42\x4e\x62\x31\x44\x66\x39\x30\x45\x78\x62\x4c','\x72\x4b\x50\x63\x7a\x76\x71','\x7a\x67\x4c\x54\x7a\x77\x35\x5a\x41\x77\x39\x55\x43\x57','\x69\x49\x62\x54\x79\x78\x72\x4a\x41\x67\x76\x5a\x69\x67\x72\x4c\x42\x4e\x4b\x47\x43\x67\x66\x30\x44\x67\x76\x59\x42\x49\x61\x49','\x6d\x74\x6d\x31\x6f\x66\x72\x30\x42\x77\x54\x49\x71\x71','\x79\x77\x7a\x30\x7a\x78\x69','\x44\x33\x7a\x79\x74\x65\x53','\x6e\x78\x57\x57\x46\x64\x6e\x38\x6e\x68\x57\x59\x46\x64\x7a\x38\x6d\x71','\x69\x49\x62\x50\x43\x59\x62\x55\x42\x33\x71\x47\x42\x32\x34\x47\x44\x67\x48\x4c\x69\x67\x66\x53\x42\x67\x39\x33\x69\x67\x58\x50\x43\x33\x71','\x77\x66\x76\x71\x79\x77\x65','\x43\x32\x4c\x36\x7a\x71','\x41\x77\x35\x57\x44\x78\x71','\x41\x77\x35\x57\x44\x78\x72\x46\x79\x78\x76\x4b\x41\x77\x38','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x5a','\x77\x4c\x4c\x69\x44\x33\x75','\x43\x67\x66\x59\x44\x61','\x7a\x67\x76\x5a\x44\x68\x6a\x31\x79\x33\x72\x50\x44\x4d\x75\x47\x79\x77\x6e\x30\x41\x77\x39\x55\x69\x67\x72\x4c\x42\x4d\x4c\x4c\x7a\x64\x4f\x47\x41\x77\x35\x57\x44\x78\x71\x47\x42\x77\x66\x30\x79\x32\x48\x4c\x43\x59\x61','\x43\x4e\x76\x55\x71\x4d\x76\x4d\x42\x33\x6a\x4c','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75\x55\x42\x33\x76\x30\x43\x68\x76\x30\x78\x32\x4c\x30\x7a\x77\x30\x55\x7a\x67\x39\x55\x7a\x71','\x78\x73\x35\x30\x45\x78\x62\x4c','\x43\x32\x76\x58\x44\x77\x76\x55\x79\x32\x75','\x7a\x32\x76\x30','\x74\x4b\x6e\x76\x43\x67\x6d','\x69\x49\x62\x50\x43\x59\x62\x55\x42\x33\x71\x47\x43\x33\x76\x57\x43\x67\x39\x59\x44\x67\x76\x4b\x69\x67\x6a\x35\x69\x68\x72\x4f\x41\x78\x6d\x47\x7a\x77\x35\x4b\x43\x67\x39\x50\x42\x4e\x71','\x76\x4b\x72\x49\x76\x4d\x71','\x43\x4e\x76\x55\x73\x77\x71','\x43\x33\x76\x49\x42\x77\x4c\x30\x76\x67\x39\x56\x42\x65\x39\x31\x44\x68\x62\x31\x44\x68\x6d','\x43\x32\x76\x5a\x43\x32\x4c\x56\x42\x49\x35\x31\x43\x67\x72\x48\x44\x67\x76\x4b','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c\x6f\x47','\x42\x33\x62\x4c\x42\x4d\x66\x50\x74\x77\x76\x5a\x43\x32\x66\x4e\x7a\x78\x6e\x75\x42\x31\x6e\x48\x42\x4d\x72\x49\x42\x33\x48\x6a\x42\x4e\x62\x31\x44\x64\x4f\x47\x44\x67\x39\x56\x42\x63\x62\x54\x7a\x78\x6e\x5a\x79\x77\x44\x4c\x69\x68\x6a\x4c\x7a\x4d\x76\x59\x7a\x77\x35\x4a\x7a\x78\x6d\x47\x44\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x30\x42\x32\x39\x53\x78\x32\x6e\x48\x42\x67\x58\x46\x41\x77\x71\x47','\x42\x32\x35\x74\x44\x67\x66\x30\x44\x78\x6e\x64\x41\x67\x66\x55\x7a\x32\x75','\x42\x67\x76\x55\x7a\x33\x72\x4f\x78\x32\x76\x34\x79\x32\x76\x4c\x7a\x67\x76\x4b','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x46\x79\x32\x66\x53\x42\x61','\x77\x75\x6a\x70\x42\x66\x6d','\x7a\x67\x76\x30\x79\x77\x4c\x53\x43\x57','\x73\x4d\x6a\x51\x71\x4d\x30','\x76\x67\x39\x56\x42\x63\x62\x30\x45\x78\x62\x4c\x69\x63\x69','\x43\x32\x54\x69\x75\x78\x71','\x73\x75\x58\x41\x43\x4d\x4b','\x44\x67\x48\x50\x42\x4d\x54\x50\x42\x4d\x43','\x43\x33\x72\x59\x7a\x77\x66\x54\x69\x67\x76\x59\x43\x4d\x39\x59','\x43\x32\x76\x30','\x43\x32\x58\x50\x79\x32\x75','\x7a\x78\x48\x57\x41\x78\x6a\x4c\x7a\x61','\x41\x4c\x62\x33\x72\x4d\x69','\x44\x68\x6a\x48\x42\x4e\x6e\x50\x44\x67\x4c\x56\x42\x47','\x7a\x67\x76\x55\x45\x76\x62\x48\x44\x68\x72\x4c\x43\x4d\x35\x5a','\x44\x32\x66\x50\x44\x67\x76\x59\x43\x57','\x44\x67\x39\x56\x42\x66\x39\x49\x42\x67\x39\x4a\x41\x32\x76\x4b','\x43\x75\x50\x64\x75\x77\x43','\x74\x65\x6e\x7a\x43\x68\x65','\x7a\x77\x35\x30\x43\x4d\x4c\x4c\x43\x57','\x41\x67\x39\x56\x41\x33\x6d','\x44\x67\x39\x56\x42\x66\x39\x59\x7a\x78\x6e\x31\x42\x68\x71','\x79\x77\x6e\x30\x41\x77\x39\x55\x69\x68\x6a\x48\x44\x67\x75\x47\x42\x67\x4c\x54\x41\x78\x71\x47\x7a\x78\x48\x4a\x7a\x77\x76\x4b\x7a\x77\x71\x36\x69\x61','\x6e\x5a\x61\x33\x6e\x4a\x43\x57\x75\x31\x50\x51\x42\x30\x35\x74','\x44\x68\x4c\x57\x7a\x71','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53\x78\x33\x6a\x4c\x43\x78\x76\x4c\x43\x33\x72\x4c\x7a\x61','\x7a\x77\x31\x57\x44\x68\x4c\x46\x41\x77\x35\x57\x44\x78\x71','\x42\x33\x7a\x4c\x43\x4e\x6a\x50\x7a\x67\x75','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c\x6f\x4e\x6e\x4a\x43\x4d\x76\x4c\x42\x4e\x6e\x4f\x42\x33\x71','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x30\x42\x32\x54\x4c\x42\x4c\x39\x30\x45\x78\x62\x4c','\x44\x67\x39\x52\x7a\x77\x35\x5a','\x41\x77\x35\x4b\x7a\x78\x47','\x6d\x4a\x4b\x57\x6d\x5a\x62\x6a\x76\x66\x6a\x4a\x73\x4c\x69','\x43\x75\x76\x31\x71\x76\x69','\x43\x4d\x76\x4d\x44\x78\x6e\x48\x42\x61','\x7a\x4e\x6a\x6f\x43\x76\x75','\x44\x67\x39\x56\x42\x66\x39\x50\x42\x4e\x7a\x56\x79\x32\x66\x30\x41\x77\x39\x55','\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6a\x4c\x69\x67\x76\x54\x43\x68\x72\x35','\x75\x65\x58\x51\x41\x4b\x47','\x41\x65\x39\x32\x45\x75\x4f','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x34','\x7a\x77\x35\x4a\x42\x32\x72\x50\x42\x4d\x44\x46\x7a\x4d\x39\x59\x42\x77\x66\x30','\x7a\x4d\x6e\x46','\x41\x75\x6e\x65\x75\x66\x43','\x42\x30\x48\x72\x7a\x66\x71','\x75\x67\x66\x4e\x45\x4b\x57','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75\x55\x42\x33\x76\x30\x43\x68\x76\x30\x78\x32\x4c\x30\x7a\x77\x30\x55\x79\x77\x72\x4b\x7a\x77\x71','\x43\x32\x4c\x55\x41\x57','\x7a\x77\x44\x59\x7a\x78\x6e\x5a\x69\x67\x72\x4c\x42\x4d\x4c\x4c\x7a\x64\x4f\x47\x41\x67\x39\x5a\x44\x63\x61\x49','\x69\x67\x4c\x5a\x69\x61','\x71\x77\x7a\x6b\x74\x31\x71','\x44\x67\x54\x4c\x41\x76\x79','\x69\x64\x34\x39\x69\x61','\x43\x32\x39\x31\x43\x4d\x6e\x4c','\x71\x77\x48\x68\x42\x31\x43','\x69\x49\x62\x50\x43\x59\x62\x55\x42\x33\x71\x47\x43\x4d\x76\x4a\x42\x32\x44\x55\x41\x78\x50\x4c\x7a\x61','\x43\x68\x6a\x56\x42\x78\x62\x30\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x42\x77\x66\x57','\x74\x77\x58\x33\x74\x4b\x43','\x42\x78\x62\x59\x41\x32\x57','\x72\x77\x4c\x72\x77\x4b\x38','\x79\x32\x39\x5a\x44\x63\x62\x4a\x79\x78\x61\x47\x43\x4d\x76\x48\x79\x32\x48\x4c\x7a\x64\x4f\x47','\x7a\x75\x72\x4b\x73\x68\x43','\x42\x33\x76\x30\x43\x68\x76\x30\x76\x67\x39\x52\x7a\x77\x35\x5a','\x79\x77\x58\x53\x42\x33\x43','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x73\x35\x57\x79\x78\x6a\x30\x6c\x4e\x76\x57\x7a\x67\x66\x30\x7a\x77\x71','\x44\x67\x39\x56\x42\x63\x31\x50\x42\x4e\x7a\x56\x79\x32\x66\x30\x41\x77\x39\x55','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53\x43\x57','\x73\x77\x35\x57\x44\x78\x71\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x7a\x78\x48\x4a\x7a\x77\x76\x4b\x43\x59\x62\x54\x79\x78\x48\x50\x42\x78\x76\x54\x69\x67\x6a\x48\x44\x67\x6e\x4f\x69\x68\x6e\x50\x45\x4d\x75\x47\x42\x32\x79\x47','\x44\x67\x39\x56\x42\x65\x35\x48\x42\x77\x75','\x72\x4d\x58\x77\x75\x4d\x6d','\x74\x67\x39\x4f\x79\x4c\x47','\x7a\x65\x54\x70\x77\x78\x61','\x79\x4d\x66\x5a\x7a\x74\x79\x30','\x69\x67\x4c\x5a\x69\x67\x35\x56\x44\x63\x62\x48\x42\x49\x62\x48\x43\x4e\x6a\x48\x45\x71','\x41\x77\x35\x4d\x42\x57','\x44\x67\x76\x34\x44\x66\x62\x50\x7a\x77\x6e\x4c\x43\x57','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x7a\x78\x48\x4c\x79\x33\x76\x30\x41\x77\x39\x55\x6c\x4e\x6e\x30\x79\x78\x6a\x30\x7a\x77\x71','\x76\x4e\x62\x59\x7a\x65\x47','\x73\x77\x35\x57\x44\x78\x71\x47\x43\x33\x72\x59\x41\x77\x35\x4e\x69\x67\x66\x30\x69\x67\x4c\x55\x7a\x67\x76\x34\x69\x61','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x43\x78\x76\x4c\x43\x4e\x4b','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x46\x44\x78\x6e\x4c','\x79\x4d\x6e\x75\x75\x4b\x47','\x73\x77\x35\x57\x44\x78\x71\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x42\x78\x76\x5a\x44\x63\x62\x55\x42\x33\x71\x47\x79\x4d\x75\x47\x7a\x77\x31\x57\x44\x68\x4b','\x76\x66\x76\x78\x44\x4d\x57','\x44\x32\x76\x49\x78\x33\x6e\x4c\x79\x78\x6a\x4a\x41\x66\x39\x57\x43\x4d\x76\x32\x41\x77\x76\x33','\x77\x4c\x48\x7a\x77\x65\x69','\x7a\x75\x6a\x65\x73\x78\x47','\x43\x4c\x76\x4c\x43\x33\x79','\x44\x32\x76\x51\x71\x31\x65','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x59\x7a\x78\x66\x31\x7a\x78\x6e\x30\x78\x32\x76\x59\x43\x4d\x39\x59','\x6e\x4a\x69\x35\x6f\x74\x72\x70\x73\x67\x6e\x49\x44\x4c\x65','\x77\x76\x6e\x6b\x75\x68\x4b','\x44\x78\x6e\x4c\x43\x4c\x39\x53\x42\x32\x6e\x48\x44\x67\x4c\x56\x42\x47','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x43\x68\x76\x30\x75\x68\x6a\x50\x42\x33\x6a\x75\x44\x78\x6a\x55\x43\x57','\x41\x77\x35\x57\x44\x78\x72\x46\x44\x67\x39\x52\x7a\x77\x35\x5a','\x6d\x4a\x79\x31\x6f\x68\x7a\x36\x7a\x4b\x6e\x5a\x41\x57','\x7a\x67\x76\x32\x7a\x77\x58\x56\x43\x67\x76\x59','\x79\x32\x66\x4a\x41\x67\x76\x4b\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x7a\x78\x48\x4c\x79\x33\x76\x30\x7a\x76\x72\x56\x42\x32\x57','\x41\x66\x6e\x54\x43\x30\x65','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x66\x39\x4d\x41\x77\x58\x30\x7a\x78\x69','\x73\x76\x66\x65\x75\x31\x65','\x41\x75\x7a\x71\x73\x68\x79','\x43\x32\x48\x50\x7a\x4e\x71','\x77\x77\x39\x52\x41\x78\x4f','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x76\x43\x32\x75','\x41\x30\x50\x4c\x42\x32\x71','\x42\x78\x6e\x4e\x78\x5a\x61','\x42\x76\x62\x69\x45\x65\x65','\x43\x66\x6a\x59\x73\x68\x75','\x6e\x4a\x43\x58\x41\x33\x4c\x77\x74\x4e\x6a\x7a','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c\x6f\x4d\x6e\x53\x41\x77\x6e\x52','\x79\x32\x39\x4b\x7a\x76\x39\x50\x42\x4e\x72\x4c\x43\x4e\x62\x59\x7a\x78\x72\x4c\x43\x47','\x41\x77\x35\x57\x44\x78\x72\x46\x44\x67\x39\x52\x7a\x77\x35\x5a\x78\x32\x72\x4c\x44\x67\x66\x50\x42\x68\x6d','\x77\x4d\x44\x4d\x79\x76\x69','\x72\x75\x6a\x66\x71\x4b\x79','\x42\x77\x39\x4b\x7a\x77\x58\x6a\x7a\x61','\x43\x4d\x76\x33\x43\x4d\x4c\x30\x7a\x71','\x42\x77\x39\x4b\x7a\x77\x58\x46\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x71','\x79\x32\x66\x55\x79\x32\x76\x53\x75\x4d\x76\x58\x44\x77\x76\x5a\x44\x67\x76\x4b','\x79\x77\x6e\x30\x41\x77\x39\x55','\x7a\x4d\x66\x50\x42\x68\x76\x59\x7a\x71','\x42\x33\x76\x30\x79\x32\x39\x54\x7a\x71','\x43\x78\x76\x4c\x44\x77\x76\x4b','\x75\x4e\x76\x55\x72\x78\x7a\x4c\x42\x4e\x72\x74\x42\x33\x76\x59\x79\x32\x75\x47\x7a\x67\x39\x4c\x43\x59\x62\x55\x42\x33\x71\x47\x43\x33\x76\x57\x43\x67\x39\x59\x44\x63\x62\x5a\x44\x67\x76\x4c\x43\x47','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x75\x39\x31\x44\x68\x62\x31\x44\x65\x4c\x55\x7a\x67\x76\x34','\x71\x4b\x6a\x6d\x41\x30\x43','\x41\x67\x39\x5a\x44\x61','\x43\x33\x72\x59\x41\x77\x6e\x30','\x79\x4d\x76\x4d\x42\x33\x6a\x4c','\x7a\x31\x6a\x64\x42\x78\x69','\x6d\x74\x71\x5a\x74\x4d\x58\x4a\x71\x32\x31\x59','\x69\x67\x4c\x5a\x69\x67\x35\x56\x44\x63\x62\x48\x69\x68\x6e\x30\x43\x4d\x4c\x55\x7a\x57','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x78\x6e\x46\x79\x77\x6e\x30\x41\x77\x39\x55','\x44\x32\x66\x59\x42\x47','\x75\x4b\x39\x4f\x45\x77\x57','\x76\x67\x39\x52\x7a\x77\x34\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x42\x78\x76\x5a\x44\x63\x62\x4a\x42\x32\x35\x30\x79\x77\x4c\x55\x69\x67\x39\x55\x42\x68\x4b\x47\x42\x4e\x76\x54\x79\x4d\x76\x59\x43\x5a\x53\x47\x41\x77\x35\x4b\x7a\x78\x47\x47','\x42\x66\x50\x6f\x73\x76\x65','\x77\x4c\x76\x51\x74\x76\x69','\x43\x4b\x72\x77\x72\x68\x43','\x44\x67\x76\x5a\x44\x61','\x72\x75\x35\x57\x72\x77\x69','\x42\x33\x76\x30\x43\x68\x76\x30\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x45\x77\x76\x6d\x42\x30\x65','\x7a\x4d\x66\x50\x42\x67\x76\x4b','\x44\x75\x58\x4f\x73\x31\x43','\x44\x66\x6e\x30\x73\x76\x69','\x42\x4d\x35\x6b\x75\x30\x71','\x41\x4c\x66\x68\x42\x68\x79','\x79\x78\x6e\x35\x42\x4d\x6e\x6a\x44\x67\x76\x59\x79\x78\x72\x56\x43\x47','\x75\x4e\x72\x79\x76\x30\x30','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x4c\x42\x4d\x6e\x56\x7a\x67\x4c\x55\x7a\x31\x39\x4d\x42\x33\x6a\x54\x79\x78\x71','\x76\x66\x50\x48\x41\x65\x43','\x43\x33\x76\x4a\x79\x32\x76\x5a\x43\x57','\x76\x4e\x4c\x69\x44\x77\x47','\x79\x32\x66\x55\x79\x32\x76\x53','\x75\x4e\x6e\x58\x75\x4b\x43','\x41\x4d\x39\x50\x42\x47','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x70\x43\x4d\x72\x4c\x43\x47','\x77\x4d\x66\x66\x42\x77\x38','\x44\x78\x6e\x4c\x43\x47','\x74\x78\x4c\x69\x73\x77\x30','\x75\x4e\x72\x77\x7a\x68\x47','\x42\x67\x66\x49\x7a\x77\x57','\x42\x77\x31\x76\x72\x65\x38','\x76\x67\x39\x52\x7a\x77\x34\x47\x79\x78\x6a\x59\x79\x78\x4b\x47\x79\x78\x71\x47\x41\x77\x35\x4b\x7a\x78\x47\x47','\x44\x67\x39\x56\x42\x68\x6e\x42','\x44\x68\x6a\x50\x42\x71','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x6a\x7a\x61','\x41\x67\x66\x5a','\x44\x78\x6e\x4c\x43\x4b\x58\x56\x79\x32\x66\x30\x41\x77\x39\x55','\x77\x4b\x7a\x30\x75\x33\x71','\x41\x68\x6a\x4c\x7a\x47','\x42\x32\x6a\x51\x7a\x77\x6e\x30','\x42\x67\x39\x33','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x78\x6e\x62\x79\x33\x72\x50\x42\x32\x34','\x7a\x4d\x58\x48\x44\x65\x31\x48\x43\x61','\x7a\x66\x44\x4d\x44\x68\x4f','\x44\x67\x4c\x54\x7a\x78\x6e\x30\x79\x77\x31\x57','\x6f\x78\x66\x72\x42\x68\x72\x64\x76\x71','\x44\x78\x6e\x4c\x43\x4c\x62\x48\x43\x4e\x72\x5a','\x73\x32\x39\x68\x41\x32\x65','\x75\x4e\x76\x55\x72\x78\x7a\x4c\x42\x4e\x72\x74\x42\x33\x76\x59\x79\x32\x75\x47\x7a\x67\x39\x4c\x43\x59\x62\x55\x42\x33\x71\x47\x43\x33\x76\x57\x43\x67\x39\x59\x44\x63\x62\x5a\x44\x77\x6a\x54\x41\x78\x72\x75\x42\x32\x39\x53\x74\x33\x76\x30\x43\x68\x76\x30\x43\x57','\x79\x78\x76\x30\x42\x57','\x43\x4d\x76\x4e\x41\x77\x39\x55\x43\x57','\x7a\x67\x76\x5a\x79\x33\x6a\x50\x43\x68\x72\x50\x42\x32\x34','\x44\x76\x4c\x71\x74\x4c\x47','\x79\x32\x66\x55\x79\x32\x76\x53\x42\x67\x76\x4b','\x74\x75\x39\x35\x79\x33\x75','\x44\x78\x6e\x48\x7a\x32\x75','\x43\x33\x72\x48\x44\x68\x76\x5a','\x44\x4d\x66\x53\x44\x77\x75','\x43\x68\x76\x5a\x41\x61','\x42\x77\x66\x34','\x41\x77\x31\x54\x77\x77\x4f'];a0_0x58b8=function(){return _0x1a16d2;};return a0_0x58b8();}function a0_0x20fc(_0x375b86,_0x28e9dc){_0x375b86=_0x375b86-0x172;const _0x58b8cd=a0_0x58b8();let _0x20fc32=_0x58b8cd[_0x375b86];if(a0_0x20fc['\x4d\x7a\x72\x54\x6c\x66']===undefined){var _0x449eca=function(_0x18aff1){const _0x5315c8='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x20567b='',_0x1d574e='';for(let _0x1d8620=0x0,_0x5b4d67,_0x37496f,_0x14d470=0x0;_0x37496f=_0x18aff1['\x63\x68\x61\x72\x41\x74'](_0x14d470++);~_0x37496f&&(_0x5b4d67=_0x1d8620%0x4?_0x5b4d67*0x40+_0x37496f:_0x37496f,_0x1d8620++%0x4)?_0x20567b+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x5b4d67>>(-0x2*_0x1d8620&0x6)):0x0){_0x37496f=_0x5315c8['\x69\x6e\x64\x65\x78\x4f\x66'](_0x37496f);}for(let _0x28ea63=0x0,_0x44d020=_0x20567b['\x6c\x65\x6e\x67\x74\x68'];_0x28ea63<_0x44d020;_0x28ea63++){_0x1d574e+='\x25'+('\x30\x30'+_0x20567b['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x28ea63)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x1d574e);};a0_0x20fc['\x4f\x6a\x4f\x41\x69\x71']=_0x449eca,a0_0x20fc['\x74\x76\x6c\x67\x63\x68']={},a0_0x20fc['\x4d\x7a\x72\x54\x6c\x66']=!![];}const _0x2a40f1=_0x58b8cd[0x0],_0x1ee270=_0x375b86+_0x2a40f1,_0xf71c0b=a0_0x20fc['\x74\x76\x6c\x67\x63\x68'][_0x1ee270];return!_0xf71c0b?(_0x20fc32=a0_0x20fc['\x4f\x6a\x4f\x41\x69\x71'](_0x20fc32),a0_0x20fc['\x74\x76\x6c\x67\x63\x68'][_0x1ee270]=_0x20fc32):_0x20fc32=_0xf71c0b,_0x20fc32;}function getResponsesExtras(_0x44735){const _0x40bf4b=a0_0x486ab8,_0x36f57d=_0x44735;if(!_0x36f57d[_0x40bf4b(0x2e3)])_0x36f57d[_0x40bf4b(0x2e3)]={'\x73\x65\x71\x75\x65\x6e\x63\x65':0x0,'\x74\x6f\x6f\x6c\x4f\x75\x74\x70\x75\x74\x49\x6e\x64\x65\x78':new Map()};return _0x36f57d[_0x40bf4b(0x2e3)];}function nextSeq(_0x339189){const _0x71bc3e=a0_0x486ab8;return _0x339189[_0x71bc3e(0x175)]+=0x1,_0x339189[_0x71bc3e(0x175)];}function emptyResponseUsage(){return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':0x0,'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':0x0,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':0x0,'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73':0x0},'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73':0x0}};}function usageFromTokens(_0x421e65){const _0x2045e9=a0_0x486ab8;return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x421e65[_0x2045e9(0x1b9)],'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x421e65[_0x2045e9(0x2a2)],'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x421e65[_0x2045e9(0x249)],'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73':0x0},'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73':0x0}};}function sandboxEventToResponsesEvent(_0x11fff4,_0x28e3df){const _0x10f38f=a0_0x486ab8,_0x3d70e9={'\x6a\x42\x51\x46\x4c':_0x10f38f(0x1cf),'\x54\x55\x57\x76\x6c':_0x10f38f(0x243),'\x41\x49\x52\x7a\x48':_0x10f38f(0x17c),'\x43\x78\x64\x73\x70':function(_0x3ef879,_0x32d260){return _0x3ef879(_0x32d260);},'\x52\x73\x71\x52\x47':_0x10f38f(0x317),'\x74\x53\x74\x49\x52':function(_0x3e076e,_0x5d49d8){return _0x3e076e(_0x5d49d8);},'\x66\x71\x50\x69\x43':function(_0x52dfe3,_0x209991){return _0x52dfe3(_0x209991);},'\x52\x74\x58\x57\x4d':_0x10f38f(0x254),'\x53\x6b\x70\x55\x54':function(_0x56497b){return _0x56497b();},'\x45\x68\x56\x63\x59':_0x10f38f(0x2ae),'\x49\x51\x44\x53\x51':_0x10f38f(0x25c),'\x68\x6d\x4f\x62\x41':_0x10f38f(0x2b9)},_0x1c80f9=getResponsesExtras(_0x28e3df);switch(_0x11fff4[_0x10f38f(0x199)]){case _0x10f38f(0x31b):return null;case _0x3d70e9[_0x10f38f(0x2bf)]:return null;case _0x3d70e9[_0x10f38f(0x1d7)]:return null;case _0x3d70e9['\x41\x49\x52\x7a\x48']:return null;case'\x6d\x65\x73\x73\x61\x67\x65\x2e\x70\x61\x72\x74\x2e\x75\x70\x64\x61\x74\x65\x64':return null;case _0x10f38f(0x267):{const _0x435d77=_0x3d70e9[_0x10f38f(0x2da)](readTokenDelta,_0x11fff4);if(_0x435d77==null||_0x435d77['\x6c\x65\x6e\x67\x74\x68']===0x0)return null;_0x28e3df[_0x10f38f(0x283)]+=0x1;if(_0x1c80f9[_0x10f38f(0x202)]===void 0x0)_0x1c80f9[_0x10f38f(0x202)]=_0x28e3df[_0x10f38f(0x2fe)][_0x10f38f(0x348)];return{'\x74\x79\x70\x65':_0x3d70e9[_0x10f38f(0x221)],'\x63\x6f\x6e\x74\x65\x6e\x74\x5f\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':_0x435d77,'\x69\x74\x65\x6d\x5f\x69\x64':'\x6d\x73\x67\x5f'+_0x28e3df['\x72\x75\x6e\x49\x64'],'\x6c\x6f\x67\x70\x72\x6f\x62\x73':[],'\x6f\x75\x74\x70\x75\x74\x5f\x69\x6e\x64\x65\x78':_0x1c80f9[_0x10f38f(0x202)],'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':_0x3d70e9[_0x10f38f(0x217)](nextSeq,_0x1c80f9)};}case _0x10f38f(0x281):{const _0xc2c86c=_0x3d70e9[_0x10f38f(0x29b)](readToolInvocation,_0x11fff4);if(!_0xc2c86c)return null;_0x28e3df[_0x10f38f(0x283)]+=0x1;const _0x3420c5=_0x28e3df[_0x10f38f(0x2fe)]['\x67\x65\x74'](_0xc2c86c['\x69\x64']),_0x298994=_0x3420c5?_0x3420c5['\x69\x6e\x64\x65\x78']:_0x28e3df['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72'][_0x10f38f(0x348)];_0x28e3df[_0x10f38f(0x2fe)][_0x10f38f(0x18a)](_0xc2c86c['\x69\x64'],{'\x69\x6e\x64\x65\x78':_0x298994,'\x69\x64':_0xc2c86c['\x69\x64'],'\x6e\x61\x6d\x65':_0xc2c86c['\x6e\x61\x6d\x65'],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0xc2c86c[_0x10f38f(0x2b2)]});const _0x56f855=_0x1c80f9[_0x10f38f(0x2ea)][_0x10f38f(0x176)](_0xc2c86c['\x69\x64'])??_0x1c80f9[_0x10f38f(0x2ea)]['\x73\x69\x7a\x65'];return _0x1c80f9['\x74\x6f\x6f\x6c\x4f\x75\x74\x70\x75\x74\x49\x6e\x64\x65\x78'][_0x10f38f(0x18a)](_0xc2c86c['\x69\x64'],_0x56f855),{'\x74\x79\x70\x65':_0x10f38f(0x1af),'\x69\x74\x65\x6d':{'\x74\x79\x70\x65':_0x10f38f(0x330),'\x69\x64':'\x66\x63\x5f'+_0xc2c86c['\x69\x64'],'\x63\x61\x6c\x6c\x5f\x69\x64':_0xc2c86c['\x69\x64'],'\x6e\x61\x6d\x65':_0xc2c86c[_0x10f38f(0x30c)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0xc2c86c[_0x10f38f(0x2b2)],'\x73\x74\x61\x74\x75\x73':_0x10f38f(0x2b9)},'\x6f\x75\x74\x70\x75\x74\x5f\x69\x6e\x64\x65\x78':_0x56f855,'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':nextSeq(_0x1c80f9)};}case _0x3d70e9[_0x10f38f(0x21b)]:{const _0xe26af4=_0x1c80f9[_0x10f38f(0x202)]??0x0;return{'\x74\x79\x70\x65':_0x10f38f(0x173),'\x69\x74\x65\x6d':{'\x74\x79\x70\x65':_0x10f38f(0x2e6),'\x69\x64':_0x10f38f(0x327)+_0x28e3df[_0x10f38f(0x17a)],'\x72\x6f\x6c\x65':_0x10f38f(0x282),'\x73\x74\x61\x74\x75\x73':_0x10f38f(0x276),'\x63\x6f\x6e\x74\x65\x6e\x74':[]},'\x6f\x75\x74\x70\x75\x74\x5f\x69\x6e\x64\x65\x78':_0xe26af4,'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':_0x3d70e9[_0x10f38f(0x29b)](nextSeq,_0x1c80f9)};}case _0x10f38f(0x27a):{const _0x84d17c=readUsage(_0x11fff4),_0x34b8c4=_0x84d17c?usageFromTokens(_0x84d17c):_0x3d70e9['\x53\x6b\x70\x55\x54'](emptyResponseUsage);return{'\x74\x79\x70\x65':_0x3d70e9['\x45\x68\x56\x63\x59'],'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':nextSeq(_0x1c80f9),'\x72\x65\x73\x70\x6f\x6e\x73\x65':{'\x69\x64':_0x28e3df[_0x10f38f(0x17a)],'\x6f\x62\x6a\x65\x63\x74':_0x3d70e9[_0x10f38f(0x1ea)],'\x63\x72\x65\x61\x74\x65\x64\x5f\x61\x74':_0x28e3df[_0x10f38f(0x26c)],'\x6f\x75\x74\x70\x75\x74\x5f\x74\x65\x78\x74':'','\x65\x72\x72\x6f\x72':null,'\x69\x6e\x63\x6f\x6d\x70\x6c\x65\x74\x65\x5f\x64\x65\x74\x61\x69\x6c\x73':null,'\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73':null,'\x6d\x65\x74\x61\x64\x61\x74\x61':null,'\x6d\x6f\x64\x65\x6c':_0x28e3df[_0x10f38f(0x1f9)],'\x6f\x75\x74\x70\x75\x74':[],'\x70\x61\x72\x61\x6c\x6c\x65\x6c\x5f\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73':![],'\x74\x65\x6d\x70\x65\x72\x61\x74\x75\x72\x65':null,'\x74\x6f\x6f\x6c\x5f\x63\x68\x6f\x69\x63\x65':_0x10f38f(0x23c),'\x74\x6f\x6f\x6c\x73':[],'\x74\x6f\x70\x5f\x70':null,'\x73\x74\x61\x74\x75\x73':_0x3d70e9['\x68\x6d\x4f\x62\x41'],'\x75\x73\x61\x67\x65':_0x34b8c4}};}default:return null;}}var EmbeddingValidationError=class extends Error{['\x74\x79\x70\x65']='\x69\x6e\x76\x61\x6c\x69\x64\x5f\x72\x65\x71\x75\x65\x73\x74\x5f\x65\x72\x72\x6f\x72';[a0_0x486ab8(0x2f8)];[a0_0x486ab8(0x253)];constructor(_0x2b9873,_0x533680,_0x508052){const _0x2eb47d=a0_0x486ab8,_0x5bd566={'\x58\x4e\x4e\x6f\x71':'\x45\x6d\x62\x65\x64\x64\x69\x6e\x67\x56\x61\x6c\x69\x64\x61\x74\x69\x6f\x6e\x45\x72\x72\x6f\x72'};super(_0x2b9873),this[_0x2eb47d(0x30c)]=_0x5bd566[_0x2eb47d(0x2a3)],this[_0x2eb47d(0x2f8)]=_0x533680,this[_0x2eb47d(0x253)]=_0x508052;}};const MAX_BATCH=0x800;function reject(_0x55be7a,_0x6a7e6f,_0x1e0108){throw new EmbeddingValidationError(_0x55be7a,_0x6a7e6f,_0x1e0108);}function normalizeInput(_0x3354c2){const _0x4ac331=a0_0x486ab8,_0x4c284b={'\x72\x44\x56\x44\x77':_0x4ac331(0x2d2),'\x6a\x51\x47\x6c\x76':function(_0x1fd9c8,_0x77ed39,_0xaf4132,_0x21f6a5){return _0x1fd9c8(_0x77ed39,_0xaf4132,_0x21f6a5);},'\x63\x70\x70\x50\x56':_0x4ac331(0x33e),'\x64\x79\x6b\x6f\x74':_0x4ac331(0x349),'\x6c\x78\x4e\x56\x57':function(_0x7a58ea,_0x419fb2){return _0x7a58ea===_0x419fb2;},'\x77\x65\x6a\x43\x51':_0x4ac331(0x1d6),'\x69\x64\x4e\x59\x48':'\x62\x61\x74\x63\x68\x5f\x74\x6f\x6f\x5f\x6c\x61\x72\x67\x65','\x56\x44\x62\x56\x64':function(_0x37b110,_0x20456){return _0x37b110<_0x20456;},'\x45\x78\x72\x75\x7a':_0x4ac331(0x2cd),'\x5a\x61\x45\x6d\x6f':'\x6d\x69\x78\x65\x64\x5f\x69\x6e\x70\x75\x74\x5f\x74\x79\x70\x65\x73','\x4d\x79\x48\x49\x6d':_0x4ac331(0x270),'\x56\x79\x48\x75\x68':function(_0x5ef769,_0x4a1ea8){return _0x5ef769!==_0x4a1ea8;},'\x6d\x6d\x55\x44\x4f':_0x4ac331(0x19e),'\x67\x57\x54\x54\x71':_0x4ac331(0x19f),'\x64\x57\x66\x74\x7a':function(_0x156086,_0x3847d0,_0x85434b,_0x5ebe34){return _0x156086(_0x3847d0,_0x85434b,_0x5ebe34);},'\x79\x50\x58\x4d\x54':_0x4ac331(0x19b),'\x64\x67\x71\x7a\x49':_0x4ac331(0x2d6)};if(typeof _0x3354c2===_0x4ac331(0x2cd)){if(_0x3354c2[_0x4ac331(0x1d2)]===0x0)reject(_0x4c284b[_0x4ac331(0x210)],_0x4ac331(0x19b),'\x69\x6e\x70\x75\x74');return{'\x6b\x69\x6e\x64':'\x74\x65\x78\x74','\x76\x61\x6c\x75\x65\x73':[_0x3354c2]};}if(!Array[_0x4ac331(0x24f)](_0x3354c2))_0x4c284b[_0x4ac331(0x219)](reject,'\x49\x6e\x70\x75\x74\x20\x6d\x75\x73\x74\x20\x62\x65\x20\x61\x20\x73\x74\x72\x69\x6e\x67\x2c\x20\x61\x72\x72\x61\x79\x20\x6f\x66\x20\x73\x74\x72\x69\x6e\x67\x73\x2c\x20\x6f\x72\x20\x61\x72\x72\x61\x79\x20\x6f\x66\x20\x74\x6f\x6b\x65\x6e\x20\x61\x72\x72\x61\x79\x73',_0x4c284b[_0x4ac331(0x294)],_0x4c284b[_0x4ac331(0x265)]);if(_0x4c284b['\x6c\x78\x4e\x56\x57'](_0x3354c2[_0x4ac331(0x1d2)],0x0))_0x4c284b[_0x4ac331(0x219)](reject,_0x4c284b[_0x4ac331(0x1dc)],_0x4ac331(0x19b),'\x69\x6e\x70\x75\x74');if(_0x3354c2[_0x4ac331(0x1d2)]>MAX_BATCH)reject(_0x4ac331(0x1c5)+MAX_BATCH,_0x4c284b['\x69\x64\x4e\x59\x48'],'\x69\x6e\x70\x75\x74');const _0x38cb10=_0x3354c2[0x0];if(_0x4c284b[_0x4ac331(0x2c7)](typeof _0x38cb10,_0x4ac331(0x2cd))){const _0x4d5687=[];for(let _0x2b937e=0x0;_0x4c284b[_0x4ac331(0x179)](_0x2b937e,_0x3354c2[_0x4ac331(0x1d2)]);_0x2b937e++){const _0x20096c=_0x3354c2[_0x2b937e];if(typeof _0x20096c!==_0x4c284b[_0x4ac331(0x2fb)])_0x4c284b[_0x4ac331(0x219)](reject,'\x49\x6e\x70\x75\x74\x20\x61\x72\x72\x61\x79\x20\x6d\x75\x73\x74\x20\x62\x65\x20\x68\x6f\x6d\x6f\x67\x65\x6e\x65\x6f\x75\x73\x3b\x20\x69\x6e\x64\x65\x78\x20'+_0x2b937e+_0x4ac331(0x209),_0x4c284b[_0x4ac331(0x224)],_0x4c284b['\x64\x79\x6b\x6f\x74']);if(_0x20096c[_0x4ac331(0x1d2)]===0x0)reject(_0x4ac331(0x1d1)+_0x2b937e+_0x4ac331(0x1a6),_0x4ac331(0x19b),_0x4c284b[_0x4ac331(0x265)]);_0x4d5687['\x70\x75\x73\x68'](_0x20096c);}return{'\x6b\x69\x6e\x64':_0x4ac331(0x2d5),'\x76\x61\x6c\x75\x65\x73':_0x4d5687};}if(typeof _0x38cb10===_0x4c284b[_0x4ac331(0x226)]){for(let _0x6ce93a=0x0;_0x6ce93a<_0x3354c2[_0x4ac331(0x1d2)];_0x6ce93a++)if(_0x4c284b[_0x4ac331(0x21f)](typeof _0x3354c2[_0x6ce93a],'\x6e\x75\x6d\x62\x65\x72'))reject(_0x4ac331(0x20d)+_0x6ce93a+_0x4ac331(0x1b2)+typeof _0x3354c2[_0x6ce93a],_0x4c284b[_0x4ac331(0x229)],_0x4ac331(0x349));return{'\x6b\x69\x6e\x64':_0x4c284b['\x67\x57\x54\x54\x71'],'\x76\x61\x6c\x75\x65\x73':[_0x3354c2]};}if(Array['\x69\x73\x41\x72\x72\x61\x79'](_0x38cb10)){const _0x33e32a=[];for(let _0x164980=0x0;_0x164980<_0x3354c2[_0x4ac331(0x1d2)];_0x164980++){const _0x22e378=_0x3354c2[_0x164980];if(!Array[_0x4ac331(0x24f)](_0x22e378))reject(_0x4ac331(0x305)+_0x164980+_0x4ac331(0x1cb),_0x4c284b[_0x4ac331(0x224)],_0x4ac331(0x349));if(_0x4c284b[_0x4ac331(0x2c7)](_0x22e378['\x6c\x65\x6e\x67\x74\x68'],0x0))_0x4c284b[_0x4ac331(0x236)](reject,_0x4ac331(0x22a)+_0x164980+_0x4ac331(0x1a6),_0x4c284b[_0x4ac331(0x2ad)],'\x69\x6e\x70\x75\x74');for(let _0x1e580a=0x0;_0x1e580a<_0x22e378[_0x4ac331(0x1d2)];_0x1e580a++)if(typeof _0x22e378[_0x1e580a]!==_0x4c284b['\x4d\x79\x48\x49\x6d'])reject(_0x4ac331(0x22a)+_0x164980+_0x4ac331(0x2f0)+_0x1e580a+_0x4ac331(0x1b2)+typeof _0x22e378[_0x1e580a],_0x4ac331(0x19e),_0x4c284b[_0x4ac331(0x265)]);_0x33e32a['\x70\x75\x73\x68'](_0x22e378);}return{'\x6b\x69\x6e\x64':_0x4ac331(0x19f),'\x76\x61\x6c\x75\x65\x73':_0x33e32a};}reject(_0x4c284b[_0x4ac331(0x2d7)],_0x4c284b[_0x4ac331(0x294)],_0x4c284b[_0x4ac331(0x265)]);}function validateEmbeddingRequest(_0xeaf370){const _0x3fa9a8=a0_0x486ab8,_0x5c5442={'\x6c\x5a\x4e\x49\x51':function(_0x43736,_0xf88390,_0x2a0302,_0x294c){return _0x43736(_0xf88390,_0x2a0302,_0x294c);},'\x7a\x52\x55\x4d\x53':'\x69\x6e\x76\x61\x6c\x69\x64\x5f\x72\x65\x71\x75\x65\x73\x74','\x62\x77\x64\x72\x72':function(_0x3fce64,_0xdbea54){return _0x3fce64!==_0xdbea54;},'\x5a\x66\x65\x76\x4c':_0x3fa9a8(0x280),'\x4f\x71\x68\x58\x79':'\x69\x6e\x76\x61\x6c\x69\x64\x5f\x64\x69\x6d\x65\x6e\x73\x69\x6f\x6e\x73','\x6e\x42\x43\x46\x74':_0x3fa9a8(0x340),'\x72\x55\x65\x73\x76':_0x3fa9a8(0x2d0),'\x73\x52\x64\x6b\x41':function(_0x4d71d6,_0x17636e,_0x358bad,_0x13f394){return _0x4d71d6(_0x17636e,_0x358bad,_0x13f394);},'\x42\x53\x44\x75\x5a':_0x3fa9a8(0x1aa),'\x46\x42\x51\x53\x4b':function(_0x541af1,_0x496279){return _0x541af1!==_0x496279;}};if(!_0xeaf370||typeof _0xeaf370!=='\x6f\x62\x6a\x65\x63\x74')_0x5c5442[_0x3fa9a8(0x20e)](reject,'\x52\x65\x71\x75\x65\x73\x74\x20\x62\x6f\x64\x79\x20\x6d\x75\x73\x74\x20\x62\x65\x20\x61\x6e\x20\x6f\x62\x6a\x65\x63\x74',_0x5c5442['\x7a\x52\x55\x4d\x53'],void 0x0);if(_0x5c5442[_0x3fa9a8(0x2f4)](typeof _0xeaf370[_0x3fa9a8(0x280)],_0x3fa9a8(0x2cd))||_0xeaf370[_0x3fa9a8(0x280)]['\x6c\x65\x6e\x67\x74\x68']===0x0)reject('\x4d\x6f\x64\x65\x6c\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64',_0x3fa9a8(0x1fb),_0x5c5442['\x5a\x66\x65\x76\x4c']);if(_0xeaf370[_0x3fa9a8(0x340)]!==void 0x0){if(_0x5c5442[_0x3fa9a8(0x2f4)](typeof _0xeaf370[_0x3fa9a8(0x340)],_0x3fa9a8(0x270))||!Number[_0x3fa9a8(0x28a)](_0xeaf370[_0x3fa9a8(0x340)])||_0xeaf370[_0x3fa9a8(0x340)]<=0x0)reject('\x44\x69\x6d\x65\x6e\x73\x69\x6f\x6e\x73\x20\x6d\x75\x73\x74\x20\x62\x65\x20\x61\x20\x70\x6f\x73\x69\x74\x69\x76\x65\x20\x69\x6e\x74\x65\x67\x65\x72',_0x5c5442['\x4f\x71\x68\x58\x79'],_0x5c5442['\x6e\x42\x43\x46\x74']);}const _0x3dd5c2=_0xeaf370[_0x3fa9a8(0x1aa)]??_0x5c5442[_0x3fa9a8(0x1db)];if(_0x3dd5c2!==_0x3fa9a8(0x2d0)&&_0x3dd5c2!==_0x3fa9a8(0x1ca))_0x5c5442[_0x3fa9a8(0x2c1)](reject,'\x65\x6e\x63\x6f\x64\x69\x6e\x67\x5f\x66\x6f\x72\x6d\x61\x74\x20\x6d\x75\x73\x74\x20\x62\x65\x20\x27\x66\x6c\x6f\x61\x74\x27\x20\x6f\x72\x20\x27\x62\x61\x73\x65\x36\x34\x27',_0x3fa9a8(0x21c),_0x5c5442[_0x3fa9a8(0x27d)]);const _0x1bd6a1=normalizeInput(_0xeaf370[_0x3fa9a8(0x349)]),_0x53cb88={'\x6d\x6f\x64\x65\x6c':_0xeaf370[_0x3fa9a8(0x280)],'\x69\x6e\x70\x75\x74':_0x1bd6a1,'\x65\x6e\x63\x6f\x64\x69\x6e\x67\x46\x6f\x72\x6d\x61\x74':_0x3dd5c2};if(_0x5c5442['\x62\x77\x64\x72\x72'](_0xeaf370[_0x3fa9a8(0x340)],void 0x0))_0x53cb88[_0x3fa9a8(0x340)]=_0xeaf370[_0x3fa9a8(0x340)];if(_0x5c5442[_0x3fa9a8(0x2de)](_0xeaf370[_0x3fa9a8(0x225)],void 0x0))_0x53cb88[_0x3fa9a8(0x225)]=_0xeaf370['\x75\x73\x65\x72'];return _0x53cb88;}function resolveProviderId(_0x49b5f0){const _0x3825ac=a0_0x486ab8,_0x3a756c={'\x77\x51\x57\x56\x6d':function(_0x414e4c,_0x34a4fb){return _0x414e4c===_0x34a4fb;},'\x59\x42\x4f\x6c\x53':function(_0x29e78e,_0x3cb5f9){return _0x29e78e||_0x3cb5f9;}},_0x58fb97=_0x49b5f0[_0x3825ac(0x22c)](),_0x5d0075=_0x58fb97['\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68']('\x74\x61\x6e\x67\x6c\x65\x2f')?_0x58fb97[_0x3825ac(0x18b)](0x7):_0x58fb97;if(!_0x5d0075)throw new Error(_0x3825ac(0x2c3)+JSON[_0x3825ac(0x1e1)](_0x49b5f0));const _0x3390df=_0x5d0075['\x69\x6e\x64\x65\x78\x4f\x66']('\x2f');if(_0x3a756c['\x77\x51\x57\x56\x6d'](_0x3390df,-0x1))return{'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x5d0075};const _0x66c72b=_0x5d0075['\x73\x6c\x69\x63\x65'](0x0,_0x3390df),_0x2c6baf=_0x5d0075[_0x3825ac(0x18b)](_0x3390df+0x1);if(_0x3a756c[_0x3825ac(0x182)](!_0x66c72b,!_0x2c6baf))throw new Error('\x49\x6e\x76\x61\x6c\x69\x64\x20\x6d\x6f\x64\x65\x6c\x20\x69\x64\x3a\x20'+JSON[_0x3825ac(0x1e1)](_0x49b5f0));return{'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x66c72b,'\x76\x61\x72\x69\x61\x6e\x74':_0x2c6baf};}function normalizeContent(_0x449c1){const _0x403a16=a0_0x486ab8,_0x8e90c0={'\x47\x73\x54\x53\x77':function(_0x102c6a,_0x128641){return _0x102c6a===_0x128641;},'\x79\x65\x4c\x6f\x41':_0x403a16(0x34a)};if(_0x449c1==null)return{'\x74\x65\x78\x74':'','\x70\x61\x72\x74\x73':[]};if(typeof _0x449c1===_0x403a16(0x2cd))return{'\x74\x65\x78\x74':_0x449c1,'\x70\x61\x72\x74\x73':[]};const _0x219ce5=[],_0x1f1975=[];for(const _0x4061ee of _0x449c1)if(_0x4061ee[_0x403a16(0x199)]===_0x403a16(0x2d5))_0x1f1975[_0x403a16(0x245)](_0x4061ee[_0x403a16(0x2d5)]),_0x219ce5[_0x403a16(0x245)]({'\x74\x79\x70\x65':_0x403a16(0x2d5),'\x74\x65\x78\x74':_0x4061ee['\x74\x65\x78\x74']});else{if(_0x8e90c0[_0x403a16(0x320)](_0x4061ee['\x74\x79\x70\x65'],'\x69\x6d\x61\x67\x65\x5f\x75\x72\x6c'))_0x219ce5[_0x403a16(0x245)]({'\x74\x79\x70\x65':'\x69\x6d\x61\x67\x65\x5f\x75\x72\x6c','\x69\x6d\x61\x67\x65\x5f\x75\x72\x6c':{'\x75\x72\x6c':_0x4061ee[_0x403a16(0x29e)]['\x75\x72\x6c'],'\x64\x65\x74\x61\x69\x6c':_0x4061ee[_0x403a16(0x29e)][_0x403a16(0x28f)]}});else{if(_0x4061ee[_0x403a16(0x199)]===_0x8e90c0[_0x403a16(0x214)])_0x219ce5[_0x403a16(0x245)]({'\x74\x79\x70\x65':_0x8e90c0[_0x403a16(0x214)],'\x69\x6e\x70\x75\x74\x5f\x61\x75\x64\x69\x6f':{'\x64\x61\x74\x61':_0x4061ee[_0x403a16(0x34a)][_0x403a16(0x2d8)],'\x66\x6f\x72\x6d\x61\x74':_0x4061ee[_0x403a16(0x34a)][_0x403a16(0x2c0)]}});}}return{'\x74\x65\x78\x74':_0x1f1975[_0x403a16(0x222)]('\x0a'),'\x70\x61\x72\x74\x73':_0x219ce5};}function readAssistantText(_0x2b65ab){const _0x17c3bd=a0_0x486ab8,_0x4c9bed={'\x4e\x74\x75\x77\x76':function(_0xb5ca4e,_0xb318f2){return _0xb5ca4e===_0xb318f2;}};if(_0x2b65ab==null)return'';if(typeof _0x2b65ab===_0x17c3bd(0x2cd))return _0x2b65ab;const _0x3f8cce=[];for(const _0x17055c of _0x2b65ab)if(_0x17055c[_0x17c3bd(0x199)]===_0x17c3bd(0x2d5))_0x3f8cce[_0x17c3bd(0x245)](_0x17055c['\x74\x65\x78\x74']);else{if(_0x4c9bed[_0x17c3bd(0x338)](_0x17055c['\x74\x79\x70\x65'],_0x17c3bd(0x1a3)))_0x3f8cce[_0x17c3bd(0x245)](_0x17055c['\x72\x65\x66\x75\x73\x61\x6c']);}return _0x3f8cce['\x6a\x6f\x69\x6e']('\x0a');}function readToolContent(_0x19766b){const _0x5c95b6=a0_0x486ab8;if(typeof _0x19766b===_0x5c95b6(0x2cd))return _0x19766b;return _0x19766b[_0x5c95b6(0x1ba)](_0x41e156=>_0x41e156[_0x5c95b6(0x2d5)])[_0x5c95b6(0x222)]('\x0a');}function convertTools(_0xe932f4){const _0x34d65d=a0_0x486ab8,_0x2b6093={'\x62\x72\x74\x51\x75':function(_0x1b4747,_0xa049fa){return _0x1b4747===_0xa049fa;},'\x49\x4c\x5a\x72\x69':_0x34d65d(0x1a9),'\x54\x4e\x43\x6b\x6b':function(_0x41c158,_0x4aff50){return _0x41c158>_0x4aff50;}};if(!_0xe932f4||_0xe932f4['\x6c\x65\x6e\x67\x74\x68']===0x0)return void 0x0;const _0x81b86d=[];for(const _0x343f4c of _0xe932f4)if(_0x2b6093[_0x34d65d(0x2d3)](_0x343f4c[_0x34d65d(0x199)],_0x34d65d(0x1a9)))_0x81b86d[_0x34d65d(0x245)]({'\x74\x79\x70\x65':_0x2b6093[_0x34d65d(0x187)],'\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x343f4c[_0x34d65d(0x1a9)][_0x34d65d(0x30c)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x343f4c[_0x34d65d(0x1a9)][_0x34d65d(0x23e)],'\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73':_0x343f4c[_0x34d65d(0x1a9)][_0x34d65d(0x328)]??null,'\x73\x74\x72\x69\x63\x74':_0x343f4c[_0x34d65d(0x1a9)][_0x34d65d(0x205)]??null}});return _0x2b6093['\x54\x4e\x43\x6b\x6b'](_0x81b86d[_0x34d65d(0x1d2)],0x0)?_0x81b86d:void 0x0;}function openaiMessagesToSandboxInput(_0x95d1b3,_0x1ca41,_0x72e496){const _0x41f7cd=a0_0x486ab8,_0x4f6ce1={'\x58\x70\x55\x4c\x51':function(_0x4d60ed,_0x479840){return _0x4d60ed(_0x479840);},'\x6a\x64\x62\x41\x7a':function(_0x1a85ba,_0x4e2890){return _0x1a85ba<_0x4e2890;},'\x49\x49\x45\x46\x6f':_0x41f7cd(0x1e5),'\x4d\x4f\x79\x63\x75':function(_0x572849,_0x4c419e){return _0x572849===_0x4c419e;},'\x47\x62\x6a\x64\x57':function(_0x18724a,_0x51d930){return _0x18724a>_0x51d930;},'\x7a\x44\x41\x56\x6e':function(_0x362e28,_0x4cdf2a){return _0x362e28(_0x4cdf2a);},'\x6c\x4e\x4e\x69\x42':function(_0x49a8bd,_0xa3e49e){return _0x49a8bd!==_0xa3e49e;},'\x4b\x75\x48\x79\x51':'\x74\x6f\x6f\x6c','\x58\x6d\x4d\x64\x61':function(_0x30f752,_0x2642c7){return _0x30f752>_0x2642c7;}},{provider:_0x56a907,variant:_0x2df1f8}=_0x4f6ce1['\x58\x70\x55\x4c\x51'](resolveProviderId,_0x72e496),_0x461934=[],_0x377bc9=[],_0x5f35b3=[];let _0xd718fc=null,_0x185e30=[],_0x4f2960=[],_0xc3a45c=![];const _0xba4183=()=>{const _0x3bd826=_0x41f7cd;_0xd718fc&&(_0x5f35b3[_0x3bd826(0x245)](_0xd718fc),_0xd718fc=null);};let _0x22f3c7=-0x1;for(let _0x4e46b5=_0x95d1b3[_0x41f7cd(0x1d2)]-0x1;_0x4e46b5>=0x0;_0x4e46b5--)if(_0x95d1b3[_0x4e46b5][_0x41f7cd(0x2db)]===_0x41f7cd(0x225)){_0x22f3c7=_0x4e46b5;break;}if(_0x22f3c7===-0x1)throw new Error(_0x41f7cd(0x285));for(let _0x26456d=0x0;_0x4f6ce1[_0x41f7cd(0x2c4)](_0x26456d,_0x95d1b3[_0x41f7cd(0x1d2)]);_0x26456d++){const _0x157c7e=_0x95d1b3[_0x26456d];switch(_0x157c7e[_0x41f7cd(0x2db)]){case _0x41f7cd(0x24c):case _0x4f6ce1[_0x41f7cd(0x333)]:{const {text:_0x3f738a}=normalizeContent(_0x157c7e[_0x41f7cd(0x1ce)]);if(_0x3f738a)_0x461934[_0x41f7cd(0x245)](_0x3f738a);break;}case'\x75\x73\x65\x72':{const {text:_0x530480,parts:_0x10fbe8}=normalizeContent(_0x157c7e[_0x41f7cd(0x1ce)]);if(_0x10fbe8[_0x41f7cd(0x273)](_0xb6948a=>_0xb6948a[_0x41f7cd(0x199)]!=='\x74\x65\x78\x74'))_0xc3a45c=!![];if(_0x4f6ce1[_0x41f7cd(0x241)](_0x26456d,_0x22f3c7)){_0x377bc9[_0x41f7cd(0x245)](_0x530480);if(_0x10fbe8[_0x41f7cd(0x1d2)]>0x0)_0x4f2960=_0x10fbe8;}else{_0xba4183();_0x4f6ce1[_0x41f7cd(0x308)](_0x10fbe8[_0x41f7cd(0x1d2)],0x0)?(_0xd718fc={'\x75\x73\x65\x72\x50\x61\x72\x74\x73':_0x10fbe8},_0x185e30=_0x10fbe8):(_0xd718fc={},_0x185e30=[]);if(_0x530480)_0x377bc9['\x70\x75\x73\x68'](_0x530480);}break;}case'\x61\x73\x73\x69\x73\x74\x61\x6e\x74':{if(!_0xd718fc)_0xd718fc={};const _0x299753=_0x4f6ce1[_0x41f7cd(0x274)](readAssistantText,_0x157c7e[_0x41f7cd(0x1ce)]);if(_0x299753)_0xd718fc['\x61\x73\x73\x69\x73\x74\x61\x6e\x74\x54\x65\x78\x74']=_0x299753;if(_0x157c7e[_0x41f7cd(0x1c4)]&&_0x4f6ce1[_0x41f7cd(0x308)](_0x157c7e[_0x41f7cd(0x1c4)][_0x41f7cd(0x1d2)],0x0)){const _0x3f3bf9=[];for(const _0x4d2995 of _0x157c7e[_0x41f7cd(0x1c4)]){if(_0x4f6ce1[_0x41f7cd(0x2df)](_0x4d2995[_0x41f7cd(0x199)],'\x66\x75\x6e\x63\x74\x69\x6f\x6e'))continue;if(!_0x4d2995['\x69\x64']||!_0x4d2995['\x66\x75\x6e\x63\x74\x69\x6f\x6e']?.[_0x41f7cd(0x30c)]||_0x4f6ce1[_0x41f7cd(0x2df)](typeof _0x4d2995[_0x41f7cd(0x1a9)]['\x61\x72\x67\x75\x6d\x65\x6e\x74\x73'],_0x41f7cd(0x2cd)))throw new Error('\x6f\x70\x65\x6e\x61\x69\x4d\x65\x73\x73\x61\x67\x65\x73\x54\x6f\x53\x61\x6e\x64\x62\x6f\x78\x49\x6e\x70\x75\x74\x3a\x20\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x61\x73\x73\x69\x73\x74\x61\x6e\x74\x20\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x20\x61\x74\x20\x69\x6e\x64\x65\x78\x20'+_0x26456d);_0x3f3bf9[_0x41f7cd(0x245)]({'\x69\x64':_0x4d2995['\x69\x64'],'\x6e\x61\x6d\x65':_0x4d2995[_0x41f7cd(0x1a9)]['\x6e\x61\x6d\x65'],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x4d2995['\x66\x75\x6e\x63\x74\x69\x6f\x6e'][_0x41f7cd(0x2b2)]});}if(_0x3f3bf9[_0x41f7cd(0x1d2)]>0x0)_0xd718fc[_0x41f7cd(0x34b)]=_0x3f3bf9;}if(_0x185e30[_0x41f7cd(0x1d2)]>0x0&&!_0xd718fc[_0x41f7cd(0x239)])_0xd718fc['\x75\x73\x65\x72\x50\x61\x72\x74\x73']=_0x185e30;break;}case _0x4f6ce1['\x4b\x75\x48\x79\x51']:{const _0x160188={'\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x49\x64':_0x157c7e['\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':readToolContent(_0x157c7e['\x63\x6f\x6e\x74\x65\x6e\x74'])};let _0x280b8f=![];if(_0xd718fc?.['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x73']?.['\x73\x6f\x6d\x65'](_0x44be4=>_0x44be4['\x69\x64']===_0x157c7e[_0x41f7cd(0x313)])){if(!_0xd718fc[_0x41f7cd(0x2af)])_0xd718fc[_0x41f7cd(0x2af)]=[];_0xd718fc['\x74\x6f\x6f\x6c\x52\x65\x73\x75\x6c\x74\x73'][_0x41f7cd(0x245)](_0x160188),_0x280b8f=!![];}else for(let _0x4b671f=_0x5f35b3[_0x41f7cd(0x1d2)]-0x1;_0x4b671f>=0x0;_0x4b671f--){const _0x530e09=_0x5f35b3[_0x4b671f];if(_0x530e09['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x73']?.[_0x41f7cd(0x273)](_0x503657=>_0x503657['\x69\x64']===_0x157c7e[_0x41f7cd(0x313)])){if(!_0x530e09[_0x41f7cd(0x2af)])_0x530e09[_0x41f7cd(0x2af)]=[];_0x530e09[_0x41f7cd(0x2af)]['\x70\x75\x73\x68'](_0x160188),_0x280b8f=!![];break;}}if(!_0x280b8f)throw new Error(_0x41f7cd(0x17e)+_0x157c7e[_0x41f7cd(0x313)]);break;}case _0x41f7cd(0x1a9):break;}if(_0x26456d===_0x22f3c7)_0xba4183();}_0xba4183();const _0x164968={'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x56a907,'\x74\x61\x73\x6b':_0x377bc9['\x6a\x6f\x69\x6e']('\x0a\x0a')};if(_0x2df1f8)_0x164968['\x76\x61\x72\x69\x61\x6e\x74']=_0x2df1f8;const _0x47afef=_0x461934[_0x41f7cd(0x222)]('\x0a\x0a');if(_0x47afef)_0x164968[_0x41f7cd(0x33a)]=_0x47afef;if(_0x4f2960['\x6c\x65\x6e\x67\x74\x68']>0x0)_0x164968[_0x41f7cd(0x24b)]=_0x4f2960;if(_0x4f6ce1[_0x41f7cd(0x259)](_0x5f35b3[_0x41f7cd(0x1d2)],0x0))_0x164968[_0x41f7cd(0x334)]=_0x5f35b3;const _0x56a172=convertTools(_0x1ca41);if(_0x56a172)_0x164968[_0x41f7cd(0x28e)]=_0x56a172;if(_0xc3a45c)_0x164968[_0x41f7cd(0x27c)]=!![];return _0x164968;}async function resolvePreviousResponseId(_0xe45a7e,_0x405db1){const _0x1275f1=a0_0x486ab8;if(!_0xe45a7e)return{'\x70\x72\x69\x6f\x72\x54\x75\x72\x6e\x73':[]};const _0xb653ab=await _0x405db1[_0x1275f1(0x26d)](_0xe45a7e);if(_0xb653ab===null)throw new Error('\x55\x6e\x6b\x6e\x6f\x77\x6e\x20\x70\x72\x65\x76\x69\x6f\x75\x73\x5f\x72\x65\x73\x70\x6f\x6e\x73\x65\x5f\x69\x64\x3a\x20'+_0xe45a7e);return{'\x70\x72\x69\x6f\x72\x54\x75\x72\x6e\x73':_0xb653ab};}function emptyUsage(){return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':0x0,'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':0x0,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':0x0,'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73':0x0},'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73':0x0}};}function readUsageFromEvent(_0x754482){const _0x2e34a2=a0_0x486ab8,_0x33e63d={'\x49\x6e\x51\x6f\x56':function(_0x5f269a,_0x1eabca){return _0x5f269a(_0x1eabca);},'\x49\x55\x48\x58\x57':function(_0x14b825,_0x5addea){return _0x14b825===_0x5addea;},'\x64\x77\x61\x45\x56':function(_0x1960ed,_0x456edb){return _0x1960ed===_0x456edb;},'\x42\x4e\x56\x53\x6d':_0x2e34a2(0x249),'\x77\x66\x73\x67\x62':function(_0x59fdcd,_0x2a2414){return _0x59fdcd+_0x2a2414;}},_0x5a1eec=_0x754482[_0x2e34a2(0x242)]??_0x754482,_0x53b151=Number(_0x5a1eec['\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x5a1eec[_0x2e34a2(0x1b9)]??_0x5a1eec[_0x2e34a2(0x307)]??0x0),_0x1481ad=_0x33e63d['\x49\x6e\x51\x6f\x56'](Number,_0x5a1eec['\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x5a1eec[_0x2e34a2(0x2a2)]??_0x5a1eec[_0x2e34a2(0x1c0)]??0x0);if(_0x33e63d[_0x2e34a2(0x319)](_0x53b151,0x0)&&_0x33e63d[_0x2e34a2(0x2e7)](_0x1481ad,0x0)&&!(_0x33e63d[_0x2e34a2(0x252)]in _0x5a1eec))return null;const _0x2a1d67=_0x33e63d['\x49\x6e\x51\x6f\x56'](Number,_0x5a1eec['\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x33e63d['\x77\x66\x73\x67\x62'](_0x53b151,_0x1481ad)),_0x2dd4ad=Number(_0x5a1eec[_0x2e34a2(0x1f6)]?.['\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x5a1eec[_0x2e34a2(0x1e6)]??0x0),_0x34c29a=Number(_0x5a1eec[_0x2e34a2(0x279)]?.['\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x5a1eec[_0x2e34a2(0x260)]??0x0);return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x53b151,'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x1481ad,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2a1d67,'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2dd4ad},'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73':_0x34c29a}};}function readToolInvocationFromRaw(_0x1f5701){const _0x54e0b2=a0_0x486ab8,_0x254de0={'\x50\x4c\x6a\x6a\x48':function(_0x4b7ddd,_0x5a589d){return _0x4b7ddd===_0x5a589d;},'\x4f\x77\x62\x66\x66':'\x74\x6f\x6f\x6c\x2d\x69\x6e\x76\x6f\x63\x61\x74\x69\x6f\x6e','\x4c\x6d\x43\x6f\x50':_0x54e0b2(0x232),'\x4b\x6f\x47\x6b\x61':'\x73\x74\x72\x69\x6e\x67','\x45\x53\x69\x48\x6e':function(_0x35cf31,_0x2f773e){return _0x35cf31===_0x2f773e;},'\x59\x4f\x61\x6f\x4e':function(_0x49e581,_0x5e88e5){return _0x49e581===_0x5e88e5;}};if(_0x1f5701[_0x54e0b2(0x199)]!==_0x54e0b2(0x281))return null;const _0xf8033f=_0x1f5701[_0x54e0b2(0x2d8)]??_0x1f5701,_0x519ca6=_0x254de0[_0x54e0b2(0x1a7)](typeof _0xf8033f[_0x54e0b2(0x199)],_0x54e0b2(0x2cd))?_0xf8033f[_0x54e0b2(0x199)]:'',_0x449edc=_0x519ca6===_0x54e0b2(0x2bd)||_0x519ca6===_0x54e0b2(0x181)||_0x254de0[_0x54e0b2(0x1a7)](typeof _0xf8033f['\x63\x6f\x6d\x70\x75\x74\x65\x72\x55\x73\x65'],_0x54e0b2(0x232))||typeof _0xf8033f[_0x54e0b2(0x1d4)]==='\x6f\x62\x6a\x65\x63\x74';if(!(_0x254de0['\x50\x4c\x6a\x6a\x48'](_0x519ca6,_0x254de0[_0x54e0b2(0x2cc)])||_0x519ca6==='\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c'||typeof _0xf8033f[_0x54e0b2(0x2ac)]===_0x254de0[_0x54e0b2(0x33b)]||typeof _0xf8033f['\x74\x6f\x6f\x6c\x5f\x69\x6e\x76\x6f\x63\x61\x74\x69\x6f\x6e']===_0x254de0[_0x54e0b2(0x33b)])&&!_0x449edc)return null;const _0x4b201b=_0xf8033f[_0x54e0b2(0x2ac)]??_0xf8033f[_0x54e0b2(0x1a5)]??_0xf8033f[_0x54e0b2(0x1ee)]??_0xf8033f['\x63\x6f\x6d\x70\x75\x74\x65\x72\x5f\x75\x73\x65']??_0xf8033f,_0x34a436=typeof _0x4b201b[_0x54e0b2(0x22d)]===_0x54e0b2(0x2cd)?_0x4b201b[_0x54e0b2(0x22d)]:typeof _0x4b201b[_0x54e0b2(0x313)]===_0x254de0[_0x54e0b2(0x23a)]?_0x4b201b[_0x54e0b2(0x313)]:_0x254de0['\x45\x53\x69\x48\x6e'](typeof _0x4b201b['\x69\x64'],_0x254de0[_0x54e0b2(0x23a)])?_0x4b201b['\x69\x64']:typeof _0x4b201b[_0x54e0b2(0x27b)]===_0x54e0b2(0x2cd)?_0x4b201b[_0x54e0b2(0x27b)]:'',_0x21efea=_0x449edc?_0x54e0b2(0x1d4):typeof _0x4b201b[_0x54e0b2(0x1c6)]===_0x54e0b2(0x2cd)?_0x4b201b[_0x54e0b2(0x1c6)]:_0x254de0[_0x54e0b2(0x1a7)](typeof _0x4b201b[_0x54e0b2(0x2c8)],_0x54e0b2(0x2cd))?_0x4b201b[_0x54e0b2(0x2c8)]:_0x254de0[_0x54e0b2(0x311)](typeof _0x4b201b[_0x54e0b2(0x30c)],_0x254de0[_0x54e0b2(0x23a)])?_0x4b201b[_0x54e0b2(0x30c)]:'',_0x302325=_0x4b201b[_0x54e0b2(0x322)]??_0x4b201b[_0x54e0b2(0x2b2)]??_0x4b201b['\x69\x6e\x70\x75\x74']??{};if(!_0x34a436||!_0x21efea)return null;return{'\x69\x64':_0x34a436,'\x6e\x61\x6d\x65':_0x21efea,'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':typeof _0x302325==='\x73\x74\x72\x69\x6e\x67'?_0x302325:JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79'](_0x302325),'\x69\x73\x43\x6f\x6d\x70\x75\x74\x65\x72\x55\x73\x65':_0x449edc,'\x63\x6f\x6d\x70\x75\x74\x65\x72\x41\x63\x74\x69\x6f\x6e':_0x449edc?_0x4b201b[_0x54e0b2(0x1fd)]??void 0x0:void 0x0};}function readReasoningFromPart(_0x264fe2){const _0x5cf7d0=a0_0x486ab8,_0x4dd31a={'\x5a\x58\x59\x58\x42':function(_0x525d04,_0x24495c){return _0x525d04!==_0x24495c;},'\x77\x65\x59\x6c\x73':function(_0x37fd31,_0x34c483){return _0x37fd31!==_0x34c483;},'\x46\x6c\x56\x52\x63':_0x5cf7d0(0x188)};if(_0x4dd31a[_0x5cf7d0(0x1d9)](_0x264fe2[_0x5cf7d0(0x199)],_0x5cf7d0(0x1c2)))return null;const _0x2988c5=_0x264fe2[_0x5cf7d0(0x34d)]??_0x264fe2;if(_0x2988c5['\x74\x79\x70\x65']!=='\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67'&&_0x4dd31a[_0x5cf7d0(0x289)](_0x2988c5[_0x5cf7d0(0x199)],_0x4dd31a[_0x5cf7d0(0x1c7)]))return null;if(typeof _0x2988c5[_0x5cf7d0(0x2d5)]===_0x5cf7d0(0x2cd))return _0x2988c5[_0x5cf7d0(0x2d5)];if(typeof _0x2988c5[_0x5cf7d0(0x1ce)]===_0x5cf7d0(0x2cd))return _0x2988c5[_0x5cf7d0(0x1ce)];return null;}function assembleResponseOutput(_0x33ddc4){const _0x15c427=a0_0x486ab8,_0x47053e={'\x78\x65\x59\x65\x6f':function(_0x488afa){return _0x488afa();},'\x66\x63\x61\x67\x5a':_0x15c427(0x267),'\x5a\x59\x48\x77\x75':_0x15c427(0x2cd),'\x48\x69\x4c\x70\x44':'\x63\x6f\x6d\x70\x75\x74\x65\x72\x5f\x63\x61\x6c\x6c','\x5a\x67\x66\x61\x52':'\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64','\x44\x53\x61\x48\x77':_0x15c427(0x1c2),'\x78\x45\x64\x4e\x79':function(_0x11e1f1,_0x5cbdc0){return _0x11e1f1(_0x5cbdc0);},'\x55\x49\x7a\x6a\x54':_0x15c427(0x27a),'\x52\x4f\x68\x79\x6c':function(_0x488340,_0x2bf4b4,_0x3a49ff){return _0x488340(_0x2bf4b4,_0x3a49ff);},'\x49\x6c\x64\x4a\x58':'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67','\x4b\x72\x44\x76\x59':_0x15c427(0x2e6),'\x46\x55\x75\x6c\x73':_0x15c427(0x282)},_0x241672={'\x74\x65\x78\x74\x50\x69\x65\x63\x65\x73':[],'\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x73':new Map(),'\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x4f\x72\x64\x65\x72':[],'\x63\x6f\x6d\x70\x75\x74\x65\x72\x43\x61\x6c\x6c\x73':[],'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x50\x69\x65\x63\x65\x73':[],'\x75\x73\x61\x67\x65':_0x47053e['\x78\x65\x59\x65\x6f'](emptyUsage),'\x68\x61\x73\x55\x73\x61\x67\x65':![]};for(const _0x3adde2 of _0x33ddc4)switch(_0x3adde2['\x74\x79\x70\x65']){case _0x47053e[_0x15c427(0x2bc)]:{const _0xd7328e=typeof _0x3adde2[_0x15c427(0x2dc)]==='\x73\x74\x72\x69\x6e\x67'&&_0x3adde2['\x64\x65\x6c\x74\x61']||typeof _0x3adde2[_0x15c427(0x2d5)]===_0x15c427(0x2cd)&&_0x3adde2[_0x15c427(0x2d5)]||typeof _0x3adde2[_0x15c427(0x267)]===_0x47053e[_0x15c427(0x34c)]&&_0x3adde2[_0x15c427(0x267)]||'';if(_0xd7328e)_0x241672[_0x15c427(0x1cd)]['\x70\x75\x73\x68'](_0xd7328e);break;}case'\x72\x61\x77':{const _0xafdc27=readToolInvocationFromRaw(_0x3adde2);if(!_0xafdc27)break;if(_0xafdc27[_0x15c427(0x2f6)])_0x241672['\x63\x6f\x6d\x70\x75\x74\x65\x72\x43\x61\x6c\x6c\x73'][_0x15c427(0x245)]({'\x74\x79\x70\x65':_0x47053e[_0x15c427(0x318)],'\x69\x64':'\x63\x63\x5f'+_0xafdc27['\x69\x64'],'\x63\x61\x6c\x6c\x5f\x69\x64':_0xafdc27['\x69\x64'],'\x73\x74\x61\x74\x75\x73':_0x15c427(0x2b9),'\x70\x65\x6e\x64\x69\x6e\x67\x5f\x73\x61\x66\x65\x74\x79\x5f\x63\x68\x65\x63\x6b\x73':[],..._0xafdc27[_0x15c427(0x295)]?{'\x61\x63\x74\x69\x6f\x6e':_0xafdc27[_0x15c427(0x295)]}:{}});else{if(!_0x241672[_0x15c427(0x34b)][_0x15c427(0x22e)](_0xafdc27['\x69\x64']))_0x241672[_0x15c427(0x223)][_0x15c427(0x245)](_0xafdc27['\x69\x64']);_0x241672[_0x15c427(0x34b)][_0x15c427(0x18a)](_0xafdc27['\x69\x64'],{'\x74\x79\x70\x65':_0x15c427(0x330),'\x69\x64':_0x15c427(0x1ab)+_0xafdc27['\x69\x64'],'\x63\x61\x6c\x6c\x5f\x69\x64':_0xafdc27['\x69\x64'],'\x6e\x61\x6d\x65':_0xafdc27['\x6e\x61\x6d\x65'],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0xafdc27[_0x15c427(0x2b2)],'\x73\x74\x61\x74\x75\x73':_0x47053e[_0x15c427(0x1f7)]});}break;}case _0x47053e[_0x15c427(0x293)]:{const _0x11da85=_0x47053e['\x78\x45\x64\x4e\x79'](readReasoningFromPart,_0x3adde2);if(_0x11da85)_0x241672[_0x15c427(0x336)][_0x15c427(0x245)](_0x11da85);break;}case _0x47053e['\x55\x49\x7a\x6a\x54']:{const _0x56d7b4=readUsageFromEvent(_0x3adde2);_0x56d7b4&&(_0x241672[_0x15c427(0x242)]=_0x47053e[_0x15c427(0x20c)](foldUsage,_0x241672[_0x15c427(0x242)],_0x56d7b4),_0x241672[_0x15c427(0x25d)]=!![]);break;}}const _0x5e5388=[];if(_0x241672[_0x15c427(0x336)][_0x15c427(0x1d2)]>0x0){const _0x5c73d8={'\x74\x79\x70\x65':_0x47053e['\x49\x6c\x64\x4a\x58'],'\x69\x64':_0x15c427(0x2b5),'\x73\x75\x6d\x6d\x61\x72\x79':[],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x241672[_0x15c427(0x336)][_0x15c427(0x1ba)](_0x169339=>({'\x74\x79\x70\x65':_0x15c427(0x332),'\x74\x65\x78\x74':_0x169339})),'\x73\x74\x61\x74\x75\x73':_0x15c427(0x2b9)};_0x5e5388[_0x15c427(0x245)](_0x5c73d8);}if(_0x241672['\x74\x65\x78\x74\x50\x69\x65\x63\x65\x73'][_0x15c427(0x1d2)]>0x0){const _0x11710f={'\x74\x79\x70\x65':_0x47053e[_0x15c427(0x2ab)],'\x69\x64':_0x15c427(0x1f0),'\x72\x6f\x6c\x65':_0x47053e['\x46\x55\x75\x6c\x73'],'\x73\x74\x61\x74\x75\x73':_0x47053e[_0x15c427(0x1f7)],'\x63\x6f\x6e\x74\x65\x6e\x74':[{'\x74\x79\x70\x65':_0x15c427(0x29d),'\x74\x65\x78\x74':_0x241672[_0x15c427(0x1cd)][_0x15c427(0x222)](''),'\x61\x6e\x6e\x6f\x74\x61\x74\x69\x6f\x6e\x73':[]}]};_0x5e5388[_0x15c427(0x245)](_0x11710f);}for(const _0x263f2d of _0x241672['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x4f\x72\x64\x65\x72']){const _0x3d6570=_0x241672[_0x15c427(0x34b)][_0x15c427(0x176)](_0x263f2d);if(_0x3d6570)_0x5e5388[_0x15c427(0x245)](_0x3d6570);}for(const _0x3b3b19 of _0x241672[_0x15c427(0x2a4)])_0x5e5388[_0x15c427(0x245)](_0x3b3b19);return{'\x6f\x75\x74\x70\x75\x74':_0x5e5388,'\x75\x73\x61\x67\x65':_0x241672[_0x15c427(0x242)]};}function foldUsage(_0x3ad66e,_0x5e6a39){const _0x353e09=a0_0x486ab8,_0x2ade34={'\x63\x56\x57\x4f\x4d':function(_0x6836c0,_0x581f49){return _0x6836c0+_0x581f49;},'\x47\x79\x68\x62\x71':function(_0x570504,_0xce34e3){return _0x570504+_0xce34e3;}};return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x3ad66e['\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73']+_0x5e6a39[_0x353e09(0x1e3)],'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x3ad66e[_0x353e09(0x213)]+_0x5e6a39['\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73'],'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2ade34['\x63\x56\x57\x4f\x4d'](_0x3ad66e[_0x353e09(0x249)],_0x5e6a39[_0x353e09(0x249)]),'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2ade34[_0x353e09(0x312)](_0x3ad66e[_0x353e09(0x1f6)][_0x353e09(0x1e6)],_0x5e6a39[_0x353e09(0x1f6)][_0x353e09(0x1e6)])},'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73':{'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73':_0x3ad66e['\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73'][_0x353e09(0x260)]+_0x5e6a39[_0x353e09(0x279)][_0x353e09(0x260)]}};}function usageFromEvents(_0x5461ad){const _0x35b495=a0_0x486ab8,_0x2ef030={'\x67\x5a\x50\x47\x73':function(_0x2d38ac){return _0x2d38ac();},'\x6d\x70\x72\x6b\x6c':function(_0x5c50c3,_0x20c8d7){return _0x5c50c3(_0x20c8d7);}};let _0x54f149=_0x2ef030[_0x35b495(0x248)](emptyUsage);for(const _0x5c9c8c of _0x5461ad){if(_0x5c9c8c[_0x35b495(0x199)]!==_0x35b495(0x27a))continue;const _0x39c88f=_0x2ef030[_0x35b495(0x1bc)](readUsageFromEvent,_0x5c9c8c);if(_0x39c88f)_0x54f149=foldUsage(_0x54f149,_0x39c88f);}return _0x54f149;}const SUPPORTED_TOOL_TYPES=new Set(['\x66\x75\x6e\x63\x74\x69\x6f\x6e',a0_0x486ab8(0x2cb),a0_0x486ab8(0x1f5),a0_0x486ab8(0x2ec),'\x77\x65\x62\x5f\x73\x65\x61\x72\x63\x68\x5f\x70\x72\x65\x76\x69\x65\x77',a0_0x486ab8(0x2cf)]),REJECTED_TOOL_TYPES=new Set([a0_0x486ab8(0x2b6)]);var ResponsesValidationError=class extends Error{[a0_0x486ab8(0x199)]=a0_0x486ab8(0x1dd);[a0_0x486ab8(0x2f8)];[a0_0x486ab8(0x253)];constructor(_0x1cd044,_0x196b40,_0x110389){const _0x4474f3=a0_0x486ab8,_0x1f7395={'\x65\x44\x64\x48\x77':_0x4474f3(0x2e8)};super(_0x1cd044),this[_0x4474f3(0x30c)]=_0x1f7395[_0x4474f3(0x1bf)],this[_0x4474f3(0x2f8)]=_0x196b40,this['\x70\x61\x72\x61\x6d']=_0x110389;}};function validateResponsesRequest(_0x11b76d){const _0x341408=a0_0x486ab8,_0x2ee959={'\x6a\x44\x58\x7a\x61':function(_0x7217a4,_0x2565cf){return _0x7217a4<_0x2565cf;},'\x66\x72\x4e\x71\x55':function(_0x4ef931,_0x5657ae){return _0x4ef931!==_0x5657ae;},'\x56\x62\x75\x6b\x46':_0x341408(0x2cd),'\x4c\x6f\x68\x62\x58':_0x341408(0x2e5),'\x68\x62\x62\x4a\x6e':_0x341408(0x2f5)},_0x4ef1a2=_0x11b76d[_0x341408(0x28e)];if(!_0x4ef1a2||_0x4ef1a2['\x6c\x65\x6e\x67\x74\x68']===0x0)return;for(let _0x2bce81=0x0;_0x2ee959['\x6a\x44\x58\x7a\x61'](_0x2bce81,_0x4ef1a2['\x6c\x65\x6e\x67\x74\x68']);_0x2bce81++){const _0x296b2b=_0x4ef1a2[_0x2bce81][_0x341408(0x199)];if(_0x2ee959[_0x341408(0x1a4)](typeof _0x296b2b,_0x2ee959[_0x341408(0x26b)]))throw new ResponsesValidationError(_0x341408(0x22b)+_0x2bce81+'\x5d\x20\x69\x73\x20\x6d\x69\x73\x73\x69\x6e\x67\x20\x61\x20\x74\x79\x70\x65\x20\x64\x69\x73\x63\x72\x69\x6d\x69\x6e\x61\x74\x6f\x72',_0x2ee959[_0x341408(0x1c8)],_0x341408(0x22b)+_0x2bce81+'\x5d\x2e\x74\x79\x70\x65');if(REJECTED_TOOL_TYPES['\x68\x61\x73'](_0x296b2b))throw new ResponsesValidationError(_0x341408(0x185)+_0x296b2b+_0x341408(0x178),_0x341408(0x2f5),_0x341408(0x22b)+_0x2bce81+_0x341408(0x174));if(!SUPPORTED_TOOL_TYPES[_0x341408(0x22e)](_0x296b2b))throw new ResponsesValidationError(_0x341408(0x185)+_0x296b2b+_0x341408(0x1b8),_0x2ee959['\x68\x62\x62\x4a\x6e'],_0x341408(0x22b)+_0x2bce81+_0x341408(0x174));}}function normalizeResponsesWebSearchForTangleRouter(_0x489716,_0x327345={}){const _0x11d070=a0_0x486ab8,_0x415e14={'\x58\x55\x50\x61\x61':'\x6f\x62\x6a\x65\x63\x74','\x65\x6f\x43\x4d\x45':function(_0x20f7f0,_0x277ae1){return _0x20f7f0!==_0x277ae1;},'\x44\x77\x70\x41\x58':_0x11d070(0x1d8),'\x51\x42\x76\x66\x5a':'\x6f\x70\x65\x6e\x72\x6f\x75\x74\x65\x72\x3a\x77\x65\x62\x5f\x73\x65\x61\x72\x63\x68'},_0x2705e7=Array[_0x11d070(0x24f)](_0x489716[_0x11d070(0x28e)])?_0x489716['\x74\x6f\x6f\x6c\x73']:void 0x0;if(!_0x2705e7)return _0x489716;let _0x178822=![];const _0x58185b=_0x2705e7[_0x11d070(0x1ba)](_0x3cbbce=>{const _0xbcee12=_0x11d070;if(!_0x3cbbce||typeof _0x3cbbce!==_0x415e14[_0xbcee12(0x347)])return _0x3cbbce;const _0x101f5e=_0x3cbbce['\x74\x79\x70\x65'];if(_0x415e14['\x65\x6f\x43\x4d\x45'](_0x101f5e,_0xbcee12(0x2ec))&&_0x101f5e!==_0x415e14['\x44\x77\x70\x41\x58'])return _0x3cbbce;return _0x178822=!![],{'\x74\x79\x70\x65':_0x415e14['\x51\x42\x76\x66\x5a'],'\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73':{...readNativeWebSearchParameters(_0x3cbbce),..._0x327345[_0xbcee12(0x2a9)]?{'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x327345['\x70\x72\x6f\x76\x69\x64\x65\x72']}:{},..._0x327345[_0xbcee12(0x297)]?{'\x6d\x61\x78\x5f\x72\x65\x73\x75\x6c\x74\x73':_0x327345[_0xbcee12(0x297)]}:{},..._0x327345[_0xbcee12(0x304)]?{'\x6d\x61\x78\x5f\x74\x6f\x74\x61\x6c\x5f\x72\x65\x73\x75\x6c\x74\x73':_0x327345[_0xbcee12(0x304)]}:{},..._0x327345['\x73\x65\x61\x72\x63\x68\x43\x6f\x6e\x74\x65\x78\x74\x53\x69\x7a\x65']?{'\x73\x65\x61\x72\x63\x68\x5f\x63\x6f\x6e\x74\x65\x78\x74\x5f\x73\x69\x7a\x65':_0x327345['\x73\x65\x61\x72\x63\x68\x43\x6f\x6e\x74\x65\x78\x74\x53\x69\x7a\x65']}:{}}};});return _0x178822?{..._0x489716,'\x74\x6f\x6f\x6c\x73':_0x58185b}:_0x489716;}function readNativeWebSearchParameters(_0x552d2a){const _0x1ecbe9=a0_0x486ab8,_0x15960c={'\x6d\x50\x48\x78\x41':function(_0x5b066b,_0x2240c7){return _0x5b066b===_0x2240c7;},'\x74\x63\x43\x53\x4a':'\x6f\x62\x6a\x65\x63\x74'},_0x302fcc=_0x552d2a,_0x23905b={},_0x441d0d=_0x302fcc[_0x1ecbe9(0x26f)]??_0x302fcc['\x73\x65\x61\x72\x63\x68\x43\x6f\x6e\x74\x65\x78\x74\x53\x69\x7a\x65'];if(_0x441d0d===_0x1ecbe9(0x233)||_0x15960c[_0x1ecbe9(0x1f1)](_0x441d0d,'\x6d\x65\x64\x69\x75\x6d')||_0x441d0d===_0x1ecbe9(0x291))_0x23905b['\x73\x65\x61\x72\x63\x68\x5f\x63\x6f\x6e\x74\x65\x78\x74\x5f\x73\x69\x7a\x65']=_0x441d0d;const _0x4c1311=_0x302fcc[_0x1ecbe9(0x1e0)]??_0x302fcc[_0x1ecbe9(0x22f)];if(_0x4c1311&&typeof _0x4c1311===_0x15960c[_0x1ecbe9(0x337)])_0x23905b[_0x1ecbe9(0x1e0)]=_0x4c1311;return _0x23905b;}function buildResponseShell(_0x430fcf){const _0x28e490=a0_0x486ab8,_0x44efee={'\x52\x6c\x55\x7a\x4c':_0x28e490(0x25c)},_0x158c23=_0x430fcf['\x6f\x75\x74\x70\x75\x74'][_0x28e490(0x2aa)](_0x46475e=>_0x46475e[_0x28e490(0x199)]===_0x28e490(0x2e6))[_0x28e490(0x235)](_0xe0124=>_0xe0124[_0x28e490(0x1ce)])['\x66\x69\x6c\x74\x65\x72'](_0x59f814=>_0x59f814[_0x28e490(0x199)]===_0x28e490(0x29d))[_0x28e490(0x1ba)](_0x245da4=>_0x245da4[_0x28e490(0x2d5)])[_0x28e490(0x222)]('');return{'\x69\x64':_0x430fcf['\x69\x64'],'\x6f\x62\x6a\x65\x63\x74':_0x44efee['\x52\x6c\x55\x7a\x4c'],'\x63\x72\x65\x61\x74\x65\x64\x5f\x61\x74':_0x430fcf['\x63\x72\x65\x61\x74\x65\x64\x41\x74'],'\x6f\x75\x74\x70\x75\x74\x5f\x74\x65\x78\x74':_0x158c23,'\x65\x72\x72\x6f\x72':null,'\x69\x6e\x63\x6f\x6d\x70\x6c\x65\x74\x65\x5f\x64\x65\x74\x61\x69\x6c\x73':null,'\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73':_0x430fcf['\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73']??null,'\x6d\x65\x74\x61\x64\x61\x74\x61':null,'\x6d\x6f\x64\x65\x6c':_0x430fcf[_0x28e490(0x280)],'\x6f\x75\x74\x70\x75\x74':_0x430fcf['\x6f\x75\x74\x70\x75\x74'],'\x70\x61\x72\x61\x6c\x6c\x65\x6c\x5f\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73':![],'\x74\x65\x6d\x70\x65\x72\x61\x74\x75\x72\x65':null,'\x74\x6f\x6f\x6c\x5f\x63\x68\x6f\x69\x63\x65':_0x28e490(0x23c),'\x74\x6f\x6f\x6c\x73':[],'\x74\x6f\x70\x5f\x70':null,'\x73\x74\x61\x74\x75\x73':'\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64','\x75\x73\x61\x67\x65':_0x430fcf[_0x28e490(0x242)],'\x70\x72\x65\x76\x69\x6f\x75\x73\x5f\x72\x65\x73\x70\x6f\x6e\x73\x65\x5f\x69\x64':_0x430fcf['\x70\x72\x65\x76\x69\x6f\x75\x73\x52\x65\x73\x70\x6f\x6e\x73\x65\x49\x64']??null};}function createTranslatorContext(_0x3fd66b){const _0x35031c=a0_0x486ab8;return{'\x63\x68\x75\x6e\x6b\x49\x6e\x64\x65\x78':0x0,'\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72':new Map(),'\x63\x72\x65\x61\x74\x65\x64\x41\x74':Math[_0x35031c(0x2c2)](Date[_0x35031c(0x326)]()/0x3e8),..._0x3fd66b};}export{EmbeddingValidationError,HookChain,InMemoryResponseStore,ResponsesValidationError,Run,actionRateLimitHook,assembleResponseOutput,auditLogHook,buildResponseShell,costCapHook,createTranslatorContext,destructiveActionGuardHook,egressPolicyHook,normalizeResponsesWebSearchForTangleRouter,openaiMessagesToSandboxInput,outcomeToFinishReason,resolvePreviousResponseId,runEvents,sandboxEventToChatChunk,sandboxEventToCompletionChunk,sandboxEventToResponsesEvent,screenshotRedactionHook,usageFromEvents,validateEmbeddingRequest,validateResponsesRequest};
|