@teinai/cli 1.1.34 → 1.1.36
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/index.js +263 -239
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var T = (e, t, i) => (
|
|
|
32
32
|
function Wi(e) {
|
|
33
33
|
for (let t of e)
|
|
34
34
|
try {
|
|
35
|
-
let i = JSON.parse(
|
|
35
|
+
let i = JSON.parse(pt.default.readFileSync(t, 'utf8'));
|
|
36
36
|
if (i.name === '@teinai/cli' && typeof i.version == 'string' && i.version.trim())
|
|
37
37
|
return i.version.trim();
|
|
38
38
|
} catch {}
|
|
@@ -45,13 +45,13 @@ function Yi() {
|
|
|
45
45
|
Te.default.join(e, '..', '..', 'cli-package', 'package.json'),
|
|
46
46
|
];
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var pt,
|
|
49
49
|
Te,
|
|
50
50
|
Ji,
|
|
51
51
|
F,
|
|
52
52
|
re = h(() => {
|
|
53
53
|
'use strict';
|
|
54
|
-
((
|
|
54
|
+
((pt = T(require('node:fs'))), (Te = T(require('node:path'))), (Ji = '0.0.0-dev'));
|
|
55
55
|
F = Wi(Yi());
|
|
56
56
|
});
|
|
57
57
|
function j() {
|
|
@@ -117,7 +117,7 @@ var ta,
|
|
|
117
117
|
var J,
|
|
118
118
|
Ce = h(() => {
|
|
119
119
|
'use strict';
|
|
120
|
-
J = new Set([
|
|
120
|
+
J = new Set([]);
|
|
121
121
|
});
|
|
122
122
|
function le(e) {
|
|
123
123
|
return !1;
|
|
@@ -125,10 +125,10 @@ function le(e) {
|
|
|
125
125
|
var kt = h(() => {
|
|
126
126
|
'use strict';
|
|
127
127
|
});
|
|
128
|
-
var
|
|
128
|
+
var de,
|
|
129
129
|
wt = h(() => {
|
|
130
130
|
'use strict';
|
|
131
|
-
|
|
131
|
+
de = {
|
|
132
132
|
source: 'TEIN Price Board',
|
|
133
133
|
checked: '17 Sep 2026',
|
|
134
134
|
generated: '2026-10-01',
|
|
@@ -6198,11 +6198,11 @@ var pe,
|
|
|
6198
6198
|
],
|
|
6199
6199
|
};
|
|
6200
6200
|
});
|
|
6201
|
-
var
|
|
6201
|
+
var pe,
|
|
6202
6202
|
xt,
|
|
6203
6203
|
$e = h(() => {
|
|
6204
6204
|
'use strict';
|
|
6205
|
-
((
|
|
6205
|
+
((pe = [
|
|
6206
6206
|
{
|
|
6207
6207
|
slug: 'tein-video-upscaler',
|
|
6208
6208
|
name: 'Tein Video Upscaler',
|
|
@@ -6331,11 +6331,11 @@ var Pt,
|
|
|
6331
6331
|
wt();
|
|
6332
6332
|
$e();
|
|
6333
6333
|
((Pt = {
|
|
6334
|
-
...
|
|
6335
|
-
families:
|
|
6336
|
-
models:
|
|
6334
|
+
...de,
|
|
6335
|
+
families: de.families.map((e) => ({ ...e, models: e.models.filter((t) => !le(t)) })),
|
|
6336
|
+
models: de.models.filter((e) => !le(e.slug)),
|
|
6337
6337
|
}),
|
|
6338
|
-
(It =
|
|
6338
|
+
(It = pe.filter((e) => !le(e.slug))),
|
|
6339
6339
|
(vt = [...Pt.models, ...It]),
|
|
6340
6340
|
(ia = [
|
|
6341
6341
|
...Pt.families,
|
|
@@ -6403,14 +6403,14 @@ var la,
|
|
|
6403
6403
|
la = {};
|
|
6404
6404
|
});
|
|
6405
6405
|
function Ct(e) {
|
|
6406
|
-
return e === 'nano-banana-pro' ?
|
|
6406
|
+
return e === 'nano-banana-pro' ? da : pa;
|
|
6407
6407
|
}
|
|
6408
|
-
var
|
|
6409
|
-
|
|
6408
|
+
var da,
|
|
6409
|
+
pa,
|
|
6410
6410
|
$t = h(() => {
|
|
6411
6411
|
'use strict';
|
|
6412
|
-
((
|
|
6413
|
-
(
|
|
6412
|
+
((da = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
6413
|
+
(pa = [
|
|
6414
6414
|
'auto',
|
|
6415
6415
|
'1:1',
|
|
6416
6416
|
'1:4',
|
|
@@ -6637,11 +6637,11 @@ function Bt(e, t, i) {
|
|
|
6637
6637
|
var Vt,
|
|
6638
6638
|
ua,
|
|
6639
6639
|
Nt,
|
|
6640
|
-
|
|
6640
|
+
kn,
|
|
6641
6641
|
ma,
|
|
6642
6642
|
Ut,
|
|
6643
6643
|
Ve,
|
|
6644
|
-
|
|
6644
|
+
wn,
|
|
6645
6645
|
Ne,
|
|
6646
6646
|
fa,
|
|
6647
6647
|
ga,
|
|
@@ -6796,7 +6796,7 @@ var Vt,
|
|
|
6796
6796
|
seed: !0,
|
|
6797
6797
|
},
|
|
6798
6798
|
]),
|
|
6799
|
-
(
|
|
6799
|
+
(kn = Nt.map((e) => e.slug)),
|
|
6800
6800
|
(ma = new Map(Nt.map((e) => [e.slug, e]))));
|
|
6801
6801
|
((Ut = 'EXAVITQu4vr4xnSDxMaL'),
|
|
6802
6802
|
(Ve = {
|
|
@@ -6821,7 +6821,7 @@ var Vt,
|
|
|
6821
6821
|
pqHfZKP75CvOlQylNhV4: 'Bill',
|
|
6822
6822
|
pNInz6obpgDQGcFmaJgB: 'Adam',
|
|
6823
6823
|
}),
|
|
6824
|
-
(
|
|
6824
|
+
(wn = Object.keys(Ve)),
|
|
6825
6825
|
(Ne = [
|
|
6826
6826
|
'mp3_44100_128',
|
|
6827
6827
|
'mp3_22050_32',
|
|
@@ -7066,20 +7066,20 @@ var he,
|
|
|
7066
7066
|
Ht,
|
|
7067
7067
|
Y,
|
|
7068
7068
|
zt,
|
|
7069
|
-
Pn,
|
|
7070
7069
|
In,
|
|
7071
7070
|
vn,
|
|
7072
7071
|
Tn,
|
|
7072
|
+
Mn,
|
|
7073
7073
|
Jt = h(() => {
|
|
7074
7074
|
'use strict';
|
|
7075
7075
|
((he = 'enhancor-ultrafine'),
|
|
7076
7076
|
(Ht = 'Enhancor Ultrafine'),
|
|
7077
7077
|
(Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7078
7078
|
(zt = 2),
|
|
7079
|
-
(
|
|
7080
|
-
(
|
|
7081
|
-
(
|
|
7082
|
-
(
|
|
7079
|
+
(In = 24 * 1024 * 1024),
|
|
7080
|
+
(vn = 4096 * 4096),
|
|
7081
|
+
(Tn = 30 * 6e4),
|
|
7082
|
+
(Mn = 120 * 6e4));
|
|
7083
7083
|
});
|
|
7084
7084
|
var X,
|
|
7085
7085
|
ye,
|
|
@@ -7606,7 +7606,7 @@ function Fa() {
|
|
|
7606
7606
|
function Ba(e) {
|
|
7607
7607
|
let t = e.slug;
|
|
7608
7608
|
if (e.family === 'tein-labs' && e.kind === 'image') return Fa();
|
|
7609
|
-
if (
|
|
7609
|
+
if (pe.some((a) => a.slug === t)) return Ua(e);
|
|
7610
7610
|
if (e.kind === 'llm') return Va(e);
|
|
7611
7611
|
if (e.editVariants?.length) return Ea(e);
|
|
7612
7612
|
let i = ge(t);
|
|
@@ -8001,6 +8001,29 @@ function Ba(e) {
|
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
8003
8003
|
function Ga() {
|
|
8004
|
+
let e = (t, i) => ({
|
|
8005
|
+
name: t,
|
|
8006
|
+
type: 'slider',
|
|
8007
|
+
default: 50,
|
|
8008
|
+
min: 0,
|
|
8009
|
+
max: 100,
|
|
8010
|
+
step: 1,
|
|
8011
|
+
description: `${i} 0 to 100. 50 is the default look.`,
|
|
8012
|
+
});
|
|
8013
|
+
return [
|
|
8014
|
+
e('skin_strength', 'Strength: how much the skin is repainted. Only with skin_fix on.'),
|
|
8015
|
+
e('skin_texture', 'Texture: how much fine pore detail is added. Only with skin_fix on.'),
|
|
8016
|
+
e(
|
|
8017
|
+
'grain',
|
|
8018
|
+
'Grain: fine noise over the photo. Works in Fast and Full, with or without skin_fix.',
|
|
8019
|
+
),
|
|
8020
|
+
e(
|
|
8021
|
+
'sharpness',
|
|
8022
|
+
'Sharpness: how crisp the edges are. Works in Fast and Full, with or without skin_fix.',
|
|
8023
|
+
),
|
|
8024
|
+
];
|
|
8025
|
+
}
|
|
8026
|
+
function Ha() {
|
|
8004
8027
|
return {
|
|
8005
8028
|
slug: he,
|
|
8006
8029
|
name: Ht,
|
|
@@ -8041,6 +8064,7 @@ function Ga() {
|
|
|
8041
8064
|
options: Y.noSkin.map(String),
|
|
8042
8065
|
description: `Full only. ${Y.skin.join(', ')} with skin_fix on; also ${Y.noSkin.filter((e) => !Y.skin.includes(e)).join(' and ')} with it off. The output is at most 48 megapixels.`,
|
|
8043
8066
|
},
|
|
8067
|
+
...Ga(),
|
|
8044
8068
|
],
|
|
8045
8069
|
};
|
|
8046
8070
|
}
|
|
@@ -8058,7 +8082,7 @@ function ze(e, t = e.api.model) {
|
|
|
8058
8082
|
parameters: Ma(e, Ba(e)),
|
|
8059
8083
|
};
|
|
8060
8084
|
}
|
|
8061
|
-
function
|
|
8085
|
+
function za() {
|
|
8062
8086
|
let e = {};
|
|
8063
8087
|
for (let t of ue())
|
|
8064
8088
|
if (t.slug !== 'seedance-2-fast') {
|
|
@@ -8074,7 +8098,7 @@ function Ha() {
|
|
|
8074
8098
|
}
|
|
8075
8099
|
t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
|
|
8076
8100
|
}
|
|
8077
|
-
(Object.assign(e, Lt()), (e[he] =
|
|
8101
|
+
(Object.assign(e, Lt()), (e[he] = Ha()));
|
|
8078
8102
|
for (let [t, i] of Object.entries(fe))
|
|
8079
8103
|
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
8080
8104
|
return e;
|
|
@@ -8085,7 +8109,7 @@ function we(e) {
|
|
|
8085
8109
|
function H(e) {
|
|
8086
8110
|
return ke[e] ?? null;
|
|
8087
8111
|
}
|
|
8088
|
-
function
|
|
8112
|
+
function Ja(e, t, i) {
|
|
8089
8113
|
if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
|
|
8090
8114
|
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ii(e)) && t === 'duration') {
|
|
8091
8115
|
let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
|
|
@@ -8119,13 +8143,13 @@ function ni(e, t) {
|
|
|
8119
8143
|
let i = { ...t };
|
|
8120
8144
|
if (e?.slug === 'seedance-2-5') {
|
|
8121
8145
|
let a = (n) => typeof n != 'string' || !n.trim();
|
|
8122
|
-
for (let n of
|
|
8146
|
+
for (let n of Wa) (a(i.finalize) && !a(i[n]) && (i.finalize = i[n]), delete i[n]);
|
|
8123
8147
|
if (!a(i.finalize)) return i;
|
|
8124
8148
|
}
|
|
8125
8149
|
for (let a of e?.parameters ?? [])
|
|
8126
8150
|
a.default !== void 0 &&
|
|
8127
8151
|
i[a.name] === void 0 &&
|
|
8128
|
-
|
|
8152
|
+
Ja(e.slug, a.name, t) &&
|
|
8129
8153
|
(i[a.name] = a.default);
|
|
8130
8154
|
return i;
|
|
8131
8155
|
}
|
|
@@ -8156,7 +8180,7 @@ var _a,
|
|
|
8156
8180
|
Yt,
|
|
8157
8181
|
ja,
|
|
8158
8182
|
ke,
|
|
8159
|
-
|
|
8183
|
+
Wa,
|
|
8160
8184
|
ee = h(() => {
|
|
8161
8185
|
'use strict';
|
|
8162
8186
|
bt();
|
|
@@ -8700,8 +8724,8 @@ var _a,
|
|
|
8700
8724
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8701
8725
|
},
|
|
8702
8726
|
]));
|
|
8703
|
-
ke =
|
|
8704
|
-
|
|
8727
|
+
ke = za();
|
|
8728
|
+
Wa = ['draft_task_id', 'draft_generation_id'];
|
|
8705
8729
|
});
|
|
8706
8730
|
function xe(e) {
|
|
8707
8731
|
let t = '/v1/pricing/models',
|
|
@@ -8726,14 +8750,14 @@ function Ii(e) {
|
|
|
8726
8750
|
'The Acceptable Use Policy applies.',
|
|
8727
8751
|
].join(' ');
|
|
8728
8752
|
}
|
|
8729
|
-
function
|
|
8730
|
-
if (
|
|
8753
|
+
function vr(e) {
|
|
8754
|
+
if (wr.has(e.name)) return e;
|
|
8731
8755
|
let t = e.inputSchema.properties;
|
|
8732
8756
|
return !t || t.callback_url
|
|
8733
8757
|
? e
|
|
8734
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
8758
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: kr } } };
|
|
8735
8759
|
}
|
|
8736
|
-
function
|
|
8760
|
+
function Tr(e) {
|
|
8737
8761
|
let t = e.inputSchema.properties;
|
|
8738
8762
|
if (!t) return e;
|
|
8739
8763
|
let i = !1,
|
|
@@ -8746,7 +8770,7 @@ function vr(e) {
|
|
|
8746
8770
|
: (a[n] = s);
|
|
8747
8771
|
return i ? { ...e, inputSchema: { ...e.inputSchema, properties: a } } : e;
|
|
8748
8772
|
}
|
|
8749
|
-
function
|
|
8773
|
+
function Mr(e) {
|
|
8750
8774
|
switch (e.type) {
|
|
8751
8775
|
case 'string':
|
|
8752
8776
|
return {
|
|
@@ -8801,11 +8825,11 @@ function Tr(e) {
|
|
|
8801
8825
|
return { type: 'string', description: e.description };
|
|
8802
8826
|
}
|
|
8803
8827
|
}
|
|
8804
|
-
function
|
|
8828
|
+
function Kr(e, t) {
|
|
8805
8829
|
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
8806
8830
|
a = {},
|
|
8807
8831
|
n = [];
|
|
8808
|
-
for (let o of e.parameters) ((a[o.name] =
|
|
8832
|
+
for (let o of e.parameters) ((a[o.name] = Mr(o)), o.required && n.push(o.name));
|
|
8809
8833
|
let s = {
|
|
8810
8834
|
type: 'object',
|
|
8811
8835
|
properties: a,
|
|
@@ -8818,11 +8842,11 @@ function Mr(e, t) {
|
|
|
8818
8842
|
inputSchema: s,
|
|
8819
8843
|
};
|
|
8820
8844
|
}
|
|
8821
|
-
function
|
|
8822
|
-
let e = D().filter((
|
|
8823
|
-
t = D().filter((
|
|
8824
|
-
i = D().filter((
|
|
8825
|
-
a = D().filter((
|
|
8845
|
+
function Sr() {
|
|
8846
|
+
let e = D().filter((p) => p.category === 'Image' && !we(p)),
|
|
8847
|
+
t = D().filter((p) => p.category === 'Video'),
|
|
8848
|
+
i = D().filter((p) => p.category === 'Text'),
|
|
8849
|
+
a = D().filter((p) => p.category === 'Audio'),
|
|
8826
8850
|
n = {
|
|
8827
8851
|
name: 'generate_image',
|
|
8828
8852
|
description:
|
|
@@ -8836,7 +8860,7 @@ function Kr() {
|
|
|
8836
8860
|
},
|
|
8837
8861
|
model: {
|
|
8838
8862
|
type: 'string',
|
|
8839
|
-
enum: e.map((
|
|
8863
|
+
enum: e.map((p) => p.slug),
|
|
8840
8864
|
default: 'gpt-image-2',
|
|
8841
8865
|
description: 'The image model to use (default: gpt-image-2).',
|
|
8842
8866
|
},
|
|
@@ -8929,7 +8953,7 @@ function Kr() {
|
|
|
8929
8953
|
},
|
|
8930
8954
|
model: {
|
|
8931
8955
|
type: 'string',
|
|
8932
|
-
enum: t.map((
|
|
8956
|
+
enum: t.map((p) => p.slug),
|
|
8933
8957
|
default: 'seedance-2-5',
|
|
8934
8958
|
description: 'The video model to use (default: seedance-2-5).',
|
|
8935
8959
|
},
|
|
@@ -9012,7 +9036,7 @@ function Kr() {
|
|
|
9012
9036
|
prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
|
|
9013
9037
|
model: {
|
|
9014
9038
|
type: 'string',
|
|
9015
|
-
enum: i.map((
|
|
9039
|
+
enum: i.map((p) => p.slug),
|
|
9016
9040
|
default: 'gpt-6-astra',
|
|
9017
9041
|
description: 'The reasoning model to use (default: gpt-6-astra).',
|
|
9018
9042
|
},
|
|
@@ -9082,10 +9106,10 @@ function Kr() {
|
|
|
9082
9106
|
additionalProperties: !0,
|
|
9083
9107
|
},
|
|
9084
9108
|
},
|
|
9085
|
-
|
|
9086
|
-
return [n, s, o, u, l,
|
|
9109
|
+
d = Cr();
|
|
9110
|
+
return [n, s, o, u, l, d, c, xr, ...Ti];
|
|
9087
9111
|
}
|
|
9088
|
-
function
|
|
9112
|
+
function Cr() {
|
|
9089
9113
|
return {
|
|
9090
9114
|
name: 'upload_asset',
|
|
9091
9115
|
description:
|
|
@@ -9133,30 +9157,30 @@ function Sr() {
|
|
|
9133
9157
|
};
|
|
9134
9158
|
}
|
|
9135
9159
|
function st() {
|
|
9136
|
-
let e =
|
|
9137
|
-
t = D().map((i) =>
|
|
9138
|
-
return [...e, ...t].map(
|
|
9160
|
+
let e = Sr(),
|
|
9161
|
+
t = D().map((i) => Kr(i));
|
|
9162
|
+
return [...e, ...t].map(vr).map(Tr);
|
|
9139
9163
|
}
|
|
9140
|
-
var
|
|
9141
|
-
kr,
|
|
9164
|
+
var kr,
|
|
9142
9165
|
wr,
|
|
9143
9166
|
xr,
|
|
9144
9167
|
_r,
|
|
9145
9168
|
Pr,
|
|
9169
|
+
Ir,
|
|
9146
9170
|
Ti,
|
|
9147
|
-
|
|
9171
|
+
$s,
|
|
9148
9172
|
vi,
|
|
9149
9173
|
Mi = h(() => {
|
|
9150
9174
|
'use strict';
|
|
9151
9175
|
G();
|
|
9152
9176
|
Fe();
|
|
9153
9177
|
ee();
|
|
9154
|
-
((
|
|
9178
|
+
((kr = {
|
|
9155
9179
|
type: 'string',
|
|
9156
9180
|
description:
|
|
9157
9181
|
'Optional HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled. The body matches GET /v1/jobs/:id and is signed with X-Tein-Signature.',
|
|
9158
9182
|
}),
|
|
9159
|
-
(
|
|
9183
|
+
(wr = new Set([
|
|
9160
9184
|
'upload_asset',
|
|
9161
9185
|
'upload_media',
|
|
9162
9186
|
'upload_image',
|
|
@@ -9167,7 +9191,7 @@ var br,
|
|
|
9167
9191
|
'get_usage',
|
|
9168
9192
|
'get_balance_history',
|
|
9169
9193
|
])),
|
|
9170
|
-
(
|
|
9194
|
+
(xr = {
|
|
9171
9195
|
name: 'get_pricing',
|
|
9172
9196
|
description:
|
|
9173
9197
|
'Published USD prices for every Tein model: Starter, Plus and Scale on each variant, plus Creative mode, Priority and draft tables where they are published, and Admin prices for models that are not on the board. No API key is required. Pass model to keep one catalog slug or API model id (for example seedance-2-5). The same payload as GET /v1/pricing/models.',
|
|
@@ -9182,13 +9206,13 @@ var br,
|
|
|
9182
9206
|
additionalProperties: !1,
|
|
9183
9207
|
},
|
|
9184
9208
|
}),
|
|
9185
|
-
(
|
|
9209
|
+
(_r = {
|
|
9186
9210
|
name: 'get_balance',
|
|
9187
9211
|
description:
|
|
9188
9212
|
"Your Tein workspace's balance right now, what this API key can still spend (the balance, or less when the key has its own spending limit), credits on hold, and the workspace's usage this month and in the last 30 days from every channel (website, API, MCP, CLI, workflows). Use it before a run to check the balance covers it, or to show the balance in an app. Nothing runs and nothing is charged. The same payload as GET /v1/balance.",
|
|
9189
9213
|
inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
|
|
9190
9214
|
}),
|
|
9191
|
-
(
|
|
9215
|
+
(Pr = {
|
|
9192
9216
|
name: 'get_usage',
|
|
9193
9217
|
description:
|
|
9194
9218
|
"Your Tein workspace's usage in detail, the same numbers as the dashboard's Usage page: total spend and requests (succeeded, failed, running), this API key's own share, and breakdowns by model, by channel (website, api, mcp, cli), by API key, and over time. Covers every run of the workspace, wherever it was started. Nothing runs and nothing is charged. The same payload as GET /v1/usage.",
|
|
@@ -9219,7 +9243,7 @@ var br,
|
|
|
9219
9243
|
additionalProperties: !1,
|
|
9220
9244
|
},
|
|
9221
9245
|
}),
|
|
9222
|
-
(
|
|
9246
|
+
(Ir = {
|
|
9223
9247
|
name: 'get_balance_history',
|
|
9224
9248
|
description:
|
|
9225
9249
|
"Your Tein balance's history, newest first, the same list as the Billing page: top ups, each run's charge (with its job_id and model), refunds, credits from Tein and adjustments, each with the balance after it. Nothing runs and nothing is charged. The same payload as GET /v1/balance/transactions.",
|
|
@@ -9237,8 +9261,8 @@ var br,
|
|
|
9237
9261
|
additionalProperties: !1,
|
|
9238
9262
|
},
|
|
9239
9263
|
}),
|
|
9240
|
-
(Ti = [
|
|
9241
|
-
(
|
|
9264
|
+
(Ti = [_r, Pr, Ir]),
|
|
9265
|
+
($s = new Set(Ti.map((e) => e.name))));
|
|
9242
9266
|
vi = new Set([
|
|
9243
9267
|
'image',
|
|
9244
9268
|
'images',
|
|
@@ -9258,12 +9282,12 @@ var br,
|
|
|
9258
9282
|
});
|
|
9259
9283
|
var Li = {};
|
|
9260
9284
|
Gi(Li, {
|
|
9261
|
-
forgetToolSchemas: () =>
|
|
9285
|
+
forgetToolSchemas: () => Or,
|
|
9262
9286
|
jsonRpcAnswer: () => $i,
|
|
9263
9287
|
preprocessLocalFiles: () => Oi,
|
|
9264
9288
|
startStdioServer: () => Ri,
|
|
9265
9289
|
});
|
|
9266
|
-
function
|
|
9290
|
+
function $r(e) {
|
|
9267
9291
|
let t = (i) =>
|
|
9268
9292
|
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
9269
9293
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
@@ -9277,7 +9301,7 @@ function $i(e, t, i) {
|
|
|
9277
9301
|
} catch {
|
|
9278
9302
|
s = null;
|
|
9279
9303
|
}
|
|
9280
|
-
if (s !== null &&
|
|
9304
|
+
if (s !== null && $r(s)) return n ? null : s;
|
|
9281
9305
|
if (n) return null;
|
|
9282
9306
|
if (!i && t >= 200 && t < 300) return;
|
|
9283
9307
|
let o = s?.error,
|
|
@@ -9298,7 +9322,7 @@ function $i(e, t, i) {
|
|
|
9298
9322
|
},
|
|
9299
9323
|
};
|
|
9300
9324
|
}
|
|
9301
|
-
function
|
|
9325
|
+
function Er() {
|
|
9302
9326
|
let e = process.argv.slice(2),
|
|
9303
9327
|
t = e.indexOf('--api-key');
|
|
9304
9328
|
return S(t >= 0 ? e[t + 1] : void 0);
|
|
@@ -9317,12 +9341,12 @@ async function Ei(e, t, i) {
|
|
|
9317
9341
|
body: JSON.stringify({ data: s }),
|
|
9318
9342
|
});
|
|
9319
9343
|
if (!l.ok) {
|
|
9320
|
-
let
|
|
9344
|
+
let d = `Upload failed (HTTP ${l.status})`;
|
|
9321
9345
|
try {
|
|
9322
|
-
let
|
|
9323
|
-
|
|
9346
|
+
let p = await l.json();
|
|
9347
|
+
d = (typeof p.error == 'string' ? p.error : p.error?.message) || p.message || d;
|
|
9324
9348
|
} catch {}
|
|
9325
|
-
throw new Error(
|
|
9349
|
+
throw new Error(d);
|
|
9326
9350
|
}
|
|
9327
9351
|
let c = await l.json();
|
|
9328
9352
|
return {
|
|
@@ -9333,14 +9357,14 @@ async function Ei(e, t, i) {
|
|
|
9333
9357
|
};
|
|
9334
9358
|
}
|
|
9335
9359
|
function Ai(e) {
|
|
9336
|
-
return
|
|
9360
|
+
return Ar.has(z.default.extname(e).toLowerCase());
|
|
9337
9361
|
}
|
|
9338
9362
|
function qi(e) {
|
|
9339
9363
|
return new Error(
|
|
9340
9364
|
`Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
|
|
9341
9365
|
);
|
|
9342
9366
|
}
|
|
9343
|
-
function
|
|
9367
|
+
function qr(e) {
|
|
9344
9368
|
let t = e.trim();
|
|
9345
9369
|
if (
|
|
9346
9370
|
!t ||
|
|
@@ -9363,10 +9387,10 @@ function lt(e) {
|
|
|
9363
9387
|
ae.set(i.name, i.inputSchema);
|
|
9364
9388
|
}
|
|
9365
9389
|
}
|
|
9366
|
-
function
|
|
9390
|
+
function Or() {
|
|
9367
9391
|
(ae.clear(), (ot = 0));
|
|
9368
9392
|
}
|
|
9369
|
-
async function
|
|
9393
|
+
async function Rr(e, t) {
|
|
9370
9394
|
if (!(Date.now() - ot < 6e4)) {
|
|
9371
9395
|
ot = Date.now();
|
|
9372
9396
|
try {
|
|
@@ -9382,7 +9406,7 @@ async function Or(e, t) {
|
|
|
9382
9406
|
} catch {}
|
|
9383
9407
|
}
|
|
9384
9408
|
}
|
|
9385
|
-
function
|
|
9409
|
+
function Lr(e) {
|
|
9386
9410
|
return e
|
|
9387
9411
|
? e.type === 'string'
|
|
9388
9412
|
? e.format === 'uri'
|
|
@@ -9391,26 +9415,26 @@ function Rr(e) {
|
|
|
9391
9415
|
}
|
|
9392
9416
|
async function Ki(e, t, i) {
|
|
9393
9417
|
if (typeof e != 'string') return e;
|
|
9394
|
-
let a =
|
|
9418
|
+
let a = qr(e);
|
|
9395
9419
|
if (!a) return e;
|
|
9396
9420
|
if (!Ai(a)) throw qi(a);
|
|
9397
9421
|
return (await Ei(a, t, i)).url;
|
|
9398
9422
|
}
|
|
9399
9423
|
async function Oi(e, t, i, a, n) {
|
|
9400
|
-
(ae.size === 0 && lt(st()), ae.has(e) || (await
|
|
9424
|
+
(ae.size === 0 && lt(st()), ae.has(e) || (await Rr(n, i)));
|
|
9401
9425
|
let s = ae.get(e)?.properties;
|
|
9402
9426
|
if (!s) return t;
|
|
9403
9427
|
let o = { ...t };
|
|
9404
9428
|
for (let [u, l] of Object.entries(t))
|
|
9405
|
-
if (
|
|
9429
|
+
if (Lr(s[u]))
|
|
9406
9430
|
if (Array.isArray(l)) {
|
|
9407
9431
|
let c = [];
|
|
9408
|
-
for (let
|
|
9432
|
+
for (let d of l) c.push(await Ki(d, i, a));
|
|
9409
9433
|
o[u] = c;
|
|
9410
9434
|
} else o[u] = await Ki(l, i, a);
|
|
9411
9435
|
return o;
|
|
9412
9436
|
}
|
|
9413
|
-
function
|
|
9437
|
+
function Dr(e) {
|
|
9414
9438
|
let t = e.id ?? null;
|
|
9415
9439
|
switch (e.method) {
|
|
9416
9440
|
case 'initialize':
|
|
@@ -9454,7 +9478,7 @@ function Lr(e) {
|
|
|
9454
9478
|
async function Ri() {
|
|
9455
9479
|
if (Si) return;
|
|
9456
9480
|
Si = !0;
|
|
9457
|
-
let e =
|
|
9481
|
+
let e = Er(),
|
|
9458
9482
|
t = w(),
|
|
9459
9483
|
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
9460
9484
|
(Ci.default
|
|
@@ -9468,10 +9492,10 @@ async function Ri() {
|
|
|
9468
9492
|
let l = o.params.name,
|
|
9469
9493
|
c = o.params.arguments || {};
|
|
9470
9494
|
if (l === 'get_pricing') {
|
|
9471
|
-
let
|
|
9472
|
-
|
|
9495
|
+
let d = typeof c.model == 'string' ? c.model.trim() : '',
|
|
9496
|
+
p = `${t.replace(/\/+$/, '')}${xe(d)}`;
|
|
9473
9497
|
try {
|
|
9474
|
-
let m = await fetch(
|
|
9498
|
+
let m = await fetch(p, { signal: AbortSignal.timeout(1e4) }),
|
|
9475
9499
|
y = await m.text();
|
|
9476
9500
|
process.stdout.write(
|
|
9477
9501
|
JSON.stringify({
|
|
@@ -9508,18 +9532,18 @@ async function Ri() {
|
|
|
9508
9532
|
return;
|
|
9509
9533
|
}
|
|
9510
9534
|
if (l === 'upload_asset' || l === 'upload_media' || l === 'upload_image') {
|
|
9511
|
-
let
|
|
9535
|
+
let d = c.path || c.filepath || c.file_path || c.file || c.data;
|
|
9512
9536
|
if (
|
|
9513
|
-
typeof
|
|
9514
|
-
!
|
|
9515
|
-
!
|
|
9516
|
-
!
|
|
9537
|
+
typeof d == 'string' &&
|
|
9538
|
+
!d.startsWith('http://') &&
|
|
9539
|
+
!d.startsWith('https://') &&
|
|
9540
|
+
!d.startsWith('data:')
|
|
9517
9541
|
)
|
|
9518
9542
|
try {
|
|
9519
|
-
let
|
|
9520
|
-
if (V.default.existsSync(
|
|
9521
|
-
if (!Ai(
|
|
9522
|
-
let m = await Ei(
|
|
9543
|
+
let p = z.default.resolve(d.trim());
|
|
9544
|
+
if (V.default.existsSync(p) && V.default.statSync(p).isFile() && e) {
|
|
9545
|
+
if (!Ai(p)) throw qi(p);
|
|
9546
|
+
let m = await Ei(p, e, t),
|
|
9523
9547
|
y = (m.sizeBytes / 1024).toFixed(1),
|
|
9524
9548
|
_e =
|
|
9525
9549
|
m.mimeType.startsWith('image/') ||
|
|
@@ -9554,8 +9578,8 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9554
9578
|
);
|
|
9555
9579
|
return;
|
|
9556
9580
|
}
|
|
9557
|
-
} catch (
|
|
9558
|
-
let m =
|
|
9581
|
+
} catch (p) {
|
|
9582
|
+
let m = p instanceof Error ? p.message : String(p);
|
|
9559
9583
|
process.stdout.write(
|
|
9560
9584
|
JSON.stringify({
|
|
9561
9585
|
jsonrpc: '2.0',
|
|
@@ -9576,8 +9600,8 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9576
9600
|
if (e)
|
|
9577
9601
|
try {
|
|
9578
9602
|
o.params.arguments = await Oi(String(l), c, e, t, i);
|
|
9579
|
-
} catch (
|
|
9580
|
-
let
|
|
9603
|
+
} catch (d) {
|
|
9604
|
+
let p = d instanceof Error ? d.message : String(d);
|
|
9581
9605
|
process.stdout.write(
|
|
9582
9606
|
JSON.stringify({
|
|
9583
9607
|
jsonrpc: '2.0',
|
|
@@ -9586,7 +9610,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9586
9610
|
content: [
|
|
9587
9611
|
{
|
|
9588
9612
|
type: 'text',
|
|
9589
|
-
text: `Failed to read or upload a local file before calling Tein: ${
|
|
9613
|
+
text: `Failed to read or upload a local file before calling Tein: ${p}`,
|
|
9590
9614
|
},
|
|
9591
9615
|
],
|
|
9592
9616
|
isError: !0,
|
|
@@ -9606,19 +9630,19 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9606
9630
|
body: JSON.stringify(o),
|
|
9607
9631
|
}),
|
|
9608
9632
|
c = await l.text(),
|
|
9609
|
-
|
|
9610
|
-
if (
|
|
9611
|
-
if (
|
|
9612
|
-
(o?.method === 'tools/list' && lt(
|
|
9633
|
+
d = $i(o, l.status, c);
|
|
9634
|
+
if (d === null) return;
|
|
9635
|
+
if (d) {
|
|
9636
|
+
(o?.method === 'tools/list' && lt(d.result?.tools),
|
|
9613
9637
|
process.stdout.write(
|
|
9614
|
-
JSON.stringify(
|
|
9638
|
+
JSON.stringify(d) +
|
|
9615
9639
|
`
|
|
9616
9640
|
`,
|
|
9617
9641
|
));
|
|
9618
9642
|
return;
|
|
9619
9643
|
}
|
|
9620
9644
|
} catch {}
|
|
9621
|
-
let u =
|
|
9645
|
+
let u = Dr(o);
|
|
9622
9646
|
u !== null &&
|
|
9623
9647
|
process.stdout.write(
|
|
9624
9648
|
JSON.stringify(u) +
|
|
@@ -9644,7 +9668,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9644
9668
|
var V,
|
|
9645
9669
|
z,
|
|
9646
9670
|
Ci,
|
|
9647
|
-
|
|
9671
|
+
Ar,
|
|
9648
9672
|
ae,
|
|
9649
9673
|
ot,
|
|
9650
9674
|
Si,
|
|
@@ -9657,7 +9681,7 @@ var V,
|
|
|
9657
9681
|
Mi();
|
|
9658
9682
|
E();
|
|
9659
9683
|
re();
|
|
9660
|
-
|
|
9684
|
+
Ar = new Set([
|
|
9661
9685
|
'.png',
|
|
9662
9686
|
'.jpg',
|
|
9663
9687
|
'.jpeg',
|
|
@@ -9812,9 +9836,9 @@ function Zi(e, t, i) {
|
|
|
9812
9836
|
if (!i || typeof i != 'object') return new b(e, a);
|
|
9813
9837
|
let n = i;
|
|
9814
9838
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
9815
|
-
let
|
|
9816
|
-
{ code:
|
|
9817
|
-
return new b(e, typeof m == 'string' && m ? m : a, typeof
|
|
9839
|
+
let d = n.error,
|
|
9840
|
+
{ code: p, message: m, ...y } = d;
|
|
9841
|
+
return new b(e, typeof m == 'string' && m ? m : a, typeof p == 'string' ? p : void 0, y);
|
|
9818
9842
|
}
|
|
9819
9843
|
let { error: s, code: o, message: u, ...l } = n,
|
|
9820
9844
|
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || a;
|
|
@@ -9950,28 +9974,28 @@ function Se(e) {
|
|
|
9950
9974
|
}
|
|
9951
9975
|
ee();
|
|
9952
9976
|
var si = ['images', 'input_images', 'videos', 'audios'];
|
|
9953
|
-
function
|
|
9977
|
+
function Ya(e) {
|
|
9954
9978
|
for (let t of si) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
9955
9979
|
}
|
|
9956
|
-
function
|
|
9980
|
+
function Xa(e) {
|
|
9957
9981
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
9958
9982
|
let t = q.default.resolve(e);
|
|
9959
9983
|
return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
|
|
9960
9984
|
}
|
|
9961
|
-
async function
|
|
9985
|
+
async function Qa(e, t) {
|
|
9962
9986
|
for (let i of si) {
|
|
9963
9987
|
if (!Array.isArray(e[i])) continue;
|
|
9964
9988
|
let a = [];
|
|
9965
9989
|
for (let n of e[i]) {
|
|
9966
9990
|
if (typeof n != 'string') continue;
|
|
9967
|
-
let s =
|
|
9991
|
+
let s = Xa(n);
|
|
9968
9992
|
a.push(s ? await t(s) : n);
|
|
9969
9993
|
}
|
|
9970
9994
|
e[i] = a;
|
|
9971
9995
|
}
|
|
9972
9996
|
}
|
|
9973
9997
|
var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
9974
|
-
function
|
|
9998
|
+
function Za(e) {
|
|
9975
9999
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
9976
10000
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
9977
10001
|
i = te.enterprise;
|
|
@@ -9984,7 +10008,7 @@ function Qa(e) {
|
|
|
9984
10008
|
t
|
|
9985
10009
|
);
|
|
9986
10010
|
}
|
|
9987
|
-
async function
|
|
10011
|
+
async function er(e, t, i, a, n) {
|
|
9988
10012
|
n.isJson ||
|
|
9989
10013
|
process.stderr.write(`Starting ${a} ${t} jobs together...
|
|
9990
10014
|
`);
|
|
@@ -10010,27 +10034,27 @@ async function Za(e, t, i, a, n) {
|
|
|
10010
10034
|
);
|
|
10011
10035
|
if (!n.isAsync) {
|
|
10012
10036
|
let l = Date.now(),
|
|
10013
|
-
c = o.filter((
|
|
10037
|
+
c = o.filter((d) => d.status === 'processing' && d.request_id);
|
|
10014
10038
|
for (; c.length;) {
|
|
10015
|
-
if ((await new Promise((
|
|
10016
|
-
let
|
|
10017
|
-
process.stderr.write(`Waiting on ${c.length} of ${a} (${
|
|
10039
|
+
if ((await new Promise((p) => setTimeout(p, 2e3)), !n.isJson)) {
|
|
10040
|
+
let p = Math.round((Date.now() - l) / 1e3);
|
|
10041
|
+
process.stderr.write(`Waiting on ${c.length} of ${a} (${p}s)...
|
|
10018
10042
|
`);
|
|
10019
10043
|
}
|
|
10020
|
-
let
|
|
10021
|
-
c.map(async (
|
|
10044
|
+
let d = await Promise.all(
|
|
10045
|
+
c.map(async (p) => {
|
|
10022
10046
|
try {
|
|
10023
|
-
return await e.getStatus(
|
|
10047
|
+
return await e.getStatus(p.request_id);
|
|
10024
10048
|
} catch {
|
|
10025
|
-
return
|
|
10049
|
+
return p;
|
|
10026
10050
|
}
|
|
10027
10051
|
}),
|
|
10028
10052
|
);
|
|
10029
|
-
for (let
|
|
10030
|
-
let m = o.findIndex((y) => y.request_id ===
|
|
10031
|
-
m >= 0 && (o[m] =
|
|
10053
|
+
for (let p of d) {
|
|
10054
|
+
let m = o.findIndex((y) => y.request_id === p.request_id);
|
|
10055
|
+
m >= 0 && (o[m] = p);
|
|
10032
10056
|
}
|
|
10033
|
-
c = o.filter((
|
|
10057
|
+
c = o.filter((p) => p.status === 'processing' && p.request_id);
|
|
10034
10058
|
}
|
|
10035
10059
|
}
|
|
10036
10060
|
if (n.isJson)
|
|
@@ -10059,7 +10083,7 @@ async function Za(e, t, i, a, n) {
|
|
|
10059
10083
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
10060
10084
|
process.exit(v);
|
|
10061
10085
|
}
|
|
10062
|
-
function
|
|
10086
|
+
function tr(e, t, i) {
|
|
10063
10087
|
if (i <= 1) return e;
|
|
10064
10088
|
let a = q.default.extname(e);
|
|
10065
10089
|
return `${e.slice(0, e.length - a.length)}-${t + 1}${a}`;
|
|
@@ -10131,7 +10155,7 @@ async function Qe(e, t) {
|
|
|
10131
10155
|
s = !!t.json,
|
|
10132
10156
|
o = !!(t.async || t.no_wait),
|
|
10133
10157
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
10134
|
-
l =
|
|
10158
|
+
l = Za(t),
|
|
10135
10159
|
c = { ...t };
|
|
10136
10160
|
(delete c.json,
|
|
10137
10161
|
delete c.async,
|
|
@@ -10140,14 +10164,14 @@ async function Qe(e, t) {
|
|
|
10140
10164
|
delete c.api_key,
|
|
10141
10165
|
delete c.api_url,
|
|
10142
10166
|
delete c.count);
|
|
10143
|
-
let
|
|
10144
|
-
(
|
|
10145
|
-
typeof
|
|
10146
|
-
|
|
10147
|
-
!
|
|
10167
|
+
let d = ni(n, c);
|
|
10168
|
+
(Ya(d),
|
|
10169
|
+
typeof d.image == 'string' && !d.images && !we(n) && ((d.images = [d.image]), delete d.image),
|
|
10170
|
+
d.image_url &&
|
|
10171
|
+
!d.first_frame_image &&
|
|
10148
10172
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
10149
|
-
(
|
|
10150
|
-
let
|
|
10173
|
+
(d.first_frame_image = d.image_url));
|
|
10174
|
+
let p = new M(i, a),
|
|
10151
10175
|
m = [
|
|
10152
10176
|
'image',
|
|
10153
10177
|
'mask_image',
|
|
@@ -10160,7 +10184,7 @@ async function Qe(e, t) {
|
|
|
10160
10184
|
'video_url',
|
|
10161
10185
|
];
|
|
10162
10186
|
for (let k of m) {
|
|
10163
|
-
let g =
|
|
10187
|
+
let g = d[k];
|
|
10164
10188
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
10165
10189
|
let P = q.default.resolve(g);
|
|
10166
10190
|
if (U.default.existsSync(P) && U.default.statSync(P).isFile()) {
|
|
@@ -10168,8 +10192,8 @@ async function Qe(e, t) {
|
|
|
10168
10192
|
s || I.start();
|
|
10169
10193
|
try {
|
|
10170
10194
|
let N = U.default.readFileSync(P),
|
|
10171
|
-
O = await
|
|
10172
|
-
((
|
|
10195
|
+
O = await p.uploadAsset(N.toString('base64'));
|
|
10196
|
+
((d[k] = O.url), s || I.succeed(`Uploaded ${q.default.basename(P)} to CDN`));
|
|
10173
10197
|
} catch (N) {
|
|
10174
10198
|
let O = N instanceof Error ? N.message : String(N);
|
|
10175
10199
|
(s
|
|
@@ -10184,12 +10208,12 @@ async function Qe(e, t) {
|
|
|
10184
10208
|
}
|
|
10185
10209
|
}
|
|
10186
10210
|
}
|
|
10187
|
-
await
|
|
10211
|
+
await Qa(d, async (k) => {
|
|
10188
10212
|
let g = new $(`Uploading local file ${q.default.basename(k)} to CDN...`);
|
|
10189
10213
|
s || g.start();
|
|
10190
10214
|
try {
|
|
10191
10215
|
let P = U.default.readFileSync(k),
|
|
10192
|
-
I = await
|
|
10216
|
+
I = await p.uploadAsset(P.toString('base64'));
|
|
10193
10217
|
return (s || g.succeed(`Uploaded ${q.default.basename(k)} to CDN`), I.url);
|
|
10194
10218
|
} catch (P) {
|
|
10195
10219
|
let I = P instanceof Error ? P.message : String(P);
|
|
@@ -10208,10 +10232,10 @@ async function Qe(e, t) {
|
|
|
10208
10232
|
let f;
|
|
10209
10233
|
try {
|
|
10210
10234
|
if (l > 1) {
|
|
10211
|
-
await
|
|
10235
|
+
await er(p, e, d, l, { isJson: s, isAsync: o });
|
|
10212
10236
|
return;
|
|
10213
10237
|
}
|
|
10214
|
-
f = await
|
|
10238
|
+
f = await p.queueJob(e, d);
|
|
10215
10239
|
} catch (k) {
|
|
10216
10240
|
let g = k instanceof b ? k : null;
|
|
10217
10241
|
(s
|
|
@@ -10253,7 +10277,7 @@ async function Qe(e, t) {
|
|
|
10253
10277
|
(s || y.update(`Rendering ${r.bold(e)} (${k}s elapsed)... [ID: ${f.request_id}]`),
|
|
10254
10278
|
await new Promise((g) => setTimeout(g, Pe)));
|
|
10255
10279
|
try {
|
|
10256
|
-
f = await
|
|
10280
|
+
f = await p.getStatus(f.request_id);
|
|
10257
10281
|
} catch (g) {
|
|
10258
10282
|
g instanceof b &&
|
|
10259
10283
|
g.exitCode !== v &&
|
|
@@ -10311,13 +10335,13 @@ ${r.bold('Outputs:')}
|
|
|
10311
10335
|
`),
|
|
10312
10336
|
u)
|
|
10313
10337
|
) {
|
|
10314
|
-
let O =
|
|
10315
|
-
|
|
10338
|
+
let O = tr(u, g++, k),
|
|
10339
|
+
dt = new $(`Downloading output to ${O}...`).start();
|
|
10316
10340
|
try {
|
|
10317
|
-
(await
|
|
10318
|
-
|
|
10341
|
+
(await p.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
|
|
10342
|
+
dt.succeed(`Saved to ${r.bold(O)}`));
|
|
10319
10343
|
} catch (Ie) {
|
|
10320
|
-
|
|
10344
|
+
dt.fail(`Failed to download: ${Ie instanceof Error ? Ie.message : Ie}`);
|
|
10321
10345
|
}
|
|
10322
10346
|
}
|
|
10323
10347
|
} else
|
|
@@ -10332,7 +10356,7 @@ ${I.text}
|
|
|
10332
10356
|
}
|
|
10333
10357
|
var li = T(require('node:readline'));
|
|
10334
10358
|
E();
|
|
10335
|
-
async function
|
|
10359
|
+
async function ir(e) {
|
|
10336
10360
|
try {
|
|
10337
10361
|
return (await new M(e, w()).checkKey(), 'ok');
|
|
10338
10362
|
} catch (t) {
|
|
@@ -10343,7 +10367,7 @@ async function tr(e) {
|
|
|
10343
10367
|
return 'unchecked';
|
|
10344
10368
|
}
|
|
10345
10369
|
}
|
|
10346
|
-
function
|
|
10370
|
+
function ar(e) {
|
|
10347
10371
|
let t = li.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
10348
10372
|
return new Promise((i) => {
|
|
10349
10373
|
t.question(e, (a) => {
|
|
@@ -10363,14 +10387,14 @@ ${r.bold('Tein AI Authentication')}
|
|
|
10363
10387
|
process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
|
|
10364
10388
|
|
|
10365
10389
|
`),
|
|
10366
|
-
(i = await
|
|
10390
|
+
(i = await ar('Enter your Tein API Key (sk_live_...): '))),
|
|
10367
10391
|
!i.startsWith('sk_live_') &&
|
|
10368
10392
|
!i.startsWith('sk_test_') &&
|
|
10369
10393
|
(process.stderr
|
|
10370
10394
|
.write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10371
10395
|
`),
|
|
10372
10396
|
process.exit(1)));
|
|
10373
|
-
let a = await
|
|
10397
|
+
let a = await ir(i);
|
|
10374
10398
|
(a === 'invalid' &&
|
|
10375
10399
|
(process.stderr
|
|
10376
10400
|
.write(`${r.red('Error:')} Tein did not accept this key. Copy it again from ${r.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
@@ -10445,10 +10469,10 @@ function _(e) {
|
|
|
10445
10469
|
? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
|
|
10446
10470
|
: `$${e.toFixed(2)}`;
|
|
10447
10471
|
}
|
|
10448
|
-
function
|
|
10472
|
+
function di(e) {
|
|
10449
10473
|
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10450
10474
|
}
|
|
10451
|
-
function
|
|
10475
|
+
function rr(e) {
|
|
10452
10476
|
let t = [
|
|
10453
10477
|
['Balance', _(e.balance)],
|
|
10454
10478
|
['Available to this key', _(e.available)],
|
|
@@ -10468,8 +10492,8 @@ function ar(e) {
|
|
|
10468
10492
|
`${_(i.remaining)} left of ${_(i.amount)}${i.resets_at ? `, resets ${i.resets_at.slice(0, 10)}` : ''}`,
|
|
10469
10493
|
]),
|
|
10470
10494
|
t.push(
|
|
10471
|
-
['This month', `${_(e.usage.this_month.spend)} on ${
|
|
10472
|
-
['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${
|
|
10495
|
+
['This month', `${_(e.usage.this_month.spend)} on ${di(e.usage.this_month.requests)}`],
|
|
10496
|
+
['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${di(e.usage.last_30_days.requests)}`],
|
|
10473
10497
|
[
|
|
10474
10498
|
'Auto top up',
|
|
10475
10499
|
e.auto_top_up.enabled
|
|
@@ -10482,7 +10506,7 @@ function ar(e) {
|
|
|
10482
10506
|
let a = Math.max(...t.map(([n]) => n.length));
|
|
10483
10507
|
return t.map(([n, s]) => ` ${n.padEnd(a)} ${s}`);
|
|
10484
10508
|
}
|
|
10485
|
-
async function
|
|
10509
|
+
async function pi(e) {
|
|
10486
10510
|
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10487
10511
|
i = w(typeof e.api_url == 'string' ? e.api_url : void 0),
|
|
10488
10512
|
a = !!e.json;
|
|
@@ -10526,7 +10550,7 @@ async function di(e) {
|
|
|
10526
10550
|
}
|
|
10527
10551
|
process.stdout.write(`
|
|
10528
10552
|
${r.bold('Tein balance')}
|
|
10529
|
-
${
|
|
10553
|
+
${rr(n).join(`
|
|
10530
10554
|
`)}
|
|
10531
10555
|
|
|
10532
10556
|
`);
|
|
@@ -10589,7 +10613,7 @@ function Ze(e) {
|
|
|
10589
10613
|
.trimEnd()}`,
|
|
10590
10614
|
);
|
|
10591
10615
|
}
|
|
10592
|
-
function
|
|
10616
|
+
function nr(e) {
|
|
10593
10617
|
let t = e.summary,
|
|
10594
10618
|
i = [
|
|
10595
10619
|
` Window ${e.from.slice(0, 10)} to ${e.to.slice(0, 10)} (${e.range})${e.filters.model ? `, model ${e.filters.model}` : ''}${e.filters.channel ? `, channel ${e.filters.channel}` : ''}`,
|
|
@@ -10631,12 +10655,12 @@ async function fi(e) {
|
|
|
10631
10655
|
}
|
|
10632
10656
|
process.stdout.write(`
|
|
10633
10657
|
${r.bold('Tein usage')}
|
|
10634
|
-
${
|
|
10658
|
+
${nr(a).join(`
|
|
10635
10659
|
`)}
|
|
10636
10660
|
|
|
10637
10661
|
`);
|
|
10638
10662
|
}
|
|
10639
|
-
function
|
|
10663
|
+
function sr(e) {
|
|
10640
10664
|
return e.data.length
|
|
10641
10665
|
? Ze([
|
|
10642
10666
|
['When (UTC)', 'Amount', 'Balance after', 'What'],
|
|
@@ -10668,7 +10692,7 @@ async function gi(e) {
|
|
|
10668
10692
|
: '';
|
|
10669
10693
|
process.stdout.write(`
|
|
10670
10694
|
${r.bold('Tein balance history')}
|
|
10671
|
-
${
|
|
10695
|
+
${sr(a).join(`
|
|
10672
10696
|
`)}${n}
|
|
10673
10697
|
|
|
10674
10698
|
`);
|
|
@@ -10676,10 +10700,10 @@ ${nr(a).join(`
|
|
|
10676
10700
|
E();
|
|
10677
10701
|
Ce();
|
|
10678
10702
|
ee();
|
|
10679
|
-
var
|
|
10703
|
+
var or = 3e3;
|
|
10680
10704
|
async function hi(e) {
|
|
10681
10705
|
try {
|
|
10682
|
-
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(
|
|
10706
|
+
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(or) });
|
|
10683
10707
|
if (!t.ok) return;
|
|
10684
10708
|
let i = await t.json(),
|
|
10685
10709
|
a = {};
|
|
@@ -10690,15 +10714,15 @@ async function hi(e) {
|
|
|
10690
10714
|
Zt(a);
|
|
10691
10715
|
} catch {}
|
|
10692
10716
|
}
|
|
10693
|
-
var
|
|
10694
|
-
|
|
10717
|
+
var lr = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
10718
|
+
dr = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
10695
10719
|
async function yi(e, t) {
|
|
10696
10720
|
await hi(t);
|
|
10697
10721
|
let i = D();
|
|
10698
10722
|
if (e) {
|
|
10699
10723
|
let s = e.toLowerCase(),
|
|
10700
|
-
o =
|
|
10701
|
-
i =
|
|
10724
|
+
o = dr[s] ?? s;
|
|
10725
|
+
i = lr.has(o)
|
|
10702
10726
|
? i.filter((u) => u.category.toLowerCase() === o)
|
|
10703
10727
|
: i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
10704
10728
|
}
|
|
@@ -10723,8 +10747,8 @@ ${r.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
10723
10747
|
for (let u of o) {
|
|
10724
10748
|
let l = u.slug.padEnd(24),
|
|
10725
10749
|
c = u.name.padEnd(22),
|
|
10726
|
-
|
|
10727
|
-
process.stdout.write(` ${r.bold(l)} ${r.gray(c)} ${r.green(
|
|
10750
|
+
d = u.priceFormatted.padEnd(22);
|
|
10751
|
+
process.stdout.write(` ${r.bold(l)} ${r.gray(c)} ${r.green(d)} ${r.dim(u.vendor)}
|
|
10728
10752
|
`);
|
|
10729
10753
|
}
|
|
10730
10754
|
process.stdout.write(`
|
|
@@ -10830,18 +10854,18 @@ var pr = 1e4,
|
|
|
10830
10854
|
priorityDraft: 'Priority + Draft',
|
|
10831
10855
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
10832
10856
|
},
|
|
10833
|
-
|
|
10834
|
-
|
|
10857
|
+
cr = Object.keys(it),
|
|
10858
|
+
ur = {
|
|
10835
10859
|
creativeMode: 'unfiltered',
|
|
10836
10860
|
creativeModePriority: 'unfilteredPriority',
|
|
10837
10861
|
creativeModeDraft: 'unfilteredDraft',
|
|
10838
10862
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
10839
10863
|
};
|
|
10840
|
-
function
|
|
10841
|
-
let i =
|
|
10864
|
+
function mr(e, t) {
|
|
10865
|
+
let i = ur[t];
|
|
10842
10866
|
return e[t] ?? (i ? e[i] : void 0);
|
|
10843
10867
|
}
|
|
10844
|
-
async function
|
|
10868
|
+
async function fr(e, t) {
|
|
10845
10869
|
let i = `${w(e)}${xe(t)}`,
|
|
10846
10870
|
a;
|
|
10847
10871
|
try {
|
|
@@ -10872,7 +10896,7 @@ function at(e) {
|
|
|
10872
10896
|
i = typeof e.scale == 'number' ? e.scale : t;
|
|
10873
10897
|
return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(i)}`;
|
|
10874
10898
|
}
|
|
10875
|
-
function
|
|
10899
|
+
function gr(e) {
|
|
10876
10900
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
10877
10901
|
let t = [];
|
|
10878
10902
|
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
@@ -10884,21 +10908,21 @@ function fr(e) {
|
|
|
10884
10908
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
10885
10909
|
);
|
|
10886
10910
|
}
|
|
10887
|
-
function
|
|
10888
|
-
let i =
|
|
10889
|
-
for (let a of
|
|
10890
|
-
let n = at(
|
|
10911
|
+
function hr(e, t) {
|
|
10912
|
+
let i = gr(e);
|
|
10913
|
+
for (let a of cr) {
|
|
10914
|
+
let n = at(mr(e, a));
|
|
10891
10915
|
if (!n) continue;
|
|
10892
10916
|
let s = it[a] ? ` (${it[a]})` : '';
|
|
10893
10917
|
t.push(` ${i}${s} ${n}`);
|
|
10894
10918
|
}
|
|
10895
10919
|
}
|
|
10896
|
-
function
|
|
10920
|
+
function yr(e, t) {
|
|
10897
10921
|
let i = e.quality ? ` quality=${e.quality}` : '';
|
|
10898
10922
|
t.push(
|
|
10899
10923
|
` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
|
|
10900
10924
|
);
|
|
10901
|
-
for (let n of e.variants ?? [])
|
|
10925
|
+
for (let n of e.variants ?? []) hr(n, t);
|
|
10902
10926
|
let a = e.addons;
|
|
10903
10927
|
if (Array.isArray(a))
|
|
10904
10928
|
for (let n of a) {
|
|
@@ -10910,7 +10934,7 @@ function hr(e, t) {
|
|
|
10910
10934
|
}
|
|
10911
10935
|
t.push('');
|
|
10912
10936
|
}
|
|
10913
|
-
function
|
|
10937
|
+
function br(e) {
|
|
10914
10938
|
let t = [],
|
|
10915
10939
|
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
10916
10940
|
(t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${i}`),
|
|
@@ -10921,18 +10945,18 @@ function yr(e) {
|
|
|
10921
10945
|
let a = new Map();
|
|
10922
10946
|
for (let l of e.board.models) {
|
|
10923
10947
|
let c = l.kind || 'other',
|
|
10924
|
-
|
|
10925
|
-
(
|
|
10948
|
+
d = a.get(c) ?? [];
|
|
10949
|
+
(d.push(l), a.set(c, d));
|
|
10926
10950
|
}
|
|
10927
10951
|
let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
|
|
10928
10952
|
s = [...a.keys()].sort((l, c) => {
|
|
10929
|
-
let
|
|
10930
|
-
|
|
10931
|
-
return (
|
|
10953
|
+
let d = n.indexOf(l),
|
|
10954
|
+
p = n.indexOf(c);
|
|
10955
|
+
return (d === -1 ? 99 : d) - (p === -1 ? 99 : p);
|
|
10932
10956
|
});
|
|
10933
10957
|
for (let l of s) {
|
|
10934
10958
|
t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
10935
|
-
for (let c of a.get(l) ?? [])
|
|
10959
|
+
for (let c of a.get(l) ?? []) yr(c, t);
|
|
10936
10960
|
}
|
|
10937
10961
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
10938
10962
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
@@ -10940,14 +10964,14 @@ function yr(e) {
|
|
|
10940
10964
|
t.push(`${r.bold(r.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
|
|
10941
10965
|
let l = new Map();
|
|
10942
10966
|
for (let c of u) {
|
|
10943
|
-
let
|
|
10944
|
-
|
|
10945
|
-
(
|
|
10967
|
+
let d = String(c.modelSlug ?? ''),
|
|
10968
|
+
p = l.get(d) ?? [];
|
|
10969
|
+
(p.push(c), l.set(d, p));
|
|
10946
10970
|
}
|
|
10947
|
-
for (let [c,
|
|
10948
|
-
let
|
|
10949
|
-
t.push(` ${r.bold(c.padEnd(26))} ${r.gray(
|
|
10950
|
-
for (let m of
|
|
10971
|
+
for (let [c, d] of l) {
|
|
10972
|
+
let p = String(d[0]?.modelName ?? c);
|
|
10973
|
+
t.push(` ${r.bold(c.padEnd(26))} ${r.gray(p)}`);
|
|
10974
|
+
for (let m of d) {
|
|
10951
10975
|
let y = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
10952
10976
|
f = at(m.prices);
|
|
10953
10977
|
f && t.push(` ${y} ${f}`);
|
|
@@ -10965,7 +10989,7 @@ function yr(e) {
|
|
|
10965
10989
|
async function ki(e) {
|
|
10966
10990
|
let t;
|
|
10967
10991
|
try {
|
|
10968
|
-
t = await
|
|
10992
|
+
t = await fr(e.apiUrl, e.model);
|
|
10969
10993
|
} catch (i) {
|
|
10970
10994
|
let a = i instanceof Error ? i.message : String(i);
|
|
10971
10995
|
(process.stderr.write(`${r.red('Error:')} ${a}
|
|
@@ -10976,7 +11000,7 @@ async function ki(e) {
|
|
|
10976
11000
|
e.json
|
|
10977
11001
|
? `${JSON.stringify(t, null, 2)}
|
|
10978
11002
|
`
|
|
10979
|
-
:
|
|
11003
|
+
: br(t),
|
|
10980
11004
|
);
|
|
10981
11005
|
}
|
|
10982
11006
|
var wi = T(require('node:path'));
|
|
@@ -11006,12 +11030,12 @@ async function xi(e, t) {
|
|
|
11006
11030
|
let c;
|
|
11007
11031
|
try {
|
|
11008
11032
|
c = await u.getStatus(e);
|
|
11009
|
-
} catch (
|
|
11010
|
-
(
|
|
11033
|
+
} catch (d) {
|
|
11034
|
+
(d instanceof b &&
|
|
11011
11035
|
(n
|
|
11012
11036
|
? process.stdout.write(
|
|
11013
11037
|
JSON.stringify(
|
|
11014
|
-
{ error: { code:
|
|
11038
|
+
{ error: { code: d.code ?? null, message: d.message, ...d.fields } },
|
|
11015
11039
|
null,
|
|
11016
11040
|
2,
|
|
11017
11041
|
) +
|
|
@@ -11019,18 +11043,18 @@ async function xi(e, t) {
|
|
|
11019
11043
|
`,
|
|
11020
11044
|
)
|
|
11021
11045
|
: l.fail(
|
|
11022
|
-
K(
|
|
11046
|
+
K(d).join(`
|
|
11023
11047
|
`),
|
|
11024
11048
|
),
|
|
11025
|
-
process.exit(
|
|
11026
|
-
n || l.fail(
|
|
11049
|
+
process.exit(d.exitCode)),
|
|
11050
|
+
n || l.fail(d instanceof Error ? d.message : String(d)),
|
|
11027
11051
|
process.exit(v));
|
|
11028
11052
|
}
|
|
11029
11053
|
if (s && c.status === 'processing') {
|
|
11030
|
-
let
|
|
11054
|
+
let d = Date.now();
|
|
11031
11055
|
for (; c.status === 'processing';) {
|
|
11032
|
-
let
|
|
11033
|
-
(n || l.update(`Waiting for ${r.bold(c.model)} (${
|
|
11056
|
+
let p = Math.round((Date.now() - d) / 1e3);
|
|
11057
|
+
(n || l.update(`Waiting for ${r.bold(c.model)} (${p}s elapsed)...`),
|
|
11034
11058
|
await new Promise((m) => setTimeout(m, 1500)));
|
|
11035
11059
|
try {
|
|
11036
11060
|
c = await u.getStatus(e);
|
|
@@ -11067,25 +11091,25 @@ async function xi(e, t) {
|
|
|
11067
11091
|
process.stdout.write(`
|
|
11068
11092
|
${r.bold('Outputs:')}
|
|
11069
11093
|
`);
|
|
11070
|
-
for (let
|
|
11071
|
-
if (
|
|
11094
|
+
for (let d of c.output)
|
|
11095
|
+
if (d.url) {
|
|
11072
11096
|
if (
|
|
11073
|
-
(process.stdout.write(` [${
|
|
11097
|
+
(process.stdout.write(` [${d.type.toUpperCase()}] ${r.cyan(r.underline(d.url))}
|
|
11074
11098
|
`),
|
|
11075
11099
|
o)
|
|
11076
11100
|
) {
|
|
11077
|
-
let
|
|
11101
|
+
let p = new $(`Downloading output to ${o}...`).start();
|
|
11078
11102
|
try {
|
|
11079
|
-
(await u.downloadOutput(
|
|
11080
|
-
|
|
11103
|
+
(await u.downloadOutput(d.url, wi.default.resolve(process.cwd(), o)),
|
|
11104
|
+
p.succeed(`Saved to ${r.bold(o)}`));
|
|
11081
11105
|
} catch (m) {
|
|
11082
|
-
|
|
11106
|
+
p.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
11083
11107
|
}
|
|
11084
11108
|
}
|
|
11085
11109
|
} else
|
|
11086
|
-
|
|
11110
|
+
d.text &&
|
|
11087
11111
|
process.stdout.write(`
|
|
11088
|
-
${
|
|
11112
|
+
${d.text}
|
|
11089
11113
|
`);
|
|
11090
11114
|
}
|
|
11091
11115
|
process.stdout.write(`
|
|
@@ -11119,42 +11143,42 @@ async function _i(e, t = {}) {
|
|
|
11119
11143
|
let o = nt.default.basename(s),
|
|
11120
11144
|
l = rt.default.readFileSync(s).toString('base64'),
|
|
11121
11145
|
c = new M(i, a),
|
|
11122
|
-
|
|
11123
|
-
n ||
|
|
11146
|
+
d = new $(`Uploading ${r.bold(o)} to Tein AI CDN...`);
|
|
11147
|
+
n || d.start();
|
|
11124
11148
|
try {
|
|
11125
|
-
let
|
|
11149
|
+
let p = await c.uploadAsset(l);
|
|
11126
11150
|
n
|
|
11127
11151
|
? process.stdout.write(
|
|
11128
|
-
JSON.stringify(
|
|
11152
|
+
JSON.stringify(p, null, 2) +
|
|
11129
11153
|
`
|
|
11130
11154
|
`,
|
|
11131
11155
|
)
|
|
11132
|
-
: (
|
|
11156
|
+
: (d.succeed('Upload successful!'),
|
|
11133
11157
|
process.stdout.write(`
|
|
11134
|
-
${r.bold('CDN URL:')} ${r.green(
|
|
11158
|
+
${r.bold('CDN URL:')} ${r.green(p.url)}
|
|
11135
11159
|
`),
|
|
11136
|
-
process.stdout.write(`${r.dim(`Key: ${
|
|
11160
|
+
process.stdout.write(`${r.dim(`Key: ${p.key}`)}
|
|
11137
11161
|
|
|
11138
11162
|
`),
|
|
11139
11163
|
process.stdout.write(`Use this CDN URL directly in your CLI runs:
|
|
11140
|
-
${r.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${
|
|
11164
|
+
${r.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${p.url}"`)}
|
|
11141
11165
|
|
|
11142
11166
|
`));
|
|
11143
|
-
} catch (
|
|
11144
|
-
let m =
|
|
11167
|
+
} catch (p) {
|
|
11168
|
+
let m = p instanceof b ? p : null,
|
|
11145
11169
|
y = m
|
|
11146
11170
|
? K(m).join(`
|
|
11147
11171
|
`)
|
|
11148
|
-
:
|
|
11149
|
-
?
|
|
11150
|
-
: String(
|
|
11172
|
+
: p instanceof Error
|
|
11173
|
+
? p.message
|
|
11174
|
+
: String(p);
|
|
11151
11175
|
(n
|
|
11152
11176
|
? process.stdout.write(
|
|
11153
11177
|
JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? y } }, null, 2) +
|
|
11154
11178
|
`
|
|
11155
11179
|
`,
|
|
11156
11180
|
)
|
|
11157
|
-
:
|
|
11181
|
+
: d.fail(`Upload failed: ${y}`),
|
|
11158
11182
|
process.exit(m ? m.exitCode : v));
|
|
11159
11183
|
}
|
|
11160
11184
|
}
|
|
@@ -11243,7 +11267,7 @@ ${r.bold('EXAMPLES:')}
|
|
|
11243
11267
|
|
|
11244
11268
|
`);
|
|
11245
11269
|
}
|
|
11246
|
-
async function
|
|
11270
|
+
async function Vr() {
|
|
11247
11271
|
let e = process.argv.slice(2),
|
|
11248
11272
|
t = oi(e);
|
|
11249
11273
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
@@ -11316,7 +11340,7 @@ async function Dr() {
|
|
|
11316
11340
|
break;
|
|
11317
11341
|
}
|
|
11318
11342
|
case 'balance': {
|
|
11319
|
-
await
|
|
11343
|
+
await pi(t.options);
|
|
11320
11344
|
break;
|
|
11321
11345
|
}
|
|
11322
11346
|
case 'usage': {
|
|
@@ -11350,7 +11374,7 @@ Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for t
|
|
|
11350
11374
|
}
|
|
11351
11375
|
}
|
|
11352
11376
|
}
|
|
11353
|
-
|
|
11377
|
+
Vr().catch((e) => {
|
|
11354
11378
|
(e instanceof b &&
|
|
11355
11379
|
(process.stderr.write(`
|
|
11356
11380
|
${r.red('Error:')} ${K(e).join(`
|