@tangle-network/sandbox 0.4.3 → 0.4.4

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.
@@ -0,0 +1,292 @@
1
+ //#region src/intelligence/index.d.ts
2
+ /**
3
+ * `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
4
+ * hosted trace-read surface on Tangle Intelligence
5
+ * (`https://intelligence.tangle.tools`, default port 3030).
6
+ *
7
+ * This is a SEPARATE host from the Sandbox API. The SDK's `IntelligenceClient`
8
+ * (exposed as `client.intelligence`) routes intelligence-*report* calls through
9
+ * `SandboxClient.fetch` against the **sandbox** `baseUrl` — that is the
10
+ * sandbox-api intelligence-report surface, a different service. The trace-read
11
+ * routes (`/v1/traces`, `/v1/runs*`, `/v1/sessions*`) live on intelligence-api
12
+ * and are tenant-scoped by the customer key, so this client does NOT reuse
13
+ * `SandboxClient.fetch`; it carries its own intelligence-host base URL.
14
+ *
15
+ * Auth is the customer key (`sk-tan-*`) sent as `Authorization: Bearer ...`;
16
+ * the platform resolves it to the caller's tenant and filters `tenant_id`
17
+ * first and unconditionally on every route, so a cross-tenant id returns an
18
+ * empty result or 404, never the row.
19
+ *
20
+ * Nothing here uses a Node API — `globalThis.fetch` only — so it runs in the
21
+ * browser, Cloudflare Workers, Deno, and Node 20+ unchanged. The base URL must
22
+ * be supplied by the caller (e.g. from `TANGLE_INTELLIGENCE_BASE_URL`) or it
23
+ * falls back to the production host.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * import { createIntelligenceClient } from "@tangle-network/sandbox/intelligence";
28
+ *
29
+ * const intel = createIntelligenceClient({
30
+ * apiKey: process.env.TANGLE_API_KEY!,
31
+ * baseUrl: process.env.TANGLE_INTELLIGENCE_BASE_URL,
32
+ * });
33
+ *
34
+ * const { items } = await intel.listTraces({ status: "ERROR", limit: 20 });
35
+ * for await (const span of intel.iterateTraceSpans(items[0].traceId)) {
36
+ * console.log(span.name, span.durationMs);
37
+ * }
38
+ * ```
39
+ *
40
+ * @packageDocumentation
41
+ */
42
+ /**
43
+ * Production intelligence-api host. Mirrors the api-side
44
+ * `DEFAULT_INTELLIGENCE_BASE_URL` so the SDK default and the server default
45
+ * never drift.
46
+ */
47
+ declare const DEFAULT_INTELLIGENCE_BASE_URL = "https://intelligence.tangle.tools";
48
+ interface IntelligenceClientConfig {
49
+ /** Tangle customer API key (`sk-tan-*`). Sent as `Authorization: Bearer ...`. */
50
+ apiKey: string;
51
+ /**
52
+ * Intelligence-api base URL. Defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
53
+ * Pass `TANGLE_INTELLIGENCE_BASE_URL` here to point at a non-prod host; do NOT
54
+ * pass the sandbox `baseUrl` — these routes live on a different service.
55
+ */
56
+ baseUrl?: string;
57
+ /** Per-request timeout. Default: 30000 (30s). */
58
+ timeoutMs?: number;
59
+ }
60
+ /**
61
+ * A bigint nanosecond timestamp rendered as a decimal string — JSON cannot
62
+ * carry a bigint, so the wire format is the same OTLP-JSON decimal-string
63
+ * convention the service accepts on ingest.
64
+ */
65
+ type NanoString = string;
66
+ /** Trace status filter: `ERROR` = the trace has ≥1 error span; `OK` = none. */
67
+ type TraceStatus = "ERROR" | "OK";
68
+ /** One row of the tenant-wide trace explorer (`GET /v1/traces`). */
69
+ interface TraceSummary {
70
+ traceId: string;
71
+ spanCount: number;
72
+ startUnixNano: NanoString;
73
+ endUnixNano: NanoString;
74
+ /** `(maxEnd - minStart) / 1e6`. */
75
+ durationMs: number;
76
+ errorCount: number;
77
+ /** Null (never 0) when no span in the trace was priced. */
78
+ costUsd: number | null;
79
+ inputTokens: number | null;
80
+ outputTokens: number | null;
81
+ /** Name of the earliest span by `start_unix_nano`. */
82
+ rootName: string | null;
83
+ /** Model of the earliest span by `start_unix_nano`. */
84
+ model: string | null;
85
+ runId: string | null;
86
+ }
87
+ /** A page of trace summaries plus the keyset cursor for the next page. */
88
+ interface TraceSummaryList {
89
+ items: TraceSummary[];
90
+ /** Opaque cursor for the next page; `null` at the end of the stream. */
91
+ nextCursor: string | null;
92
+ }
93
+ /**
94
+ * One trace-span row on the wire — every stored column passed through, the two
95
+ * bigint nano columns rendered as decimal strings. Already redacted at ingest.
96
+ */
97
+ interface SerializedSpan {
98
+ /** Span PK, `<traceId>:<spanId>`. */
99
+ id: string;
100
+ tenantId: string;
101
+ traceId: string;
102
+ parentSpanId: string | null;
103
+ name: string;
104
+ startUnixNano: NanoString;
105
+ endUnixNano: NanoString;
106
+ /** Redacted-at-ingest span attribute bag. */
107
+ attributes: Record<string, unknown>;
108
+ events: Array<Record<string, unknown>> | null;
109
+ statusCode: string | null;
110
+ statusMessage: string | null;
111
+ redactionVersion: string | null;
112
+ model: string | null;
113
+ inputTokens: number | null;
114
+ outputTokens: number | null;
115
+ /** `numeric(12,6)` as a string; `null` when the model is unpriced. */
116
+ costUsd: string | null;
117
+ runId: string | null;
118
+ scenarioId: string | null;
119
+ generation: number | null;
120
+ cellId: string | null;
121
+ sessionId: string | null;
122
+ threadId: string | null;
123
+ userId: string | null;
124
+ receivedAt: string;
125
+ }
126
+ /** A keyset page of one trace's spans plus its full span count. */
127
+ interface SpanPage {
128
+ items: SerializedSpan[];
129
+ /** True when the trace's total span count exceeds one page. */
130
+ truncated: boolean;
131
+ /** The trace's full span count, independent of the page. */
132
+ total: number;
133
+ /** Opaque cursor for the next page; `null` at the end of the trace. */
134
+ nextCursor: string | null;
135
+ }
136
+ /** A bounded window of a run's spans (run-pivoted reads are not paginated). */
137
+ interface RunSpanWindow {
138
+ items: SerializedSpan[];
139
+ truncated: boolean;
140
+ total: number;
141
+ }
142
+ /**
143
+ * An eval-run row. Numeric metrics are numeric columns rendered as strings.
144
+ * `additionalProperties` on the wire — the row carries more columns than the
145
+ * documented core, so the type is open.
146
+ */
147
+ interface Run {
148
+ id: string;
149
+ tenantId: string;
150
+ runDir: string | null;
151
+ status: string;
152
+ gateDecision: string | null;
153
+ totalCostUsd: string | null;
154
+ totalDurationMs: number | null;
155
+ holdoutLift: string | null;
156
+ labels: Record<string, unknown> | null;
157
+ receivedAt: string;
158
+ [key: string]: unknown;
159
+ }
160
+ /** A page of eval-runs. Offset is legacy; follow `nextCursor` to paginate. */
161
+ interface RunList {
162
+ items: Run[];
163
+ limit: number;
164
+ offset: number;
165
+ nextCursor: string | null;
166
+ }
167
+ /** One row of the tenant-wide session explorer (`GET /v1/sessions`). */
168
+ interface SessionSummary {
169
+ sessionId: string;
170
+ traceCount: number;
171
+ spanCount: number;
172
+ firstSeen: string;
173
+ lastSeen: string;
174
+ /** Null (never 0) when no span in the session was priced. */
175
+ totalCostUsd: number | null;
176
+ errorCount: number;
177
+ userId: string | null;
178
+ }
179
+ /** A page of session summaries plus the keyset cursor for the next page. */
180
+ interface SessionSummaryList {
181
+ items: SessionSummary[];
182
+ nextCursor: string | null;
183
+ }
184
+ /** Query params for {@link IntelligenceClient.listTraces}. */
185
+ interface ListTracesParams {
186
+ /** Page size, clamped server-side to `[1, 200]` (default 50). */
187
+ limit?: number;
188
+ /** ISO-8601 lower bound on `received_at` (inclusive). */
189
+ from?: string;
190
+ /** ISO-8601 upper bound on `received_at` (inclusive). */
191
+ to?: string;
192
+ /** Case-insensitive substring over span name (matches if ANY span matches). */
193
+ q?: string;
194
+ /** Exact model match (matches if any span carried this model). */
195
+ model?: string;
196
+ /** Exact `run_id` match. */
197
+ runId?: string;
198
+ /** `ERROR` = ≥1 error span; `OK` = no error span anywhere in the trace. */
199
+ status?: TraceStatus;
200
+ /** Opaque cursor from the prior response's `nextCursor`. */
201
+ cursor?: string;
202
+ }
203
+ /** Query params for {@link IntelligenceClient.getTraceSpans}. */
204
+ interface GetTraceSpansParams {
205
+ /** Page size, clamped server-side to `INTELLIGENCE_TRACE_SPAN_LIMIT`. */
206
+ limit?: number;
207
+ /** Opaque cursor over `(start_unix_nano, span id)` from the prior page. */
208
+ cursor?: string;
209
+ }
210
+ /** Query params for {@link IntelligenceClient.listRuns}. */
211
+ interface ListRunsParams {
212
+ limit?: number;
213
+ /** Legacy offset pagination; ignored once `cursor` is supplied. */
214
+ offset?: number;
215
+ status?: "started" | "baseline-complete" | "generation-complete" | "gate-decided" | "finished" | "errored";
216
+ gate?: "ship" | "hold" | "need_more_work" | "model_ceiling" | "arch_ceiling";
217
+ /** Case-insensitive substring over `run_dir`. */
218
+ q?: string;
219
+ from?: string;
220
+ to?: string;
221
+ /** `key:value` over the run's labels jsonb. */
222
+ label?: string;
223
+ cursor?: string;
224
+ }
225
+ /** Query params for {@link IntelligenceClient.listSessions}. */
226
+ interface ListSessionsParams {
227
+ limit?: number;
228
+ from?: string;
229
+ to?: string;
230
+ /** Case-insensitive substring over `session_id`. */
231
+ q?: string;
232
+ /** Exact end-user match (`user_id` span column). */
233
+ userId?: string;
234
+ cursor?: string;
235
+ }
236
+ /** Query params for {@link IntelligenceClient.getSessionTraces}. */
237
+ interface GetSessionTracesParams {
238
+ limit?: number;
239
+ cursor?: string;
240
+ }
241
+ /**
242
+ * Browser-safe typed client for the Tangle Intelligence trace-read surface.
243
+ * Construct via {@link createIntelligenceClient}.
244
+ */
245
+ interface IntelligenceClient {
246
+ /** List tenant-wide trace summaries (one row per trace), newest first. */
247
+ listTraces(params?: ListTracesParams): Promise<TraceSummaryList>;
248
+ /** List one trace's spans, keyset-paginated. */
249
+ getTraceSpans(traceId: string, params?: GetTraceSpansParams): Promise<SpanPage>;
250
+ /**
251
+ * Stream the FULL span set of one trace as NDJSON. The returned
252
+ * `ReadableStream` yields the raw bytes (one JSON span per line); decode it
253
+ * yourself, or use {@link iterateTraceSpans} to walk parsed spans page by
254
+ * page without the bulk endpoint.
255
+ */
256
+ exportTraceSpansNdjson(traceId: string): Promise<ReadableStream<Uint8Array>>;
257
+ /** List the tenant's eval-runs, newest first. */
258
+ listRuns(params?: ListRunsParams): Promise<RunList>;
259
+ /** Fetch a single eval-run. */
260
+ getRun(runId: string): Promise<Run>;
261
+ /** List the spans pivoted to this run (by `run_id`), bounded window. */
262
+ getRunTraces(runId: string): Promise<RunSpanWindow>;
263
+ /** List tenant-wide session summaries (one row per session), newest first. */
264
+ listSessions(params?: ListSessionsParams): Promise<SessionSummaryList>;
265
+ /** List one session's traces as the trace-summary shape, keyset-paginated. */
266
+ getSessionTraces(sessionId: string, params?: GetSessionTracesParams): Promise<TraceSummaryList>;
267
+ /**
268
+ * Async iterator over the spans of one trace, following the keyset cursor
269
+ * page by page so a trace larger than one page is walkable end-to-end
270
+ * without the NDJSON bulk endpoint.
271
+ */
272
+ iterateTraceSpans(traceId: string, params?: GetTraceSpansParams): AsyncGenerator<SerializedSpan, void, unknown>;
273
+ /**
274
+ * Async iterator over every trace summary, following `nextCursor` page by
275
+ * page until the stream ends.
276
+ */
277
+ iterateTraces(params?: ListTracesParams): AsyncGenerator<TraceSummary, void, unknown>;
278
+ /**
279
+ * Async iterator over every session summary, following `nextCursor` page by
280
+ * page until the stream ends.
281
+ */
282
+ iterateSessions(params?: ListSessionsParams): AsyncGenerator<SessionSummary, void, unknown>;
283
+ }
284
+ /**
285
+ * Create a browser-safe client for the Tangle Intelligence trace-read surface.
286
+ *
287
+ * @param config.apiKey Customer key (`sk-tan-*`) — Bearer auth, resolved to a tenant.
288
+ * @param config.baseUrl Intelligence-api host; defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
289
+ */
290
+ declare function createIntelligenceClient(config: IntelligenceClientConfig): IntelligenceClient;
291
+ //#endregion
292
+ export { DEFAULT_INTELLIGENCE_BASE_URL, GetSessionTracesParams, GetTraceSpansParams, IntelligenceClient, IntelligenceClientConfig, ListRunsParams, ListSessionsParams, ListTracesParams, NanoString, Run, RunList, RunSpanWindow, SerializedSpan, SessionSummary, SessionSummaryList, SpanPage, TraceStatus, TraceSummary, TraceSummaryList, createIntelligenceClient };
@@ -0,0 +1 @@
1
+ const a0_0x18f440=a0_0x2b66;function a0_0x2b66(_0x24e3d7,_0x1a0220){_0x24e3d7=_0x24e3d7-0x111;const _0x47946f=a0_0x4794();let _0x2b663f=_0x47946f[_0x24e3d7];if(a0_0x2b66['\x71\x74\x6d\x44\x6d\x6b']===undefined){var _0x4187b7=function(_0x117957){const _0x430f65='\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 _0x140ff1='',_0x477738='';for(let _0x2a845d=0x0,_0x514bfe,_0x216044,_0x2e007f=0x0;_0x216044=_0x117957['\x63\x68\x61\x72\x41\x74'](_0x2e007f++);~_0x216044&&(_0x514bfe=_0x2a845d%0x4?_0x514bfe*0x40+_0x216044:_0x216044,_0x2a845d++%0x4)?_0x140ff1+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x514bfe>>(-0x2*_0x2a845d&0x6)):0x0){_0x216044=_0x430f65['\x69\x6e\x64\x65\x78\x4f\x66'](_0x216044);}for(let _0x37edd6=0x0,_0x3e5e09=_0x140ff1['\x6c\x65\x6e\x67\x74\x68'];_0x37edd6<_0x3e5e09;_0x37edd6++){_0x477738+='\x25'+('\x30\x30'+_0x140ff1['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x37edd6)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x477738);};a0_0x2b66['\x6d\x63\x62\x72\x44\x77']=_0x4187b7,a0_0x2b66['\x72\x50\x70\x65\x61\x79']={},a0_0x2b66['\x71\x74\x6d\x44\x6d\x6b']=!![];}const _0x36a9dc=_0x47946f[0x0],_0x1e961f=_0x24e3d7+_0x36a9dc,_0x290723=a0_0x2b66['\x72\x50\x70\x65\x61\x79'][_0x1e961f];return!_0x290723?(_0x2b663f=a0_0x2b66['\x6d\x63\x62\x72\x44\x77'](_0x2b663f),a0_0x2b66['\x72\x50\x70\x65\x61\x79'][_0x1e961f]=_0x2b663f):_0x2b663f=_0x290723,_0x2b663f;}(function(_0x16c952,_0x3d6040){const _0x23bf4a=a0_0x2b66,_0x3d683e=_0x16c952();while(!![]){try{const _0x4376f5=-parseInt(_0x23bf4a(0x152))/0x1+-parseInt(_0x23bf4a(0x117))/0x2*(parseInt(_0x23bf4a(0x155))/0x3)+-parseInt(_0x23bf4a(0x112))/0x4*(parseInt(_0x23bf4a(0x13e))/0x5)+-parseInt(_0x23bf4a(0x11f))/0x6+-parseInt(_0x23bf4a(0x145))/0x7+-parseInt(_0x23bf4a(0x12f))/0x8*(-parseInt(_0x23bf4a(0x134))/0x9)+parseInt(_0x23bf4a(0x13c))/0xa;if(_0x4376f5===_0x3d6040)break;else _0x3d683e['push'](_0x3d683e['shift']());}catch(_0x3ee8b3){_0x3d683e['push'](_0x3d683e['shift']());}}}(a0_0x4794,0xdbd89));import{f as a0_0x19e972,r as a0_0x480284,u as a0_0xe7fdff}from'\x2e\x2e\x2f\x65\x72\x72\x6f\x72\x73\x2d\x43\x6c\x6a\x69\x47\x52\x5f\x5f\x2e\x6a\x73';function a0_0x4794(){const _0x2c35d2=['\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x73\x4c\x44\x54\x77\x77\x79','\x7a\x75\x72\x36\x7a\x75\x34','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x7a\x4d\x76\x30\x79\x32\x47','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x59\x38','\x42\x68\x44\x35\x71\x30\x4b','\x6c\x33\x6e\x57\x79\x77\x35\x5a','\x6d\x5a\x43\x32\x7a\x33\x48\x53\x43\x33\x6e\x36','\x79\x31\x76\x4d\x74\x4d\x69','\x72\x4e\x62\x64\x75\x30\x30','\x43\x32\x4c\x36\x7a\x71','\x75\x65\x44\x55\x44\x75\x53','\x6e\x74\x65\x59\x6f\x74\x66\x76\x71\x75\x50\x58\x42\x31\x69','\x79\x78\x62\x50\x73\x32\x76\x35','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x71','\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x57','\x43\x32\x4c\x4e\x42\x4d\x66\x53','\x76\x31\x4c\x35\x75\x4b\x34','\x79\x33\x76\x59\x43\x32\x39\x59','\x73\x30\x31\x68\x71\x4b\x53','\x6e\x74\x75\x31\x6d\x5a\x75\x32\x6d\x5a\x62\x76\x7a\x67\x50\x58\x77\x77\x53','\x42\x67\x4c\x54\x41\x78\x71','\x6d\x4a\x65\x59\x6d\x4a\x75\x5a\x6e\x76\x6a\x4e\x7a\x33\x6e\x77\x43\x47','\x72\x4d\x66\x50\x42\x67\x76\x4b\x69\x68\x72\x56\x69\x67\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71\x47\x44\x67\x38\x47\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x69\x65\x66\x71\x73\x74\x4f\x47','\x71\x75\x6e\x6d\x75\x4e\x69','\x43\x32\x76\x30','\x43\x33\x72\x48\x44\x68\x76\x5a','\x72\x30\x44\x6d\x77\x67\x69','\x76\x4b\x35\x57\x43\x32\x79','\x6d\x74\x69\x59\x6e\x4a\x47\x33\x6d\x4a\x76\x58\x74\x77\x58\x63\x7a\x75\x4f','\x41\x78\x72\x4c\x42\x78\x6d','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57','\x79\x78\x62\x57\x42\x67\x4c\x4a\x79\x78\x72\x50\x42\x32\x34\x56\x41\x4e\x6e\x56\x42\x47','\x43\x4c\x4c\x6d\x45\x77\x53','\x42\x4d\x76\x34\x44\x65\x6e\x31\x43\x4e\x6e\x56\x43\x47','\x44\x31\x50\x59\x71\x75\x79','\x76\x31\x6e\x7a\x45\x4e\x47','\x7a\x32\x66\x30\x7a\x71','\x71\x4d\x76\x48\x43\x4d\x76\x59\x69\x61','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x57','\x42\x32\x7a\x4d\x43\x32\x76\x30','\x79\x4d\x39\x4b\x45\x71','\x6d\x74\x61\x58\x6e\x4a\x47\x58\x6f\x76\x76\x75\x77\x4e\x48\x35\x74\x47','\x41\x68\x72\x30\x43\x68\x6d\x36\x6c\x59\x39\x50\x42\x4e\x72\x4c\x42\x67\x58\x50\x7a\x32\x76\x55\x79\x32\x75\x55\x44\x67\x66\x55\x7a\x32\x58\x4c\x6c\x4e\x72\x56\x42\x32\x58\x5a','\x7a\x33\x6e\x62\x45\x76\x71','\x6e\x5a\x4b\x30\x6e\x64\x4c\x6e\x44\x30\x48\x49\x42\x75\x79','\x44\x78\x6e\x4c\x43\x4b\x4c\x4b','\x7a\x4c\x76\x5a\x44\x65\x4b','\x6e\x65\x58\x65\x41\x75\x66\x68\x73\x71','\x79\x30\x31\x69\x75\x31\x43','\x42\x78\x62\x71\x42\x31\x69','\x72\x30\x76\x75','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x31\x48\x43\x67\x4b','\x6f\x64\x6a\x57\x77\x68\x50\x41\x73\x4d\x4f','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d\x56','\x7a\x33\x76\x72\x73\x67\x43','\x44\x65\x48\x57\x43\x4b\x34','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a','\x42\x77\x39\x4b\x7a\x77\x57','\x43\x4e\x76\x55\x73\x77\x71','\x7a\x4e\x6a\x56\x42\x71','\x6d\x5a\x47\x30\x6e\x4a\x43\x5a\x6f\x65\x35\x68\x44\x77\x44\x49\x44\x71','\x45\x67\x4c\x4f\x74\x4c\x79','\x44\x4e\x44\x58\x72\x4d\x69','\x79\x77\x6a\x56\x43\x4e\x71','\x42\x67\x66\x49\x7a\x77\x57','\x71\x77\x6a\x56\x43\x4e\x72\x66\x43\x4e\x6a\x56\x43\x47','\x42\x4d\x66\x54\x7a\x71'];a0_0x4794=function(){return _0x2c35d2;};return a0_0x4794();}const DEFAULT_INTELLIGENCE_BASE_URL=a0_0x18f440(0x153),DEFAULT_TIMEOUT_MS=0x7530;function appendParam(_0x40d31f,_0x579af7,_0x713a3a){const _0x393ce3=a0_0x18f440;if(_0x713a3a===void 0x0)return;_0x40d31f[_0x393ce3(0x141)](_0x579af7,String(_0x713a3a));}function createIntelligenceClient(_0x3ef5b1){const _0x2da8f2=a0_0x18f440,_0x39e6e0={'\x77\x5a\x72\x41\x46':_0x2da8f2(0x124),'\x57\x59\x79\x52\x4e':function(_0x1ea776,_0x1cea8c){return _0x1ea776(_0x1cea8c);},'\x4a\x57\x6d\x59\x66':'\x73\x61\x6e\x64\x62\x6f\x78\x2d\x61\x70\x69','\x65\x44\x7a\x65\x4e':_0x2da8f2(0x13d),'\x63\x4d\x48\x53\x57':function(_0x3b5b17,_0x39d635,_0x4908ca,_0x5a7760){return _0x3b5b17(_0x39d635,_0x4908ca,_0x5a7760);},'\x46\x70\x43\x53\x4d':_0x2da8f2(0x11e),'\x74\x48\x70\x72\x4e':function(_0x3a1099,_0x14d5f1,_0xd8de62,_0x3c8a3a){return _0x3a1099(_0x14d5f1,_0xd8de62,_0x3c8a3a);},'\x63\x55\x66\x4e\x62':function(_0x28b3d9,_0xaa5260,_0x1da4ee,_0x24b6da){return _0x28b3d9(_0xaa5260,_0x1da4ee,_0x24b6da);},'\x50\x47\x6e\x75\x4b':_0x2da8f2(0x11d),'\x47\x47\x4c\x58\x62':function(_0x2cc576,_0x6983){return _0x2cc576>_0x6983;},'\x56\x4e\x70\x73\x66':function(_0x41b013,_0x5de9b4,_0xf8fe7e,_0x56e6e5){return _0x41b013(_0x5de9b4,_0xf8fe7e,_0x56e6e5);},'\x67\x75\x51\x48\x67':function(_0x44c9de,_0x2db094,_0xdeb5a0,_0x25701e){return _0x44c9de(_0x2db094,_0xdeb5a0,_0x25701e);},'\x6d\x70\x50\x6f\x52':function(_0x77c81c,_0x5a7bff){return _0x77c81c(_0x5a7bff);},'\x67\x73\x41\x79\x54':function(_0x48ab18,_0x4a03ca){return _0x48ab18(_0x4a03ca);},'\x72\x59\x4c\x79\x6b':function(_0x8eacf8,_0x14b69e,_0xc18872,_0x5b2fa6){return _0x8eacf8(_0x14b69e,_0xc18872,_0x5b2fa6);},'\x4b\x4d\x47\x42\x4b':function(_0x170227,_0x16b49d,_0x448004,_0x506661){return _0x170227(_0x16b49d,_0x448004,_0x506661);},'\x57\x53\x59\x7a\x78':'\x73\x74\x61\x74\x75\x73','\x76\x77\x71\x46\x62':function(_0x251c33,_0x529624,_0x5bc64f,_0x579a68){return _0x251c33(_0x529624,_0x5bc64f,_0x579a68);},'\x6c\x77\x79\x43\x49':function(_0x38955f,_0x1fb8cc,_0x257103,_0x5b0871){return _0x38955f(_0x1fb8cc,_0x257103,_0x5b0871);},'\x51\x70\x74\x4f\x6d':function(_0x1248d1,_0x560af4,_0x46fbb6,_0x24c13d){return _0x1248d1(_0x560af4,_0x46fbb6,_0x24c13d);},'\x66\x55\x73\x74\x49':_0x2da8f2(0x13a),'\x78\x69\x68\x4e\x56':'\x63\x72\x65\x61\x74\x65\x49\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x43\x6c\x69\x65\x6e\x74\x3a\x20\x61\x70\x69\x4b\x65\x79\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64','\x41\x43\x4c\x52\x72':_0x2da8f2(0x153)};if(!_0x3ef5b1[_0x2da8f2(0x135)])throw new Error(_0x39e6e0[_0x2da8f2(0x120)]);const _0x527fb0=_0x3ef5b1[_0x2da8f2(0x135)],_0x6b1125=(_0x3ef5b1[_0x2da8f2(0x126)]??_0x39e6e0[_0x2da8f2(0x140)])[_0x2da8f2(0x136)](/\/$/,''),_0x4dd20f=_0x3ef5b1[_0x2da8f2(0x12a)]??DEFAULT_TIMEOUT_MS;async function _0x5e4394(_0x30b9c0){const _0x28511d=_0x2da8f2,_0x50c37a=''+_0x6b1125+_0x30b9c0,_0x4eb434=new AbortController(),_0x5f0414=setTimeout(()=>_0x4eb434[_0x28511d(0x122)](),_0x4dd20f);try{return await globalThis[_0x28511d(0x12b)](_0x50c37a,{'\x68\x65\x61\x64\x65\x72\x73':{'\x41\x75\x74\x68\x6f\x72\x69\x7a\x61\x74\x69\x6f\x6e':_0x28511d(0x14e)+_0x527fb0,'\x41\x63\x63\x65\x70\x74':_0x28511d(0x148)},'\x73\x69\x67\x6e\x61\x6c':_0x4eb434[_0x28511d(0x138)]});}catch(_0x5b5a03){if(_0x5b5a03 instanceof Error&&_0x5b5a03[_0x28511d(0x125)]===_0x39e6e0[_0x28511d(0x14b)])throw new a0_0xe7fdff(_0x4dd20f);throw new a0_0x480284(_0x28511d(0x13f)+(_0x5b5a03 instanceof Error?_0x5b5a03[_0x28511d(0x127)]:_0x39e6e0[_0x28511d(0x139)](String,_0x5b5a03)),_0x5b5a03 instanceof Error?_0x5b5a03:void 0x0,{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x30b9c0,'\x6f\x72\x69\x67\x69\x6e':_0x39e6e0[_0x28511d(0x128)]});}finally{_0x39e6e0[_0x28511d(0x139)](clearTimeout,_0x5f0414);}}async function _0x5cf7d2(_0x24fe6d){const _0x2cbc70=_0x2da8f2,_0x217b9a=await _0x5e4394(_0x24fe6d),_0x1f1977=await _0x217b9a['\x74\x65\x78\x74']();if(!_0x217b9a['\x6f\x6b'])throw a0_0x19e972(_0x217b9a[_0x2cbc70(0x142)],_0x1f1977,{'\x6d\x65\x74\x68\x6f\x64':_0x2cbc70(0x115),'\x70\x61\x74\x68':_0x24fe6d},_0x217b9a[_0x2cbc70(0x147)]);return JSON['\x70\x61\x72\x73\x65'](_0x1f1977);}async function _0x3cd4af(_0x522774={}){const _0x1bd9ef=_0x2da8f2,_0x54cf54=new URLSearchParams();return appendParam(_0x54cf54,_0x39e6e0[_0x1bd9ef(0x129)],_0x522774[_0x1bd9ef(0x13d)]),_0x39e6e0[_0x1bd9ef(0x113)](appendParam,_0x54cf54,_0x39e6e0[_0x1bd9ef(0x131)],_0x522774[_0x1bd9ef(0x11e)]),_0x39e6e0[_0x1bd9ef(0x11a)](appendParam,_0x54cf54,'\x74\x6f',_0x522774['\x74\x6f']),_0x39e6e0[_0x1bd9ef(0x130)](appendParam,_0x54cf54,'\x71',_0x522774['\x71']),appendParam(_0x54cf54,'\x6d\x6f\x64\x65\x6c',_0x522774[_0x1bd9ef(0x11c)]),appendParam(_0x54cf54,_0x39e6e0[_0x1bd9ef(0x133)],_0x522774[_0x1bd9ef(0x11d)]),appendParam(_0x54cf54,'\x73\x74\x61\x74\x75\x73',_0x522774['\x73\x74\x61\x74\x75\x73']),appendParam(_0x54cf54,_0x1bd9ef(0x13a),_0x522774[_0x1bd9ef(0x13a)]),_0x5cf7d2(_0x1bd9ef(0x14f)+(_0x39e6e0[_0x1bd9ef(0x143)](_0x54cf54['\x73\x69\x7a\x65'],0x0)?'\x3f'+_0x54cf54:''));}async function _0x27e67a(_0x172553,_0x5dd83b={}){const _0x32e550=_0x2da8f2,_0x14024c=new URLSearchParams();_0x39e6e0[_0x32e550(0x144)](appendParam,_0x14024c,_0x32e550(0x13d),_0x5dd83b['\x6c\x69\x6d\x69\x74']),_0x39e6e0[_0x32e550(0x119)](appendParam,_0x14024c,_0x32e550(0x13a),_0x5dd83b['\x63\x75\x72\x73\x6f\x72']);const _0x2ca37a=_0x39e6e0[_0x32e550(0x143)](_0x14024c['\x73\x69\x7a\x65'],0x0)?'\x3f'+_0x14024c:'';return _0x39e6e0['\x6d\x70\x50\x6f\x52'](_0x5cf7d2,'\x2f\x76\x31\x2f\x74\x72\x61\x63\x65\x73\x2f'+encodeURIComponent(_0x172553)+_0x32e550(0x12e)+_0x2ca37a);}async function _0x52cd82(_0x1dccfa){const _0x4a834b=_0x2da8f2,_0x4f2f66=_0x4a834b(0x12c)+_0x39e6e0['\x67\x73\x41\x79\x54'](encodeURIComponent,_0x1dccfa)+'\x2f\x73\x70\x61\x6e\x73\x2e\x6e\x64\x6a\x73\x6f\x6e',_0x3f3efb=await _0x5e4394(_0x4f2f66);if(!_0x3f3efb['\x6f\x6b']){const _0x39c711=await _0x3f3efb['\x74\x65\x78\x74']();throw a0_0x19e972(_0x3f3efb[_0x4a834b(0x142)],_0x39c711,{'\x6d\x65\x74\x68\x6f\x64':'\x47\x45\x54','\x70\x61\x74\x68':_0x4f2f66},_0x3f3efb[_0x4a834b(0x147)]);}if(!_0x3f3efb['\x62\x6f\x64\x79'])throw new a0_0x480284('\x49\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x20\x41\x50\x49\x20\x72\x65\x74\x75\x72\x6e\x65\x64\x20\x61\x6e\x20\x4e\x44\x4a\x53\x4f\x4e\x20\x65\x78\x70\x6f\x72\x74\x20\x77\x69\x74\x68\x20\x6e\x6f\x20\x62\x6f\x64\x79\x20\x73\x74\x72\x65\x61\x6d',{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x4f2f66,'\x6f\x72\x69\x67\x69\x6e':_0x4a834b(0x116)});return _0x3f3efb[_0x4a834b(0x151)];}async function _0x565a53(_0x4f84cd={}){const _0x59d0f0=_0x2da8f2,_0x15d5c9=new URLSearchParams();return appendParam(_0x15d5c9,_0x59d0f0(0x13d),_0x4f84cd[_0x59d0f0(0x13d)]),_0x39e6e0[_0x59d0f0(0x149)](appendParam,_0x15d5c9,_0x59d0f0(0x150),_0x4f84cd[_0x59d0f0(0x150)]),_0x39e6e0[_0x59d0f0(0x13b)](appendParam,_0x15d5c9,_0x39e6e0[_0x59d0f0(0x14c)],_0x4f84cd[_0x59d0f0(0x142)]),appendParam(_0x15d5c9,_0x59d0f0(0x14d),_0x4f84cd[_0x59d0f0(0x14d)]),appendParam(_0x15d5c9,'\x71',_0x4f84cd['\x71']),_0x39e6e0[_0x59d0f0(0x121)](appendParam,_0x15d5c9,_0x59d0f0(0x11e),_0x4f84cd[_0x59d0f0(0x11e)]),_0x39e6e0['\x4b\x4d\x47\x42\x4b'](appendParam,_0x15d5c9,'\x74\x6f',_0x4f84cd['\x74\x6f']),appendParam(_0x15d5c9,_0x59d0f0(0x123),_0x4f84cd[_0x59d0f0(0x123)]),_0x39e6e0[_0x59d0f0(0x12d)](appendParam,_0x15d5c9,_0x59d0f0(0x13a),_0x4f84cd[_0x59d0f0(0x13a)]),_0x39e6e0['\x67\x73\x41\x79\x54'](_0x5cf7d2,'\x2f\x76\x31\x2f\x72\x75\x6e\x73'+(_0x39e6e0[_0x59d0f0(0x143)](_0x15d5c9[_0x59d0f0(0x132)],0x0)?'\x3f'+_0x15d5c9:''));}async function _0x1ac048(_0x220352){const _0x12f327=_0x2da8f2;return _0x5cf7d2(_0x12f327(0x118)+encodeURIComponent(_0x220352));}async function _0x1e83d1(_0x46fc63){const _0x248987=_0x2da8f2;return _0x5cf7d2(_0x248987(0x118)+encodeURIComponent(_0x46fc63)+_0x248987(0x137));}async function _0x3d6066(_0x5bf7d4={}){const _0x47fc4d=_0x2da8f2,_0x35e3d1=new URLSearchParams();return _0x39e6e0['\x51\x70\x74\x4f\x6d'](appendParam,_0x35e3d1,_0x47fc4d(0x13d),_0x5bf7d4[_0x47fc4d(0x13d)]),appendParam(_0x35e3d1,_0x39e6e0[_0x47fc4d(0x131)],_0x5bf7d4[_0x47fc4d(0x11e)]),appendParam(_0x35e3d1,'\x74\x6f',_0x5bf7d4['\x74\x6f']),appendParam(_0x35e3d1,'\x71',_0x5bf7d4['\x71']),appendParam(_0x35e3d1,'\x75\x73\x65\x72\x49\x64',_0x5bf7d4[_0x47fc4d(0x156)]),appendParam(_0x35e3d1,'\x63\x75\x72\x73\x6f\x72',_0x5bf7d4[_0x47fc4d(0x13a)]),_0x5cf7d2(_0x47fc4d(0x11b)+(_0x35e3d1['\x73\x69\x7a\x65']>0x0?'\x3f'+_0x35e3d1:''));}async function _0x4d2b90(_0x54da43,_0xa8a877={}){const _0x3d899a=_0x2da8f2,_0x5f2f75=new URLSearchParams();appendParam(_0x5f2f75,_0x3d899a(0x13d),_0xa8a877[_0x3d899a(0x13d)]),appendParam(_0x5f2f75,_0x39e6e0[_0x3d899a(0x111)],_0xa8a877['\x63\x75\x72\x73\x6f\x72']);const _0x1f718e=_0x5f2f75[_0x3d899a(0x132)]>0x0?'\x3f'+_0x5f2f75:'';return _0x39e6e0[_0x3d899a(0x154)](_0x5cf7d2,'\x2f\x76\x31\x2f\x73\x65\x73\x73\x69\x6f\x6e\x73\x2f'+_0x39e6e0['\x57\x59\x79\x52\x4e'](encodeURIComponent,_0x54da43)+_0x3d899a(0x137)+_0x1f718e);}async function*_0x462d6d(_0x3bcbbf,_0x2e98b2={}){const _0x406142=_0x2da8f2;let _0x56dbdd=_0x2e98b2[_0x406142(0x13a)];for(;;){const _0x33982d=await _0x27e67a(_0x3bcbbf,{..._0x2e98b2,'\x63\x75\x72\x73\x6f\x72':_0x56dbdd});for(const _0x16a6bd of _0x33982d['\x69\x74\x65\x6d\x73'])yield _0x16a6bd;if(!_0x33982d[_0x406142(0x14a)])return;_0x56dbdd=_0x33982d[_0x406142(0x14a)];}}async function*_0x4dffd3(_0x2ae0ef={}){const _0x4eb7fd=_0x2da8f2;let _0x23207a=_0x2ae0ef[_0x4eb7fd(0x13a)];for(;;){const _0x57aef=await _0x39e6e0[_0x4eb7fd(0x114)](_0x3cd4af,{..._0x2ae0ef,'\x63\x75\x72\x73\x6f\x72':_0x23207a});for(const _0xc792f6 of _0x57aef[_0x4eb7fd(0x146)])yield _0xc792f6;if(!_0x57aef[_0x4eb7fd(0x14a)])return;_0x23207a=_0x57aef[_0x4eb7fd(0x14a)];}}async function*_0x23faa9(_0x4908ed={}){const _0x27bc55=_0x2da8f2;let _0x5a1f53=_0x4908ed[_0x27bc55(0x13a)];for(;;){const _0x774231=await _0x3d6066({..._0x4908ed,'\x63\x75\x72\x73\x6f\x72':_0x5a1f53});for(const _0x1afbe0 of _0x774231['\x69\x74\x65\x6d\x73'])yield _0x1afbe0;if(!_0x774231[_0x27bc55(0x14a)])return;_0x5a1f53=_0x774231[_0x27bc55(0x14a)];}}return{'\x6c\x69\x73\x74\x54\x72\x61\x63\x65\x73':_0x3cd4af,'\x67\x65\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x27e67a,'\x65\x78\x70\x6f\x72\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73\x4e\x64\x6a\x73\x6f\x6e':_0x52cd82,'\x6c\x69\x73\x74\x52\x75\x6e\x73':_0x565a53,'\x67\x65\x74\x52\x75\x6e':_0x1ac048,'\x67\x65\x74\x52\x75\x6e\x54\x72\x61\x63\x65\x73':_0x1e83d1,'\x6c\x69\x73\x74\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x3d6066,'\x67\x65\x74\x53\x65\x73\x73\x69\x6f\x6e\x54\x72\x61\x63\x65\x73':_0x4d2b90,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x462d6d,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x73':_0x4dffd3,'\x69\x74\x65\x72\x61\x74\x65\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x23faa9};}export{DEFAULT_INTELLIGENCE_BASE_URL,createIntelligenceClient};