@pydantic/genai-prices 0.0.51 → 0.0.53
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/cli.js +605 -243
- package/dist/index.cjs +4 -4
- package/dist/index.js +496 -134
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { format as
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { readFileSync as
|
|
2
|
+
import _e from "yargs";
|
|
3
|
+
import { format as ke } from "util";
|
|
4
|
+
import { resolve as ie, normalize as Qe } from "path";
|
|
5
|
+
import { readFileSync as ge, writeFile as Pe, statSync as Te } from "fs";
|
|
6
6
|
import "assert";
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
function Se() {
|
|
9
|
-
return Ge() ? 0 : 1;
|
|
10
|
-
}
|
|
7
|
+
import { fileURLToPath as Se } from "url";
|
|
11
8
|
function Ge() {
|
|
12
|
-
return Ce()
|
|
9
|
+
return Ce() ? 0 : 1;
|
|
13
10
|
}
|
|
14
11
|
function Ce() {
|
|
12
|
+
return Re() && !process.defaultApp;
|
|
13
|
+
}
|
|
14
|
+
function Re() {
|
|
15
15
|
return !!process.versions.electron;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return i.slice(
|
|
17
|
+
function ze(i) {
|
|
18
|
+
return i.slice(Ge() + 1);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
@@ -29,19 +29,19 @@ function $(i) {
|
|
|
29
29
|
let u = "", s = !1;
|
|
30
30
|
const r = i.match(/^-+/);
|
|
31
31
|
for (let _ = r ? r[0].length : 0; _ < i.length; _++) {
|
|
32
|
-
let
|
|
33
|
-
s && (s = !1,
|
|
32
|
+
let h = i.charAt(_);
|
|
33
|
+
s && (s = !1, h = h.toUpperCase()), _ !== 0 && (h === "-" || h === "_") ? s = !0 : h !== "-" && h !== "_" && (u += h);
|
|
34
34
|
}
|
|
35
35
|
return u;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Oe(i, o) {
|
|
39
39
|
const u = i.toLowerCase();
|
|
40
40
|
o = o || "-";
|
|
41
41
|
let s = "";
|
|
42
42
|
for (let r = 0; r < i.length; r++) {
|
|
43
|
-
const _ = u.charAt(r),
|
|
44
|
-
_ !==
|
|
43
|
+
const _ = u.charAt(r), h = i.charAt(r);
|
|
44
|
+
_ !== h && r > 0 ? s += `${o}${u.charAt(r)}` : s += h;
|
|
45
45
|
}
|
|
46
46
|
return s;
|
|
47
47
|
}
|
|
@@ -53,14 +53,14 @@ function Ne(i) {
|
|
|
53
53
|
* Copyright (c) 2016, Contributors
|
|
54
54
|
* SPDX-License-Identifier: ISC
|
|
55
55
|
*/
|
|
56
|
-
function
|
|
56
|
+
function Ee(i) {
|
|
57
57
|
if (Array.isArray(i))
|
|
58
|
-
return i.map((
|
|
58
|
+
return i.map((h) => typeof h != "string" ? h + "" : h);
|
|
59
59
|
i = i.trim();
|
|
60
60
|
let o = 0, u = null, s = null, r = null;
|
|
61
61
|
const _ = [];
|
|
62
|
-
for (let
|
|
63
|
-
if (u = s, s = i.charAt(
|
|
62
|
+
for (let h = 0; h < i.length; h++) {
|
|
63
|
+
if (u = s, s = i.charAt(h), s === " " && !r) {
|
|
64
64
|
u !== " " && o++;
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
@@ -73,19 +73,19 @@ function Oe(i) {
|
|
|
73
73
|
* Copyright (c) 2016, Contributors
|
|
74
74
|
* SPDX-License-Identifier: ISC
|
|
75
75
|
*/
|
|
76
|
-
var
|
|
76
|
+
var Q;
|
|
77
77
|
(function(i) {
|
|
78
78
|
i.BOOLEAN = "boolean", i.STRING = "string", i.NUMBER = "number", i.ARRAY = "array";
|
|
79
|
-
})(
|
|
79
|
+
})(Q || (Q = {}));
|
|
80
80
|
/**
|
|
81
81
|
* @license
|
|
82
82
|
* Copyright (c) 2016, Contributors
|
|
83
83
|
* SPDX-License-Identifier: ISC
|
|
84
84
|
*/
|
|
85
|
-
let
|
|
85
|
+
let S;
|
|
86
86
|
class De {
|
|
87
87
|
constructor(o) {
|
|
88
|
-
|
|
88
|
+
S = o;
|
|
89
89
|
}
|
|
90
90
|
parse(o, u) {
|
|
91
91
|
const s = Object.assign({
|
|
@@ -105,7 +105,7 @@ class De {
|
|
|
105
105
|
number: void 0,
|
|
106
106
|
__: void 0,
|
|
107
107
|
key: void 0
|
|
108
|
-
}, u), r =
|
|
108
|
+
}, u), r = Ee(o), _ = typeof o == "string", h = je(Object.assign(/* @__PURE__ */ Object.create(null), s.alias)), k = Object.assign({
|
|
109
109
|
"boolean-negation": !0,
|
|
110
110
|
"camel-case-expansion": !0,
|
|
111
111
|
"combine-arrays": !1,
|
|
@@ -124,7 +124,7 @@ class De {
|
|
|
124
124
|
"strip-aliased": !1,
|
|
125
125
|
"strip-dashed": !1,
|
|
126
126
|
"unknown-options-as-args": !1
|
|
127
|
-
}, s.configuration), q = Object.assign(/* @__PURE__ */ Object.create(null), s.default),
|
|
127
|
+
}, s.configuration), q = Object.assign(/* @__PURE__ */ Object.create(null), s.default), I = s.configObjects || [], B = s.envPrefix, y = k["populate--"], L = y ? "--" : "_", G = /* @__PURE__ */ Object.create(null), ne = /* @__PURE__ */ Object.create(null), C = s.__ || S.format, m = {
|
|
128
128
|
aliases: /* @__PURE__ */ Object.create(null),
|
|
129
129
|
arrays: /* @__PURE__ */ Object.create(null),
|
|
130
130
|
bools: /* @__PURE__ */ Object.create(null),
|
|
@@ -136,7 +136,7 @@ class De {
|
|
|
136
136
|
nargs: /* @__PURE__ */ Object.create(null),
|
|
137
137
|
coercions: /* @__PURE__ */ Object.create(null),
|
|
138
138
|
keys: []
|
|
139
|
-
},
|
|
139
|
+
}, P = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, W = new RegExp("^--" + k["negation-prefix"] + "(.+)");
|
|
140
140
|
[].concat(s.array || []).filter(Boolean).forEach(function(e) {
|
|
141
141
|
const a = typeof e == "object" ? e.key : e, c = Object.keys(e).map(function(n) {
|
|
142
142
|
return {
|
|
@@ -164,94 +164,94 @@ class De {
|
|
|
164
164
|
m.configs[e] = !0;
|
|
165
165
|
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, a]) => {
|
|
166
166
|
(typeof a == "boolean" || typeof a == "function") && (m.configs[e] = a);
|
|
167
|
-
})),
|
|
167
|
+
})), xe(s.key, h, s.default, m.arrays), Object.keys(q).forEach(function(e) {
|
|
168
168
|
(m.aliases[e] || []).forEach(function(a) {
|
|
169
169
|
q[a] = q[e];
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
-
let
|
|
173
|
-
|
|
172
|
+
let M = null;
|
|
173
|
+
Ae();
|
|
174
174
|
let j = [];
|
|
175
|
-
const
|
|
175
|
+
const b = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), se = {};
|
|
176
176
|
for (let e = 0; e < r.length; e++) {
|
|
177
177
|
const a = r[e], c = a.replace(/^-{3,}/, "---");
|
|
178
178
|
let n, t, l, p, d, v;
|
|
179
|
-
if (a !== "--" && /^-/.test(a) &&
|
|
179
|
+
if (a !== "--" && /^-/.test(a) && H(a))
|
|
180
180
|
U(a);
|
|
181
181
|
else if (c.match(/^---+(=|$)/)) {
|
|
182
182
|
U(a);
|
|
183
183
|
continue;
|
|
184
|
-
} else if (a.match(/^--.+=/) || !
|
|
185
|
-
p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1], m.arrays) ? e = F(e, p[1], r, p[2]) : g(p[1], m.nargs) !== !1 ? e = V(e, p[1], r, p[2]) :
|
|
186
|
-
else if (a.match(W) &&
|
|
187
|
-
p = a.match(W), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1],
|
|
188
|
-
else if (a.match(/^--.+/) || !
|
|
189
|
-
p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(
|
|
184
|
+
} else if (a.match(/^--.+=/) || !k["short-option-groups"] && a.match(/^-.+=/))
|
|
185
|
+
p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1], m.arrays) ? e = F(e, p[1], r, p[2]) : g(p[1], m.nargs) !== !1 ? e = V(e, p[1], r, p[2]) : w(p[1], p[2], !0));
|
|
186
|
+
else if (a.match(W) && k["boolean-negation"])
|
|
187
|
+
p = a.match(W), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], w(t, g(t, m.arrays) ? [!1] : !1));
|
|
188
|
+
else if (a.match(/^--.+/) || !k["short-option-groups"] && a.match(/^-[^-]+/))
|
|
189
|
+
p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(P)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (w(t, d), e++) : w(t, z(t))));
|
|
190
190
|
else if (a.match(/^-.\..+=/))
|
|
191
|
-
p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 &&
|
|
192
|
-
else if (a.match(/^-.\..+/) && !a.match(
|
|
193
|
-
d = r[e + 1], p = a.match(/^-(.\..+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], d !== void 0 && !d.match(/^-/) && !g(t, m.bools) && !g(t, m.counts) ? (
|
|
194
|
-
else if (a.match(/^-[^-]+/) && !a.match(
|
|
191
|
+
p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && w(p[1], p[2]);
|
|
192
|
+
else if (a.match(/^-.\..+/) && !a.match(P))
|
|
193
|
+
d = r[e + 1], p = a.match(/^-(.\..+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], d !== void 0 && !d.match(/^-/) && !g(t, m.bools) && !g(t, m.counts) ? (w(t, d), e++) : w(t, z(t)));
|
|
194
|
+
else if (a.match(/^-[^-]+/) && !a.match(P)) {
|
|
195
195
|
l = a.slice(1, -1).split(""), n = !1;
|
|
196
196
|
for (let x = 0; x < l.length; x++) {
|
|
197
197
|
if (d = a.slice(x + 2), l[x + 1] && l[x + 1] === "=") {
|
|
198
|
-
v = a.slice(x + 3), t = l[x], g(t, m.arrays) ? e = F(e, t, r, v) : g(t, m.nargs) !== !1 ? e = V(e, t, r, v) :
|
|
198
|
+
v = a.slice(x + 3), t = l[x], g(t, m.arrays) ? e = F(e, t, r, v) : g(t, m.nargs) !== !1 ? e = V(e, t, r, v) : w(t, v), n = !0;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
if (d === "-") {
|
|
202
|
-
|
|
202
|
+
w(l[x], d);
|
|
203
203
|
continue;
|
|
204
204
|
}
|
|
205
205
|
if (/[A-Za-z]/.test(l[x]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(d) && g(d, m.bools) === !1) {
|
|
206
|
-
|
|
206
|
+
w(l[x], d), n = !0;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
209
|
if (l[x + 1] && l[x + 1].match(/\W/)) {
|
|
210
|
-
|
|
210
|
+
w(l[x], d), n = !0;
|
|
211
211
|
break;
|
|
212
212
|
} else
|
|
213
|
-
|
|
213
|
+
w(l[x], z(l[x]));
|
|
214
214
|
}
|
|
215
|
-
t = a.slice(-1)[0], !n && t !== "-" && (g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(
|
|
216
|
-
} else if (a.match(/^-[0-9]$/) && a.match(
|
|
217
|
-
t = a.slice(1),
|
|
215
|
+
t = a.slice(-1)[0], !n && t !== "-" && (g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(P)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (w(t, d), e++) : w(t, z(t))));
|
|
216
|
+
} else if (a.match(/^-[0-9]$/) && a.match(P) && g(a.slice(1), m.bools))
|
|
217
|
+
t = a.slice(1), w(t, z(t));
|
|
218
218
|
else if (a === "--") {
|
|
219
219
|
j = r.slice(e + 1);
|
|
220
220
|
break;
|
|
221
|
-
} else if (
|
|
221
|
+
} else if (k["halt-at-non-option"]) {
|
|
222
222
|
j = r.slice(e);
|
|
223
223
|
break;
|
|
224
224
|
} else
|
|
225
225
|
U(a);
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}),
|
|
230
|
-
|
|
231
|
-
}),
|
|
232
|
-
delete
|
|
233
|
-
}),
|
|
234
|
-
|
|
227
|
+
me(b, !0), me(b, !1), fe(b), we(), ue(b, m.aliases, q, !0), be(b), k["set-placeholder-key"] && ve(b), Object.keys(m.counts).forEach(function(e) {
|
|
228
|
+
O(b, e.split(".")) || w(e, 0);
|
|
229
|
+
}), y && j.length && (b[L] = []), j.forEach(function(e) {
|
|
230
|
+
b[L].push(e);
|
|
231
|
+
}), k["camel-case-expansion"] && k["strip-dashed"] && Object.keys(b).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
|
|
232
|
+
delete b[e];
|
|
233
|
+
}), k["strip-aliased"] && [].concat(...Object.keys(h).map((e) => h[e])).forEach((e) => {
|
|
234
|
+
k["camel-case-expansion"] && e.includes("-") && delete b[e.split(".").map((a) => $(a)).join(".")], delete b[e];
|
|
235
235
|
});
|
|
236
236
|
function U(e) {
|
|
237
|
-
const a =
|
|
238
|
-
(typeof a == "string" || typeof a == "number") &&
|
|
237
|
+
const a = K("_", e);
|
|
238
|
+
(typeof a == "string" || typeof a == "number") && b._.push(a);
|
|
239
239
|
}
|
|
240
240
|
function V(e, a, c, n) {
|
|
241
241
|
let t, l = g(a, m.nargs);
|
|
242
242
|
if (l = typeof l != "number" || isNaN(l) ? 1 : l, l === 0)
|
|
243
|
-
return
|
|
244
|
-
let p =
|
|
245
|
-
if (
|
|
246
|
-
c.length - (e + 1) + p < l && (
|
|
243
|
+
return T(n) || (M = Error(C("Argument unexpected for: %s", a))), w(a, z(a)), e;
|
|
244
|
+
let p = T(n) ? 0 : 1;
|
|
245
|
+
if (k["nargs-eats-options"])
|
|
246
|
+
c.length - (e + 1) + p < l && (M = Error(C("Not enough arguments following: %s", a))), p = l;
|
|
247
247
|
else {
|
|
248
|
-
for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(
|
|
248
|
+
for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(P) || H(c[t])); t++)
|
|
249
249
|
p++;
|
|
250
|
-
p < l && (
|
|
250
|
+
p < l && (M = Error(C("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(p, l);
|
|
253
|
-
for (!
|
|
254
|
-
|
|
253
|
+
for (!T(n) && d > 0 && (w(a, n), d--), t = e + 1; t < d + e + 1; t++)
|
|
254
|
+
w(a, c[t]);
|
|
255
255
|
return e + d;
|
|
256
256
|
}
|
|
257
257
|
function F(e, a, c, n) {
|
|
@@ -259,66 +259,66 @@ class De {
|
|
|
259
259
|
const p = g(a, m.nargs);
|
|
260
260
|
if (g(a, m.bools) && !/^(true|false)$/.test(l))
|
|
261
261
|
t.push(!0);
|
|
262
|
-
else if (
|
|
262
|
+
else if (T(l) || T(n) && /^-/.test(l) && !P.test(l) && !H(l)) {
|
|
263
263
|
if (q[a] !== void 0) {
|
|
264
264
|
const d = q[a];
|
|
265
265
|
t = Array.isArray(d) ? d : [d];
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
|
-
|
|
269
|
-
for (let d = e + 1; d < c.length && !(!
|
|
268
|
+
T(n) || t.push(Y(a, n, !0));
|
|
269
|
+
for (let d = e + 1; d < c.length && !(!k["greedy-arrays"] && t.length > 0 || p && typeof p == "number" && t.length >= p || (l = c[d], /^-/.test(l) && !P.test(l) && !H(l))); d++)
|
|
270
270
|
e = d, t.push(Y(a, l, _));
|
|
271
271
|
}
|
|
272
|
-
return typeof p == "number" && (p && t.length < p || isNaN(p) && t.length === 0) && (
|
|
272
|
+
return typeof p == "number" && (p && t.length < p || isNaN(p) && t.length === 0) && (M = Error(C("Not enough arguments following: %s", a))), w(a, t), e;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
if (/-/.test(e) &&
|
|
274
|
+
function w(e, a, c = _) {
|
|
275
|
+
if (/-/.test(e) && k["camel-case-expansion"]) {
|
|
276
276
|
const l = e.split(".").map(function(p) {
|
|
277
277
|
return $(p);
|
|
278
278
|
}).join(".");
|
|
279
|
-
|
|
279
|
+
re(e, l);
|
|
280
280
|
}
|
|
281
281
|
const n = Y(e, a, c), t = e.split(".");
|
|
282
|
-
|
|
282
|
+
N(b, t, n), m.aliases[e] && m.aliases[e].forEach(function(l) {
|
|
283
283
|
const p = l.split(".");
|
|
284
|
-
|
|
285
|
-
}), t.length > 1 &&
|
|
284
|
+
N(b, p, n);
|
|
285
|
+
}), t.length > 1 && k["dot-notation"] && (m.aliases[t[0]] || []).forEach(function(l) {
|
|
286
286
|
let p = l.split(".");
|
|
287
287
|
const d = [].concat(t);
|
|
288
|
-
d.shift(), p = p.concat(d), (m.aliases[e] || []).includes(p.join(".")) ||
|
|
288
|
+
d.shift(), p = p.concat(d), (m.aliases[e] || []).includes(p.join(".")) || N(b, p, n);
|
|
289
289
|
}), g(e, m.normalize) && !g(e, m.arrays) && [e].concat(m.aliases[e] || []).forEach(function(p) {
|
|
290
|
-
Object.defineProperty(
|
|
290
|
+
Object.defineProperty(se, p, {
|
|
291
291
|
enumerable: !0,
|
|
292
292
|
get() {
|
|
293
293
|
return a;
|
|
294
294
|
},
|
|
295
295
|
set(d) {
|
|
296
|
-
a = typeof d == "string" ?
|
|
296
|
+
a = typeof d == "string" ? S.normalize(d) : d;
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
m.aliases[e] && m.aliases[e].length || (m.aliases[e] = [a], G[a] = !0), m.aliases[a] && m.aliases[a].length ||
|
|
301
|
+
function re(e, a) {
|
|
302
|
+
m.aliases[e] && m.aliases[e].length || (m.aliases[e] = [a], G[a] = !0), m.aliases[a] && m.aliases[a].length || re(a, e);
|
|
303
303
|
}
|
|
304
304
|
function Y(e, a, c) {
|
|
305
|
-
c && (a =
|
|
305
|
+
c && (a = Ve(a)), (g(e, m.bools) || g(e, m.counts)) && typeof a == "string" && (a = a === "true");
|
|
306
306
|
let n = Array.isArray(a) ? a.map(function(t) {
|
|
307
|
-
return
|
|
308
|
-
}) :
|
|
309
|
-
return g(e, m.counts) && (
|
|
307
|
+
return K(e, t);
|
|
308
|
+
}) : K(e, a);
|
|
309
|
+
return g(e, m.counts) && (T(n) || typeof n == "boolean") && (n = Z()), g(e, m.normalize) && g(e, m.arrays) && (Array.isArray(a) ? n = a.map((t) => S.normalize(t)) : n = S.normalize(a)), n;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
312
|
-
return !
|
|
311
|
+
function K(e, a) {
|
|
312
|
+
return !k["parse-positional-numbers"] && e === "_" || !g(e, m.strings) && !g(e, m.bools) && !Array.isArray(a) && (Ne(a) && k["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(e, m.numbers)) && (a = Number(a)), a;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function fe(e) {
|
|
315
315
|
const a = /* @__PURE__ */ Object.create(null);
|
|
316
|
-
|
|
316
|
+
ue(a, m.aliases, q), Object.keys(m.configs).forEach(function(c) {
|
|
317
317
|
const n = e[c] || a[c];
|
|
318
318
|
if (n)
|
|
319
319
|
try {
|
|
320
320
|
let t = null;
|
|
321
|
-
const l =
|
|
321
|
+
const l = S.resolve(S.cwd(), n), p = m.configs[c];
|
|
322
322
|
if (typeof p == "function") {
|
|
323
323
|
try {
|
|
324
324
|
t = p(l);
|
|
@@ -326,38 +326,38 @@ class De {
|
|
|
326
326
|
t = d;
|
|
327
327
|
}
|
|
328
328
|
if (t instanceof Error) {
|
|
329
|
-
|
|
329
|
+
M = t;
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
} else
|
|
333
|
-
t =
|
|
333
|
+
t = S.require(l);
|
|
334
334
|
J(t);
|
|
335
335
|
} catch (t) {
|
|
336
|
-
t.name === "PermissionDenied" ?
|
|
336
|
+
t.name === "PermissionDenied" ? M = t : e[c] && (M = Error(C("Invalid JSON config file: %s", n)));
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
function J(e, a) {
|
|
341
341
|
Object.keys(e).forEach(function(c) {
|
|
342
342
|
const n = e[c], t = a ? a + "." + c : c;
|
|
343
|
-
typeof n == "object" && n !== null && !Array.isArray(n) &&
|
|
343
|
+
typeof n == "object" && n !== null && !Array.isArray(n) && k["dot-notation"] ? J(n, t) : (!O(b, t.split(".")) || g(t, m.arrays) && k["combine-arrays"]) && w(t, n);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
typeof
|
|
346
|
+
function we() {
|
|
347
|
+
typeof I < "u" && I.forEach(function(e) {
|
|
348
348
|
J(e);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function me(e, a) {
|
|
352
352
|
if (typeof B > "u")
|
|
353
353
|
return;
|
|
354
|
-
const c = typeof B == "string" ? B : "", n =
|
|
354
|
+
const c = typeof B == "string" ? B : "", n = S.env();
|
|
355
355
|
Object.keys(n).forEach(function(t) {
|
|
356
356
|
if (c === "" || t.lastIndexOf(c, 0) === 0) {
|
|
357
357
|
const l = t.split("__").map(function(p, d) {
|
|
358
358
|
return d === 0 && (p = p.substring(c.length)), $(p);
|
|
359
359
|
});
|
|
360
|
-
(a && m.configs[l.join(".")] || !a) && !
|
|
360
|
+
(a && m.configs[l.join(".")] || !a) && !O(e, l) && w(l.join("."), n[t]);
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
}
|
|
@@ -367,55 +367,55 @@ class De {
|
|
|
367
367
|
Object.keys(e).forEach(function(n) {
|
|
368
368
|
if (!c.has(n) && (a = g(n, m.coercions), typeof a == "function"))
|
|
369
369
|
try {
|
|
370
|
-
const t =
|
|
370
|
+
const t = K(n, a(e[n]));
|
|
371
371
|
[].concat(m.aliases[n] || [], n).forEach((l) => {
|
|
372
372
|
c.add(l), e[l] = t;
|
|
373
373
|
});
|
|
374
374
|
} catch (t) {
|
|
375
|
-
|
|
375
|
+
M = t;
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function ve(e) {
|
|
380
380
|
return m.keys.forEach((a) => {
|
|
381
381
|
~a.indexOf(".") || typeof e[a] > "u" && (e[a] = void 0);
|
|
382
382
|
}), e;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function ue(e, a, c, n = !1) {
|
|
385
385
|
Object.keys(c).forEach(function(t) {
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
O(e, t.split(".")) || (N(e, t.split("."), c[t]), n && (ne[t] = !0), (a[t] || []).forEach(function(l) {
|
|
387
|
+
O(e, l.split(".")) || N(e, l.split("."), c[t]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function O(e, a) {
|
|
392
392
|
let c = e;
|
|
393
|
-
|
|
393
|
+
k["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
|
|
394
394
|
c = c[t] || {};
|
|
395
395
|
});
|
|
396
396
|
const n = a[a.length - 1];
|
|
397
397
|
return typeof c != "object" ? !1 : n in c;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function N(e, a, c) {
|
|
400
400
|
let n = e;
|
|
401
|
-
|
|
402
|
-
v =
|
|
401
|
+
k["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
|
|
402
|
+
v = pe(v), typeof n == "object" && n[v] === void 0 && (n[v] = {}), typeof n[v] != "object" || Array.isArray(n[v]) ? (Array.isArray(n[v]) ? n[v].push({}) : n[v] = [n[v], {}], n = n[v][n[v].length - 1]) : n = n[v];
|
|
403
403
|
});
|
|
404
|
-
const t =
|
|
405
|
-
let d =
|
|
406
|
-
!d && g(t, m.nargs) && (d = !0, (!
|
|
404
|
+
const t = pe(a[a.length - 1]), l = g(a.join("."), m.arrays), p = Array.isArray(c);
|
|
405
|
+
let d = k["duplicate-arguments-array"];
|
|
406
|
+
!d && g(t, m.nargs) && (d = !0, (!T(n[t]) && m.nargs[t] === 1 || Array.isArray(n[t]) && n[t].length === m.nargs[t]) && (n[t] = void 0)), c === Z() ? n[t] = Z(n[t]) : Array.isArray(n[t]) ? d && l && p ? n[t] = k["flatten-duplicate-arrays"] ? n[t].concat(c) : (Array.isArray(n[t][0]) ? n[t] : [n[t]]).concat([c]) : !d && !!l == !!p ? n[t] = c : n[t] = n[t].concat([c]) : n[t] === void 0 && l ? n[t] = p ? c : [c] : d && !(n[t] === void 0 || g(t, m.counts) || g(t, m.bools)) ? n[t] = [n[t], c] : n[t] = c;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function xe(...e) {
|
|
409
409
|
e.forEach(function(a) {
|
|
410
410
|
Object.keys(a || {}).forEach(function(c) {
|
|
411
|
-
m.aliases[c] || (m.aliases[c] = [].concat(
|
|
412
|
-
if (/-/.test(n) &&
|
|
411
|
+
m.aliases[c] || (m.aliases[c] = [].concat(h[c] || []), m.aliases[c].concat(c).forEach(function(n) {
|
|
412
|
+
if (/-/.test(n) && k["camel-case-expansion"]) {
|
|
413
413
|
const t = $(n);
|
|
414
414
|
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), G[t] = !0);
|
|
415
415
|
}
|
|
416
416
|
}), m.aliases[c].concat(c).forEach(function(n) {
|
|
417
|
-
if (n.length > 1 && /[A-Z]/.test(n) &&
|
|
418
|
-
const t =
|
|
417
|
+
if (n.length > 1 && /[A-Z]/.test(n) && k["camel-case-expansion"]) {
|
|
418
|
+
const t = Oe(n, "-");
|
|
419
419
|
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), G[t] = !0);
|
|
420
420
|
}
|
|
421
421
|
}), m.aliases[c].forEach(function(n) {
|
|
@@ -430,25 +430,25 @@ class De {
|
|
|
430
430
|
const c = [].concat(m.aliases[e] || [], e), n = Object.keys(a), t = c.find((l) => n.includes(l));
|
|
431
431
|
return t ? a[t] : !1;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function ce(e) {
|
|
434
434
|
const a = Object.keys(m);
|
|
435
435
|
return [].concat(a.map((n) => m[n])).some(function(n) {
|
|
436
436
|
return Array.isArray(n) ? n.includes(e) : n[e];
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function Be(e, ...a) {
|
|
440
440
|
return [].concat(...a).some(function(n) {
|
|
441
441
|
const t = e.match(n);
|
|
442
|
-
return t &&
|
|
442
|
+
return t && ce(t[1]);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
if (e.match(
|
|
445
|
+
function Ie(e) {
|
|
446
|
+
if (e.match(P) || !e.match(/^-[^-]+/))
|
|
447
447
|
return !1;
|
|
448
448
|
let a = !0, c;
|
|
449
449
|
const n = e.slice(1).split("");
|
|
450
450
|
for (let t = 0; t < n.length; t++) {
|
|
451
|
-
if (c = e.slice(t + 2), !
|
|
451
|
+
if (c = e.slice(t + 2), !ce(n[t])) {
|
|
452
452
|
a = !1;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
@@ -457,44 +457,44 @@ class De {
|
|
|
457
457
|
}
|
|
458
458
|
return a;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
460
|
+
function H(e) {
|
|
461
|
+
return k["unknown-options-as-args"] && ye(e);
|
|
462
462
|
}
|
|
463
463
|
function ye(e) {
|
|
464
|
-
return e = e.replace(/^-{3,}/, "--"), e.match(
|
|
464
|
+
return e = e.replace(/^-{3,}/, "--"), e.match(P) || Ie(e) ? !1 : !Be(e, /^-+([^=]+?)=[\s\S]*$/, W, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
|
|
465
465
|
}
|
|
466
466
|
function z(e) {
|
|
467
|
-
return !g(e, m.bools) && !g(e, m.counts) && `${e}` in q ? q[e] :
|
|
467
|
+
return !g(e, m.bools) && !g(e, m.counts) && `${e}` in q ? q[e] : Le(Me(e));
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Le(e) {
|
|
470
470
|
return {
|
|
471
|
-
[
|
|
472
|
-
[
|
|
473
|
-
[
|
|
474
|
-
[
|
|
471
|
+
[Q.BOOLEAN]: !0,
|
|
472
|
+
[Q.STRING]: "",
|
|
473
|
+
[Q.NUMBER]: void 0,
|
|
474
|
+
[Q.ARRAY]: []
|
|
475
475
|
}[e];
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
let a =
|
|
479
|
-
return g(e, m.strings) ? a =
|
|
477
|
+
function Me(e) {
|
|
478
|
+
let a = Q.BOOLEAN;
|
|
479
|
+
return g(e, m.strings) ? a = Q.STRING : g(e, m.numbers) ? a = Q.NUMBER : g(e, m.bools) ? a = Q.BOOLEAN : g(e, m.arrays) && (a = Q.ARRAY), a;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function T(e) {
|
|
482
482
|
return e === void 0;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
Object.keys(m.counts).find((e) => g(e, m.arrays) ? (
|
|
484
|
+
function Ae() {
|
|
485
|
+
Object.keys(m.counts).find((e) => g(e, m.arrays) ? (M = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, m.nargs) ? (M = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
|
|
486
486
|
}
|
|
487
487
|
return {
|
|
488
488
|
aliases: Object.assign({}, m.aliases),
|
|
489
|
-
argv: Object.assign(
|
|
490
|
-
configuration:
|
|
491
|
-
defaulted: Object.assign({},
|
|
492
|
-
error:
|
|
489
|
+
argv: Object.assign(se, b),
|
|
490
|
+
configuration: k,
|
|
491
|
+
defaulted: Object.assign({}, ne),
|
|
492
|
+
error: M,
|
|
493
493
|
newAliases: Object.assign({}, G)
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function je(i) {
|
|
498
498
|
const o = [], u = /* @__PURE__ */ Object.create(null);
|
|
499
499
|
let s = !0;
|
|
500
500
|
for (Object.keys(i).forEach(function(r) {
|
|
@@ -503,16 +503,16 @@ function Ee(i) {
|
|
|
503
503
|
s = !1;
|
|
504
504
|
for (let r = 0; r < o.length; r++)
|
|
505
505
|
for (let _ = r + 1; _ < o.length; _++)
|
|
506
|
-
if (o[r].filter(function(
|
|
507
|
-
return o[_].indexOf(
|
|
506
|
+
if (o[r].filter(function(k) {
|
|
507
|
+
return o[_].indexOf(k) !== -1;
|
|
508
508
|
}).length) {
|
|
509
509
|
o[r] = o[r].concat(o[_]), o.splice(_, 1), s = !0;
|
|
510
510
|
break;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
return o.forEach(function(r) {
|
|
514
|
-
r = r.filter(function(
|
|
515
|
-
return q.indexOf(
|
|
514
|
+
r = r.filter(function(h, k, q) {
|
|
515
|
+
return q.indexOf(h) === k;
|
|
516
516
|
});
|
|
517
517
|
const _ = r.pop();
|
|
518
518
|
_ !== void 0 && typeof _ == "string" && (u[_] = r);
|
|
@@ -521,10 +521,10 @@ function Ee(i) {
|
|
|
521
521
|
function Z(i) {
|
|
522
522
|
return i !== void 0 ? i + 1 : 1;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function pe(i) {
|
|
525
525
|
return i === "__proto__" ? "___proto___" : i;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Ve(i) {
|
|
528
528
|
return typeof i == "string" && (i[0] === "'" || i[0] === '"') && i[i.length - 1] === i[0] ? i.substring(1, i.length - 1) : i;
|
|
529
529
|
}
|
|
530
530
|
/**
|
|
@@ -536,42 +536,42 @@ function je(i) {
|
|
|
536
536
|
* SPDX-License-Identifier: ISC
|
|
537
537
|
*/
|
|
538
538
|
var X, ee, te;
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
-
throw Error(`yargs parser supports a minimum Node.js version of ${
|
|
542
|
-
const
|
|
539
|
+
const le = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, de = (ee = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && ee !== void 0 ? ee : (te = process == null ? void 0 : process.version) === null || te === void 0 ? void 0 : te.slice(1);
|
|
540
|
+
if (de && Number(de.match(/^([^.]+)/)[1]) < le)
|
|
541
|
+
throw Error(`yargs parser supports a minimum Node.js version of ${le}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
542
|
+
const Fe = process ? process.env : {};
|
|
543
543
|
new De({
|
|
544
544
|
cwd: process.cwd,
|
|
545
|
-
env: () =>
|
|
546
|
-
format:
|
|
545
|
+
env: () => Fe,
|
|
546
|
+
format: ke,
|
|
547
547
|
normalize: Qe,
|
|
548
|
-
resolve:
|
|
548
|
+
resolve: ie,
|
|
549
549
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
550
550
|
// we can exercise all the lines below:
|
|
551
551
|
require: (i) => {
|
|
552
552
|
if (typeof require < "u")
|
|
553
553
|
return require(i);
|
|
554
554
|
if (i.match(/\.json$/))
|
|
555
|
-
return JSON.parse(
|
|
555
|
+
return JSON.parse(ge(i, "utf8"));
|
|
556
556
|
throw Error("only .json config files are supported in ESM");
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
const
|
|
559
|
+
const Ke = {
|
|
560
560
|
fs: {
|
|
561
|
-
readFileSync:
|
|
562
|
-
writeFile:
|
|
561
|
+
readFileSync: ge,
|
|
562
|
+
writeFile: Pe
|
|
563
563
|
},
|
|
564
|
-
format:
|
|
565
|
-
resolve:
|
|
564
|
+
format: ke,
|
|
565
|
+
resolve: ie,
|
|
566
566
|
exists: (i) => {
|
|
567
567
|
try {
|
|
568
|
-
return
|
|
568
|
+
return Te(i).isFile();
|
|
569
569
|
} catch {
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
|
-
let
|
|
574
|
+
let A;
|
|
575
575
|
class He {
|
|
576
576
|
constructor(o) {
|
|
577
577
|
o = o || {}, this.directory = o.directory || "./locales", this.updateFiles = typeof o.updateFiles == "boolean" ? o.updateFiles : !0, this.locale = o.locale || "en", this.fallbackToLanguage = typeof o.fallbackToLanguage == "boolean" ? o.fallbackToLanguage : !0, this.cache = /* @__PURE__ */ Object.create(null), this.writeQueue = [];
|
|
@@ -587,15 +587,15 @@ class He {
|
|
|
587
587
|
directory: this.directory,
|
|
588
588
|
locale: this.locale,
|
|
589
589
|
cb: s
|
|
590
|
-
})) : s(),
|
|
590
|
+
})) : s(), A.format.apply(A.format, [this.cache[this.locale][u] || u].concat(o));
|
|
591
591
|
}
|
|
592
592
|
__n() {
|
|
593
593
|
const o = Array.prototype.slice.call(arguments), u = o.shift(), s = o.shift(), r = o.shift();
|
|
594
594
|
let _ = function() {
|
|
595
595
|
};
|
|
596
596
|
typeof o[o.length - 1] == "function" && (_ = o.pop()), this.cache[this.locale] || this._readLocaleFile();
|
|
597
|
-
let
|
|
598
|
-
this.cache[this.locale][u] && (
|
|
597
|
+
let h = r === 1 ? u : s;
|
|
598
|
+
this.cache[this.locale][u] && (h = this.cache[this.locale][u][r === 1 ? "one" : "other"]), !this.cache[this.locale][u] && this.updateFiles ? (this.cache[this.locale][u] = {
|
|
599
599
|
one: u,
|
|
600
600
|
other: s
|
|
601
601
|
}, this._enqueueWrite({
|
|
@@ -603,8 +603,8 @@ class He {
|
|
|
603
603
|
locale: this.locale,
|
|
604
604
|
cb: _
|
|
605
605
|
})) : _();
|
|
606
|
-
const
|
|
607
|
-
return ~
|
|
606
|
+
const k = [h];
|
|
607
|
+
return ~h.indexOf("%d") && k.push(r), A.format.apply(A.format, k.concat(o));
|
|
608
608
|
}
|
|
609
609
|
setLocale(o) {
|
|
610
610
|
this.locale = o;
|
|
@@ -620,16 +620,16 @@ class He {
|
|
|
620
620
|
_taggedLiteral(o, ...u) {
|
|
621
621
|
let s = "";
|
|
622
622
|
return o.forEach(function(r, _) {
|
|
623
|
-
const
|
|
624
|
-
s += r, typeof
|
|
623
|
+
const h = u[_ + 1];
|
|
624
|
+
s += r, typeof h < "u" && (s += "%s");
|
|
625
625
|
}), this.__.apply(this, [s].concat([].slice.call(u, 1)));
|
|
626
626
|
}
|
|
627
627
|
_enqueueWrite(o) {
|
|
628
628
|
this.writeQueue.push(o), this.writeQueue.length === 1 && this._processWriteQueue();
|
|
629
629
|
}
|
|
630
630
|
_processWriteQueue() {
|
|
631
|
-
const o = this, u = this.writeQueue[0], s = u.directory, r = u.locale, _ = u.cb,
|
|
632
|
-
|
|
631
|
+
const o = this, u = this.writeQueue[0], s = u.directory, r = u.locale, _ = u.cb, h = this._resolveLocaleFile(s, r), k = JSON.stringify(this.cache[r], null, 2);
|
|
632
|
+
A.fs.writeFile(h, k, "utf-8", function(q) {
|
|
633
633
|
o.writeQueue.shift(), o.writeQueue.length > 0 && o._processWriteQueue(), _(q);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
@@ -637,7 +637,7 @@ class He {
|
|
|
637
637
|
let o = {};
|
|
638
638
|
const u = this._resolveLocaleFile(this.directory, this.locale);
|
|
639
639
|
try {
|
|
640
|
-
|
|
640
|
+
A.fs.readFileSync && (o = JSON.parse(A.fs.readFileSync(u, "utf-8")));
|
|
641
641
|
} catch (s) {
|
|
642
642
|
if (s instanceof SyntaxError && (s.message = "syntax error in " + u), s.code === "ENOENT")
|
|
643
643
|
o = {};
|
|
@@ -647,19 +647,19 @@ class He {
|
|
|
647
647
|
this.cache[this.locale] = o;
|
|
648
648
|
}
|
|
649
649
|
_resolveLocaleFile(o, u) {
|
|
650
|
-
let s =
|
|
650
|
+
let s = A.resolve(o, "./", u + ".json");
|
|
651
651
|
if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~u.lastIndexOf("_")) {
|
|
652
|
-
const r =
|
|
652
|
+
const r = A.resolve(o, "./", u.split("_")[0] + ".json");
|
|
653
653
|
this._fileExistsSync(r) && (s = r);
|
|
654
654
|
}
|
|
655
655
|
return s;
|
|
656
656
|
}
|
|
657
657
|
_fileExistsSync(o) {
|
|
658
|
-
return
|
|
658
|
+
return A.exists(o);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
|
|
661
|
+
function $e(i, o) {
|
|
662
|
+
A = o;
|
|
663
663
|
const u = new He(i);
|
|
664
664
|
return {
|
|
665
665
|
__: u.__.bind(u),
|
|
@@ -670,19 +670,19 @@ function Ke(i, o) {
|
|
|
670
670
|
locale: u.locale
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const
|
|
674
|
-
let
|
|
673
|
+
const We = (i) => $e(i, Ke);
|
|
674
|
+
let E;
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
E = Se(import.meta.url);
|
|
677
677
|
} catch {
|
|
678
|
-
|
|
678
|
+
E = process.cwd();
|
|
679
679
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
directory:
|
|
680
|
+
const Ue = E.substring(0, E.lastIndexOf("node_modules"));
|
|
681
|
+
Ue || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, We({
|
|
682
|
+
directory: ie(E, "../../../locales"),
|
|
683
683
|
updateFiles: !1
|
|
684
684
|
});
|
|
685
|
-
const
|
|
685
|
+
const oe = [
|
|
686
686
|
{
|
|
687
687
|
id: "anthropic",
|
|
688
688
|
name: "Anthropic",
|
|
@@ -1022,6 +1022,66 @@ const ie = [
|
|
|
1022
1022
|
output_mtok: 25
|
|
1023
1023
|
}
|
|
1024
1024
|
},
|
|
1025
|
+
{
|
|
1026
|
+
id: "claude-opus-4-6",
|
|
1027
|
+
name: "Claude Opus 4.6",
|
|
1028
|
+
description: "Most intelligent model with adaptive thinking and 1M context beta",
|
|
1029
|
+
match: {
|
|
1030
|
+
or: [
|
|
1031
|
+
{
|
|
1032
|
+
starts_with: "claude-opus-4-6"
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
starts_with: "claude-opus-4.6"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
starts_with: "claude-4-6-opus"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
starts_with: "claude-4.6-opus"
|
|
1042
|
+
}
|
|
1043
|
+
]
|
|
1044
|
+
},
|
|
1045
|
+
context_window: 2e5,
|
|
1046
|
+
prices: {
|
|
1047
|
+
input_mtok: {
|
|
1048
|
+
base: 5,
|
|
1049
|
+
tiers: [
|
|
1050
|
+
{
|
|
1051
|
+
start: 2e5,
|
|
1052
|
+
price: 10
|
|
1053
|
+
}
|
|
1054
|
+
]
|
|
1055
|
+
},
|
|
1056
|
+
cache_write_mtok: {
|
|
1057
|
+
base: 6.25,
|
|
1058
|
+
tiers: [
|
|
1059
|
+
{
|
|
1060
|
+
start: 2e5,
|
|
1061
|
+
price: 12.5
|
|
1062
|
+
}
|
|
1063
|
+
]
|
|
1064
|
+
},
|
|
1065
|
+
cache_read_mtok: {
|
|
1066
|
+
base: 0.5,
|
|
1067
|
+
tiers: [
|
|
1068
|
+
{
|
|
1069
|
+
start: 2e5,
|
|
1070
|
+
price: 1
|
|
1071
|
+
}
|
|
1072
|
+
]
|
|
1073
|
+
},
|
|
1074
|
+
output_mtok: {
|
|
1075
|
+
base: 25,
|
|
1076
|
+
tiers: [
|
|
1077
|
+
{
|
|
1078
|
+
start: 2e5,
|
|
1079
|
+
price: 37.5
|
|
1080
|
+
}
|
|
1081
|
+
]
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1025
1085
|
{
|
|
1026
1086
|
id: "claude-sonnet-4-0",
|
|
1027
1087
|
name: "Claude Sonnet 4",
|
|
@@ -2856,6 +2916,20 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2856
2916
|
output_mtok: 0.9
|
|
2857
2917
|
}
|
|
2858
2918
|
},
|
|
2919
|
+
{
|
|
2920
|
+
id: "deepseek-v3p2",
|
|
2921
|
+
name: "Deepseek V3.2",
|
|
2922
|
+
description: "Model from Deepseek that harmonizes high computational efficiency with superior reasoning and agent performance. 675B parameter MoE model.",
|
|
2923
|
+
match: {
|
|
2924
|
+
equals: "accounts/fireworks/models/deepseek-v3p2"
|
|
2925
|
+
},
|
|
2926
|
+
context_window: 163840,
|
|
2927
|
+
prices: {
|
|
2928
|
+
input_mtok: 0.56,
|
|
2929
|
+
cache_read_mtok: 0.28,
|
|
2930
|
+
output_mtok: 1.68
|
|
2931
|
+
}
|
|
2932
|
+
},
|
|
2859
2933
|
{
|
|
2860
2934
|
id: "gemma-3-27b-it",
|
|
2861
2935
|
name: "Gemma 3 27B Instruct",
|
|
@@ -2869,6 +2943,61 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2869
2943
|
output_mtok: 0.1
|
|
2870
2944
|
}
|
|
2871
2945
|
},
|
|
2946
|
+
{
|
|
2947
|
+
id: "glm-4p7",
|
|
2948
|
+
name: "GLM-4.7",
|
|
2949
|
+
description: "Next-generation general-purpose model from Z.ai optimized for coding, reasoning, and agentic workflows. 352B parameter MoE model with advanced thinking controls.",
|
|
2950
|
+
match: {
|
|
2951
|
+
equals: "accounts/fireworks/models/glm-4p7"
|
|
2952
|
+
},
|
|
2953
|
+
context_window: 202752,
|
|
2954
|
+
prices: {
|
|
2955
|
+
input_mtok: 0.6,
|
|
2956
|
+
output_mtok: 2.2
|
|
2957
|
+
}
|
|
2958
|
+
},
|
|
2959
|
+
{
|
|
2960
|
+
id: "gpt-oss-120b",
|
|
2961
|
+
name: "OpenAI gpt-oss-120b",
|
|
2962
|
+
description: "OpenAI's open-weight 117B parameter MoE model designed for production, general purpose, high reasoning use-cases. Features powerful reasoning, agentic tasks, and versatile developer use cases.",
|
|
2963
|
+
match: {
|
|
2964
|
+
equals: "accounts/fireworks/models/gpt-oss-120b"
|
|
2965
|
+
},
|
|
2966
|
+
context_window: 131072,
|
|
2967
|
+
prices: {
|
|
2968
|
+
input_mtok: 0.15,
|
|
2969
|
+
cache_read_mtok: 0.07,
|
|
2970
|
+
output_mtok: 0.6
|
|
2971
|
+
}
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
id: "gpt-oss-20b",
|
|
2975
|
+
name: "OpenAI gpt-oss-20b",
|
|
2976
|
+
description: "OpenAI's open-weight 21.5B parameter model designed for powerful reasoning, agentic tasks, and versatile developer use cases. Optimized for lower latency and local or specialized tasks.",
|
|
2977
|
+
match: {
|
|
2978
|
+
equals: "accounts/fireworks/models/gpt-oss-20b"
|
|
2979
|
+
},
|
|
2980
|
+
context_window: 131072,
|
|
2981
|
+
prices: {
|
|
2982
|
+
input_mtok: 0.07,
|
|
2983
|
+
cache_read_mtok: 0.04,
|
|
2984
|
+
output_mtok: 0.3
|
|
2985
|
+
}
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
id: "kimi-k2p5",
|
|
2989
|
+
name: "Kimi K2.5",
|
|
2990
|
+
description: "Moonshot AI's flagship agentic model. Unifies vision and text, thinking and non-thinking modes, and single-agent and multi-agent execution into one model. 1T parameter MoE model.",
|
|
2991
|
+
match: {
|
|
2992
|
+
equals: "accounts/fireworks/models/kimi-k2p5"
|
|
2993
|
+
},
|
|
2994
|
+
context_window: 262144,
|
|
2995
|
+
prices: {
|
|
2996
|
+
input_mtok: 0.6,
|
|
2997
|
+
cache_read_mtok: 0.1,
|
|
2998
|
+
output_mtok: 3
|
|
2999
|
+
}
|
|
3000
|
+
},
|
|
2872
3001
|
{
|
|
2873
3002
|
id: "llama-v3p1-8b-instruct",
|
|
2874
3003
|
name: "Llama 3.1 8B Instruct",
|
|
@@ -2896,6 +3025,19 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2896
3025
|
output_mtok: 0.88
|
|
2897
3026
|
}
|
|
2898
3027
|
},
|
|
3028
|
+
{
|
|
3029
|
+
id: "minimax-m2p1",
|
|
3030
|
+
name: "MiniMax-M2.1",
|
|
3031
|
+
description: "Built for strong real-world performance across complex, multi-language, and agent-driven workflows. 228B parameter model with robust support for systems, backend, web, mobile, and office-style tasks.",
|
|
3032
|
+
match: {
|
|
3033
|
+
equals: "accounts/fireworks/models/minimax-m2p1"
|
|
3034
|
+
},
|
|
3035
|
+
context_window: 204800,
|
|
3036
|
+
prices: {
|
|
3037
|
+
input_mtok: 0.3,
|
|
3038
|
+
output_mtok: 1.2
|
|
3039
|
+
}
|
|
3040
|
+
},
|
|
2899
3041
|
{
|
|
2900
3042
|
id: "qwen2p5-vl-72b-instruct",
|
|
2901
3043
|
name: "Qwen2.5-VL 72B Instruct",
|
|
@@ -3168,7 +3310,16 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3168
3310
|
contains: "claude-4-opus"
|
|
3169
3311
|
},
|
|
3170
3312
|
{
|
|
3171
|
-
contains: "claude-opus-4"
|
|
3313
|
+
contains: "claude-opus-4@"
|
|
3314
|
+
},
|
|
3315
|
+
{
|
|
3316
|
+
contains: "claude-opus-4-0"
|
|
3317
|
+
},
|
|
3318
|
+
{
|
|
3319
|
+
contains: "claude-opus-4-1"
|
|
3320
|
+
},
|
|
3321
|
+
{
|
|
3322
|
+
equals: "claude-opus-4"
|
|
3172
3323
|
}
|
|
3173
3324
|
]
|
|
3174
3325
|
},
|
|
@@ -3200,6 +3351,64 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3200
3351
|
output_mtok: 15
|
|
3201
3352
|
}
|
|
3202
3353
|
},
|
|
3354
|
+
{
|
|
3355
|
+
id: "claude-opus-4-6",
|
|
3356
|
+
match: {
|
|
3357
|
+
or: [
|
|
3358
|
+
{
|
|
3359
|
+
contains: "claude-4-6-opus"
|
|
3360
|
+
},
|
|
3361
|
+
{
|
|
3362
|
+
contains: "claude-opus-4-6"
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
contains: "claude-4.6-opus"
|
|
3366
|
+
},
|
|
3367
|
+
{
|
|
3368
|
+
contains: "claude-opus-4.6"
|
|
3369
|
+
}
|
|
3370
|
+
]
|
|
3371
|
+
},
|
|
3372
|
+
context_window: 2e5,
|
|
3373
|
+
prices: {
|
|
3374
|
+
input_mtok: {
|
|
3375
|
+
base: 5,
|
|
3376
|
+
tiers: [
|
|
3377
|
+
{
|
|
3378
|
+
start: 2e5,
|
|
3379
|
+
price: 10
|
|
3380
|
+
}
|
|
3381
|
+
]
|
|
3382
|
+
},
|
|
3383
|
+
cache_write_mtok: {
|
|
3384
|
+
base: 6.25,
|
|
3385
|
+
tiers: [
|
|
3386
|
+
{
|
|
3387
|
+
start: 2e5,
|
|
3388
|
+
price: 12.5
|
|
3389
|
+
}
|
|
3390
|
+
]
|
|
3391
|
+
},
|
|
3392
|
+
cache_read_mtok: {
|
|
3393
|
+
base: 0.5,
|
|
3394
|
+
tiers: [
|
|
3395
|
+
{
|
|
3396
|
+
start: 2e5,
|
|
3397
|
+
price: 1
|
|
3398
|
+
}
|
|
3399
|
+
]
|
|
3400
|
+
},
|
|
3401
|
+
output_mtok: {
|
|
3402
|
+
base: 25,
|
|
3403
|
+
tiers: [
|
|
3404
|
+
{
|
|
3405
|
+
start: 2e5,
|
|
3406
|
+
price: 37.5
|
|
3407
|
+
}
|
|
3408
|
+
]
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
},
|
|
3203
3412
|
{
|
|
3204
3413
|
id: "gemini-1.0-pro-vision-001",
|
|
3205
3414
|
name: "gemini 1.0 pro vision",
|
|
@@ -9673,6 +9882,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9673
9882
|
{
|
|
9674
9883
|
equals: "gpt-5.1-codex"
|
|
9675
9884
|
},
|
|
9885
|
+
{
|
|
9886
|
+
equals: "gpt-5.1-codex-max"
|
|
9887
|
+
},
|
|
9888
|
+
{
|
|
9889
|
+
equals: "gpt-5.1-chat"
|
|
9890
|
+
},
|
|
9676
9891
|
{
|
|
9677
9892
|
equals: "gpt-5.1-chat-latest"
|
|
9678
9893
|
},
|
|
@@ -9685,6 +9900,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9685
9900
|
{
|
|
9686
9901
|
equals: "gpt-5-1-codex"
|
|
9687
9902
|
},
|
|
9903
|
+
{
|
|
9904
|
+
equals: "gpt-5-1-codex-max"
|
|
9905
|
+
},
|
|
9906
|
+
{
|
|
9907
|
+
equals: "gpt-5-1-chat"
|
|
9908
|
+
},
|
|
9688
9909
|
{
|
|
9689
9910
|
equals: "gpt-5-1-chat-latest"
|
|
9690
9911
|
}
|
|
@@ -9741,8 +9962,23 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9741
9962
|
{
|
|
9742
9963
|
equals: "gpt-5-2-2025-12-11"
|
|
9743
9964
|
},
|
|
9965
|
+
{
|
|
9966
|
+
equals: "gpt-5.2-chat"
|
|
9967
|
+
},
|
|
9968
|
+
{
|
|
9969
|
+
equals: "gpt-5.2-chat-latest"
|
|
9970
|
+
},
|
|
9971
|
+
{
|
|
9972
|
+
equals: "gpt-5-2-chat"
|
|
9973
|
+
},
|
|
9744
9974
|
{
|
|
9745
9975
|
equals: "gpt-5-2-chat-latest"
|
|
9976
|
+
},
|
|
9977
|
+
{
|
|
9978
|
+
equals: "gpt-5.2-codex"
|
|
9979
|
+
},
|
|
9980
|
+
{
|
|
9981
|
+
equals: "gpt-5-2-codex"
|
|
9746
9982
|
}
|
|
9747
9983
|
]
|
|
9748
9984
|
},
|
|
@@ -10518,6 +10754,57 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
10518
10754
|
output_mtok: 25
|
|
10519
10755
|
}
|
|
10520
10756
|
},
|
|
10757
|
+
{
|
|
10758
|
+
id: "anthropic/claude-opus-4.6",
|
|
10759
|
+
match: {
|
|
10760
|
+
or: [
|
|
10761
|
+
{
|
|
10762
|
+
equals: "anthropic/claude-opus-4.6"
|
|
10763
|
+
},
|
|
10764
|
+
{
|
|
10765
|
+
equals: "anthropic/claude-opus-4.6:beta"
|
|
10766
|
+
}
|
|
10767
|
+
]
|
|
10768
|
+
},
|
|
10769
|
+
prices: {
|
|
10770
|
+
input_mtok: {
|
|
10771
|
+
base: 5,
|
|
10772
|
+
tiers: [
|
|
10773
|
+
{
|
|
10774
|
+
start: 2e5,
|
|
10775
|
+
price: 10
|
|
10776
|
+
}
|
|
10777
|
+
]
|
|
10778
|
+
},
|
|
10779
|
+
cache_write_mtok: {
|
|
10780
|
+
base: 6.25,
|
|
10781
|
+
tiers: [
|
|
10782
|
+
{
|
|
10783
|
+
start: 2e5,
|
|
10784
|
+
price: 12.5
|
|
10785
|
+
}
|
|
10786
|
+
]
|
|
10787
|
+
},
|
|
10788
|
+
cache_read_mtok: {
|
|
10789
|
+
base: 0.5,
|
|
10790
|
+
tiers: [
|
|
10791
|
+
{
|
|
10792
|
+
start: 2e5,
|
|
10793
|
+
price: 1
|
|
10794
|
+
}
|
|
10795
|
+
]
|
|
10796
|
+
},
|
|
10797
|
+
output_mtok: {
|
|
10798
|
+
base: 25,
|
|
10799
|
+
tiers: [
|
|
10800
|
+
{
|
|
10801
|
+
start: 2e5,
|
|
10802
|
+
price: 37.5
|
|
10803
|
+
}
|
|
10804
|
+
]
|
|
10805
|
+
}
|
|
10806
|
+
}
|
|
10807
|
+
},
|
|
10521
10808
|
{
|
|
10522
10809
|
id: "anthropic/claude-sonnet-4.5",
|
|
10523
10810
|
match: {
|
|
@@ -14221,6 +14508,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
14221
14508
|
output_mtok: 1.2
|
|
14222
14509
|
}
|
|
14223
14510
|
},
|
|
14511
|
+
{
|
|
14512
|
+
id: "moonshotai/kimi-k2.5",
|
|
14513
|
+
name: "Kimi K2.5",
|
|
14514
|
+
match: {
|
|
14515
|
+
equals: "moonshotai/kimi-k2.5"
|
|
14516
|
+
},
|
|
14517
|
+
prices: {
|
|
14518
|
+
input_mtok: 0.6,
|
|
14519
|
+
output_mtok: 3
|
|
14520
|
+
}
|
|
14521
|
+
},
|
|
14224
14522
|
{
|
|
14225
14523
|
id: "moonshotai/kimi-vl-a3b-thinking:free",
|
|
14226
14524
|
match: {
|
|
@@ -15647,6 +15945,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
15647
15945
|
},
|
|
15648
15946
|
prices: {}
|
|
15649
15947
|
},
|
|
15948
|
+
{
|
|
15949
|
+
id: "qwen/qwen3-max",
|
|
15950
|
+
name: "Qwen 3 Max",
|
|
15951
|
+
match: {
|
|
15952
|
+
equals: "qwen/qwen3-max"
|
|
15953
|
+
},
|
|
15954
|
+
prices: {
|
|
15955
|
+
input_mtok: 1.2,
|
|
15956
|
+
output_mtok: 6
|
|
15957
|
+
}
|
|
15958
|
+
},
|
|
15650
15959
|
{
|
|
15651
15960
|
id: "qwen/qwq-32b",
|
|
15652
15961
|
match: {
|
|
@@ -17934,6 +18243,51 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
17934
18243
|
output_mtok: 0.5
|
|
17935
18244
|
}
|
|
17936
18245
|
},
|
|
18246
|
+
{
|
|
18247
|
+
id: "grok-4-fast-non-reasoning",
|
|
18248
|
+
name: "Grok 4 Fast Non-Reasoning",
|
|
18249
|
+
description: "A frontier multimodal model optimized specifically for high-performance agentic tool calling.",
|
|
18250
|
+
match: {
|
|
18251
|
+
or: [
|
|
18252
|
+
{
|
|
18253
|
+
equals: "grok-4-fast-non-reasoning"
|
|
18254
|
+
},
|
|
18255
|
+
{
|
|
18256
|
+
equals: "grok-4-fast-non-reasoning-latest"
|
|
18257
|
+
}
|
|
18258
|
+
]
|
|
18259
|
+
},
|
|
18260
|
+
context_window: 2e6,
|
|
18261
|
+
prices: {
|
|
18262
|
+
input_mtok: 0.2,
|
|
18263
|
+
cache_read_mtok: 0.05,
|
|
18264
|
+
output_mtok: 0.5
|
|
18265
|
+
}
|
|
18266
|
+
},
|
|
18267
|
+
{
|
|
18268
|
+
id: "grok-4-fast-reasoning",
|
|
18269
|
+
name: "Grok 4 Fast Reasoning",
|
|
18270
|
+
description: "A frontier multimodal model optimized specifically for high-performance agentic tool calling.",
|
|
18271
|
+
match: {
|
|
18272
|
+
or: [
|
|
18273
|
+
{
|
|
18274
|
+
equals: "grok-4-fast"
|
|
18275
|
+
},
|
|
18276
|
+
{
|
|
18277
|
+
equals: "grok-4-fast-reasoning"
|
|
18278
|
+
},
|
|
18279
|
+
{
|
|
18280
|
+
equals: "grok-4-fast-reasoning-latest"
|
|
18281
|
+
}
|
|
18282
|
+
]
|
|
18283
|
+
},
|
|
18284
|
+
context_window: 2e6,
|
|
18285
|
+
prices: {
|
|
18286
|
+
input_mtok: 0.2,
|
|
18287
|
+
cache_read_mtok: 0.05,
|
|
18288
|
+
output_mtok: 0.5
|
|
18289
|
+
}
|
|
18290
|
+
},
|
|
17937
18291
|
{
|
|
17938
18292
|
id: "grok-code-fast-1",
|
|
17939
18293
|
name: "Grok Code Fast 1",
|
|
@@ -17961,7 +18315,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
17961
18315
|
]
|
|
17962
18316
|
}
|
|
17963
18317
|
];
|
|
17964
|
-
function
|
|
18318
|
+
function Ye(i, o, u) {
|
|
17965
18319
|
if (o <= 0) return 0;
|
|
17966
18320
|
let s = i.base;
|
|
17967
18321
|
for (const r of i.tiers)
|
|
@@ -17969,25 +18323,25 @@ function Ue(i, o, u) {
|
|
|
17969
18323
|
return s * o / 1e6;
|
|
17970
18324
|
}
|
|
17971
18325
|
function R(i, o, u, s) {
|
|
17972
|
-
return i === void 0 || o === void 0 ? 0 : typeof i == "number" ? i * o / 1e6 :
|
|
18326
|
+
return i === void 0 || o === void 0 ? 0 : typeof i == "number" ? i * o / 1e6 : Ye(i, o, s);
|
|
17973
18327
|
}
|
|
17974
|
-
function
|
|
18328
|
+
function Je(i, o) {
|
|
17975
18329
|
let u = 0, s = 0;
|
|
17976
|
-
const r = i.input_tokens ?? 0, _ = i.cache_read_tokens ?? 0,
|
|
17977
|
-
let
|
|
17978
|
-
if (
|
|
18330
|
+
const r = i.input_tokens ?? 0, _ = i.cache_read_tokens ?? 0, h = i.cache_write_tokens ?? 0, k = i.cache_audio_read_tokens ?? 0, q = i.output_audio_tokens ?? 0;
|
|
18331
|
+
let I = i.input_audio_tokens ?? 0;
|
|
18332
|
+
if (I -= k, I < 0)
|
|
17979
18333
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
17980
18334
|
let B = i.input_tokens ?? 0;
|
|
17981
|
-
if (B -= _, B -=
|
|
18335
|
+
if (B -= _, B -= h, B -= I, B < 0)
|
|
17982
18336
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
17983
|
-
let
|
|
17984
|
-
if (
|
|
18337
|
+
let y = _;
|
|
18338
|
+
if (y -= k, y < 0)
|
|
17985
18339
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
17986
|
-
u += R(o.input_mtok, B, "input_mtok", r), u += R(o.cache_read_mtok,
|
|
17987
|
-
let
|
|
17988
|
-
if (
|
|
18340
|
+
u += R(o.input_mtok, B, "input_mtok", r), u += R(o.cache_read_mtok, y, "cache_read_mtok", r), u += R(o.cache_write_mtok, h, "cache_write_mtok", r), u += R(o.input_audio_mtok, I, "input_audio_mtok", r), u += R(o.cache_audio_read_mtok, k, "cache_audio_read_mtok", r);
|
|
18341
|
+
let L = i.output_tokens ?? 0;
|
|
18342
|
+
if (L -= q, L < 0)
|
|
17989
18343
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
17990
|
-
s += R(o.output_mtok,
|
|
18344
|
+
s += R(o.output_mtok, L, "output_mtok", r), s += R(o.output_audio_mtok, i.output_audio_tokens, "output_audio_mtok", r);
|
|
17991
18345
|
let G = u + s;
|
|
17992
18346
|
return o.requests_kcount !== void 0 && (G += o.requests_kcount / 1e3), {
|
|
17993
18347
|
input_price: u,
|
|
@@ -17995,7 +18349,7 @@ function Ye(i, o) {
|
|
|
17995
18349
|
total_price: G
|
|
17996
18350
|
};
|
|
17997
18351
|
}
|
|
17998
|
-
function
|
|
18352
|
+
function Ze(i, o) {
|
|
17999
18353
|
if (!Array.isArray(i.prices))
|
|
18000
18354
|
return i.prices;
|
|
18001
18355
|
for (let u = i.prices.length - 1; u >= 0; u--) {
|
|
@@ -18006,63 +18360,71 @@ function Je(i, o) {
|
|
|
18006
18360
|
if (o >= new Date(r.start_date))
|
|
18007
18361
|
return s.prices;
|
|
18008
18362
|
} else {
|
|
18009
|
-
const _ = o.toISOString().slice(11, 19),
|
|
18010
|
-
if (
|
|
18011
|
-
if (_ >=
|
|
18363
|
+
const _ = o.toISOString().slice(11, 19), h = r.start_time, k = r.end_time;
|
|
18364
|
+
if (k < h) {
|
|
18365
|
+
if (_ >= h || _ < k)
|
|
18012
18366
|
return s.prices;
|
|
18013
|
-
} else if (_ >=
|
|
18367
|
+
} else if (_ >= h && _ < k)
|
|
18014
18368
|
return s.prices;
|
|
18015
18369
|
}
|
|
18016
18370
|
}
|
|
18017
18371
|
return i.prices[0].prices;
|
|
18018
18372
|
}
|
|
18019
|
-
function
|
|
18020
|
-
return "or" in i ? i.or.some((u) =>
|
|
18373
|
+
function D(i, o) {
|
|
18374
|
+
return "or" in i ? i.or.some((u) => D(u, o)) : "and" in i ? i.and.every((u) => D(u, o)) : "equals" in i ? o === i.equals : "starts_with" in i ? o.startsWith(i.starts_with) : "ends_with" in i ? o.endsWith(i.ends_with) : "contains" in i ? o.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(o) : !1;
|
|
18021
18375
|
}
|
|
18022
|
-
function
|
|
18376
|
+
function Xe(i, o) {
|
|
18023
18377
|
const u = o.toLowerCase().trim(), s = i.find((r) => r.id === u);
|
|
18024
|
-
return s || i.find((r) => r.provider_match &&
|
|
18378
|
+
return s || i.find((r) => r.provider_match && D(r.provider_match, u));
|
|
18025
18379
|
}
|
|
18026
|
-
function
|
|
18027
|
-
if (s)
|
|
18028
|
-
|
|
18380
|
+
function he(i, { modelId: o, providerApiUrl: u, providerId: s }) {
|
|
18381
|
+
if (s) {
|
|
18382
|
+
const r = Xe(i, s);
|
|
18383
|
+
if (r || s.toLowerCase() !== "litellm")
|
|
18384
|
+
return r;
|
|
18385
|
+
}
|
|
18029
18386
|
if (u)
|
|
18030
18387
|
return i.find((r) => new RegExp(r.api_pattern).test(u));
|
|
18031
18388
|
if (o)
|
|
18032
|
-
return i.find((r) => r.model_match &&
|
|
18389
|
+
return i.find((r) => r.model_match && D(r.model_match, o));
|
|
18033
18390
|
}
|
|
18034
18391
|
function et(i, o) {
|
|
18035
|
-
return i.find((u) =>
|
|
18392
|
+
return i.find((u) => D(u.match, o));
|
|
18036
18393
|
}
|
|
18037
|
-
function
|
|
18394
|
+
function qe(i, o, u) {
|
|
18038
18395
|
const s = et(i.models, o);
|
|
18039
18396
|
if (s) return s;
|
|
18040
18397
|
if (i.fallback_model_providers && u)
|
|
18041
18398
|
for (const r of i.fallback_model_providers) {
|
|
18042
|
-
const _ = u.find((
|
|
18399
|
+
const _ = u.find((h) => h.id === r);
|
|
18043
18400
|
if (_) {
|
|
18044
|
-
const
|
|
18045
|
-
if (
|
|
18401
|
+
const h = qe(_, o);
|
|
18402
|
+
if (h) return h;
|
|
18046
18403
|
}
|
|
18047
18404
|
}
|
|
18048
18405
|
}
|
|
18049
|
-
let
|
|
18050
|
-
Promise.resolve(
|
|
18406
|
+
let ae = oe;
|
|
18407
|
+
Promise.resolve(oe);
|
|
18051
18408
|
function tt(i, o, u) {
|
|
18052
|
-
|
|
18053
|
-
if (
|
|
18054
|
-
|
|
18409
|
+
let s = o.toLowerCase().trim(), r = u?.providerId;
|
|
18410
|
+
if (r && r.toLowerCase() === "litellm" && s.includes("/")) {
|
|
18411
|
+
const B = s.indexOf("/"), y = s.slice(0, B), L = s.slice(B + 1);
|
|
18412
|
+
y && L && he(ae, { providerId: y }) && (r = y, s = L);
|
|
18413
|
+
}
|
|
18414
|
+
const _ = u?.provider ?? he(ae, { modelId: s, providerApiUrl: u?.providerApiUrl, providerId: r });
|
|
18055
18415
|
if (!_) return null;
|
|
18056
|
-
const
|
|
18416
|
+
const h = qe(_, s, ae);
|
|
18417
|
+
if (!h) return null;
|
|
18418
|
+
const k = u?.timestamp ?? /* @__PURE__ */ new Date(), q = Ze(h, k), I = Je(i, q);
|
|
18057
18419
|
return {
|
|
18058
18420
|
auto_update_timestamp: void 0,
|
|
18059
|
-
model:
|
|
18060
|
-
model_price:
|
|
18061
|
-
provider:
|
|
18062
|
-
...
|
|
18421
|
+
model: h,
|
|
18422
|
+
model_price: q,
|
|
18423
|
+
provider: _,
|
|
18424
|
+
...I
|
|
18063
18425
|
};
|
|
18064
18426
|
}
|
|
18065
|
-
const f =
|
|
18427
|
+
const f = _e(ze(process.argv)).scriptName("genai-prices").command(
|
|
18066
18428
|
"list [provider]",
|
|
18067
18429
|
"List providers and models",
|
|
18068
18430
|
(i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
|
|
@@ -18073,7 +18435,7 @@ const f = he(Re(process.argv)).scriptName("genai-prices").command(
|
|
|
18073
18435
|
).option("auto-update", { describe: "Enable auto-update from GitHub", type: "boolean" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" }).version("0.1.0").help().parseSync();
|
|
18074
18436
|
function at() {
|
|
18075
18437
|
if (f._[0] === "list") {
|
|
18076
|
-
const u =
|
|
18438
|
+
const u = oe;
|
|
18077
18439
|
if (f.provider) {
|
|
18078
18440
|
const s = u.find((r) => r.id === f.provider);
|
|
18079
18441
|
s || (console.error(`Provider ${f.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
|
|
@@ -18101,25 +18463,25 @@ function at() {
|
|
|
18101
18463
|
}, s = f.timestamp ? new Date(String(f.timestamp)) : void 0;
|
|
18102
18464
|
let r = !1;
|
|
18103
18465
|
for (const _ of o) {
|
|
18104
|
-
let
|
|
18105
|
-
|
|
18466
|
+
let h, k = _;
|
|
18467
|
+
k.includes(":") && ([h, k] = k.split(":", 2));
|
|
18106
18468
|
try {
|
|
18107
|
-
const q = tt(u,
|
|
18469
|
+
const q = tt(u, k, { providerId: h, timestamp: s });
|
|
18108
18470
|
if (!q) {
|
|
18109
18471
|
r = !0, console.error(`No price found for model ${_}`);
|
|
18110
18472
|
continue;
|
|
18111
18473
|
}
|
|
18112
|
-
const
|
|
18474
|
+
const I = q.model.context_window, B = [
|
|
18113
18475
|
["Provider", q.provider.name],
|
|
18114
18476
|
["Model", q.model.name ?? q.model.id],
|
|
18115
18477
|
["Model Prices", JSON.stringify(q.model_price)],
|
|
18116
|
-
["Context Window",
|
|
18478
|
+
["Context Window", I !== void 0 ? I.toLocaleString() : void 0],
|
|
18117
18479
|
["Total Price", `$${q.total_price}`],
|
|
18118
18480
|
["Input Price", `$${q.input_price}`],
|
|
18119
18481
|
["Output Price", `$${q.output_price}`]
|
|
18120
18482
|
];
|
|
18121
|
-
for (const [
|
|
18122
|
-
|
|
18483
|
+
for (const [y, L] of B)
|
|
18484
|
+
L !== void 0 && console.log(`${y.padStart(14)}: ${L}`);
|
|
18123
18485
|
console.log("");
|
|
18124
18486
|
} catch (q) {
|
|
18125
18487
|
r = !0, q instanceof Error && console.error(`Error for model ${_}:`, q.message);
|
|
@@ -18127,6 +18489,6 @@ function at() {
|
|
|
18127
18489
|
}
|
|
18128
18490
|
process.exit(r ? 1 : 0);
|
|
18129
18491
|
}
|
|
18130
|
-
|
|
18492
|
+
_e().showHelp(), process.exit(1);
|
|
18131
18493
|
}
|
|
18132
18494
|
at();
|