@ramme-io/kernel 6.0.1 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiGateway-DsVWU6ih.js → AiGateway-BmV6ypkd.js} +616 -627
- package/dist/index.es.js +12 -12
- package/dist/kernel/src/services/NeuralGateway.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/models.test.d.ts +2 -0
- package/dist/kernel/src/services/ai/models.test.d.ts.map +1 -0
- package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts +1 -1
- package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/DeepSeekAdapter.d.ts +2 -2
- package/dist/kernel/src/services/ai/providers/DeepSeekAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/GrokAdapter.d.ts +2 -2
- package/dist/kernel/src/services/ai/providers/GrokAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts +1 -1
- package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/OpenAIAdapter.d.ts +1 -1
- package/dist/kernel/src/services/ai/providers/OpenAIAdapter.d.ts.map +1 -1
- package/dist/kernel/src/setupTests.d.ts +2 -0
- package/dist/kernel/src/setupTests.d.ts.map +1 -0
- package/dist/kernel/src/stores/useSettingsStore.test.d.ts +2 -0
- package/dist/kernel/src/stores/useSettingsStore.test.d.ts.map +1 -0
- package/dist/server.es.js +10 -9
- package/package.json +9 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const Or = {
|
|
3
3
|
// ── ROOM 1: STRATEGY OFFICE ──────────────────────────────────────
|
|
4
4
|
strategist: {
|
|
5
5
|
id: "strategist",
|
|
@@ -114,20 +114,20 @@ Provide a structured audit report with:
|
|
|
114
114
|
`.trim()
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
var
|
|
117
|
+
var ve = Object.defineProperty, ke = (a, t) => {
|
|
118
118
|
for (var n in t)
|
|
119
|
-
|
|
120
|
-
},
|
|
119
|
+
ve(a, n, { get: t[n], enumerable: !0 });
|
|
120
|
+
}, Se = e.object({
|
|
121
121
|
key: e.string(),
|
|
122
122
|
label: e.string(),
|
|
123
123
|
type: e.enum(["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]),
|
|
124
124
|
required: e.boolean().optional(),
|
|
125
125
|
description: e.string().optional(),
|
|
126
126
|
defaultValue: e.any().optional()
|
|
127
|
-
}),
|
|
127
|
+
}), _e = e.object({
|
|
128
128
|
id: e.string(),
|
|
129
129
|
name: e.string(),
|
|
130
|
-
fields: e.array(
|
|
130
|
+
fields: e.array(Se),
|
|
131
131
|
defaultView: e.enum(["table", "grid", "list"]).optional(),
|
|
132
132
|
features: e.object({
|
|
133
133
|
searchable: e.boolean().optional(),
|
|
@@ -136,7 +136,7 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
136
136
|
deletable: e.boolean().optional(),
|
|
137
137
|
exportable: e.boolean().optional()
|
|
138
138
|
}).optional()
|
|
139
|
-
}),
|
|
139
|
+
}), Te = e.object({
|
|
140
140
|
id: e.string().min(1, "Signal ID is required"),
|
|
141
141
|
label: e.string(),
|
|
142
142
|
description: e.string().optional(),
|
|
@@ -152,7 +152,7 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
152
152
|
unit: e.string().optional(),
|
|
153
153
|
min: e.number().optional(),
|
|
154
154
|
max: e.number().optional()
|
|
155
|
-
}),
|
|
155
|
+
}), Ie = e.object({
|
|
156
156
|
id: e.string(),
|
|
157
157
|
name: e.string(),
|
|
158
158
|
description: e.string().optional(),
|
|
@@ -164,11 +164,11 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
164
164
|
color: e.string().optional(),
|
|
165
165
|
dashboardComponent: e.string().optional()
|
|
166
166
|
}).optional()
|
|
167
|
-
}),
|
|
167
|
+
}), Oe = e.object({
|
|
168
168
|
id: e.string(),
|
|
169
169
|
type: e.enum(["signal_change", "manual_action", "schedule", "webhook"]),
|
|
170
170
|
config: e.record(e.string(), e.any())
|
|
171
|
-
}),
|
|
171
|
+
}), Pe = e.object({
|
|
172
172
|
id: e.string(),
|
|
173
173
|
type: e.enum([
|
|
174
174
|
"update_resource",
|
|
@@ -179,13 +179,13 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
179
179
|
"agent_task"
|
|
180
180
|
]),
|
|
181
181
|
config: e.record(e.string(), e.any())
|
|
182
|
-
}),
|
|
182
|
+
}), je = e.object({
|
|
183
183
|
id: e.string(),
|
|
184
184
|
name: e.string(),
|
|
185
185
|
active: e.boolean().default(!0),
|
|
186
|
-
trigger:
|
|
187
|
-
actions: e.array(
|
|
188
|
-
}),
|
|
186
|
+
trigger: Oe,
|
|
187
|
+
actions: e.array(Pe)
|
|
188
|
+
}), Re = e.object({
|
|
189
189
|
id: e.string(),
|
|
190
190
|
type: e.string(),
|
|
191
191
|
props: e.record(e.string(), e.any()),
|
|
@@ -193,7 +193,7 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
193
193
|
colSpan: e.number().optional(),
|
|
194
194
|
rowSpan: e.number().optional()
|
|
195
195
|
}).optional()
|
|
196
|
-
}),
|
|
196
|
+
}), Ne = e.object({
|
|
197
197
|
id: e.string(),
|
|
198
198
|
title: e.string().optional(),
|
|
199
199
|
description: e.string().optional(),
|
|
@@ -201,18 +201,18 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
201
201
|
columns: e.number().optional(),
|
|
202
202
|
variant: e.enum(["grid", "stack", "split"]).optional()
|
|
203
203
|
}).optional(),
|
|
204
|
-
blocks: e.array(
|
|
205
|
-
}),
|
|
204
|
+
blocks: e.array(Re)
|
|
205
|
+
}), De = e.object({
|
|
206
206
|
id: e.string(),
|
|
207
207
|
slug: e.string(),
|
|
208
208
|
title: e.string(),
|
|
209
209
|
description: e.string().optional(),
|
|
210
210
|
icon: e.string().optional(),
|
|
211
|
-
sections: e.array(
|
|
212
|
-
}),
|
|
213
|
-
strategy:
|
|
211
|
+
sections: e.array(Ne)
|
|
212
|
+
}), Ce = e.enum(["ENVIRONMENT", "SESSION_BYOK", "VAULT"]), Me = e.object({
|
|
213
|
+
strategy: Ce,
|
|
214
214
|
status: e.enum(["VALID", "KEY_EXPIRED", "BYOK_REQUIRED", "DEGRADED", "UNKNOWN"]).default("UNKNOWN")
|
|
215
|
-
}),
|
|
215
|
+
}), Pr = e.object({
|
|
216
216
|
meta: e.object({
|
|
217
217
|
name: e.string(),
|
|
218
218
|
version: e.string(),
|
|
@@ -225,17 +225,17 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
225
225
|
layout: e.enum(["dashboard", "explorer", "studio", "focus"]).default("dashboard"),
|
|
226
226
|
mockMode: e.boolean().default(!0),
|
|
227
227
|
brokerUrl: e.string().optional(),
|
|
228
|
-
aiKeyManifest:
|
|
228
|
+
aiKeyManifest: Me.optional()
|
|
229
229
|
}),
|
|
230
230
|
modules: e.array(e.string()).optional(),
|
|
231
|
-
resources: e.array(
|
|
231
|
+
resources: e.array(_e).optional(),
|
|
232
232
|
domain: e.object({
|
|
233
|
-
signals: e.array(
|
|
234
|
-
entities: e.array(
|
|
235
|
-
workflows: e.array(
|
|
233
|
+
signals: e.array(Te),
|
|
234
|
+
entities: e.array(Ie),
|
|
235
|
+
workflows: e.array(je).optional()
|
|
236
236
|
}),
|
|
237
|
-
pages: e.array(
|
|
238
|
-
}),
|
|
237
|
+
pages: e.array(De).optional()
|
|
238
|
+
}), jr = e.object({
|
|
239
239
|
timestamp: e.number(),
|
|
240
240
|
soilMoisture: e.number().min(0).max(100),
|
|
241
241
|
ambientLight: e.number().min(0).max(1e5),
|
|
@@ -251,7 +251,7 @@ var xe = Object.defineProperty, ve = (a, t) => {
|
|
|
251
251
|
meta: e.record(e.unknown()).optional()
|
|
252
252
|
});
|
|
253
253
|
e.array($e);
|
|
254
|
-
var
|
|
254
|
+
var Le = e.enum(["telemetry", "market", "system", "logic"]), Ue = e.enum(["mqtt", "http", "ws", "mock"]);
|
|
255
255
|
e.object({
|
|
256
256
|
/**
|
|
257
257
|
* Globally unique signal identifier.
|
|
@@ -263,7 +263,7 @@ e.object({
|
|
|
263
263
|
* The semantic category of this signal.
|
|
264
264
|
* Determines which Methodology Engine processes it.
|
|
265
265
|
*/
|
|
266
|
-
kind:
|
|
266
|
+
kind: Le,
|
|
267
267
|
/**
|
|
268
268
|
* The specific measurement or metric key within its kind.
|
|
269
269
|
* RULE: Keys MUST be abstract and domain-agnostic where possible.
|
|
@@ -291,7 +291,7 @@ e.object({
|
|
|
291
291
|
/**
|
|
292
292
|
* The transport source that produced this signal.
|
|
293
293
|
*/
|
|
294
|
-
source:
|
|
294
|
+
source: Ue.optional(),
|
|
295
295
|
/**
|
|
296
296
|
* Optional domain namespace for grouping related signals.
|
|
297
297
|
* Examples: 'bodewell', 'finance', 'infrastructure', 'user_behavior'
|
|
@@ -305,20 +305,20 @@ e.object({
|
|
|
305
305
|
*/
|
|
306
306
|
meta: e.record(e.unknown()).optional()
|
|
307
307
|
});
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
BodewellCommandSchema: () =>
|
|
311
|
-
BodewellDeviceID: () =>
|
|
312
|
-
BodewellTelemetrySchema: () =>
|
|
308
|
+
var Be = {};
|
|
309
|
+
ke(Be, {
|
|
310
|
+
BodewellCommandSchema: () => Ze,
|
|
311
|
+
BodewellDeviceID: () => ee,
|
|
312
|
+
BodewellTelemetrySchema: () => qe
|
|
313
313
|
});
|
|
314
|
-
var
|
|
314
|
+
var ee = e.enum([
|
|
315
315
|
"STK-V1-001",
|
|
316
316
|
"STK-V1-002",
|
|
317
317
|
"STK-V1-003",
|
|
318
318
|
"STK-PRO-001",
|
|
319
319
|
"STK-VIS-001"
|
|
320
|
-
]),
|
|
321
|
-
device_id:
|
|
320
|
+
]), qe = e.object({
|
|
321
|
+
device_id: ee,
|
|
322
322
|
stick_id: e.string().optional().describe("Firmware alias for device_id"),
|
|
323
323
|
timestamp: e.number().optional().describe("Epoch timestamp from NTP"),
|
|
324
324
|
air_temp: e.number().optional().describe("Celsius"),
|
|
@@ -331,25 +331,25 @@ var Q = e.enum([
|
|
|
331
331
|
soil_vwc: e.number().describe("Volumetric Water Content / Raw Capacitance"),
|
|
332
332
|
soil_moisture: e.number().optional().describe("Firmware alias for raw capacitance"),
|
|
333
333
|
soil_moisture_raw: e.number().optional().describe("Unscaled capacitance (300-1100)")
|
|
334
|
-
}).passthrough(),
|
|
335
|
-
stick_id:
|
|
334
|
+
}).passthrough(), Ze = e.object({
|
|
335
|
+
stick_id: ee,
|
|
336
336
|
// Note: Your API uses stick_id here, not device_id
|
|
337
337
|
type: e.enum(["dry", "wet"]),
|
|
338
338
|
value: e.number()
|
|
339
|
-
}),
|
|
339
|
+
}), Fe = e.enum([
|
|
340
340
|
"esp32-touch-28",
|
|
341
341
|
// 2.8" 240x320 resistive touch, the workshop board
|
|
342
342
|
"esp32-headless",
|
|
343
343
|
// no display; sensor node
|
|
344
344
|
"simulator"
|
|
345
345
|
// browser-side stand-in, for building without hardware
|
|
346
|
-
]),
|
|
346
|
+
]), de = e.enum([
|
|
347
347
|
"weather",
|
|
348
348
|
"clock",
|
|
349
349
|
"aircraft",
|
|
350
350
|
"sensor",
|
|
351
351
|
"blank"
|
|
352
|
-
]),
|
|
352
|
+
]), ze = e.object({
|
|
353
353
|
/** Postal code is what a person knows; the portal resolves it to coordinates. */
|
|
354
354
|
postalCode: e.string().min(3).max(12),
|
|
355
355
|
latitude: e.number().min(-90).max(90).optional(),
|
|
@@ -357,13 +357,13 @@ var Q = e.enum([
|
|
|
357
357
|
units: e.enum(["imperial", "metric"]).default("imperial"),
|
|
358
358
|
showForecast: e.boolean().default(!0),
|
|
359
359
|
refreshSeconds: e.number().int().min(300).max(86400).default(900)
|
|
360
|
-
}),
|
|
360
|
+
}), Ve = e.object({
|
|
361
361
|
/** IANA zone, e.g. "America/New_York". */
|
|
362
362
|
timezone: e.string().default("America/New_York"),
|
|
363
363
|
twentyFourHour: e.boolean().default(!1),
|
|
364
364
|
showSeconds: e.boolean().default(!1),
|
|
365
365
|
showDate: e.boolean().default(!0)
|
|
366
|
-
}),
|
|
366
|
+
}), Ke = e.object({
|
|
367
367
|
latitude: e.number().min(-90).max(90),
|
|
368
368
|
longitude: e.number().min(-180).max(180),
|
|
369
369
|
radiusKm: e.number().min(5).max(400).default(80),
|
|
@@ -374,12 +374,12 @@ var Q = e.enum([
|
|
|
374
374
|
/** Signal keys to display, in order. Abstract keys per the Signal contract. */
|
|
375
375
|
keys: e.array(e.string()).min(1).max(6),
|
|
376
376
|
refreshSeconds: e.number().int().min(1).max(3600).default(10)
|
|
377
|
-
}), Ke = e.object({
|
|
378
|
-
weather: Fe.optional(),
|
|
379
|
-
clock: ze.optional(),
|
|
380
|
-
aircraft: Ve.optional(),
|
|
381
|
-
sensor: Je.optional()
|
|
382
377
|
}), Ye = e.object({
|
|
378
|
+
weather: ze.optional(),
|
|
379
|
+
clock: Ve.optional(),
|
|
380
|
+
aircraft: Ke.optional(),
|
|
381
|
+
sensor: Je.optional()
|
|
382
|
+
}), Ge = e.object({
|
|
383
383
|
brightness: e.number().int().min(5).max(100).default(80),
|
|
384
384
|
/** Degrees clockwise. The board can sit either way up in a case. */
|
|
385
385
|
rotation: e.union([e.literal(0), e.literal(90), e.literal(180), e.literal(270)]).default(0),
|
|
@@ -392,7 +392,7 @@ var Q = e.enum([
|
|
|
392
392
|
}), q = e.string().regex(
|
|
393
393
|
/^\d{1,3} \d{1,3} \d{1,3}$/,
|
|
394
394
|
'Expected space-separated RGB integers, e.g. "13 110 253"'
|
|
395
|
-
),
|
|
395
|
+
), He = e.object({
|
|
396
396
|
preset: e.enum(["light", "dark", "corporate", "midnight", "blueprint", "custom"]).default("dark"),
|
|
397
397
|
background: q.optional(),
|
|
398
398
|
foreground: q.optional(),
|
|
@@ -407,12 +407,12 @@ e.object({
|
|
|
407
407
|
/** Monotonic. Portal increments on write; device echoes what it is running. */
|
|
408
408
|
revision: e.number().int().nonnegative(),
|
|
409
409
|
updatedAt: e.string().datetime().optional(),
|
|
410
|
-
activeApp:
|
|
411
|
-
apps:
|
|
412
|
-
display:
|
|
413
|
-
theme:
|
|
410
|
+
activeApp: de,
|
|
411
|
+
apps: Ye,
|
|
412
|
+
display: Ge,
|
|
413
|
+
theme: He
|
|
414
414
|
});
|
|
415
|
-
var
|
|
415
|
+
var We = e.enum([
|
|
416
416
|
"unprovisioned",
|
|
417
417
|
"connecting",
|
|
418
418
|
"online",
|
|
@@ -421,19 +421,19 @@ var He = e.enum([
|
|
|
421
421
|
]);
|
|
422
422
|
e.object({
|
|
423
423
|
deviceId: e.string().min(1),
|
|
424
|
-
kind:
|
|
424
|
+
kind: Fe,
|
|
425
425
|
firmwareVersion: e.string(),
|
|
426
426
|
/** Shown on the device's own screen at boot — how the user finds it. */
|
|
427
427
|
ipAddress: e.string().optional(),
|
|
428
|
-
provisioning:
|
|
428
|
+
provisioning: We,
|
|
429
429
|
/** Revision the device is actually running, not the one it was sent. */
|
|
430
430
|
configRevision: e.number().int().nonnegative(),
|
|
431
|
-
activeApp:
|
|
431
|
+
activeApp: de,
|
|
432
432
|
rssi: e.number().int().optional().describe("dBm"),
|
|
433
433
|
uptimeSeconds: e.number().int().nonnegative().optional(),
|
|
434
434
|
freeHeapBytes: e.number().int().nonnegative().optional()
|
|
435
435
|
});
|
|
436
|
-
var
|
|
436
|
+
var Xe = e.enum([
|
|
437
437
|
"background",
|
|
438
438
|
"foreground",
|
|
439
439
|
"muted",
|
|
@@ -441,7 +441,7 @@ var We = e.enum([
|
|
|
441
441
|
"success",
|
|
442
442
|
"warning",
|
|
443
443
|
"danger"
|
|
444
|
-
]),
|
|
444
|
+
]), Qe = e.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'RGB must be three space-separated integers, e.g. "13 110 253"'), J = e.union([Xe, Qe]), pe = e.enum(["xs", "sm", "base", "lg", "xl", "display"]), te = e.enum(["start", "center", "end"]), et = e.discriminatedUnion("kind", [
|
|
445
445
|
e.object({
|
|
446
446
|
kind: e.literal("weather"),
|
|
447
447
|
latitude: e.number().min(-90).max(90),
|
|
@@ -465,12 +465,12 @@ var We = e.enum([
|
|
|
465
465
|
kind: e.literal("static"),
|
|
466
466
|
values: e.record(e.union([e.string(), e.number(), e.boolean()]))
|
|
467
467
|
})
|
|
468
|
-
]),
|
|
468
|
+
]), Q = e.union([
|
|
469
469
|
e.object({ literal: e.number() }),
|
|
470
470
|
e.object({ source: e.string().min(1), field: e.string().min(1) })
|
|
471
|
-
]),
|
|
471
|
+
]), tt = e.object({
|
|
472
472
|
compute: e.enum(["add", "subtract", "multiply", "divide"]),
|
|
473
|
-
of: e.tuple([
|
|
473
|
+
of: e.tuple([Q, Q]),
|
|
474
474
|
round: e.boolean().default(!0)
|
|
475
475
|
}), Z = e.union([
|
|
476
476
|
e.object({ literal: e.union([e.string(), e.number(), e.boolean()]) }),
|
|
@@ -480,56 +480,56 @@ var We = e.enum([
|
|
|
480
480
|
/** Field on that source, e.g. "temperature", "high", "condition". */
|
|
481
481
|
field: e.string().min(1)
|
|
482
482
|
}),
|
|
483
|
-
|
|
484
|
-
]),
|
|
485
|
-
value:
|
|
483
|
+
tt
|
|
484
|
+
]), re = e.object({
|
|
485
|
+
value: Q,
|
|
486
486
|
op: e.enum(["<", "<=", ">", ">=", "==", "!="]),
|
|
487
487
|
than: e.union([e.number(), e.string(), e.boolean()])
|
|
488
|
-
}),
|
|
489
|
-
when:
|
|
488
|
+
}), rt = e.object({
|
|
489
|
+
when: re,
|
|
490
490
|
color: J.optional(),
|
|
491
|
-
size:
|
|
491
|
+
size: pe.optional()
|
|
492
492
|
}), F = {
|
|
493
493
|
color: J.optional(),
|
|
494
494
|
/** Drawn only when this is false, or absent. */
|
|
495
|
-
hideWhen:
|
|
495
|
+
hideWhen: re.optional(),
|
|
496
496
|
/** Conditional style. First match wins. */
|
|
497
|
-
rules: e.array(
|
|
498
|
-
},
|
|
497
|
+
rules: e.array(rt).max(4).optional()
|
|
498
|
+
}, nt = e.object({
|
|
499
499
|
type: e.literal("text"),
|
|
500
500
|
value: Z,
|
|
501
|
-
size:
|
|
502
|
-
align:
|
|
501
|
+
size: pe.default("base"),
|
|
502
|
+
align: te.default("start"),
|
|
503
503
|
/** Printed after the value, e.g. a degree symbol. Never itself bound. */
|
|
504
504
|
suffix: e.string().max(8).optional(),
|
|
505
505
|
...F
|
|
506
|
-
}),
|
|
506
|
+
}), at = e.object({
|
|
507
507
|
type: e.literal("dial"),
|
|
508
508
|
value: Z,
|
|
509
509
|
min: e.number(),
|
|
510
510
|
max: e.number(),
|
|
511
511
|
label: e.string().max(24).optional(),
|
|
512
512
|
...F
|
|
513
|
-
}),
|
|
513
|
+
}), ot = e.object({
|
|
514
514
|
type: e.literal("sparkline"),
|
|
515
515
|
/** A source field holding a series rather than a scalar. */
|
|
516
516
|
series: Z,
|
|
517
517
|
...F
|
|
518
|
-
}),
|
|
518
|
+
}), it = e.object({
|
|
519
519
|
type: e.literal("bar"),
|
|
520
520
|
value: Z,
|
|
521
521
|
min: e.number(),
|
|
522
522
|
max: e.number(),
|
|
523
523
|
...F
|
|
524
|
-
}),
|
|
524
|
+
}), st = e.object({
|
|
525
525
|
type: e.literal("status"),
|
|
526
526
|
state: Z,
|
|
527
527
|
label: e.string().max(24).optional(),
|
|
528
528
|
...F
|
|
529
|
-
}),
|
|
529
|
+
}), M = 64, ct = M / 2, lt = Math.ceil(ct * M / 3) * 4, ut = e.object({
|
|
530
530
|
type: e.literal("sprite"),
|
|
531
|
-
width: e.number().int().min(1).max(
|
|
532
|
-
height: e.number().int().min(1).max(
|
|
531
|
+
width: e.number().int().min(1).max(M),
|
|
532
|
+
height: e.number().int().min(1).max(M),
|
|
533
533
|
/**
|
|
534
534
|
* Up to sixteen colours, in the same form every other colour in a document
|
|
535
535
|
* takes: a semantic token, or literal RGB.
|
|
@@ -541,35 +541,35 @@ var We = e.enum([
|
|
|
541
541
|
*/
|
|
542
542
|
palette: e.array(J).min(1).max(16),
|
|
543
543
|
/** base64 of the packed nibbles. */
|
|
544
|
-
pixels: e.string().min(4).max(
|
|
545
|
-
align:
|
|
544
|
+
pixels: e.string().min(4).max(lt),
|
|
545
|
+
align: te.default("start"),
|
|
546
546
|
/** Drawn only when this is false, or absent. */
|
|
547
|
-
hideWhen:
|
|
548
|
-
}),
|
|
549
|
-
rt,
|
|
547
|
+
hideWhen: re.optional()
|
|
548
|
+
}), he = e.discriminatedUnion("type", [
|
|
550
549
|
nt,
|
|
551
550
|
at,
|
|
552
551
|
ot,
|
|
553
552
|
it,
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
st,
|
|
554
|
+
ut
|
|
555
|
+
]), mt = e.object({
|
|
556
556
|
type: e.literal("group"),
|
|
557
557
|
direction: e.enum(["row", "stack"]),
|
|
558
558
|
gap: e.number().int().min(0).max(64).default(4),
|
|
559
|
-
align:
|
|
560
|
-
children: e.array(
|
|
561
|
-
}),
|
|
559
|
+
align: te.default("start"),
|
|
560
|
+
children: e.array(he).min(1).max(8)
|
|
561
|
+
}), dt = e.union([he, mt]), pt = e.enum(["240x320"]), Rr = e.object({
|
|
562
562
|
/** Bumped only for a breaking change; the device checks it before parsing. */
|
|
563
563
|
schemaVersion: e.literal(1),
|
|
564
564
|
id: e.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/, "lowercase slug"),
|
|
565
565
|
name: e.string().min(1).max(48),
|
|
566
566
|
/** Free text. Never an email or anything else identifying — see the plan. */
|
|
567
567
|
author: e.string().max(32).optional(),
|
|
568
|
-
screen:
|
|
568
|
+
screen: pt.default("240x320"),
|
|
569
569
|
background: J.default("background"),
|
|
570
570
|
/** Named so bindings can refer to them. */
|
|
571
|
-
sources: e.record(
|
|
572
|
-
blocks: e.array(
|
|
571
|
+
sources: e.record(et).default({}),
|
|
572
|
+
blocks: e.array(dt).min(1).max(12)
|
|
573
573
|
}).superRefine((a, t) => {
|
|
574
574
|
const n = (o) => Math.ceil(o / 2), r = (o, s) => {
|
|
575
575
|
const i = o;
|
|
@@ -586,27 +586,27 @@ var We = e.enum([
|
|
|
586
586
|
const i = o.children;
|
|
587
587
|
Array.isArray(i) && i.forEach((l, c) => r(l, ["blocks", s, "children", c]));
|
|
588
588
|
});
|
|
589
|
-
}),
|
|
589
|
+
}), Y = e.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U"), ne = e.string().regex(/^\d{4}$/);
|
|
590
590
|
e.object({
|
|
591
|
-
deviceId:
|
|
592
|
-
code:
|
|
591
|
+
deviceId: Y,
|
|
592
|
+
code: ne,
|
|
593
593
|
/** Firmware build, so a support question has an answer. */
|
|
594
594
|
version: e.string().max(40).optional()
|
|
595
595
|
});
|
|
596
596
|
e.object({
|
|
597
|
-
deviceId:
|
|
598
|
-
code:
|
|
597
|
+
deviceId: Y,
|
|
598
|
+
code: ne
|
|
599
599
|
});
|
|
600
600
|
e.object({
|
|
601
|
-
deviceId:
|
|
601
|
+
deviceId: Y
|
|
602
602
|
});
|
|
603
603
|
e.object({
|
|
604
604
|
revision: e.number().int().nonnegative(),
|
|
605
605
|
sentAt: e.number().int().nonnegative()
|
|
606
606
|
});
|
|
607
607
|
e.object({
|
|
608
|
-
deviceId:
|
|
609
|
-
code:
|
|
608
|
+
deviceId: Y,
|
|
609
|
+
code: ne,
|
|
610
610
|
ownerId: e.string().nullable().default(null),
|
|
611
611
|
version: e.string().max(40).optional(),
|
|
612
612
|
createdAt: e.number().int().nonnegative(),
|
|
@@ -644,7 +644,7 @@ e.object({
|
|
|
644
644
|
/** When it last polled — finer-grained than a registration, for liveness only. */
|
|
645
645
|
lastPollAt: e.number().int().nonnegative().optional()
|
|
646
646
|
});
|
|
647
|
-
var
|
|
647
|
+
var Nr = "?", Dr = {
|
|
648
648
|
// Accented Latin, CP437 0x80-0xA5 and 0xE1
|
|
649
649
|
Ç: { byte: 128, shows: "Ç" },
|
|
650
650
|
ü: { byte: 129, shows: "ü" },
|
|
@@ -716,7 +716,7 @@ var Rr = "?", Nr = {
|
|
|
716
716
|
"—": { byte: 45, shows: "-" },
|
|
717
717
|
"−": { byte: 45, shows: "-" },
|
|
718
718
|
" ": { byte: 32, shows: " " }
|
|
719
|
-
},
|
|
719
|
+
}, Cr = {
|
|
720
720
|
background: "17 17 17",
|
|
721
721
|
foreground: "238 238 238",
|
|
722
722
|
muted: "153 153 153",
|
|
@@ -751,29 +751,29 @@ e.object({
|
|
|
751
751
|
});
|
|
752
752
|
e.object({ ticker: z });
|
|
753
753
|
e.object({});
|
|
754
|
-
var
|
|
754
|
+
var H = "gemini-2.5-flash", ht = "gemini-2.5-flash", gt = "gemini-2.5-pro", T = {
|
|
755
755
|
"google-gemini": "gemini-2.5-flash",
|
|
756
756
|
openai: "gpt-4o-mini",
|
|
757
757
|
anthropic: "claude-haiku-4-5-20251001",
|
|
758
758
|
grok: "grok-2-1212",
|
|
759
759
|
deepseek: "deepseek-chat",
|
|
760
760
|
ollama: "llama3.3"
|
|
761
|
-
},
|
|
761
|
+
}, Mr = {
|
|
762
762
|
/** The Strategist: high creativity, exploratory conversation */
|
|
763
763
|
STRATEGIST: {
|
|
764
|
-
model:
|
|
764
|
+
model: ht,
|
|
765
765
|
provider: "google-gemini",
|
|
766
766
|
temperature: 0.7
|
|
767
767
|
},
|
|
768
768
|
/** The Architect: data schema and resource modeling — precision required */
|
|
769
769
|
ARCHITECT: {
|
|
770
|
-
model:
|
|
770
|
+
model: H,
|
|
771
771
|
provider: "google-gemini",
|
|
772
772
|
temperature: 0.3
|
|
773
773
|
},
|
|
774
774
|
/** The Designer: UI layout generation — moderate creativity */
|
|
775
775
|
DESIGNER: {
|
|
776
|
-
model:
|
|
776
|
+
model: H,
|
|
777
777
|
provider: "google-gemini",
|
|
778
778
|
temperature: 0.5
|
|
779
779
|
},
|
|
@@ -781,13 +781,13 @@ var G = "gemini-2.5-flash", pt = "gemini-2.5-flash", ht = "gemini-2.5-pro", T =
|
|
|
781
781
|
* Uses the Pro tier for superior reasoning on complex structured tasks.
|
|
782
782
|
*/
|
|
783
783
|
REVIEWER: {
|
|
784
|
-
model:
|
|
784
|
+
model: gt,
|
|
785
785
|
provider: "google-gemini",
|
|
786
786
|
temperature: 0.2
|
|
787
787
|
},
|
|
788
788
|
/** The Genesis Engine: one-shot app generation — must be schema-strict */
|
|
789
789
|
GENESIS: {
|
|
790
|
-
model:
|
|
790
|
+
model: H,
|
|
791
791
|
provider: "google-gemini",
|
|
792
792
|
temperature: 0.2
|
|
793
793
|
}
|
|
@@ -916,41 +916,41 @@ RULES
|
|
|
916
916
|
closest thing it can and do not invent a component.
|
|
917
917
|
6. Prefer a rule over a fixed colour whenever the request ties appearance to a
|
|
918
918
|
value. "Red when cold" is a rule; "red" is not.
|
|
919
|
-
`.trim(),
|
|
919
|
+
`.trim(), Lr = "Here is the current app. Change only what is asked:", S = e.string().regex(
|
|
920
920
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
921
921
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
922
|
-
),
|
|
922
|
+
), ft = e.object({
|
|
923
923
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
924
|
-
"--app-primary-color":
|
|
925
|
-
"--app-primary-foreground-color":
|
|
926
|
-
"--app-secondary-color":
|
|
927
|
-
"--app-secondary-foreground-color":
|
|
928
|
-
"--app-accent-color":
|
|
929
|
-
"--app-accent-foreground-color":
|
|
924
|
+
"--app-primary-color": S.optional(),
|
|
925
|
+
"--app-primary-foreground-color": S.optional(),
|
|
926
|
+
"--app-secondary-color": S.optional(),
|
|
927
|
+
"--app-secondary-foreground-color": S.optional(),
|
|
928
|
+
"--app-accent-color": S.optional(),
|
|
929
|
+
"--app-accent-foreground-color": S.optional(),
|
|
930
930
|
// ── Base Surface ─────────────────────────────────────────────────────────
|
|
931
|
-
"--app-bg-color":
|
|
932
|
-
"--app-card-bg-color":
|
|
933
|
-
"--app-text-color":
|
|
934
|
-
"--app-border-color":
|
|
935
|
-
"--app-muted-bg":
|
|
936
|
-
"--app-muted-text":
|
|
931
|
+
"--app-bg-color": S.optional(),
|
|
932
|
+
"--app-card-bg-color": S.optional(),
|
|
933
|
+
"--app-text-color": S.optional(),
|
|
934
|
+
"--app-border-color": S.optional(),
|
|
935
|
+
"--app-muted-bg": S.optional(),
|
|
936
|
+
"--app-muted-text": S.optional(),
|
|
937
937
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
938
938
|
"--app-border-radius-sm": e.string().optional(),
|
|
939
939
|
"--app-border-radius-md": e.string().optional(),
|
|
940
940
|
"--app-border-radius-lg": e.string().optional(),
|
|
941
941
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
942
|
-
"--app-input-bg-color":
|
|
943
|
-
"--app-input-text-color":
|
|
944
|
-
"--app-input-border-color":
|
|
945
|
-
"--app-input-focus-ring-color":
|
|
946
|
-
"--app-input-placeholder-color":
|
|
942
|
+
"--app-input-bg-color": S.optional(),
|
|
943
|
+
"--app-input-text-color": S.optional(),
|
|
944
|
+
"--app-input-border-color": S.optional(),
|
|
945
|
+
"--app-input-focus-ring-color": S.optional(),
|
|
946
|
+
"--app-input-placeholder-color": S.optional(),
|
|
947
947
|
// ── Chart Palette ────────────────────────────────────────────────────────
|
|
948
|
-
"--app-chart-1":
|
|
949
|
-
"--app-chart-2":
|
|
950
|
-
"--app-chart-3":
|
|
951
|
-
"--app-chart-4":
|
|
952
|
-
"--app-chart-5":
|
|
953
|
-
}).strict(),
|
|
948
|
+
"--app-chart-1": S.optional(),
|
|
949
|
+
"--app-chart-2": S.optional(),
|
|
950
|
+
"--app-chart-3": S.optional(),
|
|
951
|
+
"--app-chart-4": S.optional(),
|
|
952
|
+
"--app-chart-5": S.optional()
|
|
953
|
+
}).strict(), yt = e.object({
|
|
954
954
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
955
955
|
heading: e.string(),
|
|
956
956
|
/** Google Font name for body text. Example: "Inter" */
|
|
@@ -964,23 +964,23 @@ e.object({
|
|
|
964
964
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
965
965
|
description: e.string(),
|
|
966
966
|
/** Google Font pairing for heading and body text. */
|
|
967
|
-
fonts:
|
|
967
|
+
fonts: yt.optional(),
|
|
968
968
|
/**
|
|
969
969
|
* CSS variable overrides.
|
|
970
970
|
* Every key must match an --app-* variable name.
|
|
971
971
|
* All color values must be space-separated RGB integers.
|
|
972
972
|
*/
|
|
973
|
-
cssVars:
|
|
973
|
+
cssVars: ft
|
|
974
974
|
});
|
|
975
975
|
e.object({
|
|
976
|
-
primary:
|
|
977
|
-
neutral:
|
|
978
|
-
success:
|
|
979
|
-
warning:
|
|
980
|
-
destructive:
|
|
976
|
+
primary: S,
|
|
977
|
+
neutral: S,
|
|
978
|
+
success: S,
|
|
979
|
+
warning: S,
|
|
980
|
+
destructive: S,
|
|
981
981
|
radius: e.enum(["none", "sm", "md", "lg", "full"])
|
|
982
982
|
});
|
|
983
|
-
var
|
|
983
|
+
var Ur = {
|
|
984
984
|
primary: "13 110 253",
|
|
985
985
|
neutral: "24 24 27",
|
|
986
986
|
success: "34 197 94",
|
|
@@ -999,7 +999,7 @@ e.object({
|
|
|
999
999
|
lastActive: e.string().optional(),
|
|
1000
1000
|
avatarUrl: e.string().optional()
|
|
1001
1001
|
});
|
|
1002
|
-
var U = e.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits"),
|
|
1002
|
+
var U = e.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits"), ae = e.enum(["member", "admin"]), ge = e.enum(["active", "suspended"]), bt = e.object({
|
|
1003
1003
|
algo: e.literal("scrypt"),
|
|
1004
1004
|
n: e.number().int().positive(),
|
|
1005
1005
|
r: e.number().int().positive(),
|
|
@@ -1013,9 +1013,9 @@ e.object({
|
|
|
1013
1013
|
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
1014
1014
|
email: e.string().email().max(254),
|
|
1015
1015
|
name: e.string().min(1).max(64),
|
|
1016
|
-
role:
|
|
1017
|
-
status:
|
|
1018
|
-
password:
|
|
1016
|
+
role: ae,
|
|
1017
|
+
status: ge,
|
|
1018
|
+
password: bt,
|
|
1019
1019
|
createdAt: e.number().int().nonnegative(),
|
|
1020
1020
|
lastLoginAt: e.number().int().nonnegative().nullable().default(null),
|
|
1021
1021
|
/** Which admin approved this, or null for the bootstrap account. */
|
|
@@ -1025,8 +1025,8 @@ e.object({
|
|
|
1025
1025
|
accountId: U,
|
|
1026
1026
|
email: e.string().email(),
|
|
1027
1027
|
name: e.string(),
|
|
1028
|
-
role:
|
|
1029
|
-
status:
|
|
1028
|
+
role: ae,
|
|
1029
|
+
status: ge
|
|
1030
1030
|
});
|
|
1031
1031
|
e.object({
|
|
1032
1032
|
accountId: U,
|
|
@@ -1036,7 +1036,7 @@ e.object({
|
|
|
1036
1036
|
});
|
|
1037
1037
|
e.object({
|
|
1038
1038
|
email: e.string().email().max(254),
|
|
1039
|
-
role:
|
|
1039
|
+
role: ae,
|
|
1040
1040
|
createdAt: e.number().int().nonnegative(),
|
|
1041
1041
|
expiresAt: e.number().int().nonnegative(),
|
|
1042
1042
|
invitedBy: U
|
|
@@ -1047,25 +1047,25 @@ e.object({
|
|
|
1047
1047
|
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
1048
1048
|
reason: e.string().max(500).optional()
|
|
1049
1049
|
});
|
|
1050
|
-
var
|
|
1050
|
+
var wt = e.enum(["pending", "approved", "denied"]);
|
|
1051
1051
|
e.object({
|
|
1052
1052
|
requestId: e.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
|
|
1053
1053
|
email: e.string().email().max(254),
|
|
1054
1054
|
name: e.string().min(1).max(64),
|
|
1055
1055
|
reason: e.string().max(500).optional(),
|
|
1056
|
-
status:
|
|
1056
|
+
status: wt,
|
|
1057
1057
|
createdAt: e.number().int().nonnegative(),
|
|
1058
1058
|
decidedAt: e.number().int().nonnegative().nullable().default(null),
|
|
1059
1059
|
decidedBy: U.nullable().default(null)
|
|
1060
1060
|
});
|
|
1061
|
-
var
|
|
1061
|
+
var Et = e.enum([
|
|
1062
1062
|
"supplier",
|
|
1063
1063
|
"customer",
|
|
1064
1064
|
"partner",
|
|
1065
1065
|
"competitor",
|
|
1066
1066
|
"regulator",
|
|
1067
1067
|
"unknown"
|
|
1068
|
-
]),
|
|
1068
|
+
]), At = e.enum([
|
|
1069
1069
|
"public",
|
|
1070
1070
|
"public_uncovered",
|
|
1071
1071
|
"private",
|
|
@@ -1079,14 +1079,14 @@ e.object({
|
|
|
1079
1079
|
/** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
|
|
1080
1080
|
publicName: e.string().nullable(),
|
|
1081
1081
|
lei: e.string().nullable(),
|
|
1082
|
-
resolution:
|
|
1083
|
-
type:
|
|
1082
|
+
resolution: At,
|
|
1083
|
+
type: Et,
|
|
1084
1084
|
confidence: e.number().min(0).max(1),
|
|
1085
1085
|
sourceSignalIds: e.array(e.number()),
|
|
1086
1086
|
firstSeenAt: e.string().datetime(),
|
|
1087
1087
|
lastSeenAt: e.string().datetime()
|
|
1088
1088
|
});
|
|
1089
|
-
var
|
|
1089
|
+
var xt = e.enum([
|
|
1090
1090
|
"supplies_to",
|
|
1091
1091
|
"purchases_from",
|
|
1092
1092
|
"partners_with",
|
|
@@ -1108,7 +1108,7 @@ e.object({
|
|
|
1108
1108
|
id: e.string(),
|
|
1109
1109
|
sourceId: e.string(),
|
|
1110
1110
|
targetId: e.string(),
|
|
1111
|
-
edgeType:
|
|
1111
|
+
edgeType: xt,
|
|
1112
1112
|
weight: e.number().min(0).max(1),
|
|
1113
1113
|
evidenceSignalIds: e.array(e.number()),
|
|
1114
1114
|
updatedAt: e.string().datetime(),
|
|
@@ -1116,7 +1116,7 @@ e.object({
|
|
|
1116
1116
|
/** null = currently valid. Set when a differently-typed edge supersedes this one. */
|
|
1117
1117
|
validTo: e.string().datetime().nullable()
|
|
1118
1118
|
});
|
|
1119
|
-
var
|
|
1119
|
+
var vt = e.object({
|
|
1120
1120
|
signalId: e.number(),
|
|
1121
1121
|
weight: e.number().min(0).max(1),
|
|
1122
1122
|
reason: e.string().max(280)
|
|
@@ -1131,7 +1131,7 @@ e.object({
|
|
|
1131
1131
|
baseline: e.number(),
|
|
1132
1132
|
observed: e.number(),
|
|
1133
1133
|
computedAt: e.string().datetime(),
|
|
1134
|
-
contributingSignals: e.array(
|
|
1134
|
+
contributingSignals: e.array(vt)
|
|
1135
1135
|
});
|
|
1136
1136
|
e.object({
|
|
1137
1137
|
lei: e.string().nullable(),
|
|
@@ -1142,10 +1142,10 @@ e.object({
|
|
|
1142
1142
|
materialMetadata: e.record(e.unknown()),
|
|
1143
1143
|
discoveredAt: e.string().datetime()
|
|
1144
1144
|
});
|
|
1145
|
-
var
|
|
1145
|
+
var G = e.enum(["db", "mock"]), oe = e.enum(["news", "filing", "report"]), fe = e.enum(["graded", "binary", "default", "none"]), kt = e.enum(["second", "day"]), St = e.object({
|
|
1146
1146
|
/** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
|
|
1147
1147
|
id: e.string(),
|
|
1148
|
-
kind:
|
|
1148
|
+
kind: oe,
|
|
1149
1149
|
/**
|
|
1150
1150
|
* The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
|
|
1151
1151
|
* `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
|
|
@@ -1155,28 +1155,28 @@ var Y = e.enum(["db", "mock"]), ae = e.enum(["news", "filing", "report"]), ge =
|
|
|
1155
1155
|
ticker: e.string(),
|
|
1156
1156
|
/** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
|
|
1157
1157
|
occurredAt: e.string(),
|
|
1158
|
-
precision:
|
|
1158
|
+
precision: kt,
|
|
1159
1159
|
title: e.string(),
|
|
1160
1160
|
summary: e.string().nullable(),
|
|
1161
1161
|
url: e.string().nullable(),
|
|
1162
1162
|
impact: e.number().nullable(),
|
|
1163
|
-
impactScale:
|
|
1163
|
+
impactScale: fe,
|
|
1164
1164
|
/** 0 bearish … 50 neutral … 100 bullish. */
|
|
1165
1165
|
sentiment: e.number().nullable(),
|
|
1166
1166
|
/** False for filings, and for any event sitting at exactly neutral. */
|
|
1167
1167
|
sentimentIsMeaningful: e.boolean(),
|
|
1168
|
-
source:
|
|
1168
|
+
source: G,
|
|
1169
1169
|
meta: e.record(e.unknown()).nullable()
|
|
1170
1170
|
});
|
|
1171
1171
|
e.object({
|
|
1172
1172
|
total: e.number(),
|
|
1173
1173
|
page: e.number(),
|
|
1174
1174
|
page_size: e.number(),
|
|
1175
|
-
data: e.array(
|
|
1175
|
+
data: e.array(St)
|
|
1176
1176
|
});
|
|
1177
|
-
var
|
|
1177
|
+
var _t = e.enum(["day", "week", "month"]), Tt = e.object({
|
|
1178
1178
|
bucketStart: e.string(),
|
|
1179
|
-
kind:
|
|
1179
|
+
kind: oe,
|
|
1180
1180
|
count: e.number(),
|
|
1181
1181
|
/** Null when no event in the bucket had meaningful sentiment. */
|
|
1182
1182
|
avgSentiment: e.number().nullable(),
|
|
@@ -1184,26 +1184,26 @@ var St = e.enum(["day", "week", "month"]), _t = e.object({
|
|
|
1184
1184
|
});
|
|
1185
1185
|
e.object({
|
|
1186
1186
|
ticker: e.string(),
|
|
1187
|
-
bucket:
|
|
1188
|
-
buckets: e.array(
|
|
1187
|
+
bucket: _t,
|
|
1188
|
+
buckets: e.array(Tt),
|
|
1189
1189
|
/** So the client can set its time domain without a second request. */
|
|
1190
1190
|
range: e.object({ min: e.string(), max: e.string() }),
|
|
1191
|
-
source:
|
|
1191
|
+
source: G
|
|
1192
1192
|
});
|
|
1193
|
-
var
|
|
1194
|
-
kind:
|
|
1193
|
+
var It = e.object({
|
|
1194
|
+
kind: oe,
|
|
1195
1195
|
count: e.number(),
|
|
1196
1196
|
earliest: e.string().nullable(),
|
|
1197
1197
|
latest: e.string().nullable(),
|
|
1198
|
-
impactScale:
|
|
1198
|
+
impactScale: fe,
|
|
1199
1199
|
sentimentUsable: e.boolean()
|
|
1200
1200
|
});
|
|
1201
1201
|
e.object({
|
|
1202
1202
|
ticker: e.string(),
|
|
1203
|
-
facets: e.array(
|
|
1204
|
-
source:
|
|
1203
|
+
facets: e.array(It),
|
|
1204
|
+
source: G
|
|
1205
1205
|
});
|
|
1206
|
-
var
|
|
1206
|
+
var Ot = e.object({
|
|
1207
1207
|
date: e.string(),
|
|
1208
1208
|
open: e.number().nullable(),
|
|
1209
1209
|
high: e.number().nullable(),
|
|
@@ -1213,11 +1213,11 @@ var It = e.object({
|
|
|
1213
1213
|
});
|
|
1214
1214
|
e.object({
|
|
1215
1215
|
ticker: e.string(),
|
|
1216
|
-
series: e.array(
|
|
1217
|
-
source:
|
|
1216
|
+
series: e.array(Ot),
|
|
1217
|
+
source: G
|
|
1218
1218
|
});
|
|
1219
|
-
var
|
|
1220
|
-
const
|
|
1219
|
+
var Br = 50;
|
|
1220
|
+
const ie = {
|
|
1221
1221
|
// May 2026 stable series — gemini-2.0-flash is deprecated (404)
|
|
1222
1222
|
"google-gemini": ["gemini-2.5-flash", "gemini-2.5-pro", "gemini-2.5-flash-preview-05-20", "gemini-1.5-flash"],
|
|
1223
1223
|
openai: ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-3.5-turbo"],
|
|
@@ -1240,20 +1240,20 @@ const oe = {
|
|
|
1240
1240
|
// (core/ai_router.py's DEFAULT_MODELS) — llama3.2 (3B) was found live
|
|
1241
1241
|
// to mis-trigger tool calls on plain greetings.
|
|
1242
1242
|
ollama: ["llama3.3", "qwen2.5:32b", "qwen2.5-coder:32b", "qwen2.5-coder:14b", "qwen2.5-coder:7b", "llama3.2"]
|
|
1243
|
-
},
|
|
1243
|
+
}, qr = {
|
|
1244
1244
|
"google-gemini": "Google Gemini",
|
|
1245
1245
|
openai: "OpenAI",
|
|
1246
1246
|
anthropic: "Anthropic (Claude)",
|
|
1247
1247
|
grok: "xAI Grok",
|
|
1248
1248
|
deepseek: "DeepSeek",
|
|
1249
1249
|
ollama: "Ollama (Local)"
|
|
1250
|
-
},
|
|
1250
|
+
}, Zr = {
|
|
1251
1251
|
"google-gemini": "AIzaSy…",
|
|
1252
1252
|
openai: "sk-…",
|
|
1253
1253
|
anthropic: "sk-ant-…",
|
|
1254
1254
|
grok: "xai-…",
|
|
1255
1255
|
deepseek: "sk-…"
|
|
1256
|
-
},
|
|
1256
|
+
}, Pt = Symbol("Let zodToJsonSchema decide on which parser to use"), le = {
|
|
1257
1257
|
name: void 0,
|
|
1258
1258
|
$refStrategy: "root",
|
|
1259
1259
|
basePath: ["#"],
|
|
@@ -1276,14 +1276,14 @@ const oe = {
|
|
|
1276
1276
|
base64Strategy: "contentEncoding:base64",
|
|
1277
1277
|
nameStrategy: "ref",
|
|
1278
1278
|
openAiAnyTypeName: "OpenAiAnyType"
|
|
1279
|
-
},
|
|
1280
|
-
...
|
|
1279
|
+
}, jt = (a) => typeof a == "string" ? {
|
|
1280
|
+
...le,
|
|
1281
1281
|
name: a
|
|
1282
1282
|
} : {
|
|
1283
|
-
...
|
|
1283
|
+
...le,
|
|
1284
1284
|
...a
|
|
1285
|
-
},
|
|
1286
|
-
const t =
|
|
1285
|
+
}, Rt = (a) => {
|
|
1286
|
+
const t = jt(a), n = t.name !== void 0 ? [...t.basePath, t.definitionPath, t.name] : t.basePath;
|
|
1287
1287
|
return {
|
|
1288
1288
|
...t,
|
|
1289
1289
|
flags: { hasReferencedOpenAiAnyType: !1 },
|
|
@@ -1300,25 +1300,25 @@ const oe = {
|
|
|
1300
1300
|
]))
|
|
1301
1301
|
};
|
|
1302
1302
|
};
|
|
1303
|
-
function
|
|
1303
|
+
function ye(a, t, n, r) {
|
|
1304
1304
|
r != null && r.errorMessages && n && (a.errorMessage = {
|
|
1305
1305
|
...a.errorMessage,
|
|
1306
1306
|
[t]: n
|
|
1307
1307
|
});
|
|
1308
1308
|
}
|
|
1309
1309
|
function k(a, t, n, r, o) {
|
|
1310
|
-
a[t] = n,
|
|
1310
|
+
a[t] = n, ye(a, t, r, o);
|
|
1311
1311
|
}
|
|
1312
|
-
const
|
|
1312
|
+
const be = (a, t) => {
|
|
1313
1313
|
let n = 0;
|
|
1314
1314
|
for (; n < a.length && n < t.length && a[n] === t[n]; n++)
|
|
1315
1315
|
;
|
|
1316
1316
|
return [(a.length - n).toString(), ...t.slice(n)].join("/");
|
|
1317
1317
|
};
|
|
1318
|
-
var
|
|
1318
|
+
var f;
|
|
1319
1319
|
(function(a) {
|
|
1320
1320
|
a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
|
|
1321
|
-
})(
|
|
1321
|
+
})(f || (f = {}));
|
|
1322
1322
|
function O(a) {
|
|
1323
1323
|
if (a.target !== "openAi")
|
|
1324
1324
|
return {};
|
|
@@ -1328,20 +1328,20 @@ function O(a) {
|
|
|
1328
1328
|
a.openAiAnyTypeName
|
|
1329
1329
|
];
|
|
1330
1330
|
return a.flags.hasReferencedOpenAiAnyType = !0, {
|
|
1331
|
-
$ref: a.$refStrategy === "relative" ?
|
|
1331
|
+
$ref: a.$refStrategy === "relative" ? be(t, a.currentPath) : t.join("/")
|
|
1332
1332
|
};
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1334
|
+
function Nt(a, t) {
|
|
1335
1335
|
var r, o, s;
|
|
1336
1336
|
const n = {
|
|
1337
1337
|
type: "array"
|
|
1338
1338
|
};
|
|
1339
|
-
return (r = a.type) != null && r._def && ((s = (o = a.type) == null ? void 0 : o._def) == null ? void 0 : s.typeName) !==
|
|
1339
|
+
return (r = a.type) != null && r._def && ((s = (o = a.type) == null ? void 0 : o._def) == null ? void 0 : s.typeName) !== f.ZodAny && (n.items = A(a.type._def, {
|
|
1340
1340
|
...t,
|
|
1341
1341
|
currentPath: [...t.currentPath, "items"]
|
|
1342
1342
|
})), a.minLength && k(n, "minItems", a.minLength.value, a.minLength.message, t), a.maxLength && k(n, "maxItems", a.maxLength.value, a.maxLength.message, t), a.exactLength && (k(n, "minItems", a.exactLength.value, a.exactLength.message, t), k(n, "maxItems", a.exactLength.value, a.exactLength.message, t)), n;
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function Dt(a, t) {
|
|
1345
1345
|
const n = {
|
|
1346
1346
|
type: "integer",
|
|
1347
1347
|
format: "int64"
|
|
@@ -1362,20 +1362,20 @@ function Nt(a, t) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
return n;
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1365
|
+
function Ct() {
|
|
1366
1366
|
return {
|
|
1367
1367
|
type: "boolean"
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1371
|
-
return
|
|
1370
|
+
function we(a, t) {
|
|
1371
|
+
return A(a.type._def, t);
|
|
1372
1372
|
}
|
|
1373
|
-
const
|
|
1374
|
-
function
|
|
1373
|
+
const Mt = (a, t) => A(a.innerType._def, t);
|
|
1374
|
+
function Ee(a, t, n) {
|
|
1375
1375
|
const r = n ?? t.dateStrategy;
|
|
1376
1376
|
if (Array.isArray(r))
|
|
1377
1377
|
return {
|
|
1378
|
-
anyOf: r.map((o, s) =>
|
|
1378
|
+
anyOf: r.map((o, s) => Ee(a, t, o))
|
|
1379
1379
|
};
|
|
1380
1380
|
switch (r) {
|
|
1381
1381
|
case "string":
|
|
@@ -1425,29 +1425,29 @@ const $t = (a, t) => {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
return n;
|
|
1427
1427
|
};
|
|
1428
|
-
function
|
|
1428
|
+
function Lt(a, t) {
|
|
1429
1429
|
return {
|
|
1430
|
-
...
|
|
1430
|
+
...A(a.innerType._def, t),
|
|
1431
1431
|
default: a.defaultValue()
|
|
1432
1432
|
};
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1435
|
-
return t.effectStrategy === "input" ?
|
|
1434
|
+
function Ut(a, t) {
|
|
1435
|
+
return t.effectStrategy === "input" ? A(a.schema._def, t) : O(t);
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function Bt(a) {
|
|
1438
1438
|
return {
|
|
1439
1439
|
type: "string",
|
|
1440
1440
|
enum: Array.from(a.values)
|
|
1441
1441
|
};
|
|
1442
1442
|
}
|
|
1443
|
-
const
|
|
1444
|
-
function
|
|
1443
|
+
const qt = (a) => "type" in a && a.type === "string" ? !1 : "allOf" in a;
|
|
1444
|
+
function Zt(a, t) {
|
|
1445
1445
|
const n = [
|
|
1446
|
-
|
|
1446
|
+
A(a.left._def, {
|
|
1447
1447
|
...t,
|
|
1448
1448
|
currentPath: [...t.currentPath, "allOf", "0"]
|
|
1449
1449
|
}),
|
|
1450
|
-
|
|
1450
|
+
A(a.right._def, {
|
|
1451
1451
|
...t,
|
|
1452
1452
|
currentPath: [...t.currentPath, "allOf", "1"]
|
|
1453
1453
|
})
|
|
@@ -1455,7 +1455,7 @@ function qt(a, t) {
|
|
|
1455
1455
|
let r = t.target === "jsonSchema2019-09" ? { unevaluatedProperties: !1 } : void 0;
|
|
1456
1456
|
const o = [];
|
|
1457
1457
|
return n.forEach((s) => {
|
|
1458
|
-
if (
|
|
1458
|
+
if (qt(s))
|
|
1459
1459
|
o.push(...s.allOf), s.unevaluatedProperties === void 0 && (r = void 0);
|
|
1460
1460
|
else {
|
|
1461
1461
|
let i = s;
|
|
@@ -1471,7 +1471,7 @@ function qt(a, t) {
|
|
|
1471
1471
|
...r
|
|
1472
1472
|
} : void 0;
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1474
|
+
function Ft(a, t) {
|
|
1475
1475
|
const n = typeof a.value;
|
|
1476
1476
|
return n !== "bigint" && n !== "number" && n !== "boolean" && n !== "string" ? {
|
|
1477
1477
|
type: Array.isArray(a.value) ? "array" : "object"
|
|
@@ -1483,7 +1483,7 @@ function Zt(a, t) {
|
|
|
1483
1483
|
const: a.value
|
|
1484
1484
|
};
|
|
1485
1485
|
}
|
|
1486
|
-
let
|
|
1486
|
+
let W;
|
|
1487
1487
|
const j = {
|
|
1488
1488
|
/**
|
|
1489
1489
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
@@ -1506,7 +1506,7 @@ const j = {
|
|
|
1506
1506
|
* Fix in Zod:
|
|
1507
1507
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
1508
1508
|
*/
|
|
1509
|
-
emoji: () => (
|
|
1509
|
+
emoji: () => (W === void 0 && (W = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), W),
|
|
1510
1510
|
/**
|
|
1511
1511
|
* Unused
|
|
1512
1512
|
*/
|
|
@@ -1526,7 +1526,7 @@ const j = {
|
|
|
1526
1526
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
1527
1527
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
1528
1528
|
};
|
|
1529
|
-
function
|
|
1529
|
+
function Ae(a, t) {
|
|
1530
1530
|
const n = {
|
|
1531
1531
|
type: "string"
|
|
1532
1532
|
};
|
|
@@ -1568,10 +1568,10 @@ function Ee(a, t) {
|
|
|
1568
1568
|
I(n, j.cuid2, r.message, t);
|
|
1569
1569
|
break;
|
|
1570
1570
|
case "startsWith":
|
|
1571
|
-
I(n, RegExp(`^${
|
|
1571
|
+
I(n, RegExp(`^${X(r.value, t)}`), r.message, t);
|
|
1572
1572
|
break;
|
|
1573
1573
|
case "endsWith":
|
|
1574
|
-
I(n, RegExp(`${
|
|
1574
|
+
I(n, RegExp(`${X(r.value, t)}$`), r.message, t);
|
|
1575
1575
|
break;
|
|
1576
1576
|
case "datetime":
|
|
1577
1577
|
R(n, "date-time", r.message, t);
|
|
@@ -1589,7 +1589,7 @@ function Ee(a, t) {
|
|
|
1589
1589
|
k(n, "minLength", typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, r.message, t), k(n, "maxLength", typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value, r.message, t);
|
|
1590
1590
|
break;
|
|
1591
1591
|
case "includes": {
|
|
1592
|
-
I(n, RegExp(
|
|
1592
|
+
I(n, RegExp(X(r.value, t)), r.message, t);
|
|
1593
1593
|
break;
|
|
1594
1594
|
}
|
|
1595
1595
|
case "ip": {
|
|
@@ -1635,14 +1635,14 @@ function Ee(a, t) {
|
|
|
1635
1635
|
}
|
|
1636
1636
|
return n;
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1639
|
-
return t.patternStrategy === "escape" ?
|
|
1638
|
+
function X(a, t) {
|
|
1639
|
+
return t.patternStrategy === "escape" ? Vt(a) : a;
|
|
1640
1640
|
}
|
|
1641
|
-
const
|
|
1642
|
-
function
|
|
1641
|
+
const zt = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
1642
|
+
function Vt(a) {
|
|
1643
1643
|
let t = "";
|
|
1644
1644
|
for (let n = 0; n < a.length; n++)
|
|
1645
|
-
|
|
1645
|
+
zt.has(a[n]) || (t += "\\"), t += a[n];
|
|
1646
1646
|
return t;
|
|
1647
1647
|
}
|
|
1648
1648
|
function R(a, t, n, r) {
|
|
@@ -1665,11 +1665,11 @@ function I(a, t, n, r) {
|
|
|
1665
1665
|
errorMessage: { pattern: a.errorMessage.pattern }
|
|
1666
1666
|
}
|
|
1667
1667
|
}), delete a.pattern, a.errorMessage && (delete a.errorMessage.pattern, Object.keys(a.errorMessage).length === 0 && delete a.errorMessage)), a.allOf.push({
|
|
1668
|
-
pattern:
|
|
1668
|
+
pattern: ue(t, r),
|
|
1669
1669
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
1670
|
-
})) : k(a, "pattern",
|
|
1670
|
+
})) : k(a, "pattern", ue(t, r), n, r);
|
|
1671
1671
|
}
|
|
1672
|
-
function
|
|
1672
|
+
function ue(a, t) {
|
|
1673
1673
|
var c;
|
|
1674
1674
|
if (!t.applyRegexFlags || !a.flags)
|
|
1675
1675
|
return a.source;
|
|
@@ -1722,15 +1722,15 @@ function le(a, t) {
|
|
|
1722
1722
|
}
|
|
1723
1723
|
return o;
|
|
1724
1724
|
}
|
|
1725
|
-
function
|
|
1725
|
+
function xe(a, t) {
|
|
1726
1726
|
var r, o, s, i, l, c;
|
|
1727
|
-
if (t.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), t.target === "openApi3" && ((r = a.keyType) == null ? void 0 : r._def.typeName) ===
|
|
1727
|
+
if (t.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), t.target === "openApi3" && ((r = a.keyType) == null ? void 0 : r._def.typeName) === f.ZodEnum)
|
|
1728
1728
|
return {
|
|
1729
1729
|
type: "object",
|
|
1730
1730
|
required: a.keyType._def.values,
|
|
1731
1731
|
properties: a.keyType._def.values.reduce((u, m) => ({
|
|
1732
1732
|
...u,
|
|
1733
|
-
[m]:
|
|
1733
|
+
[m]: A(a.valueType._def, {
|
|
1734
1734
|
...t,
|
|
1735
1735
|
currentPath: [...t.currentPath, "properties", m]
|
|
1736
1736
|
}) ?? O(t)
|
|
@@ -1739,29 +1739,29 @@ function Ae(a, t) {
|
|
|
1739
1739
|
};
|
|
1740
1740
|
const n = {
|
|
1741
1741
|
type: "object",
|
|
1742
|
-
additionalProperties:
|
|
1742
|
+
additionalProperties: A(a.valueType._def, {
|
|
1743
1743
|
...t,
|
|
1744
1744
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1745
1745
|
}) ?? t.allowedAdditionalProperties
|
|
1746
1746
|
};
|
|
1747
1747
|
if (t.target === "openApi3")
|
|
1748
1748
|
return n;
|
|
1749
|
-
if (((o = a.keyType) == null ? void 0 : o._def.typeName) ===
|
|
1750
|
-
const { type: u, ...m } =
|
|
1749
|
+
if (((o = a.keyType) == null ? void 0 : o._def.typeName) === f.ZodString && ((s = a.keyType._def.checks) != null && s.length)) {
|
|
1750
|
+
const { type: u, ...m } = Ae(a.keyType._def, t);
|
|
1751
1751
|
return {
|
|
1752
1752
|
...n,
|
|
1753
1753
|
propertyNames: m
|
|
1754
1754
|
};
|
|
1755
1755
|
} else {
|
|
1756
|
-
if (((i = a.keyType) == null ? void 0 : i._def.typeName) ===
|
|
1756
|
+
if (((i = a.keyType) == null ? void 0 : i._def.typeName) === f.ZodEnum)
|
|
1757
1757
|
return {
|
|
1758
1758
|
...n,
|
|
1759
1759
|
propertyNames: {
|
|
1760
1760
|
enum: a.keyType._def.values
|
|
1761
1761
|
}
|
|
1762
1762
|
};
|
|
1763
|
-
if (((l = a.keyType) == null ? void 0 : l._def.typeName) ===
|
|
1764
|
-
const { type: u, ...m } =
|
|
1763
|
+
if (((l = a.keyType) == null ? void 0 : l._def.typeName) === f.ZodBranded && a.keyType._def.type._def.typeName === f.ZodString && ((c = a.keyType._def.type._def.checks) != null && c.length)) {
|
|
1764
|
+
const { type: u, ...m } = we(a.keyType._def, t);
|
|
1765
1765
|
return {
|
|
1766
1766
|
...n,
|
|
1767
1767
|
propertyNames: m
|
|
@@ -1770,13 +1770,13 @@ function Ae(a, t) {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
return n;
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1773
|
+
function Kt(a, t) {
|
|
1774
1774
|
if (t.mapStrategy === "record")
|
|
1775
|
-
return
|
|
1776
|
-
const n =
|
|
1775
|
+
return xe(a, t);
|
|
1776
|
+
const n = A(a.keyType._def, {
|
|
1777
1777
|
...t,
|
|
1778
1778
|
currentPath: [...t.currentPath, "items", "items", "0"]
|
|
1779
|
-
}) || O(t), r =
|
|
1779
|
+
}) || O(t), r = A(a.valueType._def, {
|
|
1780
1780
|
...t,
|
|
1781
1781
|
currentPath: [...t.currentPath, "items", "items", "1"]
|
|
1782
1782
|
}) || O(t);
|
|
@@ -1798,7 +1798,7 @@ function Jt(a) {
|
|
|
1798
1798
|
enum: r
|
|
1799
1799
|
};
|
|
1800
1800
|
}
|
|
1801
|
-
function
|
|
1801
|
+
function Yt(a) {
|
|
1802
1802
|
return a.target === "openAi" ? void 0 : {
|
|
1803
1803
|
not: O({
|
|
1804
1804
|
...a,
|
|
@@ -1806,7 +1806,7 @@ function Kt(a) {
|
|
|
1806
1806
|
})
|
|
1807
1807
|
};
|
|
1808
1808
|
}
|
|
1809
|
-
function
|
|
1809
|
+
function Gt(a) {
|
|
1810
1810
|
return a.target === "openApi3" ? {
|
|
1811
1811
|
enum: ["null"],
|
|
1812
1812
|
nullable: !0
|
|
@@ -1814,20 +1814,20 @@ function Yt(a) {
|
|
|
1814
1814
|
type: "null"
|
|
1815
1815
|
};
|
|
1816
1816
|
}
|
|
1817
|
-
const
|
|
1817
|
+
const K = {
|
|
1818
1818
|
ZodString: "string",
|
|
1819
1819
|
ZodNumber: "number",
|
|
1820
1820
|
ZodBigInt: "integer",
|
|
1821
1821
|
ZodBoolean: "boolean",
|
|
1822
1822
|
ZodNull: "null"
|
|
1823
1823
|
};
|
|
1824
|
-
function
|
|
1824
|
+
function Ht(a, t) {
|
|
1825
1825
|
if (t.target === "openApi3")
|
|
1826
|
-
return
|
|
1826
|
+
return me(a, t);
|
|
1827
1827
|
const n = a.options instanceof Map ? Array.from(a.options.values()) : a.options;
|
|
1828
|
-
if (n.every((r) => r._def.typeName in
|
|
1828
|
+
if (n.every((r) => r._def.typeName in K && (!r._def.checks || !r._def.checks.length))) {
|
|
1829
1829
|
const r = n.reduce((o, s) => {
|
|
1830
|
-
const i =
|
|
1830
|
+
const i = K[s._def.typeName];
|
|
1831
1831
|
return i && !o.includes(i) ? [...o, i] : o;
|
|
1832
1832
|
}, []);
|
|
1833
1833
|
return {
|
|
@@ -1868,40 +1868,40 @@ function Gt(a, t) {
|
|
|
1868
1868
|
...o._def.values.filter((s) => !r.includes(s))
|
|
1869
1869
|
], [])
|
|
1870
1870
|
};
|
|
1871
|
-
return
|
|
1871
|
+
return me(a, t);
|
|
1872
1872
|
}
|
|
1873
|
-
const
|
|
1874
|
-
const n = (a.options instanceof Map ? Array.from(a.options.values()) : a.options).map((r, o) =>
|
|
1873
|
+
const me = (a, t) => {
|
|
1874
|
+
const n = (a.options instanceof Map ? Array.from(a.options.values()) : a.options).map((r, o) => A(r._def, {
|
|
1875
1875
|
...t,
|
|
1876
1876
|
currentPath: [...t.currentPath, "anyOf", `${o}`]
|
|
1877
1877
|
})).filter((r) => !!r && (!t.strictUnions || typeof r == "object" && Object.keys(r).length > 0));
|
|
1878
1878
|
return n.length ? { anyOf: n } : void 0;
|
|
1879
1879
|
};
|
|
1880
|
-
function
|
|
1880
|
+
function Wt(a, t) {
|
|
1881
1881
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(a.innerType._def.typeName) && (!a.innerType._def.checks || !a.innerType._def.checks.length))
|
|
1882
1882
|
return t.target === "openApi3" ? {
|
|
1883
|
-
type:
|
|
1883
|
+
type: K[a.innerType._def.typeName],
|
|
1884
1884
|
nullable: !0
|
|
1885
1885
|
} : {
|
|
1886
1886
|
type: [
|
|
1887
|
-
|
|
1887
|
+
K[a.innerType._def.typeName],
|
|
1888
1888
|
"null"
|
|
1889
1889
|
]
|
|
1890
1890
|
};
|
|
1891
1891
|
if (t.target === "openApi3") {
|
|
1892
|
-
const r =
|
|
1892
|
+
const r = A(a.innerType._def, {
|
|
1893
1893
|
...t,
|
|
1894
1894
|
currentPath: [...t.currentPath]
|
|
1895
1895
|
});
|
|
1896
1896
|
return r && "$ref" in r ? { allOf: [r], nullable: !0 } : r && { ...r, nullable: !0 };
|
|
1897
1897
|
}
|
|
1898
|
-
const n =
|
|
1898
|
+
const n = A(a.innerType._def, {
|
|
1899
1899
|
...t,
|
|
1900
1900
|
currentPath: [...t.currentPath, "anyOf", "0"]
|
|
1901
1901
|
});
|
|
1902
1902
|
return n && { anyOf: [n, { type: "null" }] };
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Xt(a, t) {
|
|
1905
1905
|
const n = {
|
|
1906
1906
|
type: "number"
|
|
1907
1907
|
};
|
|
@@ -1910,7 +1910,7 @@ function Wt(a, t) {
|
|
|
1910
1910
|
for (const r of a.checks)
|
|
1911
1911
|
switch (r.kind) {
|
|
1912
1912
|
case "int":
|
|
1913
|
-
n.type = "integer",
|
|
1913
|
+
n.type = "integer", ye(n, "type", r.message, t);
|
|
1914
1914
|
break;
|
|
1915
1915
|
case "min":
|
|
1916
1916
|
t.target === "jsonSchema7" ? r.inclusive ? k(n, "minimum", r.value, r.message, t) : k(n, "exclusiveMinimum", r.value, r.message, t) : (r.inclusive || (n.exclusiveMinimum = !0), k(n, "minimum", r.value, r.message, t));
|
|
@@ -1924,7 +1924,7 @@ function Wt(a, t) {
|
|
|
1924
1924
|
}
|
|
1925
1925
|
return n;
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function Qt(a, t) {
|
|
1928
1928
|
const n = t.target === "openAi", r = {
|
|
1929
1929
|
type: "object",
|
|
1930
1930
|
properties: {}
|
|
@@ -1933,9 +1933,9 @@ function Xt(a, t) {
|
|
|
1933
1933
|
let c = s[l];
|
|
1934
1934
|
if (c === void 0 || c._def === void 0)
|
|
1935
1935
|
continue;
|
|
1936
|
-
let u =
|
|
1936
|
+
let u = tr(c);
|
|
1937
1937
|
u && n && (c._def.typeName === "ZodOptional" && (c = c._def.innerType), c.isNullable() || (c = c.nullable()), u = !1);
|
|
1938
|
-
const m =
|
|
1938
|
+
const m = A(c._def, {
|
|
1939
1939
|
...t,
|
|
1940
1940
|
currentPath: [...t.currentPath, "properties", l],
|
|
1941
1941
|
propertyPath: [...t.currentPath, "properties", l]
|
|
@@ -1943,12 +1943,12 @@ function Xt(a, t) {
|
|
|
1943
1943
|
m !== void 0 && (r.properties[l] = m, u || o.push(l));
|
|
1944
1944
|
}
|
|
1945
1945
|
o.length && (r.required = o);
|
|
1946
|
-
const i =
|
|
1946
|
+
const i = er(a, t);
|
|
1947
1947
|
return i !== void 0 && (r.additionalProperties = i), r;
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
1949
|
+
function er(a, t) {
|
|
1950
1950
|
if (a.catchall._def.typeName !== "ZodNever")
|
|
1951
|
-
return
|
|
1951
|
+
return A(a.catchall._def, {
|
|
1952
1952
|
...t,
|
|
1953
1953
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1954
1954
|
});
|
|
@@ -1961,18 +1961,18 @@ function Qt(a, t) {
|
|
|
1961
1961
|
return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1962
1962
|
}
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1964
|
+
function tr(a) {
|
|
1965
1965
|
try {
|
|
1966
1966
|
return a.isOptional();
|
|
1967
1967
|
} catch {
|
|
1968
1968
|
return !0;
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
1971
|
-
const
|
|
1971
|
+
const rr = (a, t) => {
|
|
1972
1972
|
var r;
|
|
1973
1973
|
if (t.currentPath.toString() === ((r = t.propertyPath) == null ? void 0 : r.toString()))
|
|
1974
|
-
return
|
|
1975
|
-
const n =
|
|
1974
|
+
return A(a.innerType._def, t);
|
|
1975
|
+
const n = A(a.innerType._def, {
|
|
1976
1976
|
...t,
|
|
1977
1977
|
currentPath: [...t.currentPath, "anyOf", "1"]
|
|
1978
1978
|
});
|
|
@@ -1984,15 +1984,15 @@ const tr = (a, t) => {
|
|
|
1984
1984
|
n
|
|
1985
1985
|
]
|
|
1986
1986
|
} : O(t);
|
|
1987
|
-
},
|
|
1987
|
+
}, nr = (a, t) => {
|
|
1988
1988
|
if (t.pipeStrategy === "input")
|
|
1989
|
-
return
|
|
1989
|
+
return A(a.in._def, t);
|
|
1990
1990
|
if (t.pipeStrategy === "output")
|
|
1991
|
-
return
|
|
1992
|
-
const n =
|
|
1991
|
+
return A(a.out._def, t);
|
|
1992
|
+
const n = A(a.in._def, {
|
|
1993
1993
|
...t,
|
|
1994
1994
|
currentPath: [...t.currentPath, "allOf", "0"]
|
|
1995
|
-
}), r =
|
|
1995
|
+
}), r = A(a.out._def, {
|
|
1996
1996
|
...t,
|
|
1997
1997
|
currentPath: [...t.currentPath, "allOf", n ? "1" : "0"]
|
|
1998
1998
|
});
|
|
@@ -2000,29 +2000,29 @@ const tr = (a, t) => {
|
|
|
2000
2000
|
allOf: [n, r].filter((o) => o !== void 0)
|
|
2001
2001
|
};
|
|
2002
2002
|
};
|
|
2003
|
-
function nr(a, t) {
|
|
2004
|
-
return x(a.type._def, t);
|
|
2005
|
-
}
|
|
2006
2003
|
function ar(a, t) {
|
|
2004
|
+
return A(a.type._def, t);
|
|
2005
|
+
}
|
|
2006
|
+
function or(a, t) {
|
|
2007
2007
|
const r = {
|
|
2008
2008
|
type: "array",
|
|
2009
2009
|
uniqueItems: !0,
|
|
2010
|
-
items:
|
|
2010
|
+
items: A(a.valueType._def, {
|
|
2011
2011
|
...t,
|
|
2012
2012
|
currentPath: [...t.currentPath, "items"]
|
|
2013
2013
|
})
|
|
2014
2014
|
};
|
|
2015
2015
|
return a.minSize && k(r, "minItems", a.minSize.value, a.minSize.message, t), a.maxSize && k(r, "maxItems", a.maxSize.value, a.maxSize.message, t), r;
|
|
2016
2016
|
}
|
|
2017
|
-
function
|
|
2017
|
+
function ir(a, t) {
|
|
2018
2018
|
return a.rest ? {
|
|
2019
2019
|
type: "array",
|
|
2020
2020
|
minItems: a.items.length,
|
|
2021
|
-
items: a.items.map((n, r) =>
|
|
2021
|
+
items: a.items.map((n, r) => A(n._def, {
|
|
2022
2022
|
...t,
|
|
2023
2023
|
currentPath: [...t.currentPath, "items", `${r}`]
|
|
2024
2024
|
})).reduce((n, r) => r === void 0 ? n : [...n, r], []),
|
|
2025
|
-
additionalItems:
|
|
2025
|
+
additionalItems: A(a.rest._def, {
|
|
2026
2026
|
...t,
|
|
2027
2027
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
2028
2028
|
})
|
|
@@ -2030,137 +2030,137 @@ function or(a, t) {
|
|
|
2030
2030
|
type: "array",
|
|
2031
2031
|
minItems: a.items.length,
|
|
2032
2032
|
maxItems: a.items.length,
|
|
2033
|
-
items: a.items.map((n, r) =>
|
|
2033
|
+
items: a.items.map((n, r) => A(n._def, {
|
|
2034
2034
|
...t,
|
|
2035
2035
|
currentPath: [...t.currentPath, "items", `${r}`]
|
|
2036
2036
|
})).reduce((n, r) => r === void 0 ? n : [...n, r], [])
|
|
2037
2037
|
};
|
|
2038
2038
|
}
|
|
2039
|
-
function
|
|
2039
|
+
function sr(a) {
|
|
2040
2040
|
return {
|
|
2041
2041
|
not: O(a)
|
|
2042
2042
|
};
|
|
2043
2043
|
}
|
|
2044
|
-
function
|
|
2044
|
+
function cr(a) {
|
|
2045
2045
|
return O(a);
|
|
2046
2046
|
}
|
|
2047
|
-
const
|
|
2047
|
+
const lr = (a, t) => A(a.innerType._def, t), ur = (a, t, n) => {
|
|
2048
2048
|
switch (t) {
|
|
2049
|
-
case
|
|
2050
|
-
return
|
|
2051
|
-
case
|
|
2052
|
-
return Wt(a, n);
|
|
2053
|
-
case y.ZodObject:
|
|
2049
|
+
case f.ZodString:
|
|
2050
|
+
return Ae(a, n);
|
|
2051
|
+
case f.ZodNumber:
|
|
2054
2052
|
return Xt(a, n);
|
|
2055
|
-
case
|
|
2053
|
+
case f.ZodObject:
|
|
2054
|
+
return Qt(a, n);
|
|
2055
|
+
case f.ZodBigInt:
|
|
2056
|
+
return Dt(a, n);
|
|
2057
|
+
case f.ZodBoolean:
|
|
2058
|
+
return Ct();
|
|
2059
|
+
case f.ZodDate:
|
|
2060
|
+
return Ee(a, n);
|
|
2061
|
+
case f.ZodUndefined:
|
|
2062
|
+
return sr(n);
|
|
2063
|
+
case f.ZodNull:
|
|
2064
|
+
return Gt(n);
|
|
2065
|
+
case f.ZodArray:
|
|
2056
2066
|
return Nt(a, n);
|
|
2057
|
-
case
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
case y.ZodUndefined:
|
|
2062
|
-
return ir(n);
|
|
2063
|
-
case y.ZodNull:
|
|
2064
|
-
return Yt(n);
|
|
2065
|
-
case y.ZodArray:
|
|
2066
|
-
return Rt(a, n);
|
|
2067
|
-
case y.ZodUnion:
|
|
2068
|
-
case y.ZodDiscriminatedUnion:
|
|
2069
|
-
return Gt(a, n);
|
|
2070
|
-
case y.ZodIntersection:
|
|
2071
|
-
return qt(a, n);
|
|
2072
|
-
case y.ZodTuple:
|
|
2073
|
-
return or(a, n);
|
|
2074
|
-
case y.ZodRecord:
|
|
2075
|
-
return Ae(a, n);
|
|
2076
|
-
case y.ZodLiteral:
|
|
2067
|
+
case f.ZodUnion:
|
|
2068
|
+
case f.ZodDiscriminatedUnion:
|
|
2069
|
+
return Ht(a, n);
|
|
2070
|
+
case f.ZodIntersection:
|
|
2077
2071
|
return Zt(a, n);
|
|
2078
|
-
case
|
|
2079
|
-
return
|
|
2080
|
-
case
|
|
2072
|
+
case f.ZodTuple:
|
|
2073
|
+
return ir(a, n);
|
|
2074
|
+
case f.ZodRecord:
|
|
2075
|
+
return xe(a, n);
|
|
2076
|
+
case f.ZodLiteral:
|
|
2077
|
+
return Ft(a, n);
|
|
2078
|
+
case f.ZodEnum:
|
|
2079
|
+
return Bt(a);
|
|
2080
|
+
case f.ZodNativeEnum:
|
|
2081
2081
|
return Jt(a);
|
|
2082
|
-
case
|
|
2083
|
-
return
|
|
2084
|
-
case
|
|
2085
|
-
return
|
|
2086
|
-
case
|
|
2087
|
-
return
|
|
2088
|
-
case
|
|
2089
|
-
return
|
|
2090
|
-
case
|
|
2082
|
+
case f.ZodNullable:
|
|
2083
|
+
return Wt(a, n);
|
|
2084
|
+
case f.ZodOptional:
|
|
2085
|
+
return rr(a, n);
|
|
2086
|
+
case f.ZodMap:
|
|
2087
|
+
return Kt(a, n);
|
|
2088
|
+
case f.ZodSet:
|
|
2089
|
+
return or(a, n);
|
|
2090
|
+
case f.ZodLazy:
|
|
2091
2091
|
return () => a.getter()._def;
|
|
2092
|
-
case
|
|
2093
|
-
return
|
|
2094
|
-
case
|
|
2095
|
-
case
|
|
2096
|
-
return
|
|
2097
|
-
case
|
|
2098
|
-
return
|
|
2099
|
-
case
|
|
2092
|
+
case f.ZodPromise:
|
|
2093
|
+
return ar(a, n);
|
|
2094
|
+
case f.ZodNaN:
|
|
2095
|
+
case f.ZodNever:
|
|
2096
|
+
return Yt(n);
|
|
2097
|
+
case f.ZodEffects:
|
|
2098
|
+
return Ut(a, n);
|
|
2099
|
+
case f.ZodAny:
|
|
2100
2100
|
return O(n);
|
|
2101
|
-
case
|
|
2102
|
-
return
|
|
2103
|
-
case
|
|
2101
|
+
case f.ZodUnknown:
|
|
2102
|
+
return cr(n);
|
|
2103
|
+
case f.ZodDefault:
|
|
2104
|
+
return Lt(a, n);
|
|
2105
|
+
case f.ZodBranded:
|
|
2106
|
+
return we(a, n);
|
|
2107
|
+
case f.ZodReadonly:
|
|
2108
|
+
return lr(a, n);
|
|
2109
|
+
case f.ZodCatch:
|
|
2104
2110
|
return Mt(a, n);
|
|
2105
|
-
case
|
|
2106
|
-
return
|
|
2107
|
-
case
|
|
2108
|
-
|
|
2109
|
-
case
|
|
2110
|
-
return Ct(a, n);
|
|
2111
|
-
case y.ZodPipeline:
|
|
2112
|
-
return rr(a, n);
|
|
2113
|
-
case y.ZodFunction:
|
|
2114
|
-
case y.ZodVoid:
|
|
2115
|
-
case y.ZodSymbol:
|
|
2111
|
+
case f.ZodPipeline:
|
|
2112
|
+
return nr(a, n);
|
|
2113
|
+
case f.ZodFunction:
|
|
2114
|
+
case f.ZodVoid:
|
|
2115
|
+
case f.ZodSymbol:
|
|
2116
2116
|
return;
|
|
2117
2117
|
default:
|
|
2118
2118
|
return /* @__PURE__ */ ((r) => {
|
|
2119
2119
|
})();
|
|
2120
2120
|
}
|
|
2121
2121
|
};
|
|
2122
|
-
function
|
|
2122
|
+
function A(a, t, n = !1) {
|
|
2123
2123
|
var l;
|
|
2124
2124
|
const r = t.seen.get(a);
|
|
2125
2125
|
if (t.override) {
|
|
2126
2126
|
const c = (l = t.override) == null ? void 0 : l.call(t, a, t, r, n);
|
|
2127
|
-
if (c !==
|
|
2127
|
+
if (c !== Pt)
|
|
2128
2128
|
return c;
|
|
2129
2129
|
}
|
|
2130
2130
|
if (r && !n) {
|
|
2131
|
-
const c =
|
|
2131
|
+
const c = mr(r, t);
|
|
2132
2132
|
if (c !== void 0)
|
|
2133
2133
|
return c;
|
|
2134
2134
|
}
|
|
2135
2135
|
const o = { def: a, path: t.currentPath, jsonSchema: void 0 };
|
|
2136
2136
|
t.seen.set(a, o);
|
|
2137
|
-
const s =
|
|
2138
|
-
if (i &&
|
|
2137
|
+
const s = ur(a, a.typeName, t), i = typeof s == "function" ? A(s(), t) : s;
|
|
2138
|
+
if (i && dr(a, t, i), t.postProcess) {
|
|
2139
2139
|
const c = t.postProcess(i, a, t);
|
|
2140
2140
|
return o.jsonSchema = i, c;
|
|
2141
2141
|
}
|
|
2142
2142
|
return o.jsonSchema = i, i;
|
|
2143
2143
|
}
|
|
2144
|
-
const
|
|
2144
|
+
const mr = (a, t) => {
|
|
2145
2145
|
switch (t.$refStrategy) {
|
|
2146
2146
|
case "root":
|
|
2147
2147
|
return { $ref: a.path.join("/") };
|
|
2148
2148
|
case "relative":
|
|
2149
|
-
return { $ref:
|
|
2149
|
+
return { $ref: be(t.currentPath, a.path) };
|
|
2150
2150
|
case "none":
|
|
2151
2151
|
case "seen":
|
|
2152
2152
|
return a.path.length < t.currentPath.length && a.path.every((n, r) => t.currentPath[r] === n) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), O(t)) : t.$refStrategy === "seen" ? O(t) : void 0;
|
|
2153
2153
|
}
|
|
2154
|
-
},
|
|
2155
|
-
const n =
|
|
2154
|
+
}, dr = (a, t, n) => (a.description && (n.description = a.description, t.markdownDescription && (n.markdownDescription = a.description)), n), pr = (a, t) => {
|
|
2155
|
+
const n = Rt(t);
|
|
2156
2156
|
let r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((c, [u, m]) => ({
|
|
2157
2157
|
...c,
|
|
2158
|
-
[u]:
|
|
2158
|
+
[u]: A(m._def, {
|
|
2159
2159
|
...n,
|
|
2160
2160
|
currentPath: [...n.basePath, n.definitionPath, u]
|
|
2161
2161
|
}, !0) ?? O(n)
|
|
2162
2162
|
}), {}) : void 0;
|
|
2163
|
-
const o = typeof t == "string" ? t : (t == null ? void 0 : t.nameStrategy) === "title" || t == null ? void 0 : t.name, s =
|
|
2163
|
+
const o = typeof t == "string" ? t : (t == null ? void 0 : t.nameStrategy) === "title" || t == null ? void 0 : t.name, s = A(a._def, o === void 0 ? n : {
|
|
2164
2164
|
...n,
|
|
2165
2165
|
currentPath: [...n.basePath, n.definitionPath, o]
|
|
2166
2166
|
}, !1) ?? O(n), i = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
@@ -2191,30 +2191,30 @@ const ur = (a, t) => {
|
|
|
2191
2191
|
};
|
|
2192
2192
|
return n.target === "jsonSchema7" ? l.$schema = "http://json-schema.org/draft-07/schema#" : (n.target === "jsonSchema2019-09" || n.target === "openAi") && (l.$schema = "https://json-schema.org/draft/2019-09/schema#"), n.target === "openAi" && ("anyOf" in l || "oneOf" in l || "allOf" in l || "type" in l && Array.isArray(l.type)) && console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."), l;
|
|
2193
2193
|
};
|
|
2194
|
-
function
|
|
2195
|
-
const t =
|
|
2194
|
+
function Fr(a) {
|
|
2195
|
+
const t = pr(a.parameters, { target: "jsonSchema7", $refStrategy: "none" });
|
|
2196
2196
|
return {
|
|
2197
2197
|
name: a.name,
|
|
2198
2198
|
description: a.description,
|
|
2199
2199
|
parameters: t
|
|
2200
2200
|
};
|
|
2201
2201
|
}
|
|
2202
|
-
function
|
|
2202
|
+
function hr(a) {
|
|
2203
2203
|
const t = /* @__PURE__ */ new Set(["$schema", "additionalProperties", "default"]), n = (r) => Array.isArray(r) ? r.map(n) : r && typeof r == "object" ? Object.fromEntries(
|
|
2204
2204
|
Object.entries(r).filter(([o]) => !t.has(o)).map(([o, s]) => [o, n(s)])
|
|
2205
2205
|
) : r;
|
|
2206
2206
|
return n(a);
|
|
2207
2207
|
}
|
|
2208
|
-
class
|
|
2208
|
+
class gr {
|
|
2209
2209
|
async *streamChat(t, n, r) {
|
|
2210
|
-
var h,
|
|
2210
|
+
var h, y, w, g;
|
|
2211
2211
|
const { apiKey: o, model: s = T["google-gemini"] } = n;
|
|
2212
2212
|
if (!o) throw new Error("Gemini API key required");
|
|
2213
|
-
const i = t.find((
|
|
2214
|
-
functionDeclarations: r.map((
|
|
2215
|
-
name:
|
|
2216
|
-
description:
|
|
2217
|
-
parameters:
|
|
2213
|
+
const i = t.find((b) => b.role === "system"), l = t.filter((b) => b.role !== "system").map((b) => ({ role: b.role === "assistant" ? "model" : "user", parts: [{ text: b.content }] })), c = r != null && r.length ? [{
|
|
2214
|
+
functionDeclarations: r.map((b) => ({
|
|
2215
|
+
name: b.name,
|
|
2216
|
+
description: b.description,
|
|
2217
|
+
parameters: hr(b.parameters)
|
|
2218
2218
|
}))
|
|
2219
2219
|
}] : void 0, u = await fetch(
|
|
2220
2220
|
`https://generativelanguage.googleapis.com/v1beta/models/${s}:streamGenerateContent?alt=sse`,
|
|
@@ -2229,25 +2229,25 @@ class hr {
|
|
|
2229
2229
|
}
|
|
2230
2230
|
);
|
|
2231
2231
|
if (!u.ok) {
|
|
2232
|
-
const
|
|
2233
|
-
throw new Error(`Gemini Error ${u.status}: ${
|
|
2232
|
+
const b = await u.text();
|
|
2233
|
+
throw new Error(`Gemini Error ${u.status}: ${b}`);
|
|
2234
2234
|
}
|
|
2235
2235
|
const m = (h = u.body) == null ? void 0 : h.getReader();
|
|
2236
2236
|
if (!m) throw new Error("No response body");
|
|
2237
2237
|
const d = new TextDecoder();
|
|
2238
2238
|
let p = "";
|
|
2239
2239
|
for (; ; ) {
|
|
2240
|
-
const { done:
|
|
2241
|
-
if (
|
|
2242
|
-
p += d.decode(
|
|
2243
|
-
const
|
|
2240
|
+
const { done: b, value: v } = await m.read();
|
|
2241
|
+
if (b) break;
|
|
2242
|
+
p += d.decode(v, { stream: !0 });
|
|
2243
|
+
const _ = p.split(`
|
|
2244
2244
|
`);
|
|
2245
|
-
p =
|
|
2246
|
-
for (const
|
|
2247
|
-
const
|
|
2248
|
-
if (!(!
|
|
2245
|
+
p = _.pop() || "";
|
|
2246
|
+
for (const E of _) {
|
|
2247
|
+
const x = E.trim();
|
|
2248
|
+
if (!(!x || !x.startsWith("data: ")))
|
|
2249
2249
|
try {
|
|
2250
|
-
const C = ((
|
|
2250
|
+
const C = ((g = (w = (y = JSON.parse(x.slice(6)).candidates) == null ? void 0 : y[0]) == null ? void 0 : w.content) == null ? void 0 : g.parts) ?? [];
|
|
2251
2251
|
for (const D of C)
|
|
2252
2252
|
D.text && (yield { type: "text-delta", text: D.text }), D.functionCall && (yield {
|
|
2253
2253
|
type: "tool-call",
|
|
@@ -2284,7 +2284,7 @@ class hr {
|
|
|
2284
2284
|
return ((p = (d = (m = (u = (c = (await i.json()).candidates) == null ? void 0 : c[0]) == null ? void 0 : u.content) == null ? void 0 : m.parts) == null ? void 0 : d[0]) == null ? void 0 : p.text) || "";
|
|
2285
2285
|
}
|
|
2286
2286
|
async *streamText(t, n) {
|
|
2287
|
-
var u, m, d, p, h,
|
|
2287
|
+
var u, m, d, p, h, y;
|
|
2288
2288
|
const { apiKey: r, model: o = T["google-gemini"] } = n;
|
|
2289
2289
|
if (!r) throw new Error("Gemini API key required");
|
|
2290
2290
|
if (!o) throw new Error("GeminiAdapter: model is required but was undefined");
|
|
@@ -2302,26 +2302,26 @@ class hr {
|
|
|
2302
2302
|
}
|
|
2303
2303
|
);
|
|
2304
2304
|
if (!s.ok) {
|
|
2305
|
-
const
|
|
2306
|
-
throw new Error(`Gemini Error ${s.status}: ${
|
|
2305
|
+
const w = await s.text();
|
|
2306
|
+
throw new Error(`Gemini Error ${s.status}: ${w}`);
|
|
2307
2307
|
}
|
|
2308
2308
|
const i = (u = s.body) == null ? void 0 : u.getReader();
|
|
2309
2309
|
if (!i) throw new Error("No response body");
|
|
2310
2310
|
const l = new TextDecoder();
|
|
2311
2311
|
let c = "";
|
|
2312
2312
|
for (; ; ) {
|
|
2313
|
-
const { done:
|
|
2314
|
-
if (
|
|
2315
|
-
c += l.decode(
|
|
2316
|
-
const
|
|
2313
|
+
const { done: w, value: g } = await i.read();
|
|
2314
|
+
if (w) break;
|
|
2315
|
+
c += l.decode(g, { stream: !0 });
|
|
2316
|
+
const b = c.split(`
|
|
2317
2317
|
`);
|
|
2318
|
-
c =
|
|
2319
|
-
for (const
|
|
2320
|
-
const
|
|
2321
|
-
if (!(!
|
|
2318
|
+
c = b.pop() || "";
|
|
2319
|
+
for (const v of b) {
|
|
2320
|
+
const _ = v.trim();
|
|
2321
|
+
if (!(!_ || !_.startsWith("data: ")))
|
|
2322
2322
|
try {
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2323
|
+
const x = (y = (h = (p = (d = (m = JSON.parse(_.slice(6)).candidates) == null ? void 0 : m[0]) == null ? void 0 : d.content) == null ? void 0 : p.parts) == null ? void 0 : h[0]) == null ? void 0 : y.text;
|
|
2324
|
+
x && (yield x);
|
|
2325
2325
|
} catch {
|
|
2326
2326
|
continue;
|
|
2327
2327
|
}
|
|
@@ -2351,8 +2351,8 @@ class hr {
|
|
|
2351
2351
|
}
|
|
2352
2352
|
);
|
|
2353
2353
|
if (!i.ok) {
|
|
2354
|
-
const
|
|
2355
|
-
throw this.normalizeError(
|
|
2354
|
+
const y = await i.json();
|
|
2355
|
+
throw this.normalizeError(y, i.status);
|
|
2356
2356
|
}
|
|
2357
2357
|
const c = ((h = (p = (d = (m = (u = (await i.json()).candidates) == null ? void 0 : u[0]) == null ? void 0 : m.content) == null ? void 0 : d.parts) == null ? void 0 : p[0]) == null ? void 0 : h.text) || "{}";
|
|
2358
2358
|
return JSON.parse(c);
|
|
@@ -2383,7 +2383,7 @@ class hr {
|
|
|
2383
2383
|
return new Error(((r = t.error) == null ? void 0 : r.message) || "Unknown error");
|
|
2384
2384
|
}
|
|
2385
2385
|
}
|
|
2386
|
-
class
|
|
2386
|
+
class fr {
|
|
2387
2387
|
/**
|
|
2388
2388
|
* Tool calling requires /api/chat, not /api/generate (which has no tool
|
|
2389
2389
|
* support at all). Tool support itself is model-dependent (llama3.1+,
|
|
@@ -2392,42 +2392,42 @@ class gr {
|
|
|
2392
2392
|
* this degrades gracefully rather than special-casing it.
|
|
2393
2393
|
*/
|
|
2394
2394
|
async *streamChat(t, n, r) {
|
|
2395
|
-
var d, p, h,
|
|
2396
|
-
const { baseUrl: o = "http://localhost:11434", model: s = T.ollama } = n, i = r != null && r.length ? r.map((
|
|
2395
|
+
var d, p, h, y, w;
|
|
2396
|
+
const { baseUrl: o = "http://localhost:11434", model: s = T.ollama } = n, i = r != null && r.length ? r.map((g) => ({ type: "function", function: { name: g.name, description: g.description, parameters: g.parameters } })) : void 0, l = await fetch(`${o}/api/chat`, {
|
|
2397
2397
|
method: "POST",
|
|
2398
2398
|
headers: { "Content-Type": "application/json" },
|
|
2399
2399
|
body: JSON.stringify({
|
|
2400
2400
|
model: s,
|
|
2401
|
-
messages: t.map((
|
|
2401
|
+
messages: t.map((g) => ({ role: g.role, content: g.content })),
|
|
2402
2402
|
stream: !0,
|
|
2403
2403
|
...i && { tools: i }
|
|
2404
2404
|
})
|
|
2405
2405
|
});
|
|
2406
2406
|
if (!l.ok) {
|
|
2407
|
-
const
|
|
2408
|
-
throw new Error(`Ollama Error ${l.status}: ${
|
|
2407
|
+
const g = await l.text();
|
|
2408
|
+
throw new Error(`Ollama Error ${l.status}: ${g}`);
|
|
2409
2409
|
}
|
|
2410
2410
|
const c = (d = l.body) == null ? void 0 : d.getReader();
|
|
2411
2411
|
if (!c) throw new Error("No response body");
|
|
2412
2412
|
const u = new TextDecoder();
|
|
2413
2413
|
let m = "";
|
|
2414
2414
|
for (; ; ) {
|
|
2415
|
-
const { done:
|
|
2416
|
-
if (
|
|
2417
|
-
m += u.decode(
|
|
2418
|
-
const
|
|
2415
|
+
const { done: g, value: b } = await c.read();
|
|
2416
|
+
if (g) break;
|
|
2417
|
+
m += u.decode(b, { stream: !0 });
|
|
2418
|
+
const v = m.split(`
|
|
2419
2419
|
`);
|
|
2420
|
-
m =
|
|
2421
|
-
for (const
|
|
2422
|
-
const
|
|
2423
|
-
if (
|
|
2420
|
+
m = v.pop() || "";
|
|
2421
|
+
for (const _ of v) {
|
|
2422
|
+
const E = _.trim();
|
|
2423
|
+
if (E)
|
|
2424
2424
|
try {
|
|
2425
|
-
const
|
|
2426
|
-
if ((p =
|
|
2427
|
-
for (const N of
|
|
2425
|
+
const x = JSON.parse(E);
|
|
2426
|
+
if ((p = x.message) != null && p.content && (yield { type: "text-delta", text: x.message.content }), (h = x.message) != null && h.tool_calls)
|
|
2427
|
+
for (const N of x.message.tool_calls)
|
|
2428
2428
|
yield {
|
|
2429
2429
|
type: "tool-call",
|
|
2430
|
-
toolCall: { name: (
|
|
2430
|
+
toolCall: { name: (y = N.function) == null ? void 0 : y.name, arguments: ((w = N.function) == null ? void 0 : w.arguments) ?? {} }
|
|
2431
2431
|
};
|
|
2432
2432
|
} catch {
|
|
2433
2433
|
}
|
|
@@ -2477,11 +2477,11 @@ class gr {
|
|
|
2477
2477
|
`);
|
|
2478
2478
|
c = p.pop() || "";
|
|
2479
2479
|
for (const h of p) {
|
|
2480
|
-
const
|
|
2481
|
-
if (
|
|
2480
|
+
const y = h.trim();
|
|
2481
|
+
if (y)
|
|
2482
2482
|
try {
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2483
|
+
const w = JSON.parse(y);
|
|
2484
|
+
w.response && (yield w.response);
|
|
2485
2485
|
} catch {
|
|
2486
2486
|
continue;
|
|
2487
2487
|
}
|
|
@@ -2505,9 +2505,16 @@ Do not include any explanation, only the raw JSON object.`, s = await this.gener
|
|
|
2505
2505
|
return ((s = (await r.json()).models) == null ? void 0 : s.map((i) => i.name)) || [];
|
|
2506
2506
|
}
|
|
2507
2507
|
}
|
|
2508
|
-
|
|
2508
|
+
const V = (a) => {
|
|
2509
|
+
try {
|
|
2510
|
+
return JSON.parse(a);
|
|
2511
|
+
} catch {
|
|
2512
|
+
return { error: { message: a } };
|
|
2513
|
+
}
|
|
2514
|
+
};
|
|
2515
|
+
class yr {
|
|
2509
2516
|
async *streamChat(t, n, r) {
|
|
2510
|
-
var
|
|
2517
|
+
var b, v, _;
|
|
2511
2518
|
const {
|
|
2512
2519
|
apiKey: o,
|
|
2513
2520
|
model: s = T.anthropic,
|
|
@@ -2516,7 +2523,7 @@ class fr {
|
|
|
2516
2523
|
baseUrl: c = "https://api.anthropic.com/v1"
|
|
2517
2524
|
} = n;
|
|
2518
2525
|
if (!o) throw new Error("Anthropic API key required");
|
|
2519
|
-
const u = t.find((
|
|
2526
|
+
const u = t.find((E) => E.role === "system"), m = t.filter((E) => E.role !== "system").map((E) => ({ role: E.role, content: E.content })), d = r != null && r.length ? r.map((E) => ({ name: E.name, description: E.description, input_schema: E.parameters })) : void 0, p = await fetch(`${c}/messages`, {
|
|
2520
2527
|
method: "POST",
|
|
2521
2528
|
headers: {
|
|
2522
2529
|
"Content-Type": "application/json",
|
|
@@ -2535,42 +2542,42 @@ class fr {
|
|
|
2535
2542
|
})
|
|
2536
2543
|
});
|
|
2537
2544
|
if (!p.ok) {
|
|
2538
|
-
const
|
|
2539
|
-
throw
|
|
2545
|
+
const E = await p.text();
|
|
2546
|
+
throw this.normalizeError(p.status, V(E));
|
|
2540
2547
|
}
|
|
2541
2548
|
if (!p.body) throw new Error("No response body for streaming");
|
|
2542
|
-
const h = p.body.getReader(),
|
|
2543
|
-
let
|
|
2549
|
+
const h = p.body.getReader(), y = new TextDecoder();
|
|
2550
|
+
let w = "", g = null;
|
|
2544
2551
|
try {
|
|
2545
2552
|
for (; ; ) {
|
|
2546
|
-
const { done:
|
|
2547
|
-
if (
|
|
2548
|
-
|
|
2549
|
-
const N =
|
|
2553
|
+
const { done: E, value: x } = await h.read();
|
|
2554
|
+
if (E) break;
|
|
2555
|
+
w += y.decode(x, { stream: !0 });
|
|
2556
|
+
const N = w.split(`
|
|
2550
2557
|
`);
|
|
2551
|
-
|
|
2558
|
+
w = N.pop() || "";
|
|
2552
2559
|
for (const C of N) {
|
|
2553
2560
|
const D = C.trim();
|
|
2554
2561
|
if (!(!D || !D.startsWith("data: ")))
|
|
2555
2562
|
try {
|
|
2556
2563
|
const P = JSON.parse(D.slice(6));
|
|
2557
|
-
if (P.type === "content_block_start" && ((
|
|
2558
|
-
|
|
2564
|
+
if (P.type === "content_block_start" && ((b = P.content_block) == null ? void 0 : b.type) === "tool_use")
|
|
2565
|
+
g = { id: P.content_block.id, name: P.content_block.name, argsBuf: "" };
|
|
2559
2566
|
else if (P.type === "content_block_delta")
|
|
2560
|
-
((
|
|
2561
|
-
else if (P.type === "content_block_stop" &&
|
|
2567
|
+
((v = P.delta) == null ? void 0 : v.type) === "text_delta" && P.delta.text ? yield { type: "text-delta", text: P.delta.text } : ((_ = P.delta) == null ? void 0 : _.type) === "input_json_delta" && g && (g.argsBuf += P.delta.partial_json ?? "");
|
|
2568
|
+
else if (P.type === "content_block_stop" && g) {
|
|
2562
2569
|
try {
|
|
2563
2570
|
yield {
|
|
2564
2571
|
type: "tool-call",
|
|
2565
2572
|
toolCall: {
|
|
2566
|
-
id:
|
|
2567
|
-
name:
|
|
2568
|
-
arguments:
|
|
2573
|
+
id: g.id,
|
|
2574
|
+
name: g.name,
|
|
2575
|
+
arguments: g.argsBuf ? JSON.parse(g.argsBuf) : {}
|
|
2569
2576
|
}
|
|
2570
2577
|
};
|
|
2571
2578
|
} catch {
|
|
2572
2579
|
}
|
|
2573
|
-
|
|
2580
|
+
g = null;
|
|
2574
2581
|
}
|
|
2575
2582
|
} catch {
|
|
2576
2583
|
}
|
|
@@ -2581,7 +2588,7 @@ class fr {
|
|
|
2581
2588
|
}
|
|
2582
2589
|
}
|
|
2583
2590
|
async generateText(t, n) {
|
|
2584
|
-
var m, d
|
|
2591
|
+
var m, d;
|
|
2585
2592
|
const {
|
|
2586
2593
|
apiKey: r,
|
|
2587
2594
|
model: o = T.anthropic,
|
|
@@ -2616,19 +2623,13 @@ class fr {
|
|
|
2616
2623
|
})
|
|
2617
2624
|
});
|
|
2618
2625
|
if (!c.ok) {
|
|
2619
|
-
const
|
|
2620
|
-
console.error("🔴 RAW ANTHROPIC ERROR:", c.status,
|
|
2621
|
-
try {
|
|
2622
|
-
const g = JSON.parse(h);
|
|
2623
|
-
throw new Error(`Anthropic ${c.status}: ${((m = g.error) == null ? void 0 : m.message) || JSON.stringify(g)}`);
|
|
2624
|
-
} catch {
|
|
2625
|
-
throw new Error(`Anthropic ${c.status}: ${h}`);
|
|
2626
|
-
}
|
|
2626
|
+
const p = await c.text();
|
|
2627
|
+
throw console.error("🔴 RAW ANTHROPIC ERROR:", c.status, p), console.error("🔴 Request was made to:", `${l}/messages`), console.error("🔴 Model requested:", o), this.normalizeError(c.status, V(p));
|
|
2627
2628
|
}
|
|
2628
|
-
return ((
|
|
2629
|
+
return ((d = (m = (await c.json()).content) == null ? void 0 : m[0]) == null ? void 0 : d.text) || "";
|
|
2629
2630
|
}
|
|
2630
2631
|
async *streamText(t, n) {
|
|
2631
|
-
var p
|
|
2632
|
+
var p;
|
|
2632
2633
|
const {
|
|
2633
2634
|
apiKey: r,
|
|
2634
2635
|
model: o = T.anthropic,
|
|
@@ -2656,33 +2657,27 @@ class fr {
|
|
|
2656
2657
|
})
|
|
2657
2658
|
});
|
|
2658
2659
|
if (!c.ok) {
|
|
2659
|
-
const
|
|
2660
|
-
console.error("🔴 RAW ANTHROPIC STREAM ERROR:", c.status,
|
|
2661
|
-
try {
|
|
2662
|
-
const E = JSON.parse(g);
|
|
2663
|
-
throw new Error(`Anthropic ${c.status}: ${((p = E.error) == null ? void 0 : p.message) || JSON.stringify(E)}`);
|
|
2664
|
-
} catch {
|
|
2665
|
-
throw new Error(`Anthropic ${c.status}: ${g}`);
|
|
2666
|
-
}
|
|
2660
|
+
const h = await c.text();
|
|
2661
|
+
throw console.error("🔴 RAW ANTHROPIC STREAM ERROR:", c.status, h), console.error("🔴 Request was made to:", `${l}/messages`), console.error("🔴 Model requested:", o), this.normalizeError(c.status, V(h));
|
|
2667
2662
|
}
|
|
2668
2663
|
if (!c.body) throw new Error("No response body for streaming");
|
|
2669
2664
|
const u = c.body.getReader(), m = new TextDecoder();
|
|
2670
2665
|
let d = "";
|
|
2671
2666
|
try {
|
|
2672
2667
|
for (; ; ) {
|
|
2673
|
-
const { done:
|
|
2674
|
-
if (
|
|
2675
|
-
d += m.decode(
|
|
2676
|
-
const
|
|
2668
|
+
const { done: h, value: y } = await u.read();
|
|
2669
|
+
if (h) break;
|
|
2670
|
+
d += m.decode(y, { stream: !0 });
|
|
2671
|
+
const w = d.split(`
|
|
2677
2672
|
`);
|
|
2678
|
-
d =
|
|
2679
|
-
for (const
|
|
2680
|
-
const
|
|
2681
|
-
if (!
|
|
2682
|
-
const
|
|
2673
|
+
d = w.pop() || "";
|
|
2674
|
+
for (const g of w) {
|
|
2675
|
+
const b = g.trim();
|
|
2676
|
+
if (!b || !b.startsWith("data: ")) continue;
|
|
2677
|
+
const v = b.slice(6);
|
|
2683
2678
|
try {
|
|
2684
|
-
const
|
|
2685
|
-
|
|
2679
|
+
const _ = JSON.parse(v);
|
|
2680
|
+
_.type === "content_block_delta" && ((p = _.delta) != null && p.text) && (yield _.delta.text);
|
|
2686
2681
|
} catch {
|
|
2687
2682
|
continue;
|
|
2688
2683
|
}
|
|
@@ -2708,7 +2703,7 @@ class fr {
|
|
|
2708
2703
|
* rather than sent as a parameter.
|
|
2709
2704
|
*/
|
|
2710
2705
|
async generateObject(t, n, r) {
|
|
2711
|
-
var
|
|
2706
|
+
var g, b;
|
|
2712
2707
|
const {
|
|
2713
2708
|
apiKey: o,
|
|
2714
2709
|
model: s = T.anthropic,
|
|
@@ -2740,20 +2735,14 @@ IMPORTANT: Respond ONLY with valid JSON. No markdown, no explanation, just the J
|
|
|
2740
2735
|
})
|
|
2741
2736
|
});
|
|
2742
2737
|
if (!d.ok) {
|
|
2743
|
-
const
|
|
2744
|
-
console.error("🔴 RAW ANTHROPIC OBJECT ERROR:", d.status,
|
|
2745
|
-
try {
|
|
2746
|
-
const b = JSON.parse(S);
|
|
2747
|
-
throw new Error(`Anthropic ${d.status}: ${((f = b.error) == null ? void 0 : f.message) || JSON.stringify(b)}`);
|
|
2748
|
-
} catch {
|
|
2749
|
-
throw new Error(`Anthropic ${d.status}: ${S}`);
|
|
2750
|
-
}
|
|
2738
|
+
const v = await d.text();
|
|
2739
|
+
throw console.error("🔴 RAW ANTHROPIC OBJECT ERROR:", d.status, v), console.error("🔴 Request was made to:", `${c}/messages`), console.error("🔴 Model requested:", s), this.normalizeError(d.status, V(v));
|
|
2751
2740
|
}
|
|
2752
|
-
const h = ((
|
|
2753
|
-
return JSON.parse(
|
|
2741
|
+
const h = ((b = (g = (await d.json()).content) == null ? void 0 : g[0]) == null ? void 0 : b.text) || "{}", y = h.match(/\{[\s\S]*\}/), w = y ? y[0] : h;
|
|
2742
|
+
return JSON.parse(w);
|
|
2754
2743
|
}
|
|
2755
2744
|
async listModels(t, n) {
|
|
2756
|
-
return [...
|
|
2745
|
+
return [...ie.anthropic];
|
|
2757
2746
|
}
|
|
2758
2747
|
normalizeError(t, n) {
|
|
2759
2748
|
var s;
|
|
@@ -2781,7 +2770,7 @@ function B(a) {
|
|
|
2781
2770
|
function: { name: t.name, description: t.description, parameters: t.parameters }
|
|
2782
2771
|
}));
|
|
2783
2772
|
}
|
|
2784
|
-
async function*
|
|
2773
|
+
async function* se(a, t, n, r) {
|
|
2785
2774
|
var u, m, d, p;
|
|
2786
2775
|
const o = await fetch(a, {
|
|
2787
2776
|
method: "POST",
|
|
@@ -2798,24 +2787,24 @@ async function* ie(a, t, n, r) {
|
|
|
2798
2787
|
const c = /* @__PURE__ */ new Map();
|
|
2799
2788
|
try {
|
|
2800
2789
|
for (; ; ) {
|
|
2801
|
-
const { done: h, value:
|
|
2790
|
+
const { done: h, value: y } = await s.read();
|
|
2802
2791
|
if (h) break;
|
|
2803
|
-
l += i.decode(
|
|
2804
|
-
const
|
|
2792
|
+
l += i.decode(y, { stream: !0 });
|
|
2793
|
+
const w = l.split(`
|
|
2805
2794
|
`);
|
|
2806
|
-
l =
|
|
2807
|
-
for (const
|
|
2808
|
-
const
|
|
2809
|
-
if (!
|
|
2810
|
-
const
|
|
2811
|
-
if (
|
|
2795
|
+
l = w.pop() || "";
|
|
2796
|
+
for (const g of w) {
|
|
2797
|
+
const b = g.trim();
|
|
2798
|
+
if (!b || !b.startsWith("data: ")) continue;
|
|
2799
|
+
const v = b.slice(6);
|
|
2800
|
+
if (v !== "[DONE]")
|
|
2812
2801
|
try {
|
|
2813
|
-
const
|
|
2814
|
-
if (!
|
|
2815
|
-
if (
|
|
2816
|
-
for (const
|
|
2817
|
-
const N =
|
|
2818
|
-
|
|
2802
|
+
const E = (m = (u = JSON.parse(v).choices) == null ? void 0 : u[0]) == null ? void 0 : m.delta;
|
|
2803
|
+
if (!E) continue;
|
|
2804
|
+
if (E.content && (yield { type: "text-delta", text: E.content }), E.tool_calls)
|
|
2805
|
+
for (const x of E.tool_calls) {
|
|
2806
|
+
const N = x.index ?? 0, C = c.get(N) ?? { name: "", args: "" };
|
|
2807
|
+
x.id && (C.id = x.id), (d = x.function) != null && d.name && (C.name += x.function.name), (p = x.function) != null && p.arguments && (C.args += x.function.arguments), c.set(N, C);
|
|
2819
2808
|
}
|
|
2820
2809
|
} catch {
|
|
2821
2810
|
}
|
|
@@ -2838,19 +2827,19 @@ async function* ie(a, t, n, r) {
|
|
|
2838
2827
|
} catch {
|
|
2839
2828
|
}
|
|
2840
2829
|
}
|
|
2841
|
-
function
|
|
2830
|
+
function ce(a) {
|
|
2842
2831
|
return a.map((t) => ({ role: t.role, content: t.content }));
|
|
2843
2832
|
}
|
|
2844
|
-
class
|
|
2833
|
+
class br {
|
|
2845
2834
|
async *streamChat(t, n, r) {
|
|
2846
2835
|
const { apiKey: o, model: s = T.openai, temperature: i = 0.7, baseUrl: l = "https://api.openai.com/v1" } = n;
|
|
2847
2836
|
if (!o) throw new Error("OpenAI API key required");
|
|
2848
|
-
yield*
|
|
2837
|
+
yield* se(
|
|
2849
2838
|
`${l}/chat/completions`,
|
|
2850
2839
|
{ "Content-Type": "application/json", Authorization: `Bearer ${o}` },
|
|
2851
2840
|
{
|
|
2852
2841
|
model: s,
|
|
2853
|
-
messages:
|
|
2842
|
+
messages: ce(t),
|
|
2854
2843
|
temperature: i,
|
|
2855
2844
|
stream: !0,
|
|
2856
2845
|
...B(r) && { tools: B(r), tool_choice: "auto" }
|
|
@@ -2898,28 +2887,28 @@ class yr {
|
|
|
2898
2887
|
})
|
|
2899
2888
|
});
|
|
2900
2889
|
if (!l.ok) {
|
|
2901
|
-
const
|
|
2902
|
-
throw this.normalizeError(l.status,
|
|
2890
|
+
const y = await l.json();
|
|
2891
|
+
throw this.normalizeError(l.status, y);
|
|
2903
2892
|
}
|
|
2904
2893
|
if (!l.body) throw new Error("No response body for streaming");
|
|
2905
2894
|
const c = l.body.getReader(), u = new TextDecoder();
|
|
2906
2895
|
let m = "";
|
|
2907
2896
|
try {
|
|
2908
2897
|
for (; ; ) {
|
|
2909
|
-
const { done:
|
|
2910
|
-
if (
|
|
2911
|
-
m += u.decode(
|
|
2912
|
-
const
|
|
2898
|
+
const { done: y, value: w } = await c.read();
|
|
2899
|
+
if (y) break;
|
|
2900
|
+
m += u.decode(w, { stream: !0 });
|
|
2901
|
+
const g = m.split(`
|
|
2913
2902
|
`);
|
|
2914
|
-
m =
|
|
2915
|
-
for (const
|
|
2916
|
-
const
|
|
2917
|
-
if (!
|
|
2918
|
-
const
|
|
2919
|
-
if (
|
|
2903
|
+
m = g.pop() || "";
|
|
2904
|
+
for (const b of g) {
|
|
2905
|
+
const v = b.trim();
|
|
2906
|
+
if (!v || !v.startsWith("data: ")) continue;
|
|
2907
|
+
const _ = v.slice(6);
|
|
2908
|
+
if (_ !== "[DONE]")
|
|
2920
2909
|
try {
|
|
2921
|
-
const
|
|
2922
|
-
|
|
2910
|
+
const x = (h = (p = (d = JSON.parse(_).choices) == null ? void 0 : d[0]) == null ? void 0 : p.delta) == null ? void 0 : h.content;
|
|
2911
|
+
x && (yield x);
|
|
2923
2912
|
} catch {
|
|
2924
2913
|
}
|
|
2925
2914
|
}
|
|
@@ -2946,8 +2935,8 @@ class yr {
|
|
|
2946
2935
|
})
|
|
2947
2936
|
});
|
|
2948
2937
|
if (!c.ok) {
|
|
2949
|
-
const
|
|
2950
|
-
throw this.normalizeError(c.status,
|
|
2938
|
+
const y = await c.json();
|
|
2939
|
+
throw this.normalizeError(c.status, y);
|
|
2951
2940
|
}
|
|
2952
2941
|
const m = ((h = (p = (d = (await c.json()).choices) == null ? void 0 : d[0]) == null ? void 0 : p.message) == null ? void 0 : h.content) || "{}";
|
|
2953
2942
|
return JSON.parse(m);
|
|
@@ -2982,16 +2971,16 @@ class yr {
|
|
|
2982
2971
|
return o.code = "API_ERROR", o.status = t, o;
|
|
2983
2972
|
}
|
|
2984
2973
|
}
|
|
2985
|
-
class
|
|
2974
|
+
class wr {
|
|
2986
2975
|
async *streamChat(t, n, r) {
|
|
2987
2976
|
const { apiKey: o, model: s = T.grok, temperature: i = 0.7, baseUrl: l = "https://api.x.ai/v1" } = n;
|
|
2988
2977
|
if (!o) throw new Error("Grok API key required");
|
|
2989
|
-
yield*
|
|
2978
|
+
yield* se(
|
|
2990
2979
|
`${l}/chat/completions`,
|
|
2991
2980
|
{ "Content-Type": "application/json", Authorization: `Bearer ${o}` },
|
|
2992
2981
|
{
|
|
2993
2982
|
model: s,
|
|
2994
|
-
messages:
|
|
2983
|
+
messages: ce(t),
|
|
2995
2984
|
temperature: i,
|
|
2996
2985
|
stream: !0,
|
|
2997
2986
|
...B(r) && { tools: B(r), tool_choice: "auto" }
|
|
@@ -3039,28 +3028,28 @@ class br {
|
|
|
3039
3028
|
})
|
|
3040
3029
|
});
|
|
3041
3030
|
if (!l.ok) {
|
|
3042
|
-
const
|
|
3043
|
-
throw this.normalizeError(l.status,
|
|
3031
|
+
const y = await l.json();
|
|
3032
|
+
throw this.normalizeError(l.status, y);
|
|
3044
3033
|
}
|
|
3045
3034
|
if (!l.body) throw new Error("No response body for streaming");
|
|
3046
3035
|
const c = l.body.getReader(), u = new TextDecoder();
|
|
3047
3036
|
let m = "";
|
|
3048
3037
|
try {
|
|
3049
3038
|
for (; ; ) {
|
|
3050
|
-
const { done:
|
|
3051
|
-
if (
|
|
3052
|
-
m += u.decode(
|
|
3053
|
-
const
|
|
3039
|
+
const { done: y, value: w } = await c.read();
|
|
3040
|
+
if (y) break;
|
|
3041
|
+
m += u.decode(w, { stream: !0 });
|
|
3042
|
+
const g = m.split(`
|
|
3054
3043
|
`);
|
|
3055
|
-
m =
|
|
3056
|
-
for (const
|
|
3057
|
-
const
|
|
3058
|
-
if (!
|
|
3059
|
-
const
|
|
3060
|
-
if (
|
|
3044
|
+
m = g.pop() || "";
|
|
3045
|
+
for (const b of g) {
|
|
3046
|
+
const v = b.trim();
|
|
3047
|
+
if (!v || !v.startsWith("data: ")) continue;
|
|
3048
|
+
const _ = v.slice(6);
|
|
3049
|
+
if (_ !== "[DONE]")
|
|
3061
3050
|
try {
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3051
|
+
const x = (h = (p = (d = JSON.parse(_).choices) == null ? void 0 : d[0]) == null ? void 0 : p.delta) == null ? void 0 : h.content;
|
|
3052
|
+
x && (yield x);
|
|
3064
3053
|
} catch {
|
|
3065
3054
|
}
|
|
3066
3055
|
}
|
|
@@ -3070,7 +3059,7 @@ class br {
|
|
|
3070
3059
|
}
|
|
3071
3060
|
}
|
|
3072
3061
|
async generateObject(t, n, r) {
|
|
3073
|
-
var
|
|
3062
|
+
var y, w, g;
|
|
3074
3063
|
const { apiKey: o, model: s = T.grok, temperature: i = 0.7, baseUrl: l = "https://api.x.ai/v1" } = r;
|
|
3075
3064
|
if (!o) throw new Error("Grok API key required");
|
|
3076
3065
|
const c = `${t}
|
|
@@ -3088,14 +3077,14 @@ Respond with valid JSON only.`, u = await fetch(`${l}/chat/completions`, {
|
|
|
3088
3077
|
})
|
|
3089
3078
|
});
|
|
3090
3079
|
if (!u.ok) {
|
|
3091
|
-
const
|
|
3092
|
-
throw this.normalizeError(u.status,
|
|
3080
|
+
const b = await u.json();
|
|
3081
|
+
throw this.normalizeError(u.status, b);
|
|
3093
3082
|
}
|
|
3094
|
-
const d = ((
|
|
3083
|
+
const d = ((g = (w = (y = (await u.json()).choices) == null ? void 0 : y[0]) == null ? void 0 : w.message) == null ? void 0 : g.content) || "{}", p = d.match(/\{[\s\S]*\}/), h = p ? p[0] : d;
|
|
3095
3084
|
return JSON.parse(h);
|
|
3096
3085
|
}
|
|
3097
3086
|
async listModels(t, n) {
|
|
3098
|
-
return [...
|
|
3087
|
+
return [...ie.grok];
|
|
3099
3088
|
}
|
|
3100
3089
|
normalizeError(t, n) {
|
|
3101
3090
|
var s;
|
|
@@ -3112,16 +3101,16 @@ Respond with valid JSON only.`, u = await fetch(`${l}/chat/completions`, {
|
|
|
3112
3101
|
return o.code = "API_ERROR", o.status = t, o;
|
|
3113
3102
|
}
|
|
3114
3103
|
}
|
|
3115
|
-
class
|
|
3104
|
+
class Er {
|
|
3116
3105
|
async *streamChat(t, n, r) {
|
|
3117
3106
|
const { apiKey: o, model: s = T.deepseek, temperature: i = 0.7, baseUrl: l = "https://api.deepseek.com/v1" } = n;
|
|
3118
3107
|
if (!o) throw new Error("DeepSeek API key required");
|
|
3119
|
-
yield*
|
|
3108
|
+
yield* se(
|
|
3120
3109
|
`${l}/chat/completions`,
|
|
3121
3110
|
{ "Content-Type": "application/json", Authorization: `Bearer ${o}` },
|
|
3122
3111
|
{
|
|
3123
3112
|
model: s,
|
|
3124
|
-
messages:
|
|
3113
|
+
messages: ce(t),
|
|
3125
3114
|
temperature: i,
|
|
3126
3115
|
stream: !0,
|
|
3127
3116
|
...B(r) && { tools: B(r), tool_choice: "auto" }
|
|
@@ -3169,28 +3158,28 @@ class wr {
|
|
|
3169
3158
|
})
|
|
3170
3159
|
});
|
|
3171
3160
|
if (!l.ok) {
|
|
3172
|
-
const
|
|
3173
|
-
throw this.normalizeError(l.status,
|
|
3161
|
+
const y = await l.json();
|
|
3162
|
+
throw this.normalizeError(l.status, y);
|
|
3174
3163
|
}
|
|
3175
3164
|
if (!l.body) throw new Error("No response body for streaming");
|
|
3176
3165
|
const c = l.body.getReader(), u = new TextDecoder();
|
|
3177
3166
|
let m = "";
|
|
3178
3167
|
try {
|
|
3179
3168
|
for (; ; ) {
|
|
3180
|
-
const { done:
|
|
3181
|
-
if (
|
|
3182
|
-
m += u.decode(
|
|
3183
|
-
const
|
|
3169
|
+
const { done: y, value: w } = await c.read();
|
|
3170
|
+
if (y) break;
|
|
3171
|
+
m += u.decode(w, { stream: !0 });
|
|
3172
|
+
const g = m.split(`
|
|
3184
3173
|
`);
|
|
3185
|
-
m =
|
|
3186
|
-
for (const
|
|
3187
|
-
const
|
|
3188
|
-
if (!
|
|
3189
|
-
const
|
|
3190
|
-
if (
|
|
3174
|
+
m = g.pop() || "";
|
|
3175
|
+
for (const b of g) {
|
|
3176
|
+
const v = b.trim();
|
|
3177
|
+
if (!v || !v.startsWith("data: ")) continue;
|
|
3178
|
+
const _ = v.slice(6);
|
|
3179
|
+
if (_ !== "[DONE]")
|
|
3191
3180
|
try {
|
|
3192
|
-
const
|
|
3193
|
-
|
|
3181
|
+
const x = (h = (p = (d = JSON.parse(_).choices) == null ? void 0 : d[0]) == null ? void 0 : p.delta) == null ? void 0 : h.content;
|
|
3182
|
+
x && (yield x);
|
|
3194
3183
|
} catch {
|
|
3195
3184
|
}
|
|
3196
3185
|
}
|
|
@@ -3217,14 +3206,14 @@ class wr {
|
|
|
3217
3206
|
})
|
|
3218
3207
|
});
|
|
3219
3208
|
if (!c.ok) {
|
|
3220
|
-
const
|
|
3221
|
-
throw this.normalizeError(c.status,
|
|
3209
|
+
const y = await c.json();
|
|
3210
|
+
throw this.normalizeError(c.status, y);
|
|
3222
3211
|
}
|
|
3223
3212
|
const m = ((h = (p = (d = (await c.json()).choices) == null ? void 0 : d[0]) == null ? void 0 : p.message) == null ? void 0 : h.content) || "{}";
|
|
3224
3213
|
return JSON.parse(m);
|
|
3225
3214
|
}
|
|
3226
3215
|
async listModels(t, n) {
|
|
3227
|
-
return [...
|
|
3216
|
+
return [...ie.deepseek];
|
|
3228
3217
|
}
|
|
3229
3218
|
normalizeError(t, n) {
|
|
3230
3219
|
var s;
|
|
@@ -3241,7 +3230,7 @@ class wr {
|
|
|
3241
3230
|
return o.code = "API_ERROR", o.status = t, o;
|
|
3242
3231
|
}
|
|
3243
3232
|
}
|
|
3244
|
-
let
|
|
3233
|
+
let Ar = class {
|
|
3245
3234
|
constructor(t) {
|
|
3246
3235
|
this.requests = [], this.config = t;
|
|
3247
3236
|
}
|
|
@@ -3259,16 +3248,16 @@ let Er = class {
|
|
|
3259
3248
|
};
|
|
3260
3249
|
class L {
|
|
3261
3250
|
constructor() {
|
|
3262
|
-
this.rateLimiter = new
|
|
3251
|
+
this.rateLimiter = new Ar({
|
|
3263
3252
|
maxRequests: 10,
|
|
3264
3253
|
windowMs: 6e4
|
|
3265
3254
|
}), this.adapters = /* @__PURE__ */ new Map([
|
|
3266
|
-
["google-gemini", new
|
|
3267
|
-
["ollama", new
|
|
3268
|
-
["anthropic", new
|
|
3269
|
-
["openai", new
|
|
3270
|
-
["grok", new
|
|
3271
|
-
["deepseek", new
|
|
3255
|
+
["google-gemini", new gr()],
|
|
3256
|
+
["ollama", new fr()],
|
|
3257
|
+
["anthropic", new yr()],
|
|
3258
|
+
["openai", new br()],
|
|
3259
|
+
["grok", new wr()],
|
|
3260
|
+
["deepseek", new Er()]
|
|
3272
3261
|
]);
|
|
3273
3262
|
}
|
|
3274
3263
|
static getInstance() {
|
|
@@ -3349,8 +3338,8 @@ class L {
|
|
|
3349
3338
|
return o.listModels(n, r);
|
|
3350
3339
|
}
|
|
3351
3340
|
}
|
|
3352
|
-
const
|
|
3353
|
-
class
|
|
3341
|
+
const Vr = L.getInstance(), $ = {};
|
|
3342
|
+
class Kr {
|
|
3354
3343
|
/**
|
|
3355
3344
|
* Resolve configuration with 3-tier priority:
|
|
3356
3345
|
* 1. User's localStorage override (highest priority)
|
|
@@ -3389,8 +3378,8 @@ class Vr {
|
|
|
3389
3378
|
*/
|
|
3390
3379
|
static getEnvKeyForProvider(t) {
|
|
3391
3380
|
var r, o, s, i, l;
|
|
3392
|
-
if (typeof import.meta < "u" &&
|
|
3393
|
-
const c =
|
|
3381
|
+
if (typeof import.meta < "u" && $) {
|
|
3382
|
+
const c = $, u = (d) => (d == null ? void 0 : d.trim()) || void 0;
|
|
3394
3383
|
return {
|
|
3395
3384
|
"google-gemini": u(c == null ? void 0 : c.VITE_DEFAULT_GEMINI_KEY),
|
|
3396
3385
|
openai: u(c == null ? void 0 : c.VITE_DEFAULT_OPENAI_KEY),
|
|
@@ -3413,8 +3402,8 @@ class Vr {
|
|
|
3413
3402
|
* value never exposed. Safe to call from UI components for status badges.
|
|
3414
3403
|
*/
|
|
3415
3404
|
static hasEnvKey(t) {
|
|
3416
|
-
if (typeof import.meta < "u" &&
|
|
3417
|
-
const r =
|
|
3405
|
+
if (typeof import.meta < "u" && $) {
|
|
3406
|
+
const r = $, o = (i) => (i == null ? void 0 : i.trim()) || void 0;
|
|
3418
3407
|
return !!{
|
|
3419
3408
|
"google-gemini": o(r == null ? void 0 : r.VITE_DEFAULT_GEMINI_KEY),
|
|
3420
3409
|
openai: o(r == null ? void 0 : r.VITE_DEFAULT_OPENAI_KEY),
|
|
@@ -3435,8 +3424,8 @@ class Vr {
|
|
|
3435
3424
|
*/
|
|
3436
3425
|
static loadAppDefaults() {
|
|
3437
3426
|
var n, r;
|
|
3438
|
-
if (typeof import.meta < "u" &&
|
|
3439
|
-
const o =
|
|
3427
|
+
if (typeof import.meta < "u" && $) {
|
|
3428
|
+
const o = $, s = (o == null ? void 0 : o.VITE_DEFAULT_AI_PROVIDER) || "", i = (d) => (d == null ? void 0 : d.trim()) || void 0, l = {
|
|
3440
3429
|
"google-gemini": i(o == null ? void 0 : o.VITE_DEFAULT_GEMINI_KEY),
|
|
3441
3430
|
openai: i(o == null ? void 0 : o.VITE_DEFAULT_OPENAI_KEY),
|
|
3442
3431
|
anthropic: i(o == null ? void 0 : o.VITE_DEFAULT_ANTHROPIC_KEY),
|
|
@@ -3458,15 +3447,15 @@ class Vr {
|
|
|
3458
3447
|
} : {};
|
|
3459
3448
|
}
|
|
3460
3449
|
}
|
|
3461
|
-
const
|
|
3450
|
+
const xr = (a) => {
|
|
3462
3451
|
let t = "";
|
|
3463
3452
|
for (const n of a) t += String.fromCharCode(n);
|
|
3464
3453
|
return btoa(t);
|
|
3465
|
-
},
|
|
3454
|
+
}, vr = (a) => Uint8Array.from(atob(a), (t) => t.charCodeAt(0)), kr = (a) => {
|
|
3466
3455
|
if (a === "." || a === " " || a === "_") return 0;
|
|
3467
3456
|
const t = parseInt(a, 16);
|
|
3468
3457
|
return Number.isNaN(t) ? -1 : t;
|
|
3469
|
-
},
|
|
3458
|
+
}, Sr = (a, t) => {
|
|
3470
3459
|
if (t.length === 0) return { ok: !1, error: "palette is empty" };
|
|
3471
3460
|
if (t.length > 16)
|
|
3472
3461
|
return { ok: !1, error: `palette has ${t.length} colours and a sprite holds at most 16` };
|
|
@@ -3474,10 +3463,10 @@ const Ar = (a) => {
|
|
|
3474
3463
|
`).map((c) => c.trim()).filter((c) => c.length > 0);
|
|
3475
3464
|
if (n.length === 0) return { ok: !1, error: "grid has no rows" };
|
|
3476
3465
|
const r = n.length, o = n[0].length;
|
|
3477
|
-
if (o >
|
|
3466
|
+
if (o > M || r > M)
|
|
3478
3467
|
return {
|
|
3479
3468
|
ok: !1,
|
|
3480
|
-
error: `grid is ${o}x${r} and the largest sprite is ${
|
|
3469
|
+
error: `grid is ${o}x${r} and the largest sprite is ${M}x${M}`
|
|
3481
3470
|
};
|
|
3482
3471
|
const s = n.map((c, u) => ({ i: u, len: c.length })).filter((c) => c.len !== o);
|
|
3483
3472
|
if (s.length > 0) {
|
|
@@ -3490,7 +3479,7 @@ const Ar = (a) => {
|
|
|
3490
3479
|
const i = Math.ceil(o / 2), l = new Uint8Array(i * r);
|
|
3491
3480
|
for (let c = 0; c < r; c++)
|
|
3492
3481
|
for (let u = 0; u < o; u++) {
|
|
3493
|
-
const m =
|
|
3482
|
+
const m = kr(n[c][u]);
|
|
3494
3483
|
if (m < 0)
|
|
3495
3484
|
return {
|
|
3496
3485
|
ok: !1,
|
|
@@ -3504,9 +3493,9 @@ const Ar = (a) => {
|
|
|
3504
3493
|
const d = c * i + (u >> 1);
|
|
3505
3494
|
l[d] |= u & 1 ? m : m << 4;
|
|
3506
3495
|
}
|
|
3507
|
-
return { ok: !0, sprite: { width: o, height: r, palette: t, pixels:
|
|
3496
|
+
return { ok: !0, sprite: { width: o, height: r, palette: t, pixels: xr(l) } };
|
|
3508
3497
|
}, Jr = (a) => {
|
|
3509
|
-
const t =
|
|
3498
|
+
const t = vr(a.pixels), n = Math.ceil(a.width / 2), r = [];
|
|
3510
3499
|
for (let o = 0; o < a.height; o++) {
|
|
3511
3500
|
let s = "";
|
|
3512
3501
|
for (let i = 0; i < a.width; i++) {
|
|
@@ -3517,7 +3506,7 @@ const Ar = (a) => {
|
|
|
3517
3506
|
}
|
|
3518
3507
|
return r.join(`
|
|
3519
3508
|
`);
|
|
3520
|
-
},
|
|
3509
|
+
}, Yr = (a) => {
|
|
3521
3510
|
const t = [];
|
|
3522
3511
|
if (!a || typeof a != "object") return { value: a, issues: t };
|
|
3523
3512
|
const n = a.blocks;
|
|
@@ -3528,7 +3517,7 @@ const Ar = (a) => {
|
|
|
3528
3517
|
if (Array.isArray(i.children))
|
|
3529
3518
|
return { ...i, children: i.children.map((d, p) => r(d, [...s, "children", p])) };
|
|
3530
3519
|
if (i.type !== "sprite" || typeof i.grid != "string") return o;
|
|
3531
|
-
const l = Array.isArray(i.palette) ? i.palette : [], c =
|
|
3520
|
+
const l = Array.isArray(i.palette) ? i.palette : [], c = Sr(i.grid, l);
|
|
3532
3521
|
if (!c.ok)
|
|
3533
3522
|
return t.push({ path: [...s, "grid"], message: c.error }), o;
|
|
3534
3523
|
const { grid: u, ...m } = i;
|
|
@@ -3539,7 +3528,7 @@ const Ar = (a) => {
|
|
|
3539
3528
|
issues: t
|
|
3540
3529
|
};
|
|
3541
3530
|
};
|
|
3542
|
-
class
|
|
3531
|
+
class _r {
|
|
3543
3532
|
constructor(t) {
|
|
3544
3533
|
this.requests = [], this.config = t;
|
|
3545
3534
|
}
|
|
@@ -3555,9 +3544,9 @@ class Sr {
|
|
|
3555
3544
|
return this.requests.length === 0 ? 0 : this.requests[0] + this.config.windowMs;
|
|
3556
3545
|
}
|
|
3557
3546
|
}
|
|
3558
|
-
class
|
|
3547
|
+
class Tr {
|
|
3559
3548
|
constructor(t = { maxRequests: 10, windowMs: 6e4 }) {
|
|
3560
|
-
this.rateLimiter = new
|
|
3549
|
+
this.rateLimiter = new _r(t);
|
|
3561
3550
|
}
|
|
3562
3551
|
async makeRequest(t, n) {
|
|
3563
3552
|
if (!this.rateLimiter.checkLimit()) {
|
|
@@ -3570,50 +3559,50 @@ class _r {
|
|
|
3570
3559
|
return this.rateLimiter.getRemainingRequests();
|
|
3571
3560
|
}
|
|
3572
3561
|
}
|
|
3573
|
-
const
|
|
3562
|
+
const Gr = new Tr({ maxRequests: 10, windowMs: 6e4 });
|
|
3574
3563
|
export {
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3564
|
+
Kr as A,
|
|
3565
|
+
Re as B,
|
|
3566
|
+
Mr as C,
|
|
3567
|
+
Ur as D,
|
|
3568
|
+
Ie as E,
|
|
3569
|
+
jr as F,
|
|
3570
|
+
gr as G,
|
|
3571
|
+
H,
|
|
3572
|
+
Ar as I,
|
|
3584
3573
|
$r as J,
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3574
|
+
Lr as K,
|
|
3575
|
+
Rr as L,
|
|
3576
|
+
fr as O,
|
|
3577
|
+
ie as P,
|
|
3578
|
+
_e as R,
|
|
3590
3579
|
$e as S,
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3580
|
+
Oe as T,
|
|
3581
|
+
je as W,
|
|
3582
|
+
ht as a,
|
|
3583
|
+
Vr as b,
|
|
3584
|
+
Cr as c,
|
|
3585
|
+
Dr as d,
|
|
3586
|
+
Nr as e,
|
|
3587
|
+
qr as f,
|
|
3599
3588
|
L as g,
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3589
|
+
Br as h,
|
|
3590
|
+
Tr as i,
|
|
3591
|
+
Gr as j,
|
|
3592
|
+
Or as k,
|
|
3593
|
+
Sr as l,
|
|
3594
|
+
Zr as m,
|
|
3595
|
+
Yr as n,
|
|
3596
|
+
yr as o,
|
|
3597
|
+
br as p,
|
|
3598
|
+
wr as q,
|
|
3599
|
+
Er as r,
|
|
3611
3600
|
Jr as s,
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3601
|
+
Fr as t,
|
|
3602
|
+
hr as u,
|
|
3603
|
+
Se as v,
|
|
3604
|
+
Pe as w,
|
|
3605
|
+
Ne as x,
|
|
3606
|
+
De as y,
|
|
3607
|
+
Pr as z
|
|
3619
3608
|
};
|