@302ai/media-studio-cli 0.1.0-beta.0 → 0.1.0-beta.1
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/index.js +76 -240
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1475,7 +1475,7 @@ function _getBuiltinFlags(long, short, userNames, userAliases) {
|
|
|
1475
1475
|
// package.json
|
|
1476
1476
|
var package_default = {
|
|
1477
1477
|
name: "@302ai/media-studio-cli",
|
|
1478
|
-
version: "0.1.0-beta.
|
|
1478
|
+
version: "0.1.0-beta.1",
|
|
1479
1479
|
description: "CLI for AI Media Studio — let external agents drive the core media-studio features",
|
|
1480
1480
|
author: "302.AI",
|
|
1481
1481
|
license: "Apache-2.0",
|
|
@@ -21376,120 +21376,42 @@ class ClientChat {
|
|
|
21376
21376
|
}
|
|
21377
21377
|
}
|
|
21378
21378
|
|
|
21379
|
-
//
|
|
21379
|
+
// ../../node_modules/nanoid/index.js
|
|
21380
|
+
import { webcrypto as crypto } from "node:crypto";
|
|
21381
|
+
|
|
21382
|
+
// ../../node_modules/nanoid/url-alphabet/index.js
|
|
21380
21383
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
21381
21384
|
|
|
21382
|
-
//
|
|
21383
|
-
var
|
|
21384
|
-
|
|
21385
|
-
|
|
21386
|
-
|
|
21387
|
-
let to = Math.min(from + GET_RANDOM_LIMIT, buffer.length);
|
|
21388
|
-
crypto.getRandomValues(buffer.subarray(from, to));
|
|
21389
|
-
from = to;
|
|
21390
|
-
}
|
|
21391
|
-
}
|
|
21392
|
-
function random3(bytes) {
|
|
21393
|
-
bytes |= 0;
|
|
21385
|
+
// ../../node_modules/nanoid/index.js
|
|
21386
|
+
var POOL_SIZE_MULTIPLIER = 128;
|
|
21387
|
+
var pool;
|
|
21388
|
+
var poolOffset;
|
|
21389
|
+
function fillPool(bytes) {
|
|
21394
21390
|
if (bytes < 0)
|
|
21395
21391
|
throw new RangeError("Wrong ID size");
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
return (size2 = defaultSize) => {
|
|
21405
|
-
if (!size2)
|
|
21406
|
-
return "";
|
|
21407
|
-
let id = "";
|
|
21408
|
-
while (true) {
|
|
21409
|
-
let bytes = getRandom(size2);
|
|
21410
|
-
let i2 = size2;
|
|
21411
|
-
while (i2--) {
|
|
21412
|
-
id += alphabet[bytes[i2] & mask];
|
|
21413
|
-
if (id.length >= size2)
|
|
21414
|
-
return id;
|
|
21415
|
-
}
|
|
21416
|
-
}
|
|
21417
|
-
};
|
|
21418
|
-
}
|
|
21419
|
-
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
21420
|
-
return (size2 = defaultSize) => {
|
|
21421
|
-
if (!size2)
|
|
21422
|
-
return "";
|
|
21423
|
-
let id = "";
|
|
21424
|
-
while (true) {
|
|
21425
|
-
let bytes = getRandom(step);
|
|
21426
|
-
let i2 = step;
|
|
21427
|
-
while (i2--) {
|
|
21428
|
-
if (bytes[i2] < safeByteCutoff) {
|
|
21429
|
-
id += alphabet[bytes[i2] % alphabet.length];
|
|
21430
|
-
if (id.length >= size2)
|
|
21431
|
-
return id;
|
|
21432
|
-
}
|
|
21433
|
-
}
|
|
21392
|
+
try {
|
|
21393
|
+
if (!pool || pool.length < bytes) {
|
|
21394
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
21395
|
+
crypto.getRandomValues(pool);
|
|
21396
|
+
poolOffset = 0;
|
|
21397
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
21398
|
+
crypto.getRandomValues(pool);
|
|
21399
|
+
poolOffset = 0;
|
|
21434
21400
|
}
|
|
21435
|
-
}
|
|
21436
|
-
|
|
21437
|
-
|
|
21438
|
-
function customAlphabet(alphabet, defaultSize = 21) {
|
|
21439
|
-
if (typeof alphabet !== "string" || !alphabet || alphabet.length > 256) {
|
|
21440
|
-
return customRandom(alphabet, defaultSize, random3);
|
|
21401
|
+
} catch (e2) {
|
|
21402
|
+
pool = undefined;
|
|
21403
|
+
throw e2;
|
|
21441
21404
|
}
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
|
|
21445
|
-
|
|
21405
|
+
poolOffset += bytes;
|
|
21406
|
+
}
|
|
21407
|
+
function nanoid3(size2 = 21) {
|
|
21408
|
+
fillPool(size2 |= 0);
|
|
21409
|
+
let id = "";
|
|
21410
|
+
for (let i2 = poolOffset - size2;i2 < poolOffset; i2++) {
|
|
21411
|
+
id += urlAlphabet[pool[i2] & 63];
|
|
21446
21412
|
}
|
|
21447
|
-
|
|
21448
|
-
return str.charCodeAt(0);
|
|
21449
|
-
});
|
|
21450
|
-
let alphabetLen = alphabet.length;
|
|
21451
|
-
let mask = (2 << 31 - Math.clz32(alphabetLen - 1 | 1)) - 1;
|
|
21452
|
-
let pool = "";
|
|
21453
|
-
let poolOffset = 0;
|
|
21454
|
-
let poolNext = 0;
|
|
21455
|
-
return (size2 = defaultSize) => {
|
|
21456
|
-
size2 |= 0;
|
|
21457
|
-
if (size2 < 0)
|
|
21458
|
-
throw new RangeError("Wrong ID size");
|
|
21459
|
-
if (size2 === 0)
|
|
21460
|
-
return "";
|
|
21461
|
-
if (poolOffset + size2 > pool.length) {
|
|
21462
|
-
let target = Math.max(poolNext, size2);
|
|
21463
|
-
poolNext = Math.min(target * 16, POOL_MAX);
|
|
21464
|
-
let buffer = Buffer.allocUnsafe(target);
|
|
21465
|
-
if (mask === alphabetLen - 1) {
|
|
21466
|
-
fillRandom(buffer);
|
|
21467
|
-
for (let i2 = 0;i2 < target; i2++) {
|
|
21468
|
-
buffer[i2] = charCodes[buffer[i2] & mask];
|
|
21469
|
-
}
|
|
21470
|
-
} else {
|
|
21471
|
-
let randomBytes = Buffer.allocUnsafe(Math.ceil(1.6 * (mask + 1) * target / alphabetLen));
|
|
21472
|
-
let accepted = 0;
|
|
21473
|
-
while (accepted < target) {
|
|
21474
|
-
fillRandom(randomBytes);
|
|
21475
|
-
for (let i2 = 0;i2 < randomBytes.length; i2++) {
|
|
21476
|
-
let index = randomBytes[i2] & mask;
|
|
21477
|
-
if (index < alphabetLen) {
|
|
21478
|
-
buffer[accepted++] = charCodes[index];
|
|
21479
|
-
if (accepted === target)
|
|
21480
|
-
break;
|
|
21481
|
-
}
|
|
21482
|
-
}
|
|
21483
|
-
}
|
|
21484
|
-
}
|
|
21485
|
-
pool = buffer.toString("latin1");
|
|
21486
|
-
poolOffset = 0;
|
|
21487
|
-
}
|
|
21488
|
-
poolOffset += size2;
|
|
21489
|
-
return pool.substring(poolOffset - size2, poolOffset);
|
|
21490
|
-
};
|
|
21413
|
+
return id;
|
|
21491
21414
|
}
|
|
21492
|
-
var nanoid3 = customAlphabet(urlAlphabet);
|
|
21493
21415
|
|
|
21494
21416
|
// ../media-studio-core/dist/client/session.js
|
|
21495
21417
|
class ChatSession {
|
|
@@ -21767,6 +21689,9 @@ class ClientSessions {
|
|
|
21767
21689
|
signal
|
|
21768
21690
|
});
|
|
21769
21691
|
if (!response.ok) {
|
|
21692
|
+
await response.body?.cancel().catch(() => {
|
|
21693
|
+
return;
|
|
21694
|
+
});
|
|
21770
21695
|
const retryable = response.status >= 500 || response.status === 429;
|
|
21771
21696
|
if (!retryable)
|
|
21772
21697
|
break;
|
|
@@ -21834,13 +21759,19 @@ class ClientSessions {
|
|
|
21834
21759
|
});
|
|
21835
21760
|
const reader = response.body.getReader();
|
|
21836
21761
|
const decoder = new TextDecoder;
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21762
|
+
try {
|
|
21763
|
+
for (;; ) {
|
|
21764
|
+
const { done, value } = await reader.read();
|
|
21765
|
+
if (done)
|
|
21766
|
+
break;
|
|
21767
|
+
parser.feed(decoder.decode(value, { stream: true }));
|
|
21768
|
+
if (state.outcome)
|
|
21769
|
+
break;
|
|
21770
|
+
}
|
|
21771
|
+
} finally {
|
|
21772
|
+
await reader.cancel().catch(() => {
|
|
21773
|
+
return;
|
|
21774
|
+
});
|
|
21844
21775
|
}
|
|
21845
21776
|
parser.feed(decoder.decode());
|
|
21846
21777
|
}
|
|
@@ -23143,121 +23074,6 @@ import {
|
|
|
23143
23074
|
import { homedir } from "node:os";
|
|
23144
23075
|
import { join as join2 } from "node:path";
|
|
23145
23076
|
|
|
23146
|
-
// node_modules/nanoid/url-alphabet/index.js
|
|
23147
|
-
var urlAlphabet2 = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
23148
|
-
|
|
23149
|
-
// node_modules/nanoid/index.js
|
|
23150
|
-
var GET_RANDOM_LIMIT2 = 65536;
|
|
23151
|
-
function fillRandom2(buffer) {
|
|
23152
|
-
let from = 0;
|
|
23153
|
-
while (from < buffer.length) {
|
|
23154
|
-
let to = Math.min(from + GET_RANDOM_LIMIT2, buffer.length);
|
|
23155
|
-
crypto.getRandomValues(buffer.subarray(from, to));
|
|
23156
|
-
from = to;
|
|
23157
|
-
}
|
|
23158
|
-
}
|
|
23159
|
-
function random4(bytes) {
|
|
23160
|
-
bytes |= 0;
|
|
23161
|
-
if (bytes < 0)
|
|
23162
|
-
throw new RangeError("Wrong ID size");
|
|
23163
|
-
let buffer = Buffer.allocUnsafe(bytes);
|
|
23164
|
-
fillRandom2(buffer);
|
|
23165
|
-
return buffer;
|
|
23166
|
-
}
|
|
23167
|
-
function customRandom2(alphabet, defaultSize, getRandom) {
|
|
23168
|
-
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
23169
|
-
if (safeByteCutoff === 256) {
|
|
23170
|
-
let mask = alphabet.length - 1;
|
|
23171
|
-
return (size2 = defaultSize) => {
|
|
23172
|
-
if (!size2)
|
|
23173
|
-
return "";
|
|
23174
|
-
let id = "";
|
|
23175
|
-
while (true) {
|
|
23176
|
-
let bytes = getRandom(size2);
|
|
23177
|
-
let i3 = size2;
|
|
23178
|
-
while (i3--) {
|
|
23179
|
-
id += alphabet[bytes[i3] & mask];
|
|
23180
|
-
if (id.length >= size2)
|
|
23181
|
-
return id;
|
|
23182
|
-
}
|
|
23183
|
-
}
|
|
23184
|
-
};
|
|
23185
|
-
}
|
|
23186
|
-
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
23187
|
-
return (size2 = defaultSize) => {
|
|
23188
|
-
if (!size2)
|
|
23189
|
-
return "";
|
|
23190
|
-
let id = "";
|
|
23191
|
-
while (true) {
|
|
23192
|
-
let bytes = getRandom(step);
|
|
23193
|
-
let i3 = step;
|
|
23194
|
-
while (i3--) {
|
|
23195
|
-
if (bytes[i3] < safeByteCutoff) {
|
|
23196
|
-
id += alphabet[bytes[i3] % alphabet.length];
|
|
23197
|
-
if (id.length >= size2)
|
|
23198
|
-
return id;
|
|
23199
|
-
}
|
|
23200
|
-
}
|
|
23201
|
-
}
|
|
23202
|
-
};
|
|
23203
|
-
}
|
|
23204
|
-
var POOL_MAX2 = GET_RANDOM_LIMIT2 / 2;
|
|
23205
|
-
function customAlphabet2(alphabet, defaultSize = 21) {
|
|
23206
|
-
if (typeof alphabet !== "string" || !alphabet || alphabet.length > 256) {
|
|
23207
|
-
return customRandom2(alphabet, defaultSize, random4);
|
|
23208
|
-
}
|
|
23209
|
-
for (let i3 = 0;i3 < alphabet.length; i3++) {
|
|
23210
|
-
if (alphabet.charCodeAt(i3) > 255) {
|
|
23211
|
-
return customRandom2(alphabet, defaultSize, random4);
|
|
23212
|
-
}
|
|
23213
|
-
}
|
|
23214
|
-
let charCodes = Uint8Array.from(alphabet, (str) => {
|
|
23215
|
-
return str.charCodeAt(0);
|
|
23216
|
-
});
|
|
23217
|
-
let alphabetLen = alphabet.length;
|
|
23218
|
-
let mask = (2 << 31 - Math.clz32(alphabetLen - 1 | 1)) - 1;
|
|
23219
|
-
let pool = "";
|
|
23220
|
-
let poolOffset = 0;
|
|
23221
|
-
let poolNext = 0;
|
|
23222
|
-
return (size2 = defaultSize) => {
|
|
23223
|
-
size2 |= 0;
|
|
23224
|
-
if (size2 < 0)
|
|
23225
|
-
throw new RangeError("Wrong ID size");
|
|
23226
|
-
if (size2 === 0)
|
|
23227
|
-
return "";
|
|
23228
|
-
if (poolOffset + size2 > pool.length) {
|
|
23229
|
-
let target = Math.max(poolNext, size2);
|
|
23230
|
-
poolNext = Math.min(target * 16, POOL_MAX2);
|
|
23231
|
-
let buffer = Buffer.allocUnsafe(target);
|
|
23232
|
-
if (mask === alphabetLen - 1) {
|
|
23233
|
-
fillRandom2(buffer);
|
|
23234
|
-
for (let i3 = 0;i3 < target; i3++) {
|
|
23235
|
-
buffer[i3] = charCodes[buffer[i3] & mask];
|
|
23236
|
-
}
|
|
23237
|
-
} else {
|
|
23238
|
-
let randomBytes = Buffer.allocUnsafe(Math.ceil(1.6 * (mask + 1) * target / alphabetLen));
|
|
23239
|
-
let accepted = 0;
|
|
23240
|
-
while (accepted < target) {
|
|
23241
|
-
fillRandom2(randomBytes);
|
|
23242
|
-
for (let i3 = 0;i3 < randomBytes.length; i3++) {
|
|
23243
|
-
let index = randomBytes[i3] & mask;
|
|
23244
|
-
if (index < alphabetLen) {
|
|
23245
|
-
buffer[accepted++] = charCodes[index];
|
|
23246
|
-
if (accepted === target)
|
|
23247
|
-
break;
|
|
23248
|
-
}
|
|
23249
|
-
}
|
|
23250
|
-
}
|
|
23251
|
-
}
|
|
23252
|
-
pool = buffer.toString("latin1");
|
|
23253
|
-
poolOffset = 0;
|
|
23254
|
-
}
|
|
23255
|
-
poolOffset += size2;
|
|
23256
|
-
return pool.substring(poolOffset - size2, poolOffset);
|
|
23257
|
-
};
|
|
23258
|
-
}
|
|
23259
|
-
var nanoid4 = customAlphabet2(urlAlphabet2);
|
|
23260
|
-
|
|
23261
23077
|
// node_modules/zod/v4/classic/external.js
|
|
23262
23078
|
var exports_external2 = {};
|
|
23263
23079
|
__export(exports_external2, {
|
|
@@ -23435,7 +23251,7 @@ __export(exports_external2, {
|
|
|
23435
23251
|
minSize: () => _minSize2,
|
|
23436
23252
|
multipleOf: () => _multipleOf2,
|
|
23437
23253
|
nan: () => nan2,
|
|
23438
|
-
nanoid: () =>
|
|
23254
|
+
nanoid: () => nanoid5,
|
|
23439
23255
|
nativeEnum: () => nativeEnum2,
|
|
23440
23256
|
negative: () => _negative2,
|
|
23441
23257
|
never: () => never2,
|
|
@@ -25154,7 +24970,7 @@ __export(exports_regexes2, {
|
|
|
25154
24970
|
md5_base64: () => md5_base642,
|
|
25155
24971
|
md5_base64url: () => md5_base64url2,
|
|
25156
24972
|
md5_hex: () => md5_hex2,
|
|
25157
|
-
nanoid: () =>
|
|
24973
|
+
nanoid: () => nanoid4,
|
|
25158
24974
|
nanoidOfLength: () => nanoidOfLength2,
|
|
25159
24975
|
null: () => _null4,
|
|
25160
24976
|
number: () => number4,
|
|
@@ -25188,7 +25004,7 @@ var cuid23 = /^[0-9a-z]+$/;
|
|
|
25188
25004
|
var ulid3 = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
25189
25005
|
var xid3 = /^[0-9a-vA-V]{20}$/;
|
|
25190
25006
|
var ksuid3 = /^[A-Za-z0-9]{27}$/;
|
|
25191
|
-
var
|
|
25007
|
+
var nanoid4 = /^[a-zA-Z0-9_-]{21}$/;
|
|
25192
25008
|
function nanoidOfLength2(length) {
|
|
25193
25009
|
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
25194
25010
|
}
|
|
@@ -26137,7 +25953,7 @@ var $ZodEmoji2 = /* @__PURE__ */ $constructor2("$ZodEmoji", (inst, def) => {
|
|
|
26137
25953
|
var $ZodNanoID2 = /* @__PURE__ */ $constructor2("$ZodNanoID", (inst, def) => {
|
|
26138
25954
|
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
26139
25955
|
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
26140
|
-
def.pattern ?? (def.pattern = def.length === undefined ?
|
|
25956
|
+
def.pattern ?? (def.pattern = def.length === undefined ? nanoid4 : nanoidOfLength2(def.length));
|
|
26141
25957
|
$ZodStringFormat2.init(inst, def);
|
|
26142
25958
|
});
|
|
26143
25959
|
var $ZodCUID3 = /* @__PURE__ */ $constructor2("$ZodCUID", (inst, def) => {
|
|
@@ -39515,7 +39331,7 @@ __export(exports_schemas4, {
|
|
|
39515
39331
|
map: () => map3,
|
|
39516
39332
|
meta: () => meta4,
|
|
39517
39333
|
nan: () => nan2,
|
|
39518
|
-
nanoid: () =>
|
|
39334
|
+
nanoid: () => nanoid5,
|
|
39519
39335
|
nativeEnum: () => nativeEnum2,
|
|
39520
39336
|
never: () => never2,
|
|
39521
39337
|
nonoptional: () => nonoptional2,
|
|
@@ -40045,7 +39861,7 @@ var ZodNanoID2 = /* @__PURE__ */ $constructor2("ZodNanoID", (inst, def) => {
|
|
|
40045
39861
|
$ZodNanoID2.init(inst, def);
|
|
40046
39862
|
ZodStringFormat2.init(inst, def);
|
|
40047
39863
|
});
|
|
40048
|
-
function
|
|
39864
|
+
function nanoid5(params) {
|
|
40049
39865
|
return _nanoid2(ZodNanoID2, params);
|
|
40050
39866
|
}
|
|
40051
39867
|
var ZodCUID3 = /* @__PURE__ */ $constructor2("ZodCUID", (inst, def) => {
|
|
@@ -41859,6 +41675,11 @@ var SERVERS = {
|
|
|
41859
41675
|
name: "CN",
|
|
41860
41676
|
url: "https://media.302ai.cn"
|
|
41861
41677
|
},
|
|
41678
|
+
staging: {
|
|
41679
|
+
key: "staging",
|
|
41680
|
+
name: "Staging",
|
|
41681
|
+
url: "https://media.tool302.com"
|
|
41682
|
+
},
|
|
41862
41683
|
local: {
|
|
41863
41684
|
key: "local",
|
|
41864
41685
|
name: "Local",
|
|
@@ -41868,6 +41689,14 @@ var SERVERS = {
|
|
|
41868
41689
|
function getDefaultApiBaseUrl() {
|
|
41869
41690
|
return SERVERS.default.url;
|
|
41870
41691
|
}
|
|
41692
|
+
function isPrereleaseVersion(version3) {
|
|
41693
|
+
const plusIndex = version3.indexOf("+");
|
|
41694
|
+
const versionCore = plusIndex === -1 ? version3 : version3.slice(0, plusIndex);
|
|
41695
|
+
return versionCore.includes("-");
|
|
41696
|
+
}
|
|
41697
|
+
function isStagingServerExposed(version3 = package_default.version) {
|
|
41698
|
+
return isPrereleaseVersion(version3);
|
|
41699
|
+
}
|
|
41871
41700
|
function getDefaultConfigDir() {
|
|
41872
41701
|
if (process.env.XDG_CONFIG_HOME) {
|
|
41873
41702
|
return join2(process.env.XDG_CONFIG_HOME, "302ai-media-studio");
|
|
@@ -41930,7 +41759,7 @@ function saveAuthFile(data) {
|
|
|
41930
41759
|
const dir = getConfigDir();
|
|
41931
41760
|
mkdirSync(dir, { recursive: true });
|
|
41932
41761
|
const authPath = getAuthFilePath();
|
|
41933
|
-
const tmpPath = `${authPath}.${
|
|
41762
|
+
const tmpPath = `${authPath}.${nanoid3()}.tmp`;
|
|
41934
41763
|
writeFileSync(tmpPath, JSON.stringify(data, null, 2), "utf8");
|
|
41935
41764
|
chmodSync(tmpPath, 384);
|
|
41936
41765
|
renameSync(tmpPath, authPath);
|
|
@@ -41953,7 +41782,7 @@ function saveConfigFile(data) {
|
|
|
41953
41782
|
const dir = getConfigDir();
|
|
41954
41783
|
mkdirSync(dir, { recursive: true });
|
|
41955
41784
|
const configPath = getConfigFilePath();
|
|
41956
|
-
const tmpPath = `${configPath}.${
|
|
41785
|
+
const tmpPath = `${configPath}.${nanoid3()}.tmp`;
|
|
41957
41786
|
writeFileSync(tmpPath, JSON.stringify(data, null, 2), "utf8");
|
|
41958
41787
|
chmodSync(tmpPath, 384);
|
|
41959
41788
|
renameSync(tmpPath, configPath);
|
|
@@ -42094,7 +41923,7 @@ function isSessionGoneError(err) {
|
|
|
42094
41923
|
return err.body.includes(ERR_SESSION_EXPIRED);
|
|
42095
41924
|
}
|
|
42096
41925
|
async function provisionSession(options) {
|
|
42097
|
-
const sessionId =
|
|
41926
|
+
const sessionId = nanoid3();
|
|
42098
41927
|
const client = createMediaStudioClient({
|
|
42099
41928
|
baseUrl: options.apiBaseUrl,
|
|
42100
41929
|
apiKey: options.apiKey,
|
|
@@ -43927,7 +43756,7 @@ function shutdownServer(server) {
|
|
|
43927
43756
|
server.close();
|
|
43928
43757
|
}
|
|
43929
43758
|
async function runLoopbackLogin(opts) {
|
|
43930
|
-
const state = opts.state ??
|
|
43759
|
+
const state = opts.state ?? nanoid3();
|
|
43931
43760
|
const opener = opts.openBrowser ?? defaultOpenBrowser;
|
|
43932
43761
|
const timeoutMs = opts.timeoutMs ?? 120000;
|
|
43933
43762
|
return new Promise((resolve, reject2) => {
|
|
@@ -43991,6 +43820,7 @@ async function runLoopbackLogin(opts) {
|
|
|
43991
43820
|
var REGION_MAP = {
|
|
43992
43821
|
default: SERVERS.default.url,
|
|
43993
43822
|
cn: SERVERS.cn.url,
|
|
43823
|
+
...isStagingServerExposed() ? { staging: SERVERS.staging.url } : {},
|
|
43994
43824
|
local: SERVERS.local.url,
|
|
43995
43825
|
dev: SERVERS.local.url
|
|
43996
43826
|
};
|
|
@@ -44007,7 +43837,7 @@ var loginCommand = defineCommand({
|
|
|
44007
43837
|
},
|
|
44008
43838
|
region: {
|
|
44009
43839
|
type: "string",
|
|
44010
|
-
description: "Server region: 'default', 'cn', or 'local'"
|
|
43840
|
+
description: isStagingServerExposed() ? "Server region: 'default', 'cn', 'staging', or 'local'" : "Server region: 'default', 'cn', or 'local'"
|
|
44011
43841
|
}
|
|
44012
43842
|
},
|
|
44013
43843
|
run: async ({ args }) => {
|
|
@@ -44035,6 +43865,12 @@ var loginCommand = defineCommand({
|
|
|
44035
43865
|
{ label: SERVERS.default.name, value: SERVERS.default.url },
|
|
44036
43866
|
{ label: SERVERS.cn.name, value: SERVERS.cn.url }
|
|
44037
43867
|
];
|
|
43868
|
+
if (isStagingServerExposed()) {
|
|
43869
|
+
options.push({
|
|
43870
|
+
label: SERVERS.staging.name,
|
|
43871
|
+
value: SERVERS.staging.url
|
|
43872
|
+
});
|
|
43873
|
+
}
|
|
44038
43874
|
if (false) {}
|
|
44039
43875
|
if (process.env.CI || false || !process.stdin.isTTY) {
|
|
44040
43876
|
targetApiUrl = SERVERS.default.url;
|
package/package.json
CHANGED