@tangle-network/sandbox 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/agent/index.d.ts +435 -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/{errors-BI75IXOM.d.ts → client-BuPZLOxS.d.ts} +2 -129
- package/dist/client-BwRV2Zun.js +1 -0
- 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-2gFsmmQs.d.ts} +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1 -825
- package/dist/openai/index.d.ts +4 -5
- package/dist/openai/index.js +1 -1721
- package/dist/platform-integrations.js +1 -2
- package/dist/{sandbox-aBpWqler.d.ts → sandbox-CpK8etqP.d.ts} +291 -84
- 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 +23 -2
- package/dist/client-Uve6A5C6.js +0 -2280
- 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_0x5bb0d7=a0_0x6f22;(function(_0x20a6d1,_0x29e732){const _0x2f4e0c=a0_0x6f22,_0x345f86=_0x20a6d1();while(!![]){try{const _0x2b5d5e=parseInt(_0x2f4e0c(0x2ce))/0x1+parseInt(_0x2f4e0c(0x325))/0x2*(parseInt(_0x2f4e0c(0x365))/0x3)+-parseInt(_0x2f4e0c(0x223))/0x4+-parseInt(_0x2f4e0c(0x301))/0x5*(parseInt(_0x2f4e0c(0x2b5))/0x6)+-parseInt(_0x2f4e0c(0x2b8))/0x7+-parseInt(_0x2f4e0c(0x20e))/0x8*(-parseInt(_0x2f4e0c(0x200))/0x9)+parseInt(_0x2f4e0c(0x20c))/0xa;if(_0x2b5d5e===_0x29e732)break;else _0x345f86['push'](_0x345f86['shift']());}catch(_0x246d2a){_0x345f86['push'](_0x345f86['shift']());}}}(a0_0x4e17,0x41fb6));var HookChain=class{[a0_0x5bb0d7(0x1e5)];constructor(_0x3c88ef=[]){const _0x285ea2=a0_0x5bb0d7;this[_0x285ea2(0x1e5)]=_0x3c88ef;}get[a0_0x5bb0d7(0x2f8)](){const _0x2b3601=a0_0x5bb0d7;return this[_0x2b3601(0x1e5)][_0x2b3601(0x226)];}async[a0_0x5bb0d7(0x3bc)](_0x40adf7){const _0x4af64f=a0_0x5bb0d7,_0x30c961={'\x71\x4e\x57\x49\x77':_0x4af64f(0x353),'\x52\x65\x4d\x4a\x45':function(_0x397390,_0x22c18b){return _0x397390??_0x22c18b;},'\x64\x6c\x41\x47\x47':_0x4af64f(0x270)};let _0x21b314=_0x40adf7,_0x551a26=null;for(const _0x3dd922 of this[_0x4af64f(0x1e5)]){if(!_0x3dd922[_0x4af64f(0x2a9)])continue;const _0x33ded1=await _0x3dd922[_0x4af64f(0x2a9)](_0x21b314);if(_0x33ded1['\x61\x63\x74\x69\x6f\x6e']==='\x62\x6c\x6f\x63\x6b')return _0x33ded1;_0x33ded1['\x61\x63\x74\x69\x6f\x6e']===_0x30c961[_0x4af64f(0x2bc)]&&(_0x21b314={..._0x21b314,'\x61\x72\x67\x73':_0x33ded1[_0x4af64f(0x24e)]},_0x551a26=_0x33ded1);}return _0x30c961[_0x4af64f(0x349)](_0x551a26,{'\x61\x63\x74\x69\x6f\x6e':_0x30c961[_0x4af64f(0x2a8)]});}async['\x72\x75\x6e\x41\x66\x74\x65\x72'](_0x55fca1,_0x29833d){const _0x10ab1b=a0_0x5bb0d7,_0x13ea35={'\x6d\x79\x55\x4a\x76':function(_0x5e8d43,_0x17fbd2){return _0x5e8d43??_0x17fbd2;}};let _0x170a18=_0x29833d,_0x4a134b=null;for(const _0x1b3611 of this[_0x10ab1b(0x1e5)]){if(!_0x1b3611[_0x10ab1b(0x260)])continue;const _0x2df06d=await _0x1b3611[_0x10ab1b(0x260)](_0x55fca1,_0x170a18);if(_0x2df06d['\x61\x63\x74\x69\x6f\x6e']===_0x10ab1b(0x374))return _0x2df06d;_0x2df06d[_0x10ab1b(0x2a5)]==='\x6f\x76\x65\x72\x72\x69\x64\x65'&&(_0x170a18=_0x2df06d[_0x10ab1b(0x2db)],_0x4a134b=_0x2df06d);}return _0x13ea35[_0x10ab1b(0x233)](_0x4a134b,{'\x61\x63\x74\x69\x6f\x6e':'\x70\x61\x73\x73'});}};function auditLogHook(_0x316814={}){const _0x1aeda4=a0_0x5bb0d7,_0x31690a={'\x65\x41\x74\x42\x62':function(_0x145249,_0x5ee9c9){return _0x145249(_0x5ee9c9);}},_0x29d92c=_0x316814[_0x1aeda4(0x309)]??(_0x385c3e=>{const _0x202b2e=_0x1aeda4;console[_0x202b2e(0x2ca)](_0x202b2e(0x3a4),_0x385c3e);});return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x3fe393){const _0x2c9232=_0x1aeda4;return await _0x31690a[_0x2c9232(0x283)](_0x29d92c,{'\x70\x68\x61\x73\x65':_0x2c9232(0x2a0),'\x72\x75\x6e\x49\x64':_0x3fe393[_0x2c9232(0x379)],'\x74\x68\x72\x65\x61\x64\x49\x64':_0x3fe393['\x74\x68\x72\x65\x61\x64\x49\x64'],'\x70\x61\x72\x74\x6e\x65\x72\x49\x64':_0x3fe393[_0x2c9232(0x3a0)],'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x3fe393['\x74\x6f\x6f\x6c\x4e\x61\x6d\x65'],'\x63\x61\x6c\x6c\x49\x64':_0x3fe393[_0x2c9232(0x299)],'\x74\x69\x6d\x65\x73\x74\x61\x6d\x70':_0x3fe393[_0x2c9232(0x251)],'\x61\x72\x67\x73':_0x3fe393[_0x2c9232(0x24e)]}),{'\x61\x63\x74\x69\x6f\x6e':_0x2c9232(0x270)};},async '\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x41169f,_0x40d3f3){const _0x2df9ba=_0x1aeda4;return await _0x29d92c({'\x70\x68\x61\x73\x65':'\x61\x66\x74\x65\x72','\x72\x75\x6e\x49\x64':_0x41169f['\x72\x75\x6e\x49\x64'],'\x74\x68\x72\x65\x61\x64\x49\x64':_0x41169f['\x74\x68\x72\x65\x61\x64\x49\x64'],'\x70\x61\x72\x74\x6e\x65\x72\x49\x64':_0x41169f[_0x2df9ba(0x3a0)],'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x41169f[_0x2df9ba(0x384)],'\x63\x61\x6c\x6c\x49\x64':_0x41169f['\x63\x61\x6c\x6c\x49\x64'],'\x74\x69\x6d\x65\x73\x74\x61\x6d\x70':_0x41169f['\x74\x69\x6d\x65\x73\x74\x61\x6d\x70'],'\x72\x65\x73\x75\x6c\x74':_0x40d3f3}),{'\x61\x63\x74\x69\x6f\x6e':_0x2df9ba(0x30e)};}};}const NETWORK_TOOL_REGEX=/^(fetch|http|https|browser|playwright|curl|wget|computer-use:click|computer-use:type)/i,URL_FIELD_NAMES=new Set([a0_0x5bb0d7(0x204),a0_0x5bb0d7(0x222),a0_0x5bb0d7(0x2af),'\x68\x72\x65\x66',a0_0x5bb0d7(0x348),a0_0x5bb0d7(0x2a7),a0_0x5bb0d7(0x341)]);function extractUrlsFromArgs(_0x5bd4f9){const _0x3a39af=a0_0x5bb0d7,_0x14834a={'\x6f\x61\x7a\x55\x74':function(_0x289903,_0x1dae10){return _0x289903===_0x1dae10;},'\x55\x41\x6a\x55\x4f':function(_0x130629,_0x45a157){return _0x130629!==_0x45a157;},'\x57\x68\x5a\x63\x68':_0x3a39af(0x2dd)},_0x4ce566=[],_0x3bc873=_0x415502=>{const _0xcc3905=_0x3a39af;if(typeof _0x415502===_0xcc3905(0x2dd)){if(/^https?:\/\//i[_0xcc3905(0x23f)](_0x415502))try{const _0x55f711=new URL(_0x415502);_0x4ce566[_0xcc3905(0x380)]({'\x72\x61\x77':_0x415502,'\x68\x6f\x73\x74':_0x55f711[_0xcc3905(0x37b)]});}catch{_0x4ce566[_0xcc3905(0x380)]({'\x72\x61\x77':_0x415502,'\x68\x6f\x73\x74':null});}return;}if(_0x14834a['\x6f\x61\x7a\x55\x74'](_0x415502,null)||_0x14834a[_0xcc3905(0x37d)](typeof _0x415502,'\x6f\x62\x6a\x65\x63\x74'))return;if(Array[_0xcc3905(0x240)](_0x415502)){for(const _0x217f05 of _0x415502)_0x3bc873(_0x217f05);return;}for(const [_0x4cf821,_0x273dfc]of Object[_0xcc3905(0x378)](_0x415502)){if(URL_FIELD_NAMES['\x68\x61\x73'](_0x4cf821[_0xcc3905(0x31e)]())&&typeof _0x273dfc===_0x14834a[_0xcc3905(0x221)]){try{const _0x528cb2=new URL(_0x273dfc);_0x4ce566[_0xcc3905(0x380)]({'\x72\x61\x77':_0x273dfc,'\x68\x6f\x73\x74':_0x528cb2['\x68\x6f\x73\x74']});}catch{_0x4ce566[_0xcc3905(0x380)]({'\x72\x61\x77':_0x273dfc,'\x68\x6f\x73\x74':null});}continue;}_0x3bc873(_0x273dfc);}};return _0x3bc873(_0x5bd4f9),_0x4ce566;}function isNetworkLike(_0x2853ac,_0x59169f){const _0x52b9bd=a0_0x5bb0d7,_0x1aebd1={'\x6d\x41\x47\x44\x46':function(_0x33c2c2,_0x29e020){return _0x33c2c2>_0x29e020;}};if(NETWORK_TOOL_REGEX[_0x52b9bd(0x23f)](_0x2853ac[_0x52b9bd(0x384)]))return!![];return _0x1aebd1['\x6d\x41\x47\x44\x46'](_0x59169f[_0x52b9bd(0x226)],0x0);}function hostMatches(_0x276905,_0x41faae){const _0x2cac9c=a0_0x5bb0d7;if(_0x41faae===_0x276905)return!![];if(_0x41faae[_0x2cac9c(0x330)]('\x2a\x2e')){const _0x18c366=_0x41faae[_0x2cac9c(0x297)](0x1);return _0x276905[_0x2cac9c(0x3b7)](_0x18c366);}return![];}function egressPolicyHook(_0x1f99eb={}){const _0x48cb51=a0_0x5bb0d7,_0x9e100c={'\x66\x50\x69\x4c\x62':'\x61\x6c\x6c\x6f\x77','\x65\x70\x65\x6f\x4e':_0x48cb51(0x2d9),'\x52\x70\x54\x63\x63':function(_0x460629,_0x391712,_0x180dcc){return _0x460629(_0x391712,_0x180dcc);},'\x76\x67\x6b\x53\x4b':_0x48cb51(0x1e6)},_0x350c8d=_0x1f99eb[_0x48cb51(0x1fa)]??[],_0x3b758f=_0x1f99eb[_0x48cb51(0x1f2)];return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x3ef5fb){const _0x94cec3=_0x48cb51,_0x50e6ec=extractUrlsFromArgs(_0x3ef5fb['\x61\x72\x67\x73']);if(!isNetworkLike(_0x3ef5fb,_0x50e6ec))return{'\x61\x63\x74\x69\x6f\x6e':_0x9e100c[_0x94cec3(0x231)]};if(_0x1f99eb[_0x94cec3(0x25c)])return await _0x1f99eb[_0x94cec3(0x25c)](_0x3ef5fb)?{'\x61\x63\x74\x69\x6f\x6e':_0x9e100c[_0x94cec3(0x231)]}:{'\x61\x63\x74\x69\x6f\x6e':'\x62\x6c\x6f\x63\x6b','\x72\x65\x61\x73\x6f\x6e':_0x9e100c[_0x94cec3(0x339)]};for(const _0x2de31f of _0x50e6ec){if(!_0x2de31f[_0x94cec3(0x37b)])continue;for(const _0x4514dd of _0x350c8d)if(_0x9e100c[_0x94cec3(0x211)](hostMatches,_0x2de31f['\x68\x6f\x73\x74'],_0x4514dd))return{'\x61\x63\x74\x69\x6f\x6e':_0x94cec3(0x1e6),'\x72\x65\x61\x73\x6f\x6e':'\x65\x67\x72\x65\x73\x73\x20\x64\x65\x6e\x69\x65\x64\x3a\x20\x68\x6f\x73\x74\x20\x22'+_0x2de31f[_0x94cec3(0x37b)]+_0x94cec3(0x272)+_0x4514dd+'\x22'};}if(_0x3b758f&&_0x3b758f['\x6c\x65\x6e\x67\x74\x68']>0x0)for(const _0x10534c of _0x50e6ec){const _0x274549=_0x10534c[_0x94cec3(0x37b)];if(!_0x274549)return{'\x61\x63\x74\x69\x6f\x6e':_0x9e100c[_0x94cec3(0x386)],'\x72\x65\x61\x73\x6f\x6e':_0x94cec3(0x2c3)};if(!_0x3b758f[_0x94cec3(0x302)](_0x4a5c42=>hostMatches(_0x274549,_0x4a5c42)))return{'\x61\x63\x74\x69\x6f\x6e':_0x94cec3(0x1e6),'\x72\x65\x61\x73\x6f\x6e':'\x65\x67\x72\x65\x73\x73\x20\x64\x65\x6e\x69\x65\x64\x3a\x20\x68\x6f\x73\x74\x20\x22'+_0x274549+_0x94cec3(0x236)};}return{'\x61\x63\x74\x69\x6f\x6e':_0x94cec3(0x270)};}};}function costCapHook(_0x35baa5){const _0x50027d=a0_0x5bb0d7,_0x3fa6e5={'\x4b\x5a\x63\x4d\x45':_0x50027d(0x374)},_0x306e2c=_0x35baa5['\x67\x65\x74\x43\x75\x72\x72\x65\x6e\x74\x43\x6f\x73\x74']??(async()=>0x0);return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x1b8204){const _0x408183=_0x50027d,_0x1b2898=await _0x306e2c(_0x1b8204['\x70\x61\x72\x74\x6e\x65\x72\x49\x64']);if(_0x1b2898>=_0x35baa5[_0x408183(0x1ff)])return{'\x61\x63\x74\x69\x6f\x6e':'\x62\x6c\x6f\x63\x6b','\x72\x65\x61\x73\x6f\x6e':_0x408183(0x213)+_0x1b2898+_0x408183(0x3b9)+_0x35baa5[_0x408183(0x1ff)]};return{'\x61\x63\x74\x69\x6f\x6e':_0x408183(0x270)};},async '\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x441ba4){const _0x27b38b=_0x50027d,_0x2ff206=await _0x306e2c(_0x441ba4[_0x27b38b(0x3a0)]);if(_0x2ff206>=_0x35baa5[_0x27b38b(0x1ff)])return{'\x61\x63\x74\x69\x6f\x6e':_0x3fa6e5['\x4b\x5a\x63\x4d\x45'],'\x72\x65\x61\x73\x6f\x6e':_0x27b38b(0x2ec)+_0x2ff206+_0x27b38b(0x3b9)+_0x35baa5['\x63\x65\x69\x6c\x69\x6e\x67']};return{'\x61\x63\x74\x69\x6f\x6e':_0x27b38b(0x30e)};}};}function actionRateLimitHook(_0x10e83d){const _0x9070ac=a0_0x5bb0d7,_0x3be737={'\x44\x41\x6f\x68\x51':function(_0x4dc47d){return _0x4dc47d();},'\x4a\x74\x52\x56\x79':function(_0x133b96,_0x20077a){return _0x133b96*_0x20077a;},'\x64\x5a\x72\x57\x7a':function(_0x43f8d5,_0x5c1eb6){return _0x43f8d5<_0x5c1eb6;}},_0x497155=_0x10e83d[_0x9070ac(0x3a3)]??Date[_0x9070ac(0x3a3)],_0x3049ce=Math['\x6d\x61\x78'](0x1,Math[_0x9070ac(0x201)](_0x10e83d[_0x9070ac(0x243)])),_0x4c3b9f=_0x10e83d[_0x9070ac(0x243)]/0x3e8,_0x5ecec=new Map();return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x26db80){const _0x2a5e94=_0x9070ac;if(!_0x26db80[_0x2a5e94(0x384)][_0x2a5e94(0x330)]('\x63\x6f\x6d\x70\x75\x74\x65\x72\x2d\x75\x73\x65\x3a'))return{'\x61\x63\x74\x69\x6f\x6e':_0x2a5e94(0x270)};const _0x39f164=_0x26db80['\x72\x75\x6e\x49\x64'],_0x141d49=_0x3be737['\x44\x41\x6f\x68\x51'](_0x497155),_0x967188=_0x5ecec[_0x2a5e94(0x2f1)](_0x39f164)??{'\x74\x6f\x6b\x65\x6e\x73':_0x3049ce,'\x6c\x61\x73\x74\x52\x65\x66\x69\x6c\x6c\x4d\x73':_0x141d49},_0x45ff1c=Math[_0x2a5e94(0x396)](0x0,_0x141d49-_0x967188[_0x2a5e94(0x238)]);_0x967188[_0x2a5e94(0x354)]=Math['\x6d\x69\x6e'](_0x3049ce,_0x967188[_0x2a5e94(0x354)]+_0x3be737[_0x2a5e94(0x2ba)](_0x45ff1c,_0x4c3b9f)),_0x967188['\x6c\x61\x73\x74\x52\x65\x66\x69\x6c\x6c\x4d\x73']=_0x141d49;if(_0x3be737[_0x2a5e94(0x29f)](_0x967188[_0x2a5e94(0x354)],0x1))return _0x5ecec[_0x2a5e94(0x316)](_0x39f164,_0x967188),{'\x61\x63\x74\x69\x6f\x6e':_0x2a5e94(0x1e6),'\x72\x65\x61\x73\x6f\x6e':_0x2a5e94(0x1e2)+_0x10e83d[_0x2a5e94(0x243)]+'\x2f\x73'};return _0x967188['\x74\x6f\x6b\x65\x6e\x73']-=0x1,_0x5ecec[_0x2a5e94(0x316)](_0x39f164,_0x967188),{'\x61\x63\x74\x69\x6f\x6e':'\x61\x6c\x6c\x6f\x77'};}};}function readScreenshotPayload(_0x26b527){const _0x48ad4a=a0_0x5bb0d7,_0x4c38bf={'\x55\x69\x65\x41\x79':function(_0xc21592,_0x3f0b3d){return _0xc21592===_0x3f0b3d;},'\x67\x75\x61\x6b\x62':_0x48ad4a(0x331),'\x50\x6c\x4f\x68\x47':function(_0xbdcc8a,_0x47c27e){return _0xbdcc8a===_0x47c27e;}},_0x4b368c=[_0x26b527['\x63\x6f\x6e\x74\x65\x6e\x74'],_0x26b527[_0x48ad4a(0x381)]?.[_0x48ad4a(0x36e)],_0x26b527['\x64\x65\x74\x61\x69\x6c\x73']];for(const _0x3cf913 of _0x4b368c)if(_0x3cf913&&_0x4c38bf[_0x48ad4a(0x35a)](typeof _0x3cf913,_0x4c38bf['\x67\x75\x61\x6b\x62'])){if(_0x4c38bf[_0x48ad4a(0x3a9)](typeof _0x3cf913['\x70\x6e\x67\x42\x61\x73\x65\x36\x34'],_0x48ad4a(0x2dd)))return _0x3cf913;}return null;}function screenshotRedactionHook(_0x3a3bdf={}){const _0x18d0f4=a0_0x5bb0d7,_0x260a73={'\x72\x5a\x74\x51\x54':function(_0xf2e779,_0x5cee70){return _0xf2e779!==_0x5cee70;},'\x4b\x52\x55\x71\x53':_0x18d0f4(0x209),'\x57\x79\x67\x6b\x4f':_0x18d0f4(0x30e),'\x44\x42\x63\x4a\x71':function(_0x1e7e25,_0x1d2bfe){return _0x1e7e25(_0x1d2bfe);},'\x75\x4f\x71\x72\x44':_0x18d0f4(0x216)},_0x2ae9cd=_0x3a3bdf[_0x18d0f4(0x2d1)]??(_0x9bc5b8=>console['\x77\x61\x72\x6e'](_0x9bc5b8)),_0x4482be=(_0x3a3bdf['\x72\x65\x67\x69\x6f\x6e\x73']?.[_0x18d0f4(0x226)]??0x0)>0x0;let _0x5a21d0=![];return{async '\x61\x66\x74\x65\x72\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x39a7ff,_0x2e5d01){const _0x56b27=_0x18d0f4;if(_0x260a73[_0x56b27(0x2d2)](_0x39a7ff[_0x56b27(0x384)],_0x260a73['\x4b\x52\x55\x71\x53']))return{'\x61\x63\x74\x69\x6f\x6e':_0x260a73[_0x56b27(0x2f2)]};if(!_0x4482be)return{'\x61\x63\x74\x69\x6f\x6e':_0x260a73[_0x56b27(0x2f2)]};if(!readScreenshotPayload(_0x2e5d01))return{'\x61\x63\x74\x69\x6f\x6e':_0x56b27(0x30e)};return!_0x5a21d0&&(_0x5a21d0=!![],_0x260a73[_0x56b27(0x318)](_0x2ae9cd,_0x260a73[_0x56b27(0x3b3)])),{'\x61\x63\x74\x69\x6f\x6e':_0x56b27(0x30e)};}};}const TYPE_TEXT_FIELDS=['\x74\x65\x78\x74',a0_0x5bb0d7(0x2e8),a0_0x5bb0d7(0x29e),a0_0x5bb0d7(0x2d5)],CLICK_LABEL_FIELDS=[a0_0x5bb0d7(0x1ee),a0_0x5bb0d7(0x1fc),'\x74\x69\x74\x6c\x65',a0_0x5bb0d7(0x207),a0_0x5bb0d7(0x3ac)];function readStringField(_0x1e4a00,_0x26578c){const _0x33a159=a0_0x5bb0d7,_0x2672c3={'\x6a\x46\x48\x70\x47':function(_0x38be7e,_0x996656){return _0x38be7e!==_0x996656;},'\x59\x52\x5a\x43\x62':_0x33a159(0x331),'\x45\x4e\x41\x6f\x71':function(_0x53b67a,_0x23573b){return _0x53b67a===_0x23573b;},'\x50\x43\x52\x65\x52':_0x33a159(0x2dd)};if(!_0x1e4a00||_0x2672c3[_0x33a159(0x2b7)](typeof _0x1e4a00,_0x2672c3[_0x33a159(0x27d)]))return null;const _0x29b768=_0x1e4a00;for(const _0x2304ef of _0x26578c){const _0x343295=_0x29b768[_0x2304ef];if(_0x2672c3['\x45\x4e\x41\x6f\x71'](typeof _0x343295,_0x2672c3[_0x33a159(0x1f8)])&&_0x343295['\x6c\x65\x6e\x67\x74\x68']>0x0)return _0x343295;}return null;}function destructiveActionGuardHook(_0x3aa9ae){const _0x320d88=a0_0x5bb0d7,_0x6738ae={'\x73\x4a\x6d\x76\x61':function(_0x35de17,_0x145ba0){return _0x35de17===_0x145ba0;},'\x6b\x4f\x4c\x4f\x5a':function(_0x926af5,_0x9f385a,_0x8eb3cc){return _0x926af5(_0x9f385a,_0x8eb3cc);},'\x5a\x6c\x4e\x74\x71':_0x320d88(0x270)},_0x332c9a=_0x3aa9ae[_0x320d88(0x38f)];return{async '\x62\x65\x66\x6f\x72\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0xc10b7){const _0x57f613=_0x320d88;let _0x2bd5e9=null;if(_0x6738ae[_0x57f613(0x2cf)](_0xc10b7[_0x57f613(0x384)],'\x63\x6f\x6d\x70\x75\x74\x65\x72\x2d\x75\x73\x65\x3a\x74\x79\x70\x65'))_0x2bd5e9=readStringField(_0xc10b7[_0x57f613(0x24e)],TYPE_TEXT_FIELDS);else{if(_0xc10b7[_0x57f613(0x384)]==='\x63\x6f\x6d\x70\x75\x74\x65\x72\x2d\x75\x73\x65\x3a\x63\x6c\x69\x63\x6b')_0x2bd5e9=_0x6738ae[_0x57f613(0x34c)](readStringField,_0xc10b7[_0x57f613(0x24e)],CLICK_LABEL_FIELDS);else return{'\x61\x63\x74\x69\x6f\x6e':'\x61\x6c\x6c\x6f\x77'};}if(!_0x2bd5e9)return{'\x61\x63\x74\x69\x6f\x6e':_0x6738ae[_0x57f613(0x269)]};for(const _0x4d2ac6 of _0x332c9a)if(_0x4d2ac6[_0x57f613(0x23f)](_0x2bd5e9))return{'\x61\x63\x74\x69\x6f\x6e':_0x57f613(0x1e6),'\x72\x65\x61\x73\x6f\x6e':_0x57f613(0x305)+_0x4d2ac6[_0x57f613(0x300)]()};return{'\x61\x63\x74\x69\x6f\x6e':_0x57f613(0x270)};}};}var InMemoryResponseStore=class{[a0_0x5bb0d7(0x1f7)]=new Map();async[a0_0x5bb0d7(0x328)](_0x4ff88e){const _0x5af65f=a0_0x5bb0d7,_0x3a7c72=this[_0x5af65f(0x1f7)]['\x67\x65\x74'](_0x4ff88e);return _0x3a7c72?_0x3a7c72[_0x5af65f(0x239)](_0x3b4570=>({..._0x3b4570})):null;}async['\x70\x75\x74\x50\x72\x69\x6f\x72\x54\x75\x72\x6e\x73'](_0x5ad27b,_0x55d86b){const _0x6a15fb=a0_0x5bb0d7;this[_0x6a15fb(0x1f7)][_0x6a15fb(0x316)](_0x5ad27b,_0x55d86b[_0x6a15fb(0x239)](_0x4529b2=>({..._0x4529b2})));}[a0_0x5bb0d7(0x2f8)](){const _0x305767=a0_0x5bb0d7;return this[_0x305767(0x1f7)][_0x305767(0x2f8)];}['\x64\x65\x6c\x65\x74\x65'](_0x33bb67){const _0xc2025d=a0_0x5bb0d7;return this[_0xc2025d(0x1f7)][_0xc2025d(0x358)](_0x33bb67);}[a0_0x5bb0d7(0x392)](){const _0x191467=a0_0x5bb0d7;this[_0x191467(0x1f7)][_0x191467(0x392)]();}};const TERMINAL_STATUSES=new Set([a0_0x5bb0d7(0x33a),a0_0x5bb0d7(0x2c0),a0_0x5bb0d7(0x32b),a0_0x5bb0d7(0x324)]);function isTerminal(_0x5e0a53){const _0x15cf1e=a0_0x5bb0d7;return TERMINAL_STATUSES[_0x15cf1e(0x370)](_0x5e0a53);}async function*runEvents(_0xf36457,_0x3ba8ea,_0x1acc90){const _0x97d147=a0_0x5bb0d7;for await(const _0x4e679d of _0x1acc90[_0x97d147(0x31d)](_0xf36457,_0x3ba8ea))yield _0x4e679d;}function readToolCallFromFrame(_0x2cb6a5){const _0x4c323c=a0_0x5bb0d7,_0x3e7b0d={'\x49\x42\x6c\x6b\x62':function(_0x3f35cc,_0x3e50c4){return _0x3f35cc===_0x3e50c4;},'\x71\x54\x78\x61\x46':'\x72\x61\x77','\x78\x61\x55\x4a\x62':function(_0x543771,_0x2df7c9){return _0x543771===_0x2df7c9;},'\x50\x46\x65\x41\x4c':function(_0x1728ee,_0x441588){return _0x1728ee(_0x441588);},'\x4e\x65\x44\x5a\x47':'\x63\x6f\x6d\x70\x75\x74\x65\x72\x2d\x75\x73\x65','\x77\x70\x72\x48\x6f':'\x63\x6f\x6d\x70\x75\x74\x65\x72\x5f\x63\x61\x6c\x6c','\x74\x6a\x73\x42\x66':function(_0x49b946,_0x1c6615){return _0x49b946(_0x1c6615);}};if(_0x3e7b0d[_0x4c323c(0x225)](_0x2cb6a5['\x74\x79\x70\x65'],'\x72\x65\x71\x75\x69\x72\x65\x73\x5f\x61\x63\x74\x69\x6f\x6e')||_0x3e7b0d[_0x4c323c(0x225)](_0x2cb6a5[_0x4c323c(0x335)],_0x4c323c(0x369))){const _0x2815b7=_0x2cb6a5[_0x4c323c(0x23a)]??_0x2cb6a5,_0x30224f=String(_0x2815b7['\x63\x61\x6c\x6c\x49\x64']??_0x2815b7[_0x4c323c(0x21a)]??_0x2815b7['\x69\x64']??''),_0x36758c=String(_0x2815b7['\x74\x6f\x6f\x6c\x4e\x61\x6d\x65']??_0x2815b7[_0x4c323c(0x25e)]??_0x2815b7[_0x4c323c(0x3a6)]??'');if(!_0x30224f||!_0x36758c)return null;return{'\x63\x61\x6c\x6c\x49\x64':_0x30224f,'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x36758c,'\x61\x72\x67\x73':_0x2815b7[_0x4c323c(0x24e)]??_0x2815b7['\x61\x72\x67\x75\x6d\x65\x6e\x74\x73']??_0x2815b7['\x69\x6e\x70\x75\x74']??{},'\x72\x65\x71\x75\x69\x72\x65\x73\x41\x63\x74\x69\x6f\x6e':!![]};}if(_0x2cb6a5['\x74\x79\x70\x65']!==_0x3e7b0d['\x71\x54\x78\x61\x46'])return null;const _0x3342bc=_0x2cb6a5[_0x4c323c(0x23a)]??_0x2cb6a5,_0x514cfc=typeof _0x3342bc[_0x4c323c(0x335)]===_0x4c323c(0x2dd)?_0x3342bc[_0x4c323c(0x335)]:'';if(!(_0x514cfc==='\x74\x6f\x6f\x6c\x2d\x69\x6e\x76\x6f\x63\x61\x74\x69\x6f\x6e'||_0x3e7b0d[_0x4c323c(0x3a8)](_0x514cfc,_0x4c323c(0x1f9))||_0x3e7b0d[_0x4c323c(0x3a8)](_0x514cfc,_0x4c323c(0x343))||_0x514cfc===_0x4c323c(0x30b)))return null;const _0x4b7c1e=_0x3342bc[_0x4c323c(0x26f)]??_0x3342bc[_0x4c323c(0x31b)]??_0x3342bc[_0x4c323c(0x273)]??_0x3342bc[_0x4c323c(0x208)]??_0x3342bc,_0x28294b=_0x3e7b0d[_0x4c323c(0x383)](String,_0x4b7c1e[_0x4c323c(0x382)]??_0x4b7c1e[_0x4c323c(0x249)]??_0x4b7c1e['\x63\x61\x6c\x6c\x49\x64']??_0x4b7c1e['\x69\x64']??''),_0x540007=_0x514cfc===_0x3e7b0d[_0x4c323c(0x212)]||_0x514cfc===_0x3e7b0d[_0x4c323c(0x30d)]?_0x4c323c(0x205)+String(_0x4b7c1e['\x61\x63\x74\x69\x6f\x6e']?.[_0x4c323c(0x335)]??'\x61\x63\x74\x69\x6f\x6e'):_0x3e7b0d[_0x4c323c(0x26d)](String,_0x4b7c1e['\x74\x6f\x6f\x6c\x4e\x61\x6d\x65']??_0x4b7c1e['\x74\x6f\x6f\x6c\x5f\x6e\x61\x6d\x65']??_0x4b7c1e[_0x4c323c(0x3a6)]??'');if(!_0x28294b||!_0x540007)return null;return{'\x63\x61\x6c\x6c\x49\x64':_0x28294b,'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x540007,'\x61\x72\x67\x73':_0x4b7c1e[_0x4c323c(0x24e)]??_0x4b7c1e['\x61\x72\x67\x75\x6d\x65\x6e\x74\x73']??_0x4b7c1e[_0x4c323c(0x29e)]??{},'\x72\x65\x71\x75\x69\x72\x65\x73\x41\x63\x74\x69\x6f\x6e':![]};}function readTerminal(_0x353f91){const _0x4e1389=a0_0x5bb0d7,_0xe53c9c={'\x59\x6b\x69\x58\x49':_0x4e1389(0x1e4),'\x76\x73\x6c\x54\x71':function(_0x1627bc,_0x43a9c9){return _0x1627bc===_0x43a9c9;},'\x52\x6d\x4b\x4d\x48':_0x4e1389(0x2dd),'\x61\x45\x6d\x69\x56':'\x73\x75\x63\x63\x65\x73\x73','\x70\x69\x51\x56\x47':function(_0x2838f6,_0x3317a6){return _0x2838f6===_0x3317a6;},'\x76\x56\x75\x6e\x62':function(_0x579f0d,_0x52006d){return _0x579f0d===_0x52006d;},'\x51\x51\x55\x42\x6f':function(_0x5b13c0,_0x26d58){return _0x5b13c0===_0x26d58;},'\x63\x4f\x79\x52\x62':_0x4e1389(0x292)};if(_0x353f91[_0x4e1389(0x335)]===_0xe53c9c[_0x4e1389(0x398)]){const _0x17dbcc=_0xe53c9c['\x76\x73\x6c\x54\x71'](typeof _0x353f91['\x6f\x75\x74\x63\x6f\x6d\x65'],_0xe53c9c['\x52\x6d\x4b\x4d\x48'])&&_0x353f91['\x6f\x75\x74\x63\x6f\x6d\x65']||_0xe53c9c[_0x4e1389(0x323)];if(_0x17dbcc===_0xe53c9c['\x61\x45\x6d\x69\x56']||_0xe53c9c[_0x4e1389(0x206)](_0x17dbcc,_0x4e1389(0x33a))||_0x17dbcc===_0x4e1389(0x32f)||_0x17dbcc===_0xe53c9c[_0x4e1389(0x398)])return{'\x73\x74\x61\x74\x75\x73':_0x4e1389(0x33a)};return{'\x73\x74\x61\x74\x75\x73':_0x4e1389(0x2c0),'\x72\x65\x61\x73\x6f\x6e':_0xe53c9c[_0x4e1389(0x2fc)](typeof _0x353f91['\x65\x72\x72\x6f\x72'],_0xe53c9c[_0x4e1389(0x2f7)])?_0x353f91['\x65\x72\x72\x6f\x72']:_0x17dbcc};}if(_0x353f91[_0x4e1389(0x335)]===_0x4e1389(0x265))return{'\x73\x74\x61\x74\x75\x73':'\x66\x61\x69\x6c\x65\x64','\x72\x65\x61\x73\x6f\x6e':typeof _0x353f91[_0x4e1389(0x38a)]===_0x4e1389(0x2dd)&&_0x353f91['\x6d\x65\x73\x73\x61\x67\x65']||_0xe53c9c[_0x4e1389(0x2f9)](typeof _0x353f91[_0x4e1389(0x265)],_0xe53c9c[_0x4e1389(0x2f7)])&&_0x353f91['\x65\x72\x72\x6f\x72']||_0xe53c9c[_0x4e1389(0x1eb)]};return null;}var EventQueue=class{[a0_0x5bb0d7(0x322)]=[];[a0_0x5bb0d7(0x2e9)]=[];[a0_0x5bb0d7(0x235)]=![];[a0_0x5bb0d7(0x289)]=![];[a0_0x5bb0d7(0x380)](_0xd40b22){const _0x44c5fc=a0_0x5bb0d7,_0x2fd99c={'\x66\x66\x69\x44\x46':function(_0x4c71f2,_0x191d27){return _0x4c71f2(_0x191d27);}};if(this[_0x44c5fc(0x235)])return;const _0x136b65=this[_0x44c5fc(0x2e9)][_0x44c5fc(0x39e)]();if(_0x136b65){_0x2fd99c['\x66\x66\x69\x44\x46'](_0x136b65,{'\x76\x61\x6c\x75\x65':_0xd40b22,'\x64\x6f\x6e\x65':![]});return;}this[_0x44c5fc(0x322)][_0x44c5fc(0x380)](_0xd40b22);}[a0_0x5bb0d7(0x359)](){const _0x430482=a0_0x5bb0d7,_0x3f16d8={'\x56\x45\x4b\x67\x57':function(_0x9649dc,_0x3ff0ec){return _0x9649dc>_0x3ff0ec;}};if(this['\x63\x6c\x6f\x73\x65\x64'])return;this[_0x430482(0x235)]=!![];while(_0x3f16d8['\x56\x45\x4b\x67\x57'](this[_0x430482(0x2e9)][_0x430482(0x226)],0x0))this[_0x430482(0x2e9)][_0x430482(0x39e)]()?.({'\x76\x61\x6c\x75\x65':void 0x0,'\x64\x6f\x6e\x65':!![]});}['\x69\x74\x65\x72\x61\x74\x6f\x72'](){const _0x29e5c9=a0_0x5bb0d7,_0x1d6142={'\x68\x61\x79\x64\x66':_0x29e5c9(0x3bd)};if(this['\x69\x74\x65\x72\x61\x74\x6f\x72\x43\x72\x65\x61\x74\x65\x64'])throw new Error(_0x1d6142[_0x29e5c9(0x250)]);this[_0x29e5c9(0x289)]=!![];const _0x5ebc6a=this;return{[Symbol['\x61\x73\x79\x6e\x63\x49\x74\x65\x72\x61\x74\x6f\x72']](){return this;},'\x6e\x65\x78\x74'(){const _0x27c51f=_0x29e5c9;if(_0x5ebc6a[_0x27c51f(0x322)]['\x6c\x65\x6e\x67\x74\x68']>0x0){const _0x50e202=_0x5ebc6a[_0x27c51f(0x322)]['\x73\x68\x69\x66\x74']();return Promise[_0x27c51f(0x388)]({'\x76\x61\x6c\x75\x65':_0x50e202,'\x64\x6f\x6e\x65':![]});}if(_0x5ebc6a[_0x27c51f(0x235)])return Promise[_0x27c51f(0x388)]({'\x76\x61\x6c\x75\x65':void 0x0,'\x64\x6f\x6e\x65':!![]});return new Promise(_0x2d9a86=>{const _0x57d123=_0x27c51f;_0x5ebc6a[_0x57d123(0x2e9)][_0x57d123(0x380)](_0x2d9a86);});},'\x72\x65\x74\x75\x72\x6e'(){return _0x5ebc6a['\x63\x6c\x6f\x73\x65'](),Promise['\x72\x65\x73\x6f\x6c\x76\x65']({'\x76\x61\x6c\x75\x65':void 0x0,'\x64\x6f\x6e\x65':!![]});}};}},Run=class{['\x69\x64'];[a0_0x5bb0d7(0x35b)];[a0_0x5bb0d7(0x3a0)];[a0_0x5bb0d7(0x356)]=a0_0x5bb0d7(0x307);[a0_0x5bb0d7(0x3ae)];['\x68\x6f\x6f\x6b\x73'];[a0_0x5bb0d7(0x33f)];['\x6f\x6e\x53\x74\x61\x74\x75\x73\x43\x68\x61\x6e\x67\x65'];[a0_0x5bb0d7(0x2ee)]=new EventQueue();[a0_0x5bb0d7(0x241)]=null;[a0_0x5bb0d7(0x279)]=new Map();[a0_0x5bb0d7(0x2ef)]=![];constructor(_0x133629){const _0x41656f=a0_0x5bb0d7,_0x5f0271='\x30\x7c\x34\x7c\x33\x7c\x31\x7c\x32\x7c\x35\x7c\x36'[_0x41656f(0x37c)]('\x7c');let _0x59fb1e=0x0;while(!![]){switch(_0x5f0271[_0x59fb1e++]){case'\x30':this['\x69\x64']=_0x133629['\x69\x64'];continue;case'\x31':this['\x73\x6f\x75\x72\x63\x65']=_0x133629[_0x41656f(0x3ae)];continue;case'\x32':this[_0x41656f(0x1e5)]=_0x133629['\x68\x6f\x6f\x6b\x73'];continue;case'\x33':this[_0x41656f(0x3a0)]=_0x133629[_0x41656f(0x3a0)];continue;case'\x34':this[_0x41656f(0x35b)]=_0x133629['\x74\x68\x72\x65\x61\x64\x49\x64'];continue;case'\x35':this[_0x41656f(0x33f)]=_0x133629['\x65\x78\x65\x63\x75\x74\x65\x54\x6f\x6f\x6c'];continue;case'\x36':this[_0x41656f(0x321)]=_0x133629['\x6f\x6e\x53\x74\x61\x74\x75\x73\x43\x68\x61\x6e\x67\x65'];continue;}break;}}get[a0_0x5bb0d7(0x3ba)](){const _0x2faf17=a0_0x5bb0d7;return this[_0x2faf17(0x356)];}[a0_0x5bb0d7(0x2a1)](){const _0x26fda9=a0_0x5bb0d7;return this[_0x26fda9(0x2ee)][_0x26fda9(0x390)]();}[a0_0x5bb0d7(0x2c9)](){const _0x556edc=a0_0x5bb0d7;if(this[_0x556edc(0x241)])return this[_0x556edc(0x241)];return this[_0x556edc(0x241)]=this[_0x556edc(0x2e3)](),this['\x73\x74\x61\x72\x74\x50\x72\x6f\x6d\x69\x73\x65'];}async[a0_0x5bb0d7(0x3b2)](_0x3d0f97){const _0x3d68c8=a0_0x5bb0d7;if(isTerminal(this[_0x3d68c8(0x356)]))return;this[_0x3d68c8(0x2ef)]=!![];if(this[_0x3d68c8(0x3ae)][_0x3d68c8(0x3b2)])try{await this[_0x3d68c8(0x3ae)]['\x63\x61\x6e\x63\x65\x6c'](this[_0x3d68c8(0x35b)],this['\x69\x64']);}catch{}this['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e'](_0x3d68c8(0x32b)),this[_0x3d68c8(0x2ee)][_0x3d68c8(0x380)]({'\x74\x79\x70\x65':_0x3d68c8(0x32b),'\x72\x65\x61\x73\x6f\x6e':_0x3d0f97}),this[_0x3d68c8(0x2ee)][_0x3d68c8(0x359)]();}async[a0_0x5bb0d7(0x293)](_0x2aad5f){const _0x540d1d=a0_0x5bb0d7,_0x1245fb={'\x48\x78\x68\x68\x4a':'\x72\x65\x71\x75\x69\x72\x65\x73\x5f\x61\x63\x74\x69\x6f\x6e','\x56\x4d\x48\x7a\x76':_0x540d1d(0x3a2)};if(!this[_0x540d1d(0x3ae)][_0x540d1d(0x293)])throw new Error(_0x540d1d(0x290));if(isTerminal(this[_0x540d1d(0x356)]))throw new Error(_0x540d1d(0x28c)+this[_0x540d1d(0x356)]+_0x540d1d(0x336));await this[_0x540d1d(0x3ae)]['\x73\x74\x65\x65\x72'](this[_0x540d1d(0x35b)],this['\x69\x64'],_0x2aad5f);if(this[_0x540d1d(0x356)]===_0x1245fb[_0x540d1d(0x2b4)])this[_0x540d1d(0x2eb)](_0x1245fb[_0x540d1d(0x3b5)]);this['\x73\x74\x61\x72\x74\x50\x72\x6f\x6d\x69\x73\x65']=this[_0x540d1d(0x2e3)](),await this['\x73\x74\x61\x72\x74\x50\x72\x6f\x6d\x69\x73\x65'];}async[a0_0x5bb0d7(0x26a)](_0x342f74){const _0x39491c=a0_0x5bb0d7,_0x1c95fa={'\x58\x65\x72\x55\x54':_0x39491c(0x2fe),'\x6b\x65\x68\x54\x4b':_0x39491c(0x3a2)};if(this[_0x39491c(0x356)]!==_0x1c95fa['\x58\x65\x72\x55\x54'])throw new Error(_0x39491c(0x391)+this[_0x39491c(0x356)]);if(!this[_0x39491c(0x3ae)][_0x39491c(0x26a)])throw new Error(_0x39491c(0x2f5));for(const _0x4e82bf of _0x342f74)this[_0x39491c(0x279)]['\x64\x65\x6c\x65\x74\x65'](_0x4e82bf[_0x39491c(0x382)]);await this['\x73\x6f\x75\x72\x63\x65'][_0x39491c(0x26a)](this['\x74\x68\x72\x65\x61\x64\x49\x64'],this['\x69\x64'],_0x342f74),this[_0x39491c(0x2eb)](_0x1c95fa[_0x39491c(0x2e5)]),this[_0x39491c(0x241)]=this['\x64\x72\x69\x76\x65\x53\x74\x72\x65\x61\x6d'](),await this[_0x39491c(0x241)];}[a0_0x5bb0d7(0x3aa)](){const _0x1c9795=a0_0x5bb0d7,_0x11afb6={'\x6b\x4c\x50\x6f\x54':_0x1c9795(0x324),'\x79\x71\x69\x6c\x4f':_0x1c9795(0x2c0)};if(isTerminal(this[_0x1c9795(0x356)]))return;this['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e'](_0x11afb6[_0x1c9795(0x22e)]),this[_0x1c9795(0x2ee)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x11afb6['\x79\x71\x69\x6c\x4f'],'\x72\x65\x61\x73\x6f\x6e':'\x65\x78\x70\x69\x72\x65\x64'}),this[_0x1c9795(0x2ee)][_0x1c9795(0x359)]();}[a0_0x5bb0d7(0x2eb)](_0x3322d2){const _0xd1d294=a0_0x5bb0d7,_0x34c373={'\x49\x54\x64\x44\x68':function(_0x470f19,_0x240d3c){return _0x470f19===_0x240d3c;}};if(_0x34c373['\x49\x54\x64\x44\x68'](this[_0xd1d294(0x356)],_0x3322d2))return;const _0x912e2e=this['\x5f\x73\x74\x61\x74\x75\x73'];this[_0xd1d294(0x356)]=_0x3322d2,this['\x71\x75\x65\x75\x65']['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0xd1d294(0x3ba),'\x73\x74\x61\x74\x75\x73':_0x3322d2,'\x70\x72\x65\x76\x69\x6f\x75\x73':_0x912e2e}),this[_0xd1d294(0x321)]?.(_0x3322d2,_0x912e2e);}async[a0_0x5bb0d7(0x2e3)](){const _0x145a1d=a0_0x5bb0d7,_0x383c62={'\x44\x59\x52\x51\x74':'\x69\x6e\x5f\x70\x72\x6f\x67\x72\x65\x73\x73','\x79\x44\x58\x69\x62':_0x145a1d(0x232),'\x4e\x6a\x75\x50\x61':function(_0xd735eb,_0x2b474a){return _0xd735eb(_0x2b474a);},'\x4f\x46\x72\x57\x6e':'\x74\x65\x72\x6d\x69\x6e\x61\x74\x65','\x6b\x6b\x41\x50\x68':function(_0x133b67,_0x559527){return _0x133b67===_0x559527;},'\x42\x57\x49\x59\x4d':_0x145a1d(0x33a),'\x6f\x49\x57\x44\x52':'\x66\x61\x69\x6c\x65\x64','\x67\x49\x46\x54\x56':function(_0x25de46,_0x18312c){return _0x25de46(_0x18312c);}};try{for await(const _0x10dac8 of runEvents(this[_0x145a1d(0x35b)],this['\x69\x64'],this[_0x145a1d(0x3ae)])){if(this['\x63\x61\x6e\x63\x65\x6c\x52\x65\x71\x75\x65\x73\x74\x65\x64'])return;if(this[_0x145a1d(0x356)]===_0x145a1d(0x307))this[_0x145a1d(0x2eb)](_0x383c62['\x44\x59\x52\x51\x74']);this['\x71\x75\x65\x75\x65'][_0x145a1d(0x380)]({'\x74\x79\x70\x65':_0x383c62[_0x145a1d(0x1e9)],'\x65\x76\x65\x6e\x74':_0x10dac8});const _0x5e5954=_0x383c62[_0x145a1d(0x2c4)](readToolCallFromFrame,_0x10dac8);if(_0x5e5954){const _0x54ce35=await this[_0x145a1d(0x2b2)](_0x5e5954);if(_0x54ce35===_0x383c62[_0x145a1d(0x36c)])return;if(_0x383c62['\x6b\x6b\x41\x50\x68'](_0x54ce35,_0x145a1d(0x2fe)))return;continue;}const _0x575cd8=readTerminal(_0x10dac8);if(_0x575cd8){_0x575cd8[_0x145a1d(0x3ba)]==='\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64'?(this[_0x145a1d(0x2eb)]('\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64'),this[_0x145a1d(0x2ee)][_0x145a1d(0x380)]({'\x74\x79\x70\x65':_0x383c62[_0x145a1d(0x244)]})):(this['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e'](_0x145a1d(0x2c0)),this[_0x145a1d(0x2ee)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x383c62[_0x145a1d(0x2b0)],'\x72\x65\x61\x73\x6f\x6e':_0x575cd8['\x72\x65\x61\x73\x6f\x6e']??_0x145a1d(0x2fb)}));this[_0x145a1d(0x2ee)][_0x145a1d(0x359)]();return;}}!_0x383c62[_0x145a1d(0x202)](isTerminal,this['\x5f\x73\x74\x61\x74\x75\x73'])&&(this[_0x145a1d(0x2eb)](_0x383c62['\x42\x57\x49\x59\x4d']),this[_0x145a1d(0x2ee)][_0x145a1d(0x380)]({'\x74\x79\x70\x65':_0x145a1d(0x33a)}),this[_0x145a1d(0x2ee)]['\x63\x6c\x6f\x73\x65']());}catch(_0x20df3d){if(isTerminal(this[_0x145a1d(0x356)]))return;const _0x4f12fc=_0x20df3d instanceof Error?_0x20df3d[_0x145a1d(0x38a)]:_0x383c62['\x4e\x6a\x75\x50\x61'](String,_0x20df3d);this[_0x145a1d(0x2eb)](_0x383c62['\x6f\x49\x57\x44\x52']),this[_0x145a1d(0x2ee)][_0x145a1d(0x380)]({'\x74\x79\x70\x65':_0x383c62['\x6f\x49\x57\x44\x52'],'\x72\x65\x61\x73\x6f\x6e':_0x4f12fc}),this[_0x145a1d(0x2ee)][_0x145a1d(0x359)]();}}async[a0_0x5bb0d7(0x2b2)](_0x48e757){const _0x139e36=a0_0x5bb0d7,_0x1f9794={'\x6b\x48\x72\x75\x6e':function(_0x8a801a,_0x4a7cca){return _0x8a801a>_0x4a7cca;},'\x79\x6d\x58\x68\x6a':function(_0x3d5c7c,_0x3078cf){return _0x3d5c7c===_0x3078cf;},'\x64\x62\x6f\x50\x4a':_0x139e36(0x2a9),'\x45\x61\x58\x6d\x64':_0x139e36(0x34f),'\x44\x78\x75\x41\x66':'\x74\x6f\x6f\x6c\x5f\x72\x65\x73\x75\x6c\x74','\x46\x50\x46\x47\x4f':_0x139e36(0x2fe),'\x4a\x53\x54\x6f\x67':_0x139e36(0x2b9),'\x6f\x4c\x69\x58\x79':'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c','\x47\x51\x62\x6d\x6f':function(_0x384135,_0x286685){return _0x384135 instanceof _0x286685;},'\x4e\x77\x54\x52\x53':function(_0x1f24e9,_0x5ef851){return _0x1f24e9(_0x5ef851);},'\x66\x6d\x44\x4e\x63':'\x74\x65\x72\x6d\x69\x6e\x61\x74\x65','\x75\x50\x46\x49\x7a':_0x139e36(0x2c0)},_0x48dd42={'\x72\x75\x6e\x49\x64':this['\x69\x64'],'\x74\x68\x72\x65\x61\x64\x49\x64':this[_0x139e36(0x35b)],'\x70\x61\x72\x74\x6e\x65\x72\x49\x64':this[_0x139e36(0x3a0)],'\x74\x6f\x6f\x6c\x4e\x61\x6d\x65':_0x48e757[_0x139e36(0x384)],'\x61\x72\x67\x73':_0x48e757[_0x139e36(0x24e)],'\x63\x61\x6c\x6c\x49\x64':_0x48e757[_0x139e36(0x299)],'\x74\x69\x6d\x65\x73\x74\x61\x6d\x70':Date[_0x139e36(0x3a3)]()};let _0x473540=_0x48dd42;if(this[_0x139e36(0x1e5)]&&_0x1f9794[_0x139e36(0x338)](this[_0x139e36(0x1e5)][_0x139e36(0x2f8)],0x0)){const _0x528b6e=await this[_0x139e36(0x1e5)][_0x139e36(0x3bc)](_0x48dd42);if(_0x1f9794[_0x139e36(0x22b)](_0x528b6e['\x61\x63\x74\x69\x6f\x6e'],_0x139e36(0x1e6))){const _0x36c4d1={'\x63\x6f\x6e\x74\x65\x6e\x74':{'\x65\x72\x72\x6f\x72':_0x528b6e[_0x139e36(0x280)]},'\x69\x73\x45\x72\x72\x6f\x72':!![],'\x64\x65\x74\x61\x69\x6c\x73':{'\x62\x6c\x6f\x63\x6b\x65\x64\x42\x79':_0x1f9794[_0x139e36(0x36a)]}};this[_0x139e36(0x2ee)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x1f9794[_0x139e36(0x285)],'\x63\x74\x78':_0x48dd42,'\x72\x65\x61\x73\x6f\x6e':_0x528b6e[_0x139e36(0x280)]}),this['\x71\x75\x65\x75\x65'][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x1f9794[_0x139e36(0x31f)],'\x63\x74\x78':_0x48dd42,'\x72\x65\x73\x75\x6c\x74':_0x36c4d1});if(_0x48e757['\x72\x65\x71\x75\x69\x72\x65\x73\x41\x63\x74\x69\x6f\x6e'])return this[_0x139e36(0x279)]['\x73\x65\x74'](_0x48e757[_0x139e36(0x299)],_0x48dd42),this[_0x139e36(0x2eb)](_0x139e36(0x2fe)),this['\x71\x75\x65\x75\x65'][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x1f9794[_0x139e36(0x3a1)],'\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x49\x64\x73':Array[_0x139e36(0x219)](this['\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x73'][_0x139e36(0x1f6)]())}),_0x139e36(0x2fe);return _0x139e36(0x39c);}if(_0x528b6e[_0x139e36(0x2a5)]===_0x139e36(0x353))_0x473540={..._0x48dd42,'\x61\x72\x67\x73':_0x528b6e[_0x139e36(0x24e)]};}if(_0x48e757[_0x139e36(0x366)]){const _0x27060a=_0x1f9794[_0x139e36(0x32c)][_0x139e36(0x37c)]('\x7c');let _0x1e00c1=0x0;while(!![]){switch(_0x27060a[_0x1e00c1++]){case'\x30':return _0x139e36(0x2fe);case'\x31':this['\x74\x72\x61\x6e\x73\x69\x74\x69\x6f\x6e'](_0x139e36(0x2fe));continue;case'\x32':this['\x70\x65\x6e\x64\x69\x6e\x67\x43\x61\x6c\x6c\x73']['\x73\x65\x74'](_0x48e757['\x63\x61\x6c\x6c\x49\x64'],_0x473540);continue;case'\x33':this[_0x139e36(0x2ee)][_0x139e36(0x380)]({'\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[_0x139e36(0x219)](this[_0x139e36(0x279)][_0x139e36(0x1f6)]())});continue;case'\x34':this['\x71\x75\x65\x75\x65'][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x139e36(0x1f9),'\x63\x74\x78':_0x473540});continue;}break;}}if(!this['\x65\x78\x65\x63\x75\x74\x65\x54\x6f\x6f\x6c'])return this['\x71\x75\x65\x75\x65'][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x1f9794['\x6f\x4c\x69\x58\x79'],'\x63\x74\x78':_0x473540}),'\x63\x6f\x6e\x74\x69\x6e\x75\x65';this[_0x139e36(0x2ee)][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x139e36(0x1f9),'\x63\x74\x78':_0x473540});let _0x17ee7d;try{_0x17ee7d=await this[_0x139e36(0x33f)](_0x473540);}catch(_0x3f5f72){_0x17ee7d={'\x63\x6f\x6e\x74\x65\x6e\x74':{'\x65\x72\x72\x6f\x72':_0x1f9794['\x47\x51\x62\x6d\x6f'](_0x3f5f72,Error)?_0x3f5f72['\x6d\x65\x73\x73\x61\x67\x65']:_0x1f9794['\x4e\x77\x54\x52\x53'](String,_0x3f5f72)},'\x69\x73\x45\x72\x72\x6f\x72':!![]};}let _0x5c803d=_0x17ee7d;if(this[_0x139e36(0x1e5)]&&this['\x68\x6f\x6f\x6b\x73']['\x73\x69\x7a\x65']>0x0){const _0x2ff840=await this[_0x139e36(0x1e5)][_0x139e36(0x25f)](_0x473540,_0x17ee7d);if(_0x1f9794[_0x139e36(0x22b)](_0x2ff840['\x61\x63\x74\x69\x6f\x6e'],_0x1f9794[_0x139e36(0x395)]))return this[_0x139e36(0x2ee)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x1f9794[_0x139e36(0x31f)],'\x63\x74\x78':_0x473540,'\x72\x65\x73\x75\x6c\x74':_0x17ee7d}),this[_0x139e36(0x2eb)](_0x139e36(0x2c0)),this[_0x139e36(0x2ee)][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x1f9794[_0x139e36(0x2c1)],'\x72\x65\x61\x73\x6f\x6e':_0x2ff840[_0x139e36(0x280)]}),this['\x71\x75\x65\x75\x65'][_0x139e36(0x359)](),_0x139e36(0x374);if(_0x1f9794[_0x139e36(0x22b)](_0x2ff840[_0x139e36(0x2a5)],'\x6f\x76\x65\x72\x72\x69\x64\x65'))_0x5c803d=_0x2ff840['\x72\x65\x73\x75\x6c\x74'];}return this[_0x139e36(0x2ee)][_0x139e36(0x380)]({'\x74\x79\x70\x65':_0x139e36(0x2e6),'\x63\x74\x78':_0x473540,'\x72\x65\x73\x75\x6c\x74':_0x5c803d}),'\x63\x6f\x6e\x74\x69\x6e\x75\x65';}};function outcomeToFinishReason(_0x5df87f,_0xafaf4d){const _0xc3f06c=a0_0x5bb0d7,_0x29ece5={'\x53\x66\x4b\x5a\x65':'\x73\x75\x63\x63\x65\x73\x73','\x68\x74\x59\x6d\x57':_0xc3f06c(0x32f),'\x4a\x66\x6e\x55\x73':_0xc3f06c(0x1e4),'\x4f\x43\x62\x51\x43':'\x73\x74\x6f\x70','\x59\x54\x6b\x46\x65':_0xc3f06c(0x226),'\x78\x67\x59\x73\x4e':_0xc3f06c(0x253),'\x75\x48\x4f\x6b\x6a':'\x63\x6f\x6e\x74\x65\x6e\x74\x5f\x66\x69\x6c\x74\x65\x72'};switch(_0x5df87f){case _0x29ece5[_0xc3f06c(0x2a3)]:case _0x29ece5[_0xc3f06c(0x29c)]:case _0xc3f06c(0x33a):case _0x29ece5['\x4a\x66\x6e\x55\x73']:return _0xafaf4d?_0xc3f06c(0x1e1):_0x29ece5['\x4f\x43\x62\x51\x43'];case _0xc3f06c(0x287):case _0xc3f06c(0x226):case'\x6d\x61\x78\x5f\x74\x6f\x6b\x65\x6e\x73':return _0x29ece5[_0xc3f06c(0x357)];case _0x29ece5['\x78\x67\x59\x73\x4e']:case _0x29ece5[_0xc3f06c(0x220)]:case _0xc3f06c(0x34b):return _0x29ece5[_0xc3f06c(0x220)];default:return _0xc3f06c(0x1e7);}}function readTokenDelta(_0x45e65f){const _0x28e377=a0_0x5bb0d7,_0x42dc26={'\x64\x48\x69\x61\x58':function(_0x3745f5,_0x3ed8fb){return _0x3745f5===_0x3ed8fb;},'\x64\x53\x4e\x4f\x49':_0x28e377(0x2dd)};if(typeof _0x45e65f[_0x28e377(0x2e2)]==='\x73\x74\x72\x69\x6e\x67')return _0x45e65f[_0x28e377(0x2e2)];if(_0x42dc26[_0x28e377(0x2e4)](typeof _0x45e65f[_0x28e377(0x268)],_0x42dc26[_0x28e377(0x306)]))return _0x45e65f[_0x28e377(0x268)];if(typeof _0x45e65f[_0x28e377(0x30a)]===_0x28e377(0x2dd))return _0x45e65f[_0x28e377(0x30a)];return null;}function readToolInvocation(_0x4cc079){const _0x59e061=a0_0x5bb0d7,_0x842ee0={'\x7a\x6f\x6b\x74\x65':_0x59e061(0x27e),'\x4c\x46\x4a\x71\x6a':_0x59e061(0x2dd),'\x6a\x4e\x5a\x71\x47':function(_0x2342f1,_0x507d58){return _0x2342f1===_0x507d58;},'\x54\x59\x53\x76\x44':_0x59e061(0x1f4),'\x65\x6f\x78\x4c\x66':function(_0x442b11,_0x331460){return _0x442b11===_0x331460;},'\x6b\x73\x45\x50\x6f':function(_0x18ca21,_0x261557){return _0x18ca21||_0x261557;}};if(_0x4cc079[_0x59e061(0x335)]!==_0x842ee0[_0x59e061(0x2df)])return null;const _0x396281=_0x4cc079[_0x59e061(0x23a)]??_0x4cc079,_0x25f90a=typeof _0x396281[_0x59e061(0x335)]==='\x73\x74\x72\x69\x6e\x67'?_0x396281[_0x59e061(0x335)]:typeof _0x4cc079[_0x59e061(0x335)]===_0x842ee0['\x4c\x46\x4a\x71\x6a']?_0x4cc079[_0x59e061(0x335)]:'';if(!(_0x842ee0[_0x59e061(0x210)](_0x25f90a,_0x842ee0[_0x59e061(0x261)])||_0x25f90a==='\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c'||_0x842ee0[_0x59e061(0x210)](typeof _0x396281[_0x59e061(0x26f)],'\x6f\x62\x6a\x65\x63\x74')||typeof _0x396281[_0x59e061(0x31b)]===_0x59e061(0x331)))return null;const _0xd3fd3=_0x396281[_0x59e061(0x26f)]??_0x396281[_0x59e061(0x31b)]??_0x396281,_0x1cf797=typeof _0xd3fd3[_0x59e061(0x382)]===_0x59e061(0x2dd)?_0xd3fd3[_0x59e061(0x382)]:_0x842ee0['\x6a\x4e\x5a\x71\x47'](typeof _0xd3fd3[_0x59e061(0x249)],_0x842ee0[_0x59e061(0x2fd)])?_0xd3fd3['\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64']:typeof _0xd3fd3['\x69\x64']===_0x59e061(0x2dd)?_0xd3fd3['\x69\x64']:typeof _0xd3fd3[_0x59e061(0x299)]==='\x73\x74\x72\x69\x6e\x67'?_0xd3fd3[_0x59e061(0x299)]:'',_0x8a1d0e=typeof _0xd3fd3[_0x59e061(0x384)]===_0x842ee0[_0x59e061(0x2fd)]?_0xd3fd3[_0x59e061(0x384)]:typeof _0xd3fd3[_0x59e061(0x25e)]===_0x842ee0[_0x59e061(0x2fd)]?_0xd3fd3[_0x59e061(0x25e)]:_0x842ee0[_0x59e061(0x2ab)](typeof _0xd3fd3[_0x59e061(0x3a6)],_0x59e061(0x2dd))?_0xd3fd3[_0x59e061(0x3a6)]:'',_0x4c98ba=_0xd3fd3[_0x59e061(0x24e)]??_0xd3fd3[_0x59e061(0x23e)]??_0xd3fd3[_0x59e061(0x29e)]??{};if(_0x842ee0[_0x59e061(0x397)](!_0x1cf797,!_0x8a1d0e))return null;return{'\x69\x64':_0x1cf797,'\x6e\x61\x6d\x65':_0x8a1d0e,'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':typeof _0x4c98ba===_0x842ee0[_0x59e061(0x2fd)]?_0x4c98ba:JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79'](_0x4c98ba)};}function readUsage(_0x3c1f84){const _0x4e98e7=a0_0x5bb0d7,_0x1c16d1={'\x41\x57\x71\x55\x61':function(_0x55ef18,_0x220b5c){return _0x55ef18===_0x220b5c;},'\x78\x51\x62\x51\x59':function(_0x132b1f,_0x5efa8e){return _0x132b1f===_0x5efa8e;}},_0x2888e7=_0x3c1f84[_0x4e98e7(0x327)]??_0x3c1f84,_0x38ce6a=Number(_0x2888e7[_0x4e98e7(0x2e1)]??_0x2888e7[_0x4e98e7(0x1e8)]??_0x2888e7[_0x4e98e7(0x362)]??0x0),_0x18f788=Number(_0x2888e7[_0x4e98e7(0x35e)]??_0x2888e7[_0x4e98e7(0x2a6)]??_0x2888e7['\x6f\x75\x74\x70\x75\x74\x54\x6f\x6b\x65\x6e\x73']??0x0);if(_0x1c16d1[_0x4e98e7(0x3bf)](_0x38ce6a,0x0)&&_0x1c16d1[_0x4e98e7(0x291)](_0x18f788,0x0))return null;return{'\x70\x72\x6f\x6d\x70\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x38ce6a,'\x63\x6f\x6d\x70\x6c\x65\x74\x69\x6f\x6e\x5f\x74\x6f\x6b\x65\x6e\x73':_0x18f788,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':Number(_0x2888e7[_0x4e98e7(0x3b6)]??_0x38ce6a+_0x18f788)};}function readOutcome(_0xa78f4b){const _0x510d35=a0_0x5bb0d7,_0x477245={'\x72\x6f\x58\x79\x78':function(_0x49e989,_0x100c04){return _0x49e989===_0x100c04;},'\x71\x46\x58\x46\x44':_0x510d35(0x2dd),'\x65\x4a\x45\x66\x4a':'\x73\x75\x63\x63\x65\x73\x73'};if(_0x477245[_0x510d35(0x31c)](typeof _0xa78f4b[_0x510d35(0x2ea)],_0x477245[_0x510d35(0x371)]))return _0xa78f4b[_0x510d35(0x2ea)];if(_0x477245[_0x510d35(0x31c)](typeof _0xa78f4b[_0x510d35(0x3ba)],_0x477245[_0x510d35(0x371)]))return _0xa78f4b['\x73\x74\x61\x74\x75\x73'];if(_0xa78f4b[_0x510d35(0x217)]===![])return _0x510d35(0x2e0);return _0x477245[_0x510d35(0x310)];}function chatBaseChunk(_0x1170d1){const _0x46e3d6=a0_0x5bb0d7;return _0x1170d1[_0x46e3d6(0x27f)]+=0x1,{'\x69\x64':_0x1170d1['\x72\x75\x6e\x49\x64'],'\x63\x72\x65\x61\x74\x65\x64':_0x1170d1[_0x46e3d6(0x1ed)],'\x6d\x6f\x64\x65\x6c':_0x1170d1['\x6d\x6f\x64\x65\x6c\x49\x64'],'\x6f\x62\x6a\x65\x63\x74':_0x46e3d6(0x37e)};}function sandboxEventToChatChunk(_0x5c7d47,_0x5b7eb2){const _0x8dee47=a0_0x5bb0d7,_0x2e74af={'\x69\x57\x42\x5a\x72':_0x8dee47(0x3ba),'\x54\x79\x4a\x71\x66':_0x8dee47(0x35f),'\x44\x57\x63\x44\x74':_0x8dee47(0x30a),'\x73\x42\x6d\x4e\x47':function(_0xd5408c,_0x36af3c){return _0xd5408c(_0x36af3c);},'\x75\x68\x47\x56\x50':function(_0x292534,_0x4ab080){return _0x292534==_0x4ab080;},'\x56\x47\x77\x41\x47':_0x8dee47(0x265),'\x65\x6e\x4c\x43\x61':function(_0x506ae7,_0x324cca){return _0x506ae7>_0x324cca;},'\x4a\x67\x4e\x6e\x50':function(_0x1f415b,_0x53ae04,_0x182f39){return _0x1f415b(_0x53ae04,_0x182f39);},'\x4a\x46\x70\x42\x41':function(_0x12b486,_0x2ed7b4){return _0x12b486>_0x2ed7b4;},'\x75\x6c\x57\x66\x66':function(_0x1f0daf,_0x2cafd6){return _0x1f0daf(_0x2cafd6);}};switch(_0x5c7d47[_0x8dee47(0x335)]){case _0x8dee47(0x2c9):return null;case'\x65\x78\x65\x63\x75\x74\x69\x6f\x6e\x2e\x73\x74\x61\x72\x74\x65\x64':return null;case _0x2e74af[_0x8dee47(0x355)]:return null;case _0x8dee47(0x230):return null;case _0x2e74af[_0x8dee47(0x25d)]:return null;case _0x2e74af[_0x8dee47(0x22a)]:{const _0x16ec8b=_0x2e74af[_0x8dee47(0x1e3)](readTokenDelta,_0x5c7d47);if(_0x2e74af[_0x8dee47(0x1f0)](_0x16ec8b,null)||_0x16ec8b[_0x8dee47(0x226)]===0x0)return null;return{..._0x2e74af[_0x8dee47(0x1e3)](chatBaseChunk,_0x5b7eb2),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':{'\x72\x6f\x6c\x65':'\x61\x73\x73\x69\x73\x74\x61\x6e\x74','\x63\x6f\x6e\x74\x65\x6e\x74':_0x16ec8b},'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':null}]};}case _0x8dee47(0x27e):{const _0x239096=_0x2e74af[_0x8dee47(0x1e3)](readToolInvocation,_0x5c7d47);if(!_0x239096)return null;const _0x5b6a2b=_0x5b7eb2['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72']['\x67\x65\x74'](_0x239096['\x69\x64']),_0x1217b7=_0x5b6a2b?_0x5b6a2b[_0x8dee47(0x37a)]:_0x5b7eb2[_0x8dee47(0x29a)][_0x8dee47(0x2f8)];return _0x5b7eb2['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72'][_0x8dee47(0x316)](_0x239096['\x69\x64'],{'\x69\x6e\x64\x65\x78':_0x1217b7,'\x69\x64':_0x239096['\x69\x64'],'\x6e\x61\x6d\x65':_0x239096[_0x8dee47(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x239096[_0x8dee47(0x23e)]}),{..._0x2e74af[_0x8dee47(0x1e3)](chatBaseChunk,_0x5b7eb2),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':{'\x72\x6f\x6c\x65':_0x8dee47(0x284),'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73':[{'\x69\x6e\x64\x65\x78':_0x1217b7,'\x69\x64':_0x239096['\x69\x64'],'\x74\x79\x70\x65':_0x8dee47(0x282),'\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x239096[_0x8dee47(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x239096[_0x8dee47(0x23e)]}}]},'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':null}]};}case _0x2e74af[_0x8dee47(0x303)]:{const _0x5ba4a8=_0x2e74af[_0x8dee47(0x26e)](_0x5b7eb2['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72'][_0x8dee47(0x2f8)],0x0);return{...chatBaseChunk(_0x5b7eb2),'\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':_0x2e74af[_0x8dee47(0x1ef)](outcomeToFinishReason,'\x65\x72\x72\x6f\x72',_0x5ba4a8)}]};}case'\x64\x6f\x6e\x65':{const _0x3e061e=_0x2e74af[_0x8dee47(0x2b6)](_0x5b7eb2[_0x8dee47(0x29a)][_0x8dee47(0x2f8)],0x0),_0xddc6f6=outcomeToFinishReason(readOutcome(_0x5c7d47),_0x3e061e),_0x2c9bf4=readUsage(_0x5c7d47),_0x194055={..._0x2e74af['\x75\x6c\x57\x66\x66'](chatBaseChunk,_0x5b7eb2),'\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':_0xddc6f6}]};if(_0x2c9bf4)_0x194055[_0x8dee47(0x327)]=_0x2c9bf4;return _0x194055;}default:return null;}}function completionBaseChunk(_0x58d250){const _0x2a135e=a0_0x5bb0d7;return _0x58d250[_0x2a135e(0x27f)]+=0x1,{'\x69\x64':_0x58d250['\x72\x75\x6e\x49\x64'],'\x63\x72\x65\x61\x74\x65\x64':_0x58d250['\x63\x72\x65\x61\x74\x65\x64\x41\x74'],'\x6d\x6f\x64\x65\x6c':_0x58d250[_0x2a135e(0x1f3)],'\x6f\x62\x6a\x65\x63\x74':_0x2a135e(0x29b)};}function sandboxEventToCompletionChunk(_0x48a609,_0x13884f){const _0x21d5ab=a0_0x5bb0d7,_0x1bdff7={'\x54\x69\x50\x6c\x6b':_0x21d5ab(0x2c9),'\x78\x4a\x6d\x6f\x50':_0x21d5ab(0x346),'\x47\x71\x43\x6e\x64':_0x21d5ab(0x230),'\x55\x76\x56\x4c\x4a':'\x6d\x65\x73\x73\x61\x67\x65\x2e\x70\x61\x72\x74\x2e\x75\x70\x64\x61\x74\x65\x64','\x50\x42\x53\x47\x42':function(_0x2bb65f,_0x2d1b52){return _0x2bb65f===_0x2d1b52;},'\x52\x6e\x66\x6f\x75':function(_0x17d6e1,_0x21a1b6){return _0x17d6e1(_0x21a1b6);},'\x4b\x66\x57\x50\x75':function(_0x32fd9d,_0x2a59b1,_0x3b3d0b){return _0x32fd9d(_0x2a59b1,_0x3b3d0b);},'\x72\x6c\x5a\x59\x47':_0x21d5ab(0x265),'\x52\x66\x6a\x74\x6c':'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x73','\x75\x62\x61\x48\x55':function(_0x52e25c,_0x2db4ab){return _0x52e25c(_0x2db4ab);}};switch(_0x48a609[_0x21d5ab(0x335)]){case _0x1bdff7[_0x21d5ab(0x39a)]:case _0x1bdff7[_0x21d5ab(0x36b)]:case _0x21d5ab(0x3ba):case _0x1bdff7[_0x21d5ab(0x344)]:case _0x1bdff7['\x55\x76\x56\x4c\x4a']:case'\x72\x61\x77':if(_0x1bdff7['\x50\x42\x53\x47\x42'](_0x48a609[_0x21d5ab(0x335)],_0x21d5ab(0x27e))){const _0x5a8f47=readToolInvocation(_0x48a609);if(_0x5a8f47){const _0x4aaaa1=_0x13884f[_0x21d5ab(0x29a)][_0x21d5ab(0x2f1)](_0x5a8f47['\x69\x64']),_0x471fd2=_0x4aaaa1?_0x4aaaa1['\x69\x6e\x64\x65\x78']:_0x13884f[_0x21d5ab(0x29a)][_0x21d5ab(0x2f8)];_0x13884f[_0x21d5ab(0x29a)][_0x21d5ab(0x316)](_0x5a8f47['\x69\x64'],{'\x69\x6e\x64\x65\x78':_0x471fd2,'\x69\x64':_0x5a8f47['\x69\x64'],'\x6e\x61\x6d\x65':_0x5a8f47[_0x21d5ab(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x5a8f47[_0x21d5ab(0x23e)]});}}return null;case _0x21d5ab(0x30a):{const _0x3adc0b=_0x1bdff7[_0x21d5ab(0x2f3)](readTokenDelta,_0x48a609);if(_0x3adc0b==null||_0x3adc0b[_0x21d5ab(0x226)]===0x0)return null;return{...completionBaseChunk(_0x13884f),'\x63\x68\x6f\x69\x63\x65\x73':[{'\x69\x6e\x64\x65\x78':0x0,'\x74\x65\x78\x74':_0x3adc0b,'\x66\x69\x6e\x69\x73\x68\x5f\x72\x65\x61\x73\x6f\x6e':null,'\x6c\x6f\x67\x70\x72\x6f\x62\x73':null}]};}case _0x21d5ab(0x265):case _0x21d5ab(0x1e4):{const _0x7c0df1=_0x1bdff7[_0x21d5ab(0x39f)](outcomeToFinishReason,_0x48a609['\x74\x79\x70\x65']===_0x21d5ab(0x265)?_0x1bdff7[_0x21d5ab(0x345)]:readOutcome(_0x48a609),![]),_0x430f36=_0x7c0df1===_0x1bdff7[_0x21d5ab(0x375)]?_0x21d5ab(0x1e7):_0x7c0df1,_0xf8fc25=_0x1bdff7[_0x21d5ab(0x22c)](readUsage,_0x48a609),_0x3265f1={...completionBaseChunk(_0x13884f),'\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':_0x430f36,'\x6c\x6f\x67\x70\x72\x6f\x62\x73':null}]};if(_0xf8fc25)_0x3265f1[_0x21d5ab(0x327)]=_0xf8fc25;return _0x3265f1;}default:return null;}}function getResponsesExtras(_0xd90496){const _0x546b6d=a0_0x5bb0d7,_0x400565=_0xd90496;if(!_0x400565['\x5f\x5f\x72\x65\x73\x70\x6f\x6e\x73\x65\x73\x45\x78\x74\x72\x61\x73'])_0x400565[_0x546b6d(0x264)]={'\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 _0x400565[_0x546b6d(0x264)];}function nextSeq(_0x3a63e4){const _0x1f9770=a0_0x5bb0d7;return _0x3a63e4[_0x1f9770(0x340)]+=0x1,_0x3a63e4['\x73\x65\x71\x75\x65\x6e\x63\x65'];}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(_0x5bd532){const _0x4eab96=a0_0x5bb0d7;return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x5bd532[_0x4eab96(0x2e1)],'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x5bd532[_0x4eab96(0x35e)],'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x5bd532[_0x4eab96(0x3b6)],'\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(_0x5eaede,_0x49d329){const _0x401093=a0_0x5bb0d7,_0x5396d9={'\x46\x70\x6f\x56\x54':function(_0x37c175,_0x501c87){return _0x37c175(_0x501c87);},'\x77\x67\x6b\x4b\x48':_0x401093(0x30a),'\x54\x71\x4f\x4a\x64':function(_0x4f3251,_0x157c8e){return _0x4f3251===_0x157c8e;},'\x51\x48\x4b\x66\x50':_0x401093(0x2bf),'\x65\x6e\x4a\x52\x4e':_0x401093(0x22f),'\x54\x54\x5a\x78\x41':'\x65\x72\x72\x6f\x72','\x59\x48\x55\x6a\x4e':_0x401093(0x38a),'\x52\x54\x51\x4d\x44':'\x69\x6e\x63\x6f\x6d\x70\x6c\x65\x74\x65','\x59\x52\x61\x44\x6b':_0x401093(0x33a)},_0x37530f=_0x5396d9[_0x401093(0x342)](getResponsesExtras,_0x49d329);switch(_0x5eaede[_0x401093(0x335)]){case _0x401093(0x2c9):return null;case _0x401093(0x346):return null;case _0x401093(0x3ba):return null;case _0x401093(0x230):return null;case _0x401093(0x35f):return null;case _0x5396d9['\x77\x67\x6b\x4b\x48']:{const _0x4ba0ad=readTokenDelta(_0x5eaede);if(_0x4ba0ad==null||_0x4ba0ad[_0x401093(0x226)]===0x0)return null;_0x49d329[_0x401093(0x27f)]+=0x1;if(_0x5396d9['\x54\x71\x4f\x4a\x64'](_0x37530f[_0x401093(0x34d)],void 0x0))_0x37530f[_0x401093(0x34d)]=_0x49d329[_0x401093(0x29a)]['\x73\x69\x7a\x65'];return{'\x74\x79\x70\x65':_0x401093(0x352),'\x63\x6f\x6e\x74\x65\x6e\x74\x5f\x69\x6e\x64\x65\x78':0x0,'\x64\x65\x6c\x74\x61':_0x4ba0ad,'\x69\x74\x65\x6d\x5f\x69\x64':'\x6d\x73\x67\x5f'+_0x49d329[_0x401093(0x379)],'\x6c\x6f\x67\x70\x72\x6f\x62\x73':[],'\x6f\x75\x74\x70\x75\x74\x5f\x69\x6e\x64\x65\x78':_0x37530f[_0x401093(0x34d)],'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':nextSeq(_0x37530f)};}case _0x401093(0x27e):{const _0x336530=readToolInvocation(_0x5eaede);if(!_0x336530)return null;_0x49d329[_0x401093(0x27f)]+=0x1;const _0x47c5c2=_0x49d329[_0x401093(0x29a)][_0x401093(0x2f1)](_0x336530['\x69\x64']),_0x3ea108=_0x47c5c2?_0x47c5c2[_0x401093(0x37a)]:_0x49d329['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x42\x75\x66\x66\x65\x72'][_0x401093(0x2f8)];_0x49d329[_0x401093(0x29a)][_0x401093(0x316)](_0x336530['\x69\x64'],{'\x69\x6e\x64\x65\x78':_0x3ea108,'\x69\x64':_0x336530['\x69\x64'],'\x6e\x61\x6d\x65':_0x336530[_0x401093(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x336530[_0x401093(0x23e)]});const _0x111b06=_0x37530f[_0x401093(0x3a7)]['\x67\x65\x74'](_0x336530['\x69\x64'])??_0x37530f[_0x401093(0x3a7)][_0x401093(0x2f8)];return _0x37530f[_0x401093(0x3a7)][_0x401093(0x316)](_0x336530['\x69\x64'],_0x111b06),{'\x74\x79\x70\x65':_0x5396d9[_0x401093(0x2c8)],'\x69\x74\x65\x6d':{'\x74\x79\x70\x65':_0x5396d9[_0x401093(0x1fe)],'\x69\x64':_0x401093(0x36f)+_0x336530['\x69\x64'],'\x63\x61\x6c\x6c\x5f\x69\x64':_0x336530['\x69\x64'],'\x6e\x61\x6d\x65':_0x336530[_0x401093(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x336530[_0x401093(0x23e)],'\x73\x74\x61\x74\x75\x73':_0x401093(0x33a)},'\x6f\x75\x74\x70\x75\x74\x5f\x69\x6e\x64\x65\x78':_0x111b06,'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':nextSeq(_0x37530f)};}case _0x5396d9['\x54\x54\x5a\x78\x41']:{const _0x4534b7=_0x37530f[_0x401093(0x34d)]??0x0;return{'\x74\x79\x70\x65':_0x401093(0x2ac),'\x69\x74\x65\x6d':{'\x74\x79\x70\x65':_0x5396d9[_0x401093(0x34a)],'\x69\x64':_0x401093(0x2cc)+_0x49d329[_0x401093(0x379)],'\x72\x6f\x6c\x65':_0x401093(0x284),'\x73\x74\x61\x74\x75\x73':_0x5396d9['\x52\x54\x51\x4d\x44'],'\x63\x6f\x6e\x74\x65\x6e\x74':[]},'\x6f\x75\x74\x70\x75\x74\x5f\x69\x6e\x64\x65\x78':_0x4534b7,'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':nextSeq(_0x37530f)};}case _0x401093(0x1e4):{const _0x170bd5=_0x5396d9[_0x401093(0x342)](readUsage,_0x5eaede),_0xfba109=_0x170bd5?usageFromTokens(_0x170bd5):emptyResponseUsage();return{'\x74\x79\x70\x65':_0x401093(0x23c),'\x73\x65\x71\x75\x65\x6e\x63\x65\x5f\x6e\x75\x6d\x62\x65\x72':nextSeq(_0x37530f),'\x72\x65\x73\x70\x6f\x6e\x73\x65':{'\x69\x64':_0x49d329[_0x401093(0x379)],'\x6f\x62\x6a\x65\x63\x74':_0x401093(0x2d4),'\x63\x72\x65\x61\x74\x65\x64\x5f\x61\x74':_0x49d329[_0x401093(0x1ed)],'\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':_0x49d329[_0x401093(0x1f3)],'\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':_0x401093(0x320),'\x74\x6f\x6f\x6c\x73':[],'\x74\x6f\x70\x5f\x70':null,'\x73\x74\x61\x74\x75\x73':_0x5396d9[_0x401093(0x2a4)],'\x75\x73\x61\x67\x65':_0xfba109}};}default:return null;}}var EmbeddingValidationError=class extends Error{[a0_0x5bb0d7(0x335)]='\x69\x6e\x76\x61\x6c\x69\x64\x5f\x72\x65\x71\x75\x65\x73\x74\x5f\x65\x72\x72\x6f\x72';['\x63\x6f\x64\x65'];[a0_0x5bb0d7(0x389)];constructor(_0x2b7f9d,_0x10ceb5,_0x3c99ff){const _0x1eefb9=a0_0x5bb0d7;super(_0x2b7f9d),this['\x6e\x61\x6d\x65']='\x45\x6d\x62\x65\x64\x64\x69\x6e\x67\x56\x61\x6c\x69\x64\x61\x74\x69\x6f\x6e\x45\x72\x72\x6f\x72',this[_0x1eefb9(0x387)]=_0x10ceb5,this[_0x1eefb9(0x389)]=_0x3c99ff;}};const MAX_BATCH=0x800;function reject(_0x1b3f94,_0x3fd97c,_0x47634b){throw new EmbeddingValidationError(_0x1b3f94,_0x3fd97c,_0x47634b);}function normalizeInput(_0x48fc32){const _0x1f56e1=a0_0x5bb0d7,_0x4e8862={'\x48\x57\x79\x66\x67':_0x1f56e1(0x2dd),'\x46\x71\x6e\x4d\x57':function(_0x21aa67,_0x17f29b){return _0x21aa67===_0x17f29b;},'\x71\x74\x52\x6a\x65':function(_0x4a5630,_0x5193a9,_0x59e342,_0x531946){return _0x4a5630(_0x5193a9,_0x59e342,_0x531946);},'\x71\x48\x76\x43\x43':_0x1f56e1(0x29e),'\x79\x50\x4f\x7a\x69':_0x1f56e1(0x268),'\x62\x70\x45\x72\x50':function(_0x437664,_0x586992,_0x293ba3,_0x560705){return _0x437664(_0x586992,_0x293ba3,_0x560705);},'\x69\x78\x4a\x66\x4c':_0x1f56e1(0x23b),'\x64\x42\x62\x66\x44':function(_0x29a896,_0x3033b2){return _0x29a896>_0x3033b2;},'\x63\x58\x55\x74\x42':function(_0x1a14d4,_0x27153e){return _0x1a14d4<_0x27153e;},'\x76\x57\x67\x76\x6d':function(_0x27bd66,_0x5253a4){return _0x27bd66!==_0x5253a4;},'\x62\x44\x46\x6a\x74':'\x6e\x75\x6d\x62\x65\x72','\x79\x53\x6b\x52\x4e':_0x1f56e1(0x203),'\x6e\x72\x4e\x55\x67':_0x1f56e1(0x234),'\x79\x47\x7a\x6a\x74':function(_0x30e2b9,_0x591d53){return _0x30e2b9<_0x591d53;}};if(typeof _0x48fc32===_0x4e8862[_0x1f56e1(0x21e)]){if(_0x4e8862[_0x1f56e1(0x32a)](_0x48fc32[_0x1f56e1(0x226)],0x0))_0x4e8862[_0x1f56e1(0x376)](reject,'\x49\x6e\x70\x75\x74\x20\x73\x74\x72\x69\x6e\x67\x20\x6d\x75\x73\x74\x20\x6e\x6f\x74\x20\x62\x65\x20\x65\x6d\x70\x74\x79',_0x1f56e1(0x234),_0x4e8862['\x71\x48\x76\x43\x43']);return{'\x6b\x69\x6e\x64':_0x4e8862[_0x1f56e1(0x248)],'\x76\x61\x6c\x75\x65\x73':[_0x48fc32]};}if(!Array[_0x1f56e1(0x240)](_0x48fc32))_0x4e8862[_0x1f56e1(0x337)](reject,_0x4e8862[_0x1f56e1(0x26c)],'\x69\x6e\x76\x61\x6c\x69\x64\x5f\x69\x6e\x70\x75\x74\x5f\x74\x79\x70\x65',_0x1f56e1(0x29e));if(_0x48fc32[_0x1f56e1(0x226)]===0x0)_0x4e8862['\x71\x74\x52\x6a\x65'](reject,_0x1f56e1(0x361),_0x1f56e1(0x234),_0x1f56e1(0x29e));if(_0x4e8862[_0x1f56e1(0x281)](_0x48fc32['\x6c\x65\x6e\x67\x74\x68'],MAX_BATCH))reject(_0x1f56e1(0x296)+MAX_BATCH,_0x1f56e1(0x20a),'\x69\x6e\x70\x75\x74');const _0x3600bb=_0x48fc32[0x0];if(typeof _0x3600bb===_0x1f56e1(0x2dd)){const _0x1e417a=[];for(let _0x1d73c0=0x0;_0x4e8862[_0x1f56e1(0x312)](_0x1d73c0,_0x48fc32[_0x1f56e1(0x226)]);_0x1d73c0++){const _0x181b14=_0x48fc32[_0x1d73c0];if(_0x4e8862['\x76\x57\x67\x76\x6d'](typeof _0x181b14,_0x4e8862['\x48\x57\x79\x66\x67']))reject(_0x1f56e1(0x399)+_0x1d73c0+_0x1f56e1(0x3b4),'\x6d\x69\x78\x65\x64\x5f\x69\x6e\x70\x75\x74\x5f\x74\x79\x70\x65\x73',_0x4e8862[_0x1f56e1(0x33d)]);if(_0x181b14[_0x1f56e1(0x226)]===0x0)reject(_0x1f56e1(0x2dc)+_0x1d73c0+_0x1f56e1(0x21d),_0x1f56e1(0x234),_0x4e8862['\x71\x48\x76\x43\x43']);_0x1e417a['\x70\x75\x73\x68'](_0x181b14);}return{'\x6b\x69\x6e\x64':_0x4e8862[_0x1f56e1(0x248)],'\x76\x61\x6c\x75\x65\x73':_0x1e417a};}if(typeof _0x3600bb==='\x6e\x75\x6d\x62\x65\x72'){for(let _0x3ff404=0x0;_0x3ff404<_0x48fc32[_0x1f56e1(0x226)];_0x3ff404++)if(_0x4e8862[_0x1f56e1(0x38c)](typeof _0x48fc32[_0x3ff404],_0x4e8862[_0x1f56e1(0x37f)]))_0x4e8862[_0x1f56e1(0x376)](reject,_0x1f56e1(0x28d)+_0x3ff404+_0x1f56e1(0x263)+typeof _0x48fc32[_0x3ff404],_0x1f56e1(0x288),_0x1f56e1(0x29e));return{'\x6b\x69\x6e\x64':'\x74\x6f\x6b\x65\x6e\x73','\x76\x61\x6c\x75\x65\x73':[_0x48fc32]};}if(Array['\x69\x73\x41\x72\x72\x61\x79'](_0x3600bb)){const _0x46f694=[];for(let _0x286f80=0x0;_0x286f80<_0x48fc32[_0x1f56e1(0x226)];_0x286f80++){const _0x3256e0=_0x48fc32[_0x286f80];if(!Array['\x69\x73\x41\x72\x72\x61\x79'](_0x3256e0))reject(_0x1f56e1(0x399)+_0x286f80+_0x1f56e1(0x39b),_0x4e8862[_0x1f56e1(0x274)],_0x4e8862['\x71\x48\x76\x43\x43']);if(_0x3256e0[_0x1f56e1(0x226)]===0x0)_0x4e8862[_0x1f56e1(0x376)](reject,_0x1f56e1(0x1f5)+_0x286f80+_0x1f56e1(0x21d),_0x4e8862[_0x1f56e1(0x2c2)],_0x4e8862['\x71\x48\x76\x43\x43']);for(let _0x237fda=0x0;_0x4e8862[_0x1f56e1(0x277)](_0x237fda,_0x3256e0[_0x1f56e1(0x226)]);_0x237fda++)if(_0x4e8862[_0x1f56e1(0x38c)](typeof _0x3256e0[_0x237fda],_0x4e8862[_0x1f56e1(0x37f)]))reject(_0x1f56e1(0x1f5)+_0x286f80+_0x1f56e1(0x28e)+_0x237fda+'\x20\x69\x73\x20'+typeof _0x3256e0[_0x237fda],_0x1f56e1(0x288),_0x4e8862[_0x1f56e1(0x33d)]);_0x46f694[_0x1f56e1(0x380)](_0x3256e0);}return{'\x6b\x69\x6e\x64':_0x1f56e1(0x354),'\x76\x61\x6c\x75\x65\x73':_0x46f694};}reject(_0x1f56e1(0x23b),_0x1f56e1(0x3b0),_0x1f56e1(0x29e));}function validateEmbeddingRequest(_0x52100a){const _0x182fe6=a0_0x5bb0d7,_0x29aa38={'\x58\x46\x71\x49\x56':function(_0x3af8a5,_0x4c6530){return _0x3af8a5!==_0x4c6530;},'\x71\x44\x4b\x7a\x59':_0x182fe6(0x331),'\x72\x48\x79\x72\x49':'\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','\x59\x4e\x4c\x6f\x7a':function(_0x157d25,_0x3e20f7,_0x1636af,_0x12e7a1){return _0x157d25(_0x3e20f7,_0x1636af,_0x12e7a1);},'\x4e\x61\x43\x51\x71':'\x4d\x6f\x64\x65\x6c\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64','\x55\x42\x71\x59\x4b':function(_0x12fa38,_0x180e51){return _0x12fa38!==_0x180e51;},'\x4d\x53\x72\x41\x44':_0x182fe6(0x2f0),'\x52\x4a\x47\x62\x59':function(_0x386f46,_0x4f6878){return _0x386f46!==_0x4f6878;},'\x73\x41\x53\x68\x4c':function(_0x33f111,_0x741582,_0x1fb823,_0x32b93a){return _0x33f111(_0x741582,_0x1fb823,_0x32b93a);},'\x55\x6e\x64\x49\x44':function(_0x155462,_0x36f1fd){return _0x155462(_0x36f1fd);},'\x55\x6d\x52\x7a\x6c':function(_0x477a4a,_0x1e6ee0){return _0x477a4a!==_0x1e6ee0;}};if(!_0x52100a||_0x29aa38['\x58\x46\x71\x49\x56'](typeof _0x52100a,_0x29aa38[_0x182fe6(0x363)]))reject(_0x29aa38[_0x182fe6(0x372)],'\x69\x6e\x76\x61\x6c\x69\x64\x5f\x72\x65\x71\x75\x65\x73\x74',void 0x0);if(typeof _0x52100a[_0x182fe6(0x30c)]!==_0x182fe6(0x2dd)||_0x52100a[_0x182fe6(0x30c)][_0x182fe6(0x226)]===0x0)_0x29aa38[_0x182fe6(0x2c7)](reject,_0x29aa38[_0x182fe6(0x1f1)],_0x182fe6(0x2f4),_0x182fe6(0x30c));if(_0x29aa38['\x55\x42\x71\x59\x4b'](_0x52100a['\x64\x69\x6d\x65\x6e\x73\x69\x6f\x6e\x73'],void 0x0)){if(typeof _0x52100a[_0x182fe6(0x275)]!=='\x6e\x75\x6d\x62\x65\x72'||!Number[_0x182fe6(0x2bb)](_0x52100a['\x64\x69\x6d\x65\x6e\x73\x69\x6f\x6e\x73'])||_0x52100a['\x64\x69\x6d\x65\x6e\x73\x69\x6f\x6e\x73']<=0x0)reject(_0x182fe6(0x24f),_0x29aa38[_0x182fe6(0x2d6)],_0x182fe6(0x275));}const _0x49b2d5=_0x52100a[_0x182fe6(0x39d)]??_0x182fe6(0x237);if(_0x49b2d5!==_0x182fe6(0x237)&&_0x29aa38[_0x182fe6(0x394)](_0x49b2d5,_0x182fe6(0x1fb)))_0x29aa38[_0x182fe6(0x35d)](reject,_0x182fe6(0x33b),_0x182fe6(0x3b8),'\x65\x6e\x63\x6f\x64\x69\x6e\x67\x5f\x66\x6f\x72\x6d\x61\x74');const _0x530e85=_0x29aa38['\x55\x6e\x64\x49\x44'](normalizeInput,_0x52100a['\x69\x6e\x70\x75\x74']),_0x558ed7={'\x6d\x6f\x64\x65\x6c':_0x52100a[_0x182fe6(0x30c)],'\x69\x6e\x70\x75\x74':_0x530e85,'\x65\x6e\x63\x6f\x64\x69\x6e\x67\x46\x6f\x72\x6d\x61\x74':_0x49b2d5};if(_0x29aa38[_0x182fe6(0x27c)](_0x52100a[_0x182fe6(0x275)],void 0x0))_0x558ed7[_0x182fe6(0x275)]=_0x52100a[_0x182fe6(0x275)];if(_0x29aa38[_0x182fe6(0x27c)](_0x52100a[_0x182fe6(0x29d)],void 0x0))_0x558ed7[_0x182fe6(0x29d)]=_0x52100a[_0x182fe6(0x29d)];return _0x558ed7;}function resolveProviderId(_0x780739){const _0x1b24c2=a0_0x5bb0d7,_0xf5cdb2={'\x77\x67\x71\x49\x6d':_0x1b24c2(0x34e)},_0x3934f5=_0x780739[_0x1b24c2(0x313)](),_0x17b2f6=_0x3934f5[_0x1b24c2(0x330)](_0xf5cdb2[_0x1b24c2(0x3a5)])?_0x3934f5[_0x1b24c2(0x297)](0x7):_0x3934f5;if(!_0x17b2f6)throw new Error(_0x1b24c2(0x367)+JSON[_0x1b24c2(0x2a2)](_0x780739));const _0x222eaa=_0x17b2f6[_0x1b24c2(0x28f)]('\x2f');if(_0x222eaa===-0x1)return{'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x17b2f6};const _0x36b758=_0x17b2f6[_0x1b24c2(0x297)](0x0,_0x222eaa),_0x1cc6e4=_0x17b2f6['\x73\x6c\x69\x63\x65'](_0x222eaa+0x1);if(!_0x36b758||!_0x1cc6e4)throw new Error('\x49\x6e\x76\x61\x6c\x69\x64\x20\x6d\x6f\x64\x65\x6c\x20\x69\x64\x3a\x20'+JSON[_0x1b24c2(0x2a2)](_0x780739));return{'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x36b758,'\x76\x61\x72\x69\x61\x6e\x74':_0x1cc6e4};}function normalizeContent(_0x44cb75){const _0x53c19d=a0_0x5bb0d7,_0x2bd91e={'\x49\x6d\x62\x59\x71':function(_0x3199c5,_0x55c115){return _0x3199c5===_0x55c115;},'\x53\x57\x6e\x79\x4c':_0x53c19d(0x268),'\x53\x52\x73\x57\x78':_0x53c19d(0x2de),'\x6d\x6e\x78\x59\x6f':function(_0x563e4a,_0x167445){return _0x563e4a===_0x167445;}};if(_0x44cb75==null)return{'\x74\x65\x78\x74':'','\x70\x61\x72\x74\x73':[]};if(_0x2bd91e[_0x53c19d(0x20f)](typeof _0x44cb75,_0x53c19d(0x2dd)))return{'\x74\x65\x78\x74':_0x44cb75,'\x70\x61\x72\x74\x73':[]};const _0x27aaa9=[],_0x171a48=[];for(const _0x718af8 of _0x44cb75)if(_0x718af8[_0x53c19d(0x335)]===_0x2bd91e[_0x53c19d(0x2cb)])_0x171a48['\x70\x75\x73\x68'](_0x718af8['\x74\x65\x78\x74']),_0x27aaa9[_0x53c19d(0x380)]({'\x74\x79\x70\x65':_0x2bd91e[_0x53c19d(0x2cb)],'\x74\x65\x78\x74':_0x718af8[_0x53c19d(0x268)]});else{if(_0x718af8[_0x53c19d(0x335)]===_0x2bd91e['\x53\x52\x73\x57\x78'])_0x27aaa9[_0x53c19d(0x380)]({'\x74\x79\x70\x65':_0x53c19d(0x2de),'\x69\x6d\x61\x67\x65\x5f\x75\x72\x6c':{'\x75\x72\x6c':_0x718af8[_0x53c19d(0x2de)][_0x53c19d(0x204)],'\x64\x65\x74\x61\x69\x6c':_0x718af8[_0x53c19d(0x2de)][_0x53c19d(0x364)]}});else{if(_0x2bd91e[_0x53c19d(0x2ff)](_0x718af8['\x74\x79\x70\x65'],_0x53c19d(0x311)))_0x27aaa9['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x53c19d(0x311),'\x69\x6e\x70\x75\x74\x5f\x61\x75\x64\x69\x6f':{'\x64\x61\x74\x61':_0x718af8['\x69\x6e\x70\x75\x74\x5f\x61\x75\x64\x69\x6f'][_0x53c19d(0x23a)],'\x66\x6f\x72\x6d\x61\x74':_0x718af8[_0x53c19d(0x311)][_0x53c19d(0x298)]}});}}return{'\x74\x65\x78\x74':_0x171a48['\x6a\x6f\x69\x6e']('\x0a'),'\x70\x61\x72\x74\x73':_0x27aaa9};}function readAssistantText(_0x658375){const _0x4fa915=a0_0x5bb0d7,_0x4681ed={'\x77\x62\x66\x4f\x77':function(_0x187af7,_0x3e088f){return _0x187af7==_0x3e088f;}};if(_0x4681ed[_0x4fa915(0x317)](_0x658375,null))return'';if(typeof _0x658375==='\x73\x74\x72\x69\x6e\x67')return _0x658375;const _0x82c02=[];for(const _0x15d53d of _0x658375)if(_0x15d53d['\x74\x79\x70\x65']==='\x74\x65\x78\x74')_0x82c02[_0x4fa915(0x380)](_0x15d53d[_0x4fa915(0x268)]);else{if(_0x15d53d[_0x4fa915(0x335)]==='\x72\x65\x66\x75\x73\x61\x6c')_0x82c02['\x70\x75\x73\x68'](_0x15d53d[_0x4fa915(0x2ed)]);}return _0x82c02[_0x4fa915(0x2aa)]('\x0a');}function readToolContent(_0xa0e1e8){const _0x57ea60=a0_0x5bb0d7,_0x532ea5={'\x4d\x74\x6f\x78\x45':_0x57ea60(0x2dd)};if(typeof _0xa0e1e8===_0x532ea5[_0x57ea60(0x252)])return _0xa0e1e8;return _0xa0e1e8[_0x57ea60(0x239)](_0x482ccb=>_0x482ccb[_0x57ea60(0x268)])[_0x57ea60(0x2aa)]('\x0a');}function convertTools(_0x691be6){const _0x1c5d4f=a0_0x5bb0d7,_0x240258={'\x57\x49\x4d\x4d\x4a':function(_0xb4694c,_0x57b8db){return _0xb4694c===_0x57b8db;},'\x63\x4b\x63\x41\x58':_0x1c5d4f(0x282),'\x64\x61\x6e\x48\x66':function(_0x1c4ddc,_0x30e41b){return _0x1c4ddc>_0x30e41b;}};if(!_0x691be6||_0x691be6[_0x1c5d4f(0x226)]===0x0)return void 0x0;const _0x2e03c3=[];for(const _0x5306ec of _0x691be6)if(_0x240258[_0x1c5d4f(0x20d)](_0x5306ec['\x74\x79\x70\x65'],_0x1c5d4f(0x282)))_0x2e03c3[_0x1c5d4f(0x380)]({'\x74\x79\x70\x65':_0x240258[_0x1c5d4f(0x2b1)],'\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x5306ec['\x66\x75\x6e\x63\x74\x69\x6f\x6e'][_0x1c5d4f(0x3a6)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x5306ec['\x66\x75\x6e\x63\x74\x69\x6f\x6e']['\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e'],'\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73':_0x5306ec[_0x1c5d4f(0x282)]['\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73']??null,'\x73\x74\x72\x69\x63\x74':_0x5306ec[_0x1c5d4f(0x282)][_0x1c5d4f(0x30f)]??null}});return _0x240258[_0x1c5d4f(0x255)](_0x2e03c3[_0x1c5d4f(0x226)],0x0)?_0x2e03c3:void 0x0;}function openaiMessagesToSandboxInput(_0x3a4f0d,_0x449b5d,_0x4d94b6){const _0x1a9f25=a0_0x5bb0d7,_0x27af5c={'\x59\x4a\x44\x53\x71':function(_0x46bb27,_0x18fe7d){return _0x46bb27(_0x18fe7d);},'\x48\x48\x62\x74\x41':function(_0x1fc97d,_0x1c3dac){return _0x1fc97d-_0x1c3dac;},'\x54\x65\x68\x6d\x57':function(_0xac6aa9,_0x4e1d65){return _0xac6aa9>=_0x4e1d65;},'\x59\x46\x70\x4f\x63':'\x61\x73\x73\x69\x73\x74\x61\x6e\x74','\x51\x59\x41\x50\x45':function(_0x52fff9,_0x2d9fea){return _0x52fff9>_0x2d9fea;},'\x6a\x6e\x50\x74\x45':function(_0x2a445d,_0x4dd459){return _0x2a445d!==_0x4dd459;},'\x71\x44\x5a\x54\x51':function(_0x4636d1,_0x3820a7){return _0x4636d1!==_0x3820a7;},'\x54\x47\x61\x6b\x66':_0x1a9f25(0x282),'\x66\x63\x65\x77\x4f':function(_0x473e94){return _0x473e94();},'\x52\x68\x6a\x61\x74':function(_0x18aa22){return _0x18aa22();},'\x4c\x68\x6b\x45\x4d':function(_0x26a6e1,_0xe9a12c){return _0x26a6e1>_0xe9a12c;},'\x64\x44\x62\x54\x69':function(_0x3a81da,_0x22a69d){return _0x3a81da(_0x22a69d);}},{provider:_0x3f1bef,variant:_0x4cf0b8}=_0x27af5c[_0x1a9f25(0x23d)](resolveProviderId,_0x4d94b6),_0x4536bf=[],_0x8c0213=[],_0x1c9d5c=[];let _0x124f42=null,_0x3f5581=[],_0x14c758=[],_0x780ba6=![];const _0x18dc77=()=>{const _0x14a027=_0x1a9f25;_0x124f42&&(_0x1c9d5c[_0x14a027(0x380)](_0x124f42),_0x124f42=null);};let _0x4ae8a7=-0x1;for(let _0x382089=_0x27af5c[_0x1a9f25(0x385)](_0x3a4f0d[_0x1a9f25(0x226)],0x1);_0x27af5c[_0x1a9f25(0x3af)](_0x382089,0x0);_0x382089--)if(_0x3a4f0d[_0x382089][_0x1a9f25(0x2c5)]==='\x75\x73\x65\x72'){_0x4ae8a7=_0x382089;break;}if(_0x4ae8a7===-0x1)throw new Error(_0x1a9f25(0x3b1));for(let _0x4eb47b=0x0;_0x4eb47b<_0x3a4f0d[_0x1a9f25(0x226)];_0x4eb47b++){const _0x533167=_0x3a4f0d[_0x4eb47b];switch(_0x533167[_0x1a9f25(0x2c5)]){case _0x1a9f25(0x245):case _0x1a9f25(0x33c):{const {text:_0x4a3257}=normalizeContent(_0x533167[_0x1a9f25(0x2d3)]);if(_0x4a3257)_0x4536bf[_0x1a9f25(0x380)](_0x4a3257);break;}case _0x1a9f25(0x29d):{const {text:_0x24a28e,parts:_0x13a0ec}=normalizeContent(_0x533167[_0x1a9f25(0x2d3)]);if(_0x13a0ec[_0x1a9f25(0x302)](_0x3918ef=>_0x3918ef[_0x1a9f25(0x335)]!==_0x1a9f25(0x268)))_0x780ba6=!![];if(_0x4eb47b===_0x4ae8a7){_0x8c0213['\x70\x75\x73\x68'](_0x24a28e);if(_0x13a0ec[_0x1a9f25(0x226)]>0x0)_0x14c758=_0x13a0ec;}else{_0x18dc77();_0x13a0ec[_0x1a9f25(0x226)]>0x0?(_0x124f42={'\x75\x73\x65\x72\x50\x61\x72\x74\x73':_0x13a0ec},_0x3f5581=_0x13a0ec):(_0x124f42={},_0x3f5581=[]);if(_0x24a28e)_0x8c0213[_0x1a9f25(0x380)](_0x24a28e);}break;}case _0x27af5c[_0x1a9f25(0x28a)]:{if(!_0x124f42)_0x124f42={};const _0x15078f=readAssistantText(_0x533167['\x63\x6f\x6e\x74\x65\x6e\x74']);if(_0x15078f)_0x124f42[_0x1a9f25(0x21c)]=_0x15078f;if(_0x533167[_0x1a9f25(0x1e1)]&&_0x27af5c[_0x1a9f25(0x334)](_0x533167[_0x1a9f25(0x1e1)][_0x1a9f25(0x226)],0x0)){const _0x11b0a7=[];for(const _0x27bcc4 of _0x533167[_0x1a9f25(0x1e1)]){if(_0x27af5c[_0x1a9f25(0x1ec)](_0x27bcc4['\x74\x79\x70\x65'],'\x66\x75\x6e\x63\x74\x69\x6f\x6e'))continue;if(!_0x27bcc4['\x69\x64']||!_0x27bcc4['\x66\x75\x6e\x63\x74\x69\x6f\x6e']?.[_0x1a9f25(0x3a6)]||_0x27af5c[_0x1a9f25(0x2cd)](typeof _0x27bcc4[_0x1a9f25(0x282)]['\x61\x72\x67\x75\x6d\x65\x6e\x74\x73'],_0x1a9f25(0x2dd)))throw new Error(_0x1a9f25(0x2fa)+_0x4eb47b);_0x11b0a7[_0x1a9f25(0x380)]({'\x69\x64':_0x27bcc4['\x69\x64'],'\x6e\x61\x6d\x65':_0x27bcc4[_0x1a9f25(0x282)][_0x1a9f25(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x27bcc4[_0x1a9f25(0x282)]['\x61\x72\x67\x75\x6d\x65\x6e\x74\x73']});}if(_0x27af5c[_0x1a9f25(0x334)](_0x11b0a7['\x6c\x65\x6e\x67\x74\x68'],0x0))_0x124f42[_0x1a9f25(0x329)]=_0x11b0a7;}if(_0x3f5581[_0x1a9f25(0x226)]>0x0&&!_0x124f42['\x75\x73\x65\x72\x50\x61\x72\x74\x73'])_0x124f42[_0x1a9f25(0x267)]=_0x3f5581;break;}case _0x1a9f25(0x20b):{const _0x183d40={'\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x49\x64':_0x533167[_0x1a9f25(0x249)],'\x63\x6f\x6e\x74\x65\x6e\x74':readToolContent(_0x533167[_0x1a9f25(0x2d3)])};let _0x43c582=![];if(_0x124f42?.[_0x1a9f25(0x329)]?.['\x73\x6f\x6d\x65'](_0x556ace=>_0x556ace['\x69\x64']===_0x533167['\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64'])){if(!_0x124f42[_0x1a9f25(0x27b)])_0x124f42[_0x1a9f25(0x27b)]=[];_0x124f42[_0x1a9f25(0x27b)][_0x1a9f25(0x380)](_0x183d40),_0x43c582=!![];}else for(let _0x10c76c=_0x1c9d5c[_0x1a9f25(0x226)]-0x1;_0x10c76c>=0x0;_0x10c76c--){const _0x4ca811=_0x1c9d5c[_0x10c76c];if(_0x4ca811['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x73']?.[_0x1a9f25(0x302)](_0x5a180e=>_0x5a180e['\x69\x64']===_0x533167[_0x1a9f25(0x249)])){if(!_0x4ca811[_0x1a9f25(0x27b)])_0x4ca811[_0x1a9f25(0x27b)]=[];_0x4ca811[_0x1a9f25(0x27b)]['\x70\x75\x73\x68'](_0x183d40),_0x43c582=!![];break;}}if(!_0x43c582)throw new Error(_0x1a9f25(0x242)+_0x533167[_0x1a9f25(0x249)]);break;}case _0x27af5c['\x54\x47\x61\x6b\x66']:break;}if(_0x4eb47b===_0x4ae8a7)_0x27af5c[_0x1a9f25(0x319)](_0x18dc77);}_0x27af5c[_0x1a9f25(0x32d)](_0x18dc77);const _0x5cd925={'\x70\x72\x6f\x76\x69\x64\x65\x72':_0x3f1bef,'\x74\x61\x73\x6b':_0x8c0213[_0x1a9f25(0x2aa)]('\x0a\x0a')};if(_0x4cf0b8)_0x5cd925[_0x1a9f25(0x314)]=_0x4cf0b8;const _0x2cc05a=_0x4536bf[_0x1a9f25(0x2aa)]('\x0a\x0a');if(_0x2cc05a)_0x5cd925['\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73']=_0x2cc05a;if(_0x27af5c[_0x1a9f25(0x3ab)](_0x14c758[_0x1a9f25(0x226)],0x0))_0x5cd925['\x74\x61\x73\x6b\x50\x61\x72\x74\x73']=_0x14c758;if(_0x1c9d5c['\x6c\x65\x6e\x67\x74\x68']>0x0)_0x5cd925[_0x1a9f25(0x276)]=_0x1c9d5c;const _0x37b3a4=_0x27af5c[_0x1a9f25(0x377)](convertTools,_0x449b5d);if(_0x37b3a4)_0x5cd925[_0x1a9f25(0x258)]=_0x37b3a4;if(_0x780ba6)_0x5cd925[_0x1a9f25(0x21b)]=!![];return _0x5cd925;}async function resolvePreviousResponseId(_0x16f008,_0xc95986){const _0x404821=a0_0x5bb0d7,_0x239fa6={'\x49\x7a\x75\x6c\x67':function(_0xd2b4c7,_0x17a8cd){return _0xd2b4c7===_0x17a8cd;}};if(!_0x16f008)return{'\x70\x72\x69\x6f\x72\x54\x75\x72\x6e\x73':[]};const _0x4f21b7=await _0xc95986[_0x404821(0x328)](_0x16f008);if(_0x239fa6['\x49\x7a\x75\x6c\x67'](_0x4f21b7,null))throw new Error(_0x404821(0x393)+_0x16f008);return{'\x70\x72\x69\x6f\x72\x54\x75\x72\x6e\x73':_0x4f21b7};}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(_0x52e7f0){const _0x2b9784=a0_0x5bb0d7,_0x1574b0={'\x43\x62\x4d\x4d\x48':function(_0x17d465,_0x238914){return _0x17d465(_0x238914);},'\x5a\x67\x41\x44\x68':function(_0x30a1dd,_0x4bb4e5){return _0x30a1dd===_0x4bb4e5;},'\x79\x6f\x47\x57\x63':function(_0x533797,_0x3320d9){return _0x533797===_0x3320d9;},'\x79\x59\x70\x52\x6d':function(_0x19d1cf,_0x35cd20){return _0x19d1cf in _0x35cd20;},'\x44\x4e\x5a\x4b\x75':'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73','\x6b\x48\x6a\x6e\x75':function(_0x5c6189,_0x2f4521){return _0x5c6189(_0x2f4521);},'\x71\x44\x50\x62\x46':function(_0x3140d0,_0x45ba9){return _0x3140d0+_0x45ba9;}},_0x2042b7=_0x52e7f0['\x75\x73\x61\x67\x65']??_0x52e7f0,_0x161bb3=_0x1574b0[_0x2b9784(0x24a)](Number,_0x2042b7[_0x2b9784(0x1e8)]??_0x2042b7[_0x2b9784(0x2e1)]??_0x2042b7[_0x2b9784(0x362)]??0x0),_0x5abb37=Number(_0x2042b7[_0x2b9784(0x2a6)]??_0x2042b7['\x63\x6f\x6d\x70\x6c\x65\x74\x69\x6f\x6e\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x2042b7[_0x2b9784(0x215)]??0x0);if(_0x1574b0[_0x2b9784(0x286)](_0x161bb3,0x0)&&_0x1574b0['\x79\x6f\x47\x57\x63'](_0x5abb37,0x0)&&!_0x1574b0[_0x2b9784(0x224)](_0x1574b0['\x44\x4e\x5a\x4b\x75'],_0x2042b7))return null;const _0x2168b9=_0x1574b0[_0x2b9784(0x308)](Number,_0x2042b7['\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73']??_0x1574b0[_0x2b9784(0x27a)](_0x161bb3,_0x5abb37)),_0x5de154=Number(_0x2042b7['\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73']?.[_0x2b9784(0x1ea)]??_0x2042b7[_0x2b9784(0x1ea)]??0x0),_0x370d91=_0x1574b0[_0x2b9784(0x24a)](Number,_0x2042b7['\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73\x5f\x64\x65\x74\x61\x69\x6c\x73']?.[_0x2b9784(0x257)]??_0x2042b7['\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x6f\x6b\x65\x6e\x73']??0x0);return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x161bb3,'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x5abb37,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2168b9,'\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':_0x5de154},'\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':_0x370d91}};}function readToolInvocationFromRaw(_0x2a085b){const _0x25b51a=a0_0x5bb0d7,_0x55ca1a={'\x61\x52\x52\x77\x59':function(_0x2c595d,_0xb326ae){return _0x2c595d!==_0xb326ae;},'\x68\x6a\x74\x64\x57':function(_0x39376d,_0x4b4dfa){return _0x39376d===_0x4b4dfa;},'\x45\x55\x58\x68\x64':function(_0x1899b2,_0x1dc68f){return _0x1899b2===_0x1dc68f;},'\x78\x5a\x6b\x62\x6c':_0x25b51a(0x331),'\x57\x62\x75\x66\x6b':function(_0x7cd18,_0x3361eb){return _0x7cd18===_0x3361eb;},'\x6e\x65\x67\x55\x55':_0x25b51a(0x1f4),'\x71\x6c\x62\x69\x59':function(_0x4fc8ee,_0x10c587){return _0x4fc8ee===_0x10c587;},'\x56\x45\x56\x55\x45':_0x25b51a(0x1f9),'\x58\x7a\x6b\x50\x68':'\x73\x74\x72\x69\x6e\x67','\x7a\x6f\x4d\x42\x77':function(_0x19eb2a,_0x2c866f){return _0x19eb2a===_0x2c866f;},'\x70\x48\x58\x76\x45':function(_0x5c0020,_0xa15fa4){return _0x5c0020===_0xa15fa4;},'\x70\x4f\x48\x45\x59':function(_0x318f98,_0x3b6c79){return _0x318f98===_0x3b6c79;},'\x79\x58\x6a\x42\x69':_0x25b51a(0x208),'\x57\x71\x45\x6c\x41':function(_0xc244a0,_0x59b49c){return _0xc244a0===_0x59b49c;},'\x53\x54\x52\x48\x76':function(_0x2d334a,_0x1eebf5){return _0x2d334a||_0x1eebf5;}};if(_0x55ca1a[_0x25b51a(0x218)](_0x2a085b[_0x25b51a(0x335)],_0x25b51a(0x27e)))return null;const _0x113dff=_0x2a085b[_0x25b51a(0x23a)]??_0x2a085b,_0x25a7f3=typeof _0x113dff[_0x25b51a(0x335)]===_0x25b51a(0x2dd)?_0x113dff[_0x25b51a(0x335)]:'',_0x43b815=_0x25a7f3===_0x25b51a(0x343)||_0x55ca1a[_0x25b51a(0x31a)](_0x25a7f3,_0x25b51a(0x30b))||typeof _0x113dff[_0x25b51a(0x273)]==='\x6f\x62\x6a\x65\x63\x74'||_0x55ca1a[_0x25b51a(0x259)](typeof _0x113dff[_0x25b51a(0x208)],_0x55ca1a[_0x25b51a(0x247)]);if(!(_0x55ca1a[_0x25b51a(0x254)](_0x25a7f3,_0x55ca1a[_0x25b51a(0x32e)])||_0x55ca1a[_0x25b51a(0x35c)](_0x25a7f3,_0x55ca1a[_0x25b51a(0x262)])||typeof _0x113dff[_0x25b51a(0x26f)]===_0x55ca1a[_0x25b51a(0x247)]||_0x55ca1a[_0x25b51a(0x254)](typeof _0x113dff[_0x25b51a(0x31b)],'\x6f\x62\x6a\x65\x63\x74'))&&!_0x43b815)return null;const _0x47f83f=_0x113dff[_0x25b51a(0x26f)]??_0x113dff[_0x25b51a(0x31b)]??_0x113dff[_0x25b51a(0x273)]??_0x113dff[_0x25b51a(0x208)]??_0x113dff,_0x2d541a=typeof _0x47f83f['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x49\x64']===_0x55ca1a['\x58\x7a\x6b\x50\x68']?_0x47f83f[_0x25b51a(0x382)]:_0x55ca1a[_0x25b51a(0x304)](typeof _0x47f83f['\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64'],'\x73\x74\x72\x69\x6e\x67')?_0x47f83f[_0x25b51a(0x249)]:_0x55ca1a['\x70\x48\x58\x76\x45'](typeof _0x47f83f['\x69\x64'],_0x25b51a(0x2dd))?_0x47f83f['\x69\x64']:_0x55ca1a['\x70\x4f\x48\x45\x59'](typeof _0x47f83f[_0x25b51a(0x299)],_0x25b51a(0x2dd))?_0x47f83f['\x63\x61\x6c\x6c\x49\x64']:'',_0x3f75a2=_0x43b815?_0x55ca1a[_0x25b51a(0x278)]:_0x55ca1a[_0x25b51a(0x368)](typeof _0x47f83f[_0x25b51a(0x384)],'\x73\x74\x72\x69\x6e\x67')?_0x47f83f['\x74\x6f\x6f\x6c\x4e\x61\x6d\x65']:typeof _0x47f83f['\x74\x6f\x6f\x6c\x5f\x6e\x61\x6d\x65']===_0x25b51a(0x2dd)?_0x47f83f[_0x25b51a(0x25e)]:typeof _0x47f83f[_0x25b51a(0x3a6)]===_0x25b51a(0x2dd)?_0x47f83f[_0x25b51a(0x3a6)]:'',_0x281d8a=_0x47f83f[_0x25b51a(0x24e)]??_0x47f83f[_0x25b51a(0x23e)]??_0x47f83f[_0x25b51a(0x29e)]??{};if(_0x55ca1a[_0x25b51a(0x21f)](!_0x2d541a,!_0x3f75a2))return null;return{'\x69\x64':_0x2d541a,'\x6e\x61\x6d\x65':_0x3f75a2,'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x55ca1a[_0x25b51a(0x31a)](typeof _0x281d8a,_0x25b51a(0x2dd))?_0x281d8a:JSON[_0x25b51a(0x2a2)](_0x281d8a),'\x69\x73\x43\x6f\x6d\x70\x75\x74\x65\x72\x55\x73\x65':_0x43b815,'\x63\x6f\x6d\x70\x75\x74\x65\x72\x41\x63\x74\x69\x6f\x6e':_0x43b815?_0x47f83f[_0x25b51a(0x2a5)]??void 0x0:void 0x0};}function readReasoningFromPart(_0x24f11f){const _0x47acfd=a0_0x5bb0d7,_0x4be696={'\x69\x45\x69\x78\x74':_0x47acfd(0x2b3),'\x6e\x4b\x6f\x77\x6a':'\x74\x68\x69\x6e\x6b\x69\x6e\x67','\x42\x6b\x67\x62\x64':function(_0x2b2caf,_0x350df4){return _0x2b2caf===_0x350df4;}};if(_0x24f11f[_0x47acfd(0x335)]!==_0x47acfd(0x35f))return null;const _0x29150a=_0x24f11f['\x70\x61\x72\x74']??_0x24f11f;if(_0x29150a[_0x47acfd(0x335)]!==_0x4be696[_0x47acfd(0x332)]&&_0x29150a[_0x47acfd(0x335)]!==_0x4be696[_0x47acfd(0x3be)])return null;if(_0x4be696[_0x47acfd(0x2da)](typeof _0x29150a['\x74\x65\x78\x74'],_0x47acfd(0x2dd)))return _0x29150a[_0x47acfd(0x268)];if(_0x4be696['\x42\x6b\x67\x62\x64'](typeof _0x29150a[_0x47acfd(0x2d3)],_0x47acfd(0x2dd)))return _0x29150a[_0x47acfd(0x2d3)];return null;}function assembleResponseOutput(_0x2dd80d){const _0xe3ab3=a0_0x5bb0d7,_0x452e4e={'\x4b\x42\x72\x48\x4b':function(_0x3ce9c4){return _0x3ce9c4();},'\x70\x4f\x66\x73\x4c':_0xe3ab3(0x2dd),'\x61\x4b\x7a\x4c\x69':function(_0x36450d,_0x1d5b29){return _0x36450d===_0x1d5b29;},'\x59\x63\x51\x77\x4e':function(_0x5bdd45,_0x10699a){return _0x5bdd45(_0x10699a);},'\x49\x64\x7a\x79\x7a':_0xe3ab3(0x30b),'\x71\x4c\x52\x73\x65':_0xe3ab3(0x22f),'\x47\x56\x4f\x4d\x58':'\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64','\x43\x4f\x4b\x42\x72':function(_0x25823b,_0x3c17aa){return _0x25823b>_0x3c17aa;},'\x4d\x50\x6f\x56\x75':'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67','\x64\x65\x65\x51\x4c':function(_0x3deef1,_0x20fbaa){return _0x3deef1>_0x20fbaa;},'\x55\x6c\x6a\x64\x6b':_0xe3ab3(0x38a),'\x57\x5a\x78\x68\x6e':'\x61\x73\x73\x69\x73\x74\x61\x6e\x74'},_0x386be3={'\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':_0x452e4e[_0xe3ab3(0x2e7)](emptyUsage),'\x68\x61\x73\x55\x73\x61\x67\x65':![]};for(const _0x1a0cd0 of _0x2dd80d)switch(_0x1a0cd0[_0xe3ab3(0x335)]){case _0xe3ab3(0x30a):{const _0x34d494=typeof _0x1a0cd0[_0xe3ab3(0x2e2)]===_0x452e4e['\x70\x4f\x66\x73\x4c']&&_0x1a0cd0[_0xe3ab3(0x2e2)]||typeof _0x1a0cd0[_0xe3ab3(0x268)]===_0x452e4e[_0xe3ab3(0x229)]&&_0x1a0cd0[_0xe3ab3(0x268)]||_0x452e4e[_0xe3ab3(0x24d)](typeof _0x1a0cd0[_0xe3ab3(0x30a)],_0x452e4e[_0xe3ab3(0x229)])&&_0x1a0cd0[_0xe3ab3(0x30a)]||'';if(_0x34d494)_0x386be3[_0xe3ab3(0x294)][_0xe3ab3(0x380)](_0x34d494);break;}case _0xe3ab3(0x27e):{const _0x4e3eaa=_0x452e4e[_0xe3ab3(0x2d0)](readToolInvocationFromRaw,_0x1a0cd0);if(!_0x4e3eaa)break;if(_0x4e3eaa['\x69\x73\x43\x6f\x6d\x70\x75\x74\x65\x72\x55\x73\x65'])_0x386be3[_0xe3ab3(0x24b)]['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x452e4e[_0xe3ab3(0x256)],'\x69\x64':'\x63\x63\x5f'+_0x4e3eaa['\x69\x64'],'\x63\x61\x6c\x6c\x5f\x69\x64':_0x4e3eaa['\x69\x64'],'\x73\x74\x61\x74\x75\x73':_0xe3ab3(0x33a),'\x70\x65\x6e\x64\x69\x6e\x67\x5f\x73\x61\x66\x65\x74\x79\x5f\x63\x68\x65\x63\x6b\x73':[],..._0x4e3eaa[_0xe3ab3(0x38d)]?{'\x61\x63\x74\x69\x6f\x6e':_0x4e3eaa[_0xe3ab3(0x38d)]}:{}});else{if(!_0x386be3['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x73'][_0xe3ab3(0x370)](_0x4e3eaa['\x69\x64']))_0x386be3[_0xe3ab3(0x347)][_0xe3ab3(0x380)](_0x4e3eaa['\x69\x64']);_0x386be3['\x74\x6f\x6f\x6c\x43\x61\x6c\x6c\x73'][_0xe3ab3(0x316)](_0x4e3eaa['\x69\x64'],{'\x74\x79\x70\x65':_0x452e4e[_0xe3ab3(0x38e)],'\x69\x64':_0xe3ab3(0x36f)+_0x4e3eaa['\x69\x64'],'\x63\x61\x6c\x6c\x5f\x69\x64':_0x4e3eaa['\x69\x64'],'\x6e\x61\x6d\x65':_0x4e3eaa[_0xe3ab3(0x3a6)],'\x61\x72\x67\x75\x6d\x65\x6e\x74\x73':_0x4e3eaa[_0xe3ab3(0x23e)],'\x73\x74\x61\x74\x75\x73':_0x452e4e[_0xe3ab3(0x28b)]});}break;}case _0xe3ab3(0x35f):{const _0x201570=_0x452e4e[_0xe3ab3(0x2d0)](readReasoningFromPart,_0x1a0cd0);if(_0x201570)_0x386be3[_0xe3ab3(0x266)][_0xe3ab3(0x380)](_0x201570);break;}case _0xe3ab3(0x1e4):{const _0x444af3=readUsageFromEvent(_0x1a0cd0);_0x444af3&&(_0x386be3['\x75\x73\x61\x67\x65']=foldUsage(_0x386be3['\x75\x73\x61\x67\x65'],_0x444af3),_0x386be3[_0xe3ab3(0x295)]=!![]);break;}}const _0x3c6116=[];if(_0x452e4e[_0xe3ab3(0x271)](_0x386be3[_0xe3ab3(0x266)]['\x6c\x65\x6e\x67\x74\x68'],0x0)){const _0x5918d8={'\x74\x79\x70\x65':_0x452e4e[_0xe3ab3(0x3bb)],'\x69\x64':_0xe3ab3(0x2d8),'\x73\x75\x6d\x6d\x61\x72\x79':[],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x386be3[_0xe3ab3(0x266)][_0xe3ab3(0x239)](_0x1e550d=>({'\x74\x79\x70\x65':'\x72\x65\x61\x73\x6f\x6e\x69\x6e\x67\x5f\x74\x65\x78\x74','\x74\x65\x78\x74':_0x1e550d})),'\x73\x74\x61\x74\x75\x73':_0xe3ab3(0x33a)};_0x3c6116['\x70\x75\x73\x68'](_0x5918d8);}if(_0x452e4e[_0xe3ab3(0x227)](_0x386be3['\x74\x65\x78\x74\x50\x69\x65\x63\x65\x73'][_0xe3ab3(0x226)],0x0)){const _0x392c69={'\x74\x79\x70\x65':_0x452e4e[_0xe3ab3(0x351)],'\x69\x64':_0xe3ab3(0x36d),'\x72\x6f\x6c\x65':_0x452e4e['\x57\x5a\x78\x68\x6e'],'\x73\x74\x61\x74\x75\x73':_0xe3ab3(0x33a),'\x63\x6f\x6e\x74\x65\x6e\x74':[{'\x74\x79\x70\x65':'\x6f\x75\x74\x70\x75\x74\x5f\x74\x65\x78\x74','\x74\x65\x78\x74':_0x386be3[_0xe3ab3(0x294)][_0xe3ab3(0x2aa)](''),'\x61\x6e\x6e\x6f\x74\x61\x74\x69\x6f\x6e\x73':[]}]};_0x3c6116['\x70\x75\x73\x68'](_0x392c69);}for(const _0x365b92 of _0x386be3[_0xe3ab3(0x347)]){const _0x5e28f3=_0x386be3[_0xe3ab3(0x329)]['\x67\x65\x74'](_0x365b92);if(_0x5e28f3)_0x3c6116[_0xe3ab3(0x380)](_0x5e28f3);}for(const _0x553ebc of _0x386be3['\x63\x6f\x6d\x70\x75\x74\x65\x72\x43\x61\x6c\x6c\x73'])_0x3c6116['\x70\x75\x73\x68'](_0x553ebc);return{'\x6f\x75\x74\x70\x75\x74':_0x3c6116,'\x75\x73\x61\x67\x65':_0x386be3[_0xe3ab3(0x327)]};}function a0_0x6f22(_0x4c669e,_0x51f696){_0x4c669e=_0x4c669e-0x1e1;const _0x4e1755=a0_0x4e17();let _0x6f2201=_0x4e1755[_0x4c669e];if(a0_0x6f22['\x51\x6a\x6d\x4f\x4b\x45']===undefined){var _0x84329f=function(_0x1d4f92){const _0x589a4f='\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 _0x507aa1='',_0x42e505='';for(let _0x22aa51=0x0,_0x3e02e0,_0x1743e1,_0x9ca606=0x0;_0x1743e1=_0x1d4f92['\x63\x68\x61\x72\x41\x74'](_0x9ca606++);~_0x1743e1&&(_0x3e02e0=_0x22aa51%0x4?_0x3e02e0*0x40+_0x1743e1:_0x1743e1,_0x22aa51++%0x4)?_0x507aa1+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x3e02e0>>(-0x2*_0x22aa51&0x6)):0x0){_0x1743e1=_0x589a4f['\x69\x6e\x64\x65\x78\x4f\x66'](_0x1743e1);}for(let _0x864a70=0x0,_0x4dc107=_0x507aa1['\x6c\x65\x6e\x67\x74\x68'];_0x864a70<_0x4dc107;_0x864a70++){_0x42e505+='\x25'+('\x30\x30'+_0x507aa1['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x864a70)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x42e505);};a0_0x6f22['\x48\x4f\x6d\x54\x64\x51']=_0x84329f,a0_0x6f22['\x47\x56\x6c\x52\x59\x41']={},a0_0x6f22['\x51\x6a\x6d\x4f\x4b\x45']=!![];}const _0x22a113=_0x4e1755[0x0],_0x2f02d3=_0x4c669e+_0x22a113,_0x58c49f=a0_0x6f22['\x47\x56\x6c\x52\x59\x41'][_0x2f02d3];return!_0x58c49f?(_0x6f2201=a0_0x6f22['\x48\x4f\x6d\x54\x64\x51'](_0x6f2201),a0_0x6f22['\x47\x56\x6c\x52\x59\x41'][_0x2f02d3]=_0x6f2201):_0x6f2201=_0x58c49f,_0x6f2201;}function foldUsage(_0x2bc65e,_0x5cd5a2){const _0x286830=a0_0x5bb0d7,_0x39a278={'\x4f\x41\x57\x7a\x49':function(_0x5b722a,_0x46b85c){return _0x5b722a+_0x46b85c;}};return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x39a278['\x4f\x41\x57\x7a\x49'](_0x2bc65e['\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73'],_0x5cd5a2[_0x286830(0x1e8)]),'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2bc65e[_0x286830(0x2a6)]+_0x5cd5a2[_0x286830(0x2a6)],'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2bc65e['\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73']+_0x5cd5a2[_0x286830(0x3b6)],'\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':_0x39a278[_0x286830(0x33e)](_0x2bc65e[_0x286830(0x3ad)]['\x63\x61\x63\x68\x65\x64\x5f\x74\x6f\x6b\x65\x6e\x73'],_0x5cd5a2[_0x286830(0x3ad)][_0x286830(0x1ea)])},'\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':_0x39a278[_0x286830(0x33e)](_0x2bc65e[_0x286830(0x26b)][_0x286830(0x257)],_0x5cd5a2[_0x286830(0x26b)][_0x286830(0x257)])}};}function usageFromEvents(_0x3357cd){const _0x7b24f3=a0_0x5bb0d7;let _0x4f0523=emptyUsage();for(const _0x46213c of _0x3357cd){if(_0x46213c['\x74\x79\x70\x65']!==_0x7b24f3(0x1e4))continue;const _0x5dd196=readUsageFromEvent(_0x46213c);if(_0x5dd196)_0x4f0523=foldUsage(_0x4f0523,_0x5dd196);}return _0x4f0523;}function a0_0x4e17(){const _0x375448=['\x7a\x77\x35\x4a\x42\x32\x72\x50\x42\x4d\x44\x46\x7a\x4d\x39\x59\x42\x77\x66\x30\x69\x67\x31\x31\x43\x33\x71\x47\x79\x4d\x75\x47\x6a\x32\x7a\x53\x42\x32\x66\x30\x6a\x59\x62\x56\x43\x49\x61\x4e\x79\x4d\x66\x5a\x7a\x74\x79\x30\x6a\x57','\x7a\x67\x76\x32\x7a\x77\x58\x56\x43\x67\x76\x59','\x43\x75\x48\x32\x71\x30\x6d','\x74\x30\x66\x78\x45\x4b\x4b','\x7a\x78\x48\x4c\x79\x33\x76\x30\x7a\x76\x72\x56\x42\x32\x57','\x43\x32\x76\x58\x44\x77\x76\x55\x79\x32\x75','\x79\x77\x72\x4b\x43\x4d\x76\x5a\x43\x57','\x72\x4e\x62\x56\x76\x4c\x71','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c','\x72\x33\x66\x64\x42\x4d\x71','\x43\x4d\x58\x41\x77\x75\x43','\x7a\x78\x48\x4c\x79\x33\x76\x30\x41\x77\x39\x55\x6c\x4e\x6e\x30\x79\x78\x6a\x30\x7a\x77\x71','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x70\x43\x4d\x72\x4c\x43\x47','\x43\x33\x6a\x4a','\x75\x4d\x76\x6e\x73\x4b\x75','\x77\x75\x48\x76\x41\x4b\x34','\x7a\x4d\x4c\x53\x44\x67\x76\x59\x7a\x77\x71','\x41\x30\x39\x6d\x74\x31\x4f','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x75\x39\x31\x44\x68\x62\x31\x44\x65\x4c\x55\x7a\x67\x76\x34','\x44\x67\x66\x55\x7a\x32\x58\x4c\x6c\x57','\x44\x67\x39\x56\x42\x66\x39\x49\x42\x67\x39\x4a\x41\x32\x76\x4b','\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','\x76\x77\x58\x51\x7a\x67\x53','\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','\x43\x4d\x76\x33\x43\x4d\x4c\x30\x7a\x71','\x44\x67\x39\x52\x7a\x77\x35\x5a','\x41\x76\x44\x63\x77\x4e\x69','\x78\x33\x6e\x30\x79\x78\x72\x31\x43\x57','\x77\x76\x72\x52\x72\x4d\x75','\x7a\x67\x76\x53\x7a\x78\x72\x4c','\x79\x32\x58\x56\x43\x32\x75','\x76\x77\x4c\x4c\x71\x78\x4b','\x44\x67\x48\x59\x7a\x77\x66\x4b\x73\x77\x71','\x43\x77\x58\x49\x41\x76\x4b','\x43\x30\x66\x74\x41\x65\x57','\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x4c\x56\x42\x4c\x39\x30\x42\x32\x54\x4c\x42\x4e\x6d','\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','\x42\x68\x66\x33\x45\x67\x6d','\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','\x41\x77\x35\x57\x44\x78\x72\x75\x42\x32\x54\x4c\x42\x4e\x6d','\x43\x75\x72\x6c\x45\x4c\x4b','\x7a\x67\x76\x30\x79\x77\x4c\x53','\x6e\x74\x44\x51\x76\x33\x7a\x65\x73\x32\x38','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x78\x6e\x62\x79\x33\x72\x50\x42\x32\x34','\x73\x77\x35\x32\x79\x77\x58\x50\x7a\x63\x62\x54\x42\x32\x72\x4c\x42\x63\x62\x50\x7a\x64\x4f\x47','\x76\x33\x66\x66\x42\x65\x65','\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\x67\x6a\x56\x75\x65\x4f','\x45\x65\x50\x54\x42\x31\x61','\x74\x30\x7a\x59\x76\x32\x34','\x42\x78\x6e\x4e\x78\x5a\x61','\x43\x32\x6e\x59\x7a\x77\x76\x55\x43\x32\x48\x56\x44\x61','\x7a\x4d\x6e\x46','\x41\x67\x66\x5a','\x43\x75\x7a\x79\x72\x4b\x71','\x43\x4b\x48\x35\x43\x4b\x4b','\x7a\x4d\x6e\x59\x43\x4d\x4b','\x44\x67\x76\x59\x42\x77\x4c\x55\x79\x78\x72\x4c','\x75\x4d\x7a\x51\x44\x67\x57','\x43\x78\x72\x73\x41\x4d\x75','\x7a\x65\x72\x49\x76\x67\x4b','\x7a\x77\x35\x30\x43\x4d\x4c\x4c\x43\x57','\x43\x4e\x76\x55\x73\x77\x71','\x41\x77\x35\x4b\x7a\x78\x47','\x41\x67\x39\x5a\x44\x61','\x43\x33\x62\x53\x41\x78\x71','\x76\x75\x66\x51\x76\x75\x38','\x79\x32\x48\x48\x44\x63\x35\x4a\x42\x32\x31\x57\x42\x67\x76\x30\x41\x77\x39\x55\x6c\x4d\x6e\x4f\x44\x77\x35\x52','\x79\x4b\x72\x67\x41\x4e\x71','\x43\x68\x76\x5a\x41\x61','\x7a\x67\x76\x30\x79\x77\x4c\x53\x43\x57','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x6a\x7a\x61','\x75\x65\x7a\x4c\x71\x75\x57','\x44\x67\x39\x56\x42\x65\x35\x48\x42\x77\x75','\x73\x65\x48\x49\x44\x65\x65','\x44\x4d\x44\x52\x75\x30\x53','\x79\x32\x39\x4b\x7a\x71','\x43\x4d\x76\x5a\x42\x32\x58\x32\x7a\x71','\x43\x67\x66\x59\x79\x77\x30','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x30\x42\x32\x39\x53','\x44\x4c\x44\x4e\x44\x4d\x30','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x62\x79\x33\x72\x50\x42\x32\x34','\x43\x75\x58\x73\x43\x32\x75','\x7a\x67\x76\x55\x45\x76\x62\x48\x44\x68\x72\x4c\x43\x4d\x35\x5a','\x41\x78\x72\x4c\x43\x4d\x66\x30\x42\x33\x69','\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\x32\x58\x4c\x79\x78\x69','\x76\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x57\x43\x4d\x76\x32\x41\x77\x39\x31\x43\x31\x39\x59\x7a\x78\x6e\x57\x42\x32\x35\x5a\x7a\x76\x39\x50\x7a\x64\x4f\x47','\x75\x4b\x50\x68\x79\x4c\x4b','\x7a\x4d\x31\x65\x74\x4d\x6d','\x42\x77\x66\x34','\x41\x33\x6e\x66\x75\x67\x38','\x77\x77\x54\x50\x77\x65\x4b','\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','\x76\x67\x4c\x71\x42\x67\x53','\x69\x67\x4c\x5a\x69\x67\x35\x56\x44\x63\x62\x48\x42\x49\x62\x48\x43\x4e\x6a\x48\x45\x71','\x79\x32\x39\x55\x44\x67\x4c\x55\x44\x77\x75','\x7a\x77\x35\x4a\x42\x32\x72\x50\x42\x4d\x44\x46\x7a\x4d\x39\x59\x42\x77\x66\x30','\x43\x32\x48\x50\x7a\x4e\x71','\x73\x32\x7a\x78\x75\x68\x75','\x43\x67\x66\x59\x44\x67\x35\x4c\x43\x4b\x4c\x4b','\x72\x4c\x62\x67\x72\x30\x38','\x41\x77\x35\x46\x43\x68\x6a\x56\x7a\x33\x6a\x4c\x43\x33\x6d','\x42\x4d\x39\x33','\x77\x32\x66\x31\x7a\x67\x4c\x30\x78\x71','\x44\x32\x44\x58\x73\x77\x30','\x42\x4d\x66\x54\x7a\x71','\x44\x67\x39\x56\x42\x65\x39\x31\x44\x68\x62\x31\x44\x65\x4c\x55\x7a\x67\x76\x34','\x45\x67\x66\x76\x73\x4d\x69','\x75\x67\x58\x70\x41\x65\x43','\x7a\x78\x48\x57\x41\x78\x6a\x4c','\x74\x67\x48\x52\x72\x75\x30','\x42\x4d\x76\x48\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','\x43\x32\x39\x31\x43\x4d\x6e\x4c','\x76\x67\x76\x4f\x42\x76\x43','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x50\x42\x4e\x62\x31\x44\x66\x39\x30\x45\x78\x62\x4c','\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','\x79\x32\x66\x55\x79\x32\x76\x53','\x44\x75\x39\x58\x43\x4b\x71','\x69\x67\x4c\x5a\x69\x67\x35\x56\x44\x63\x62\x48\x69\x68\x6e\x30\x43\x4d\x4c\x55\x7a\x57','\x76\x4b\x31\x69\x45\x4e\x79','\x44\x67\x39\x30\x79\x77\x58\x46\x44\x67\x39\x52\x7a\x77\x35\x5a','\x7a\x77\x35\x4b\x43\x31\x44\x50\x44\x67\x47','\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','\x69\x64\x34\x39\x69\x61','\x43\x33\x72\x48\x44\x68\x76\x5a','\x74\x76\x62\x56\x76\x4e\x75','\x43\x4e\x76\x55\x71\x4d\x76\x4d\x42\x33\x6a\x4c','\x75\x4e\x76\x55\x6c\x4d\x76\x32\x7a\x77\x35\x30\x43\x59\x47\x50\x69\x67\x31\x48\x45\x73\x62\x56\x42\x4d\x58\x35\x69\x67\x6a\x4c\x69\x67\x6e\x56\x42\x4e\x6e\x31\x42\x77\x76\x4b\x69\x67\x39\x55\x79\x32\x75\x55\x69\x65\x31\x31\x42\x68\x72\x50\x43\x67\x58\x4c\x69\x67\x4c\x30\x7a\x78\x6a\x48\x44\x67\x39\x59\x43\x59\x62\x56\x42\x49\x62\x30\x41\x67\x75\x47\x43\x32\x66\x54\x7a\x73\x62\x73\x44\x77\x34\x47\x43\x32\x48\x48\x43\x4d\x75\x47\x43\x33\x72\x48\x44\x67\x75\x47\x79\x77\x35\x4b\x69\x68\x44\x56\x44\x77\x58\x4b\x69\x67\x4c\x55\x44\x67\x76\x59\x42\x67\x76\x48\x44\x4d\x75\x56\x43\x33\x72\x4c\x79\x77\x57\x47\x7a\x78\x7a\x4c\x42\x4e\x72\x5a\x6c\x47','\x42\x4b\x54\x56\x44\x32\x4f','\x71\x76\x44\x58\x76\x77\x65','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53\x43\x57','\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','\x43\x30\x6a\x54\x74\x4b\x43','\x7a\x67\x39\x55\x7a\x71','\x41\x67\x39\x56\x41\x33\x6d','\x79\x4d\x58\x56\x79\x32\x53','\x43\x33\x72\x56\x43\x61','\x41\x77\x35\x57\x44\x78\x72\x46\x44\x67\x39\x52\x7a\x77\x35\x5a','\x45\x75\x72\x79\x41\x77\x69','\x79\x32\x66\x4a\x41\x67\x76\x4b\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x79\x30\x39\x35\x75\x4d\x69','\x41\x4d\x35\x71\x44\x65\x75','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x7a\x65\x66\x30','\x42\x67\x66\x49\x7a\x77\x57','\x73\x4d\x44\x6f\x42\x4c\x61','\x44\x77\x48\x68\x76\x4c\x61','\x74\x4d\x66\x64\x75\x78\x65','\x79\x77\x58\x53\x42\x33\x44\x6d\x41\x78\x6e\x30','\x42\x77\x39\x4b\x7a\x77\x58\x6a\x7a\x61','\x44\x67\x39\x56\x42\x63\x31\x50\x42\x4e\x7a\x56\x79\x32\x66\x30\x41\x77\x39\x55','\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','\x41\x32\x76\x35\x43\x57','\x79\x32\x48\x48\x41\x77\x35\x5a','\x75\x65\x6e\x73\x7a\x76\x69','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53','\x7a\x67\x76\x55\x45\x75\x58\x50\x43\x33\x71','\x79\x4d\x66\x5a\x7a\x74\x79\x30','\x79\x77\x58\x30','\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','\x7a\x77\x35\x6b\x75\x4b\x34','\x79\x32\x76\x50\x42\x67\x4c\x55\x7a\x57','\x6d\x74\x4b\x58\x6d\x4a\x69\x57\x6d\x33\x6a\x6a\x44\x75\x72\x4a\x43\x71','\x7a\x4d\x58\x56\x42\x33\x69','\x7a\x30\x4c\x67\x76\x66\x79','\x42\x77\x4c\x34\x7a\x77\x72\x46\x41\x77\x35\x57\x44\x78\x72\x46\x44\x68\x4c\x57\x7a\x78\x6d','\x44\x78\x6a\x53','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x69\x54\x44\x78\x6e\x4c\x6f\x47','\x43\x67\x4c\x72\x76\x4b\x43','\x79\x78\x6a\x50\x79\x75\x58\x48\x79\x4d\x76\x53','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x46\x44\x78\x6e\x4c','\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','\x79\x4d\x66\x30\x79\x32\x48\x46\x44\x67\x39\x56\x78\x32\x58\x48\x43\x4d\x44\x4c','\x44\x67\x39\x56\x42\x61','\x6d\x5a\x61\x35\x6d\x64\x43\x34\x6d\x66\x76\x6d\x77\x4c\x50\x67\x73\x61','\x76\x30\x4c\x6e\x74\x75\x4f','\x6f\x66\x6e\x41\x71\x4e\x62\x58\x77\x47','\x73\x77\x31\x49\x77\x78\x65','\x41\x4b\x35\x41\x43\x75\x43','\x75\x4e\x62\x75\x79\x32\x6d','\x74\x4d\x76\x65\x77\x4b\x43','\x79\x32\x39\x5a\x44\x63\x62\x4a\x79\x78\x61\x47\x43\x4d\x76\x48\x79\x32\x48\x4c\x7a\x64\x4f\x47','\x42\x66\x76\x76\x75\x65\x65','\x42\x33\x76\x30\x43\x68\x76\x30\x76\x67\x39\x52\x7a\x77\x35\x5a','\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','\x43\x33\x76\x4a\x79\x32\x76\x5a\x43\x57','\x79\x76\x6a\x73\x44\x31\x4b','\x7a\x4e\x6a\x56\x42\x71','\x79\x32\x66\x53\x42\x66\x39\x50\x7a\x61','\x42\x78\x76\x53\x44\x67\x4c\x54\x42\x32\x72\x48\x42\x61','\x79\x78\x6e\x5a\x41\x78\x6e\x30\x79\x77\x35\x30\x76\x67\x76\x34\x44\x61','\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6a\x4c\x69\x67\x76\x54\x43\x68\x72\x35','\x73\x66\x44\x35\x7a\x4d\x43','\x75\x31\x72\x73\x73\x68\x79','\x44\x75\x48\x70\x41\x32\x4f','\x76\x32\x48\x41\x79\x32\x47','\x44\x78\x6a\x50','\x6f\x74\x75\x5a\x6d\x64\x43\x32\x73\x32\x7a\x54\x75\x65\x6e\x6c','\x45\x76\x4c\x57\x75\x4d\x30','\x73\x75\x6a\x53\x41\x32\x69','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x7a\x67\x76\x4c\x75\x75\x57','\x78\x73\x35\x30\x45\x78\x62\x4c','\x43\x65\x39\x4d\x43\x30\x57','\x72\x66\x44\x4a\x72\x68\x71','\x45\x77\x31\x79\x41\x67\x4f','\x44\x77\x6a\x48\x73\x66\x75','\x7a\x4d\x4c\x53\x7a\x76\x39\x5a\x7a\x77\x66\x59\x79\x32\x47','\x41\x30\x58\x71\x42\x31\x71','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x35\x46\x79\x32\x66\x53\x42\x61','\x43\x32\x76\x5a\x43\x32\x4c\x56\x42\x49\x35\x31\x43\x67\x72\x48\x44\x67\x76\x4b','\x7a\x4c\x62\x50\x74\x67\x69','\x43\x33\x72\x59\x7a\x77\x66\x54','\x42\x78\x4c\x76\x73\x4e\x79','\x7a\x77\x31\x57\x44\x68\x4c\x46\x41\x77\x35\x57\x44\x78\x71','\x79\x32\x58\x56\x43\x32\x76\x4b','\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','\x7a\x4d\x58\x56\x79\x78\x71','\x42\x67\x66\x5a\x44\x66\x6a\x4c\x7a\x4d\x4c\x53\x42\x65\x31\x5a','\x42\x77\x66\x57','\x7a\x67\x66\x30\x79\x71','\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','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75\x55\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x76\x4b','\x77\x75\x50\x65\x75\x33\x65','\x79\x78\x6a\x4e\x44\x77\x31\x4c\x42\x4e\x72\x5a','\x44\x67\x76\x5a\x44\x61','\x41\x78\x6e\x62\x43\x4e\x6a\x48\x45\x71','\x43\x33\x72\x48\x43\x4e\x72\x71\x43\x4d\x39\x54\x41\x78\x6e\x4c','\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','\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','\x71\x4c\x44\x6a\x77\x75\x30','\x43\x33\x4c\x5a\x44\x67\x76\x54','\x44\x32\x76\x49\x78\x33\x6e\x4c\x79\x78\x6a\x4a\x41\x61','\x45\x66\x50\x52\x79\x4d\x57','\x45\x76\x62\x70\x45\x4d\x4b','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53\x78\x32\x4c\x4b','\x71\x32\x6a\x6e\x74\x75\x47','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x64\x79\x77\x58\x53\x43\x57','\x76\x67\x39\x56\x42\x63\x62\x30\x45\x78\x62\x4c\x69\x63\x69','\x79\x75\x54\x36\x74\x67\x4b','\x79\x78\x6a\x4e\x43\x57','\x72\x67\x4c\x54\x7a\x77\x35\x5a\x41\x77\x39\x55\x43\x59\x62\x54\x44\x78\x6e\x30\x69\x67\x6a\x4c\x69\x67\x65\x47\x43\x67\x39\x5a\x41\x78\x72\x50\x44\x4d\x75\x47\x41\x77\x35\x30\x7a\x77\x44\x4c\x43\x47','\x41\x67\x66\x35\x7a\x67\x79','\x44\x67\x4c\x54\x7a\x78\x6e\x30\x79\x77\x31\x57','\x74\x78\x72\x56\x45\x65\x75','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x66\x39\x4d\x41\x77\x58\x30\x7a\x78\x6a\x4c\x7a\x61','\x76\x32\x6a\x31\x7a\x4d\x53','\x7a\x67\x66\x55\x73\x67\x79','\x73\x77\x72\x36\x45\x78\x4f','\x43\x4d\x76\x48\x43\x32\x39\x55\x41\x77\x35\x4e\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x44\x67\x39\x56\x42\x68\x6d','\x72\x76\x76\x79\x41\x67\x71','\x76\x4d\x72\x59\x44\x66\x4f','\x42\x33\x76\x30\x43\x68\x76\x30','\x79\x77\x58\x53\x42\x33\x44\x67\x42\x47','\x76\x68\x4c\x6b\x43\x77\x79','\x44\x67\x39\x56\x42\x66\x39\x55\x79\x77\x31\x4c','\x43\x4e\x76\x55\x71\x77\x7a\x30\x7a\x78\x69','\x79\x77\x7a\x30\x7a\x78\x6a\x75\x42\x32\x39\x53\x71\x32\x66\x53\x42\x61','\x76\x66\x4c\x74\x44\x4b\x71','\x76\x4b\x76\x77\x76\x75\x75','\x69\x67\x4c\x5a\x69\x61','\x78\x31\x39\x59\x7a\x78\x6e\x57\x42\x32\x35\x5a\x7a\x78\x6e\x66\x45\x68\x72\x59\x79\x78\x6d','\x7a\x78\x6a\x59\x42\x33\x69','\x43\x4d\x76\x48\x43\x32\x39\x55\x41\x77\x35\x4e\x75\x67\x4c\x4c\x79\x32\x76\x5a','\x44\x78\x6e\x4c\x43\x4c\x62\x48\x43\x4e\x72\x5a','\x44\x67\x76\x34\x44\x61','\x77\x4d\x58\x6f\x44\x68\x65','\x43\x33\x76\x49\x42\x77\x4c\x30\x76\x67\x39\x56\x42\x65\x39\x31\x44\x68\x62\x31\x44\x68\x6d','\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','\x41\x78\x48\x6b\x7a\x4b\x57','\x44\x67\x50\x5a\x71\x4d\x79','\x7a\x77\x35\x6d\x71\x32\x65','\x44\x67\x39\x56\x42\x65\x4c\x55\x44\x4d\x39\x4a\x79\x78\x72\x50\x42\x32\x34','\x79\x77\x58\x53\x42\x33\x43','\x71\x30\x39\x6c\x71\x4e\x69','\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','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x76\x43\x32\x75','\x45\x76\x6e\x52\x75\x4b\x34','\x7a\x67\x4c\x54\x7a\x77\x35\x5a\x41\x77\x39\x55\x43\x57','\x43\x68\x6a\x50\x42\x33\x6a\x75\x44\x78\x6a\x55\x43\x57','\x45\x75\x44\x36\x41\x4e\x71','\x45\x76\x48\x51\x71\x4d\x4b','\x43\x67\x76\x55\x7a\x67\x4c\x55\x7a\x30\x6e\x48\x42\x67\x58\x5a','\x43\x75\x72\x71\x79\x4b\x79','\x44\x67\x39\x56\x42\x66\x6a\x4c\x43\x33\x76\x53\x44\x68\x6d','\x76\x77\x31\x73\x45\x4d\x57','\x77\x76\x6a\x41\x71\x32\x69','\x43\x4d\x66\x33','\x79\x32\x48\x31\x42\x4d\x54\x6a\x42\x4d\x72\x4c\x45\x61','\x43\x4d\x76\x48\x43\x32\x39\x55','\x7a\x65\x6a\x49\x7a\x4b\x71','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x34','\x7a\x75\x66\x30\x71\x4d\x69','\x79\x78\x6e\x5a\x41\x78\x6e\x30\x79\x77\x35\x30','\x72\x77\x66\x79\x42\x77\x71','\x77\x4d\x44\x62\x72\x67\x47','\x42\x67\x76\x55\x7a\x33\x72\x4f\x78\x32\x76\x34\x79\x32\x76\x4c\x7a\x67\x76\x4b','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x30\x42\x32\x54\x4c\x42\x4c\x39\x30\x45\x78\x62\x4c','\x41\x78\x72\x4c\x43\x4d\x66\x30\x42\x33\x6a\x64\x43\x4d\x76\x48\x44\x67\x76\x4b','\x77\x75\x7a\x57\x74\x32\x6d','\x72\x31\x7a\x70\x74\x76\x47','\x79\x32\x66\x55\x42\x4d\x39\x30\x69\x68\x6e\x30\x7a\x77\x76\x59\x69\x67\x65\x47','\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','\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','\x41\x77\x35\x4b\x7a\x78\x48\x70\x7a\x47','\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','\x45\x66\x66\x49\x75\x76\x4b','\x43\x33\x72\x59\x7a\x77\x66\x54\x69\x67\x76\x59\x43\x4d\x39\x59','\x43\x33\x72\x4c\x7a\x78\x69','\x44\x67\x76\x34\x44\x66\x62\x50\x7a\x77\x6e\x4c\x43\x57','\x41\x67\x66\x5a\x76\x78\x6e\x48\x7a\x32\x75','\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','\x43\x32\x58\x50\x79\x32\x75','\x7a\x4d\x39\x59\x42\x77\x66\x30','\x79\x32\x66\x53\x42\x65\x4c\x4b','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x63\x44\x77\x7a\x4d\x7a\x78\x69','\x44\x67\x76\x34\x44\x66\x39\x4a\x42\x32\x31\x57\x42\x67\x76\x30\x41\x77\x39\x55','\x41\x68\x72\x7a\x42\x76\x43','\x44\x78\x6e\x4c\x43\x47','\x41\x77\x35\x57\x44\x78\x71','\x7a\x66\x50\x59\x76\x33\x4f','\x79\x4d\x76\x4d\x42\x33\x6a\x4c','\x7a\x78\x7a\x4c\x42\x4e\x72\x5a','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x75\x32\x7a\x6c\x77\x4d\x75','\x77\x76\x6a\x48\x72\x67\x53','\x79\x77\x6e\x30\x41\x77\x39\x55','\x42\x33\x76\x30\x43\x68\x76\x30\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x44\x67\x66\x59\x7a\x32\x76\x30','\x7a\x67\x58\x62\x72\x30\x43','\x79\x4d\x76\x4d\x42\x33\x6a\x4c\x76\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x57','\x41\x4d\x39\x50\x42\x47','\x7a\x77\x39\x34\x74\x67\x79','\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','\x43\x68\x6a\x4c\x44\x4d\x4c\x56\x44\x78\x6e\x73\x7a\x78\x6e\x57\x42\x32\x35\x5a\x7a\x75\x4c\x4b','\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','\x7a\x77\x35\x4b\x43\x67\x39\x50\x42\x4e\x71','\x42\x30\x4c\x78\x72\x66\x69','\x79\x30\x54\x4a\x71\x76\x47','\x41\x67\x66\x55\x7a\x67\x58\x4c\x76\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x57','\x43\x4d\x76\x48\x43\x32\x39\x55\x41\x77\x35\x4e','\x73\x68\x48\x4f\x41\x65\x4f','\x6d\x5a\x6d\x35\x6e\x74\x72\x57\x79\x78\x48\x57\x45\x4e\x43','\x73\x4b\x7a\x57\x71\x4b\x65','\x41\x4b\x7a\x69\x43\x65\x43','\x6d\x74\x69\x35\x6f\x64\x69\x5a\x6e\x66\x72\x34\x45\x76\x6a\x54\x76\x71','\x6d\x4e\x57\x58\x46\x64\x72\x38\x6d\x33\x57\x57','\x73\x4e\x72\x73\x76\x4e\x4b','\x41\x78\x6e\x6a\x42\x4e\x72\x4c\x7a\x32\x76\x59','\x43\x75\x35\x78\x73\x78\x43','\x79\x32\x39\x4b\x7a\x76\x39\x50\x42\x4e\x72\x4c\x43\x4e\x62\x59\x7a\x78\x72\x4c\x43\x47','\x45\x4b\x48\x52\x7a\x30\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','\x7a\x4d\x66\x50\x42\x67\x76\x4b','\x44\x76\x62\x67\x73\x78\x4f','\x42\x4e\x6a\x6f\x76\x77\x43','\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','\x74\x4d\x50\x31\x75\x67\x65','\x43\x4d\x39\x53\x7a\x71','\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\x75\x35\x6d\x42\x33\x4f','\x75\x75\x48\x6c\x7a\x4c\x61','\x43\x33\x72\x48\x43\x4e\x71','\x41\x77\x35\x4d\x42\x57','\x75\x31\x44\x55\x45\x75\x57','\x42\x78\x6e\x4e\x78\x57','\x43\x75\x72\x41\x76\x66\x65','\x6d\x4a\x71\x57\x6f\x64\x6d\x35\x7a\x4d\x50\x36\x7a\x65\x58\x52','\x43\x30\x50\x54\x44\x4d\x65','\x77\x77\x6e\x72\x44\x30\x34','\x44\x32\x66\x59\x42\x47','\x43\x4c\x50\x30\x75\x76\x71','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x43\x4d\x76\x5a\x43\x67\x39\x55\x43\x32\x75','\x43\x78\x76\x4c\x43\x4e\x4b','\x74\x76\x6e\x59\x71\x75\x71','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x43\x4e\x6e\x46\x6d\x61','\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','\x71\x4d\x54\x4e\x79\x4d\x71','\x43\x4d\x76\x5a\x44\x77\x58\x30','\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','\x43\x33\x72\x59\x41\x77\x35\x4e','\x41\x77\x31\x48\x7a\x32\x76\x46\x44\x78\x6a\x53','\x45\x4d\x39\x52\x44\x67\x75','\x7a\x4d\x66\x50\x42\x68\x76\x59\x7a\x71','\x43\x68\x6a\x56\x42\x78\x62\x30\x78\x33\x72\x56\x41\x32\x76\x55\x43\x57','\x7a\x67\x76\x53\x44\x67\x65','\x7a\x68\x6a\x50\x44\x4d\x76\x74\x44\x68\x6a\x4c\x79\x77\x30','\x7a\x65\x48\x50\x79\x76\x47','\x41\x32\x76\x4f\x76\x65\x53','\x44\x67\x39\x56\x42\x66\x39\x59\x7a\x78\x6e\x31\x42\x68\x71','\x73\x30\x6a\x59\x73\x65\x53','\x44\x4d\x66\x53\x44\x77\x75','\x44\x32\x66\x50\x44\x67\x76\x59\x43\x57','\x42\x33\x76\x30\x79\x32\x39\x54\x7a\x71','\x44\x68\x6a\x48\x42\x4e\x6e\x50\x44\x67\x4c\x56\x42\x47','\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','\x43\x4d\x76\x4d\x44\x78\x6e\x48\x42\x61','\x43\x78\x76\x4c\x44\x77\x75','\x79\x32\x66\x55\x79\x32\x76\x53\x75\x4d\x76\x58\x44\x77\x76\x5a\x44\x67\x76\x4b','\x41\x77\x35\x32\x79\x77\x58\x50\x7a\x66\x39\x4b\x41\x77\x31\x4c\x42\x4e\x6e\x50\x42\x32\x35\x5a','\x7a\x32\x76\x30','\x76\x33\x4c\x4e\x41\x30\x38','\x75\x4d\x35\x4d\x42\x33\x75','\x42\x77\x39\x4b\x7a\x77\x58\x46\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x71','\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','\x7a\x4d\x58\x48\x44\x65\x31\x48\x43\x61','\x75\x4d\x31\x6c\x74\x75\x47','\x43\x32\x4c\x36\x7a\x71','\x75\x76\x66\x76\x71\x4d\x38','\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\x66\x53\x7a\x4d\x39\x59\x42\x77\x76\x4b\x69\x67\x66\x5a\x43\x32\x4c\x5a\x44\x67\x66\x55\x44\x63\x62\x30\x42\x32\x39\x53\x78\x32\x6e\x48\x42\x67\x57\x47\x79\x78\x71\x47\x41\x77\x35\x4b\x7a\x78\x47\x47','\x44\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x4d\x79\x77\x4c\x53\x44\x78\x6a\x4c','\x44\x4c\x7a\x31\x42\x4d\x69','\x74\x65\x7a\x6b\x43\x77\x4f','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x78\x6e\x46\x79\x77\x6e\x30\x41\x77\x39\x55','\x42\x77\x35\x34\x77\x77\x38','\x44\x67\x39\x74\x44\x68\x6a\x50\x42\x4d\x43','\x6d\x4a\x61\x31\x71\x4d\x35\x48\x77\x4c\x44\x36','\x43\x32\x39\x54\x7a\x71','\x76\x4b\x44\x33\x71\x75\x43','\x45\x4d\x39\x6e\x71\x4e\x43','\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','\x7a\x66\x6e\x6f\x74\x30\x4b','\x43\x78\x76\x4c\x44\x77\x76\x4b','\x41\x30\x48\x51\x42\x4e\x75','\x43\x32\x4c\x55\x41\x57','\x44\x67\x39\x52\x7a\x77\x34','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x78\x6a\x46\x79\x32\x66\x53\x42\x61','\x42\x77\x39\x4b\x7a\x77\x57','\x44\x33\x62\x59\x73\x67\x38','\x43\x67\x66\x5a\x43\x57','\x43\x33\x72\x59\x41\x77\x6e\x30','\x7a\x75\x50\x66\x7a\x4b\x4f','\x41\x77\x35\x57\x44\x78\x72\x46\x79\x78\x76\x4b\x41\x77\x38','\x79\x31\x48\x76\x44\x65\x69','\x44\x68\x6a\x50\x42\x71','\x44\x4d\x66\x59\x41\x77\x66\x55\x44\x61','\x44\x77\x35\x5a\x44\x78\x62\x57\x42\x33\x6a\x30\x7a\x77\x72\x46\x44\x67\x39\x56\x42\x61','\x43\x32\x76\x30','\x44\x32\x6a\x4d\x74\x33\x43','\x72\x65\x6a\x4a\x73\x4e\x65','\x7a\x4d\x6e\x4c\x44\x30\x38','\x41\x67\x50\x30\x7a\x66\x43','\x44\x67\x39\x56\x42\x66\x39\x50\x42\x4e\x7a\x56\x79\x32\x66\x30\x41\x77\x39\x55','\x43\x4d\x39\x79\x45\x78\x47','\x42\x33\x62\x4c\x42\x47','\x44\x67\x39\x6d\x42\x33\x44\x4c\x43\x4b\x6e\x48\x43\x32\x75','\x72\x68\x48\x31\x71\x77\x79','\x79\x78\x76\x30\x42\x57','\x42\x32\x35\x74\x44\x67\x66\x30\x44\x78\x6e\x64\x41\x67\x66\x55\x7a\x32\x75','\x79\x4e\x76\x4d\x7a\x4d\x76\x59','\x79\x75\x76\x54\x41\x76\x79','\x7a\x78\x48\x57\x41\x78\x6a\x4c\x7a\x61','\x6d\x74\x43\x59\x6d\x4a\x72\x6a\x41\x67\x54\x67\x73\x66\x65','\x44\x67\x39\x56\x42\x68\x6e\x42','\x44\x78\x6e\x48\x7a\x32\x75','\x7a\x32\x76\x30\x75\x68\x6a\x50\x42\x33\x6a\x75\x44\x78\x6a\x55\x43\x57','\x44\x67\x39\x56\x42\x65\x6e\x48\x42\x67\x58\x5a','\x72\x4e\x66\x55\x74\x76\x43','\x79\x32\x66\x55\x79\x32\x76\x53\x42\x67\x76\x4b','\x73\x4c\x6e\x75\x42\x32\x43','\x75\x4d\x48\x51\x79\x78\x71','\x42\x4d\x76\x4e\x76\x76\x75','\x43\x33\x76\x4a\x79\x32\x76\x4c\x7a\x67\x76\x4b','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x42\x32\x6a\x51\x7a\x77\x6e\x30','\x41\x75\x76\x50\x45\x68\x71','\x42\x33\x76\x30\x43\x68\x76\x30\x78\x33\x72\x4c\x45\x68\x71','\x75\x76\x4c\x62\x75\x65\x75','\x44\x68\x4c\x57\x7a\x71','\x69\x68\x6a\x31\x42\x47','\x79\x4e\x62\x66\x43\x4c\x61','\x41\x30\x48\x59\x44\x77\x34','\x7a\x78\x62\x4c\x42\x30\x34','\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x76\x4b'];a0_0x4e17=function(){return _0x375448;};return a0_0x4e17();}const SUPPORTED_TOOL_TYPES=new Set([a0_0x5bb0d7(0x282),a0_0x5bb0d7(0x350),a0_0x5bb0d7(0x2bd),a0_0x5bb0d7(0x246),a0_0x5bb0d7(0x2c6)]),REJECTED_TOOL_TYPES=new Set([a0_0x5bb0d7(0x22d)]);var ResponsesValidationError=class extends Error{[a0_0x5bb0d7(0x335)]=a0_0x5bb0d7(0x2ae);[a0_0x5bb0d7(0x387)];[a0_0x5bb0d7(0x389)];constructor(_0x4eb55c,_0x27b9bd,_0x45814b){const _0x1d8354=a0_0x5bb0d7;super(_0x4eb55c),this[_0x1d8354(0x3a6)]=_0x1d8354(0x1fd),this[_0x1d8354(0x387)]=_0x27b9bd,this[_0x1d8354(0x389)]=_0x45814b;}};function validateResponsesRequest(_0x150ef6){const _0x5e1d6f=a0_0x5bb0d7,_0x87da63={'\x6c\x55\x55\x50\x41':function(_0x178c6a,_0x29bd65){return _0x178c6a<_0x29bd65;},'\x66\x63\x72\x72\x69':_0x5e1d6f(0x2dd),'\x7a\x48\x6b\x67\x4c':_0x5e1d6f(0x315)},_0x5eaf75=_0x150ef6[_0x5e1d6f(0x258)];if(!_0x5eaf75||_0x5eaf75[_0x5e1d6f(0x226)]===0x0)return;for(let _0x5000fc=0x0;_0x87da63[_0x5e1d6f(0x214)](_0x5000fc,_0x5eaf75[_0x5e1d6f(0x226)]);_0x5000fc++){const _0x5bb105=_0x5eaf75[_0x5000fc][_0x5e1d6f(0x335)];if(typeof _0x5bb105!==_0x87da63[_0x5e1d6f(0x373)])throw new ResponsesValidationError(_0x5e1d6f(0x326)+_0x5000fc+'\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',_0x5e1d6f(0x38b),_0x5e1d6f(0x326)+_0x5000fc+'\x5d\x2e\x74\x79\x70\x65');if(REJECTED_TOOL_TYPES['\x68\x61\x73'](_0x5bb105))throw new ResponsesValidationError('\x54\x6f\x6f\x6c\x20\x74\x79\x70\x65\x20\x22'+_0x5bb105+'\x22\x20\x69\x73\x20\x6e\x6f\x74\x20\x73\x75\x70\x70\x6f\x72\x74\x65\x64\x20\x62\x79\x20\x74\x68\x69\x73\x20\x65\x6e\x64\x70\x6f\x69\x6e\x74',_0x87da63[_0x5e1d6f(0x2be)],'\x74\x6f\x6f\x6c\x73\x5b'+_0x5000fc+'\x5d\x2e\x74\x79\x70\x65');if(!SUPPORTED_TOOL_TYPES[_0x5e1d6f(0x370)](_0x5bb105))throw new ResponsesValidationError(_0x5e1d6f(0x24c)+_0x5bb105+'\x22\x20\x69\x73\x20\x6e\x6f\x74\x20\x72\x65\x63\x6f\x67\x6e\x69\x7a\x65\x64','\x75\x6e\x73\x75\x70\x70\x6f\x72\x74\x65\x64\x5f\x74\x6f\x6f\x6c',_0x5e1d6f(0x326)+_0x5000fc+_0x5e1d6f(0x228));}}function buildResponseShell(_0x59b9c9){const _0x43383c=a0_0x5bb0d7,_0xf147ba={'\x56\x64\x72\x74\x5a':_0x43383c(0x2d4),'\x7a\x44\x66\x74\x6f':_0x43383c(0x33a)},_0x4308e8=_0x59b9c9[_0x43383c(0x25b)][_0x43383c(0x2d7)](_0x5d8056=>_0x5d8056[_0x43383c(0x335)]===_0x43383c(0x38a))[_0x43383c(0x2f6)](_0x13171c=>_0x13171c[_0x43383c(0x2d3)])[_0x43383c(0x2d7)](_0x40c8c3=>_0x40c8c3[_0x43383c(0x335)]===_0x43383c(0x333))[_0x43383c(0x239)](_0x523f9e=>_0x523f9e['\x74\x65\x78\x74'])[_0x43383c(0x2aa)]('');return{'\x69\x64':_0x59b9c9['\x69\x64'],'\x6f\x62\x6a\x65\x63\x74':_0xf147ba[_0x43383c(0x25a)],'\x63\x72\x65\x61\x74\x65\x64\x5f\x61\x74':_0x59b9c9['\x63\x72\x65\x61\x74\x65\x64\x41\x74'],'\x6f\x75\x74\x70\x75\x74\x5f\x74\x65\x78\x74':_0x4308e8,'\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':_0x59b9c9['\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':_0x59b9c9[_0x43383c(0x30c)],'\x6f\x75\x74\x70\x75\x74':_0x59b9c9[_0x43383c(0x25b)],'\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':_0x43383c(0x320),'\x74\x6f\x6f\x6c\x73':[],'\x74\x6f\x70\x5f\x70':null,'\x73\x74\x61\x74\x75\x73':_0xf147ba['\x7a\x44\x66\x74\x6f'],'\x75\x73\x61\x67\x65':_0x59b9c9['\x75\x73\x61\x67\x65'],'\x70\x72\x65\x76\x69\x6f\x75\x73\x5f\x72\x65\x73\x70\x6f\x6e\x73\x65\x5f\x69\x64':_0x59b9c9[_0x43383c(0x2ad)]??null};}function createTranslatorContext(_0x57473a){const _0x5e179d=a0_0x5bb0d7,_0x2c9273={'\x6c\x71\x77\x78\x63':function(_0x32b6a4,_0x24fb6d){return _0x32b6a4/_0x24fb6d;}};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[_0x5e179d(0x201)](_0x2c9273[_0x5e179d(0x360)](Date[_0x5e179d(0x3a3)](),0x3e8)),..._0x57473a};}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};
|