@prestyj/core 5.30.2 → 5.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +161 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -1
- package/dist/index.d.ts +82 -1
- package/dist/index.js +157 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AUTH_PROVIDERS: () => AUTH_PROVIDERS,
|
|
33
34
|
AuthStorage: () => AuthStorage,
|
|
34
35
|
DEFAULT_LOCAL_ENDPOINTS: () => DEFAULT_LOCAL_ENDPOINTS,
|
|
35
36
|
DEFAULT_MAX_VIDEO_BYTES: () => DEFAULT_MAX_VIDEO_BYTES,
|
|
@@ -44,6 +45,7 @@ __export(index_exports, {
|
|
|
44
45
|
TelegramBot: () => TelegramBot,
|
|
45
46
|
XAI_OAUTH_KEY: () => XAI_OAUTH_KEY,
|
|
46
47
|
XIAOMI_CREDITS_KEY: () => XIAOMI_CREDITS_KEY,
|
|
48
|
+
authPriorityNote: () => authPriorityNote,
|
|
47
49
|
clampThinkingForPlanMode: () => clampThinkingForPlanMode,
|
|
48
50
|
clearLocalDiscoveryCache: () => clearLocalDiscoveryCache,
|
|
49
51
|
clearRuntimeModels: () => clearRuntimeModels,
|
|
@@ -51,6 +53,7 @@ __export(index_exports, {
|
|
|
51
53
|
compareClaudeCodeVersions: () => compareClaudeCodeVersions,
|
|
52
54
|
createAutoUpdater: () => createAutoUpdater,
|
|
53
55
|
decodeOggOpus: () => decodeOggOpus,
|
|
56
|
+
describeAuthMethods: () => describeAuthMethods,
|
|
54
57
|
discoverLocalModels: () => discoverLocalModels,
|
|
55
58
|
downmixToMono: () => downmixToMono,
|
|
56
59
|
dualAuthProvider: () => dualAuthProvider,
|
|
@@ -62,6 +65,7 @@ __export(index_exports, {
|
|
|
62
65
|
generatePKCE: () => generatePKCE,
|
|
63
66
|
getAllModels: () => getAllModels,
|
|
64
67
|
getAppPaths: () => getAppPaths,
|
|
68
|
+
getAuthProvider: () => getAuthProvider,
|
|
65
69
|
getAuthStorageKey: () => getAuthStorageKey,
|
|
66
70
|
getAuthStorageKeys: () => getAuthStorageKeys,
|
|
67
71
|
getClaudeCliUserAgent: () => getClaudeCliUserAgent,
|
|
@@ -3327,6 +3331,159 @@ function findProbedModel(probes, modelId) {
|
|
|
3327
3331
|
return void 0;
|
|
3328
3332
|
}
|
|
3329
3333
|
|
|
3334
|
+
// src/auth-providers.ts
|
|
3335
|
+
var AUTH_PROVIDERS = [
|
|
3336
|
+
{
|
|
3337
|
+
value: "anthropic",
|
|
3338
|
+
label: "Anthropic",
|
|
3339
|
+
description: "Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5",
|
|
3340
|
+
methods: ["oauth"]
|
|
3341
|
+
},
|
|
3342
|
+
{
|
|
3343
|
+
value: "openai",
|
|
3344
|
+
label: "OpenAI",
|
|
3345
|
+
description: "GPT-6 Astra, GPT-6.1 Sol, GPT-6 Luna",
|
|
3346
|
+
methods: ["oauth"]
|
|
3347
|
+
},
|
|
3348
|
+
{
|
|
3349
|
+
value: "gemini",
|
|
3350
|
+
label: "Gemini",
|
|
3351
|
+
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.7 Flash, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
|
|
3352
|
+
methods: ["oauth"]
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
value: "xai",
|
|
3356
|
+
label: "xAI (Grok)",
|
|
3357
|
+
description: "Grok 4.7 \xB7 OAuth or API key",
|
|
3358
|
+
methods: ["oauth", "apikey"],
|
|
3359
|
+
apiKeyLabel: "xAI",
|
|
3360
|
+
methodDetails: {
|
|
3361
|
+
oauth: {
|
|
3362
|
+
method: "oauth",
|
|
3363
|
+
label: "Sign in with Grok",
|
|
3364
|
+
billing: "Included with SuperGrok or X Premium.",
|
|
3365
|
+
when: ""
|
|
3366
|
+
},
|
|
3367
|
+
apikey: {
|
|
3368
|
+
method: "apikey",
|
|
3369
|
+
label: "xAI API key",
|
|
3370
|
+
billing: "Pay-per-token on console.x.ai credits.",
|
|
3371
|
+
when: ""
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
},
|
|
3375
|
+
{
|
|
3376
|
+
value: "moonshot",
|
|
3377
|
+
label: "Moonshot",
|
|
3378
|
+
description: "Kimi K3, K2.8 Preview (Kimi sign-in), K2.7 Code, K2.7 Code HighSpeed \xB7 OAuth or API key",
|
|
3379
|
+
methods: ["oauth", "apikey"],
|
|
3380
|
+
apiKeyLabel: "Moonshot",
|
|
3381
|
+
methodDetails: {
|
|
3382
|
+
oauth: {
|
|
3383
|
+
method: "oauth",
|
|
3384
|
+
label: "Sign in with Kimi",
|
|
3385
|
+
billing: "Included with a Kimi For Coding plan.",
|
|
3386
|
+
when: ""
|
|
3387
|
+
},
|
|
3388
|
+
apikey: {
|
|
3389
|
+
method: "apikey",
|
|
3390
|
+
label: "Moonshot API key",
|
|
3391
|
+
billing: "Pay-per-token on Moonshot credits.",
|
|
3392
|
+
when: ""
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
},
|
|
3396
|
+
{
|
|
3397
|
+
value: "glm",
|
|
3398
|
+
label: "Z.AI (GLM)",
|
|
3399
|
+
description: "GLM-5.3, GLM-5.3-Flash",
|
|
3400
|
+
methods: ["apikey"],
|
|
3401
|
+
apiKeyLabel: "Z.AI"
|
|
3402
|
+
},
|
|
3403
|
+
{
|
|
3404
|
+
value: "minimax",
|
|
3405
|
+
label: "MiniMax",
|
|
3406
|
+
description: "MiniMax M3",
|
|
3407
|
+
methods: ["apikey"],
|
|
3408
|
+
apiKeyLabel: "MiniMax"
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
value: "xiaomi",
|
|
3412
|
+
label: "Xiaomi (MiMo)",
|
|
3413
|
+
description: "MiMo-V2.6-Pro, MiMo-V2.6-Flash, MiMo-V2.6-Pro-UltraSpeed \xB7 Token Plan or API Credits",
|
|
3414
|
+
methods: ["apikey"],
|
|
3415
|
+
apiKeyLabel: "Xiaomi MiMo",
|
|
3416
|
+
apiKeyBaseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
3417
|
+
apiKeyVariants: [
|
|
3418
|
+
{
|
|
3419
|
+
key: "xiaomi",
|
|
3420
|
+
label: "Token Plan",
|
|
3421
|
+
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1"
|
|
3422
|
+
},
|
|
3423
|
+
{
|
|
3424
|
+
key: XIAOMI_CREDITS_KEY,
|
|
3425
|
+
label: "API Credits (required for UltraSpeed)",
|
|
3426
|
+
baseUrl: "https://api.xiaomimimo.com/v1"
|
|
3427
|
+
}
|
|
3428
|
+
]
|
|
3429
|
+
},
|
|
3430
|
+
{
|
|
3431
|
+
value: "deepseek",
|
|
3432
|
+
label: "DeepSeek",
|
|
3433
|
+
description: "DeepSeek V4 Pro, V4.1 Flash",
|
|
3434
|
+
methods: ["apikey"],
|
|
3435
|
+
apiKeyLabel: "DeepSeek"
|
|
3436
|
+
},
|
|
3437
|
+
{
|
|
3438
|
+
value: "sakana",
|
|
3439
|
+
label: "Sakana (Fugu)",
|
|
3440
|
+
description: "Fugu, Fugu Max, Fugu Ultra",
|
|
3441
|
+
methods: ["apikey"],
|
|
3442
|
+
apiKeyLabel: "Sakana"
|
|
3443
|
+
},
|
|
3444
|
+
{
|
|
3445
|
+
value: "openrouter",
|
|
3446
|
+
label: "OpenRouter",
|
|
3447
|
+
description: "Qwen3.8 Max \xB7 multi-provider gateway",
|
|
3448
|
+
methods: ["apikey"],
|
|
3449
|
+
apiKeyLabel: "OpenRouter"
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
value: "huggingface",
|
|
3453
|
+
label: "Hugging Face",
|
|
3454
|
+
description: "Kimi K2.7 Code, DeepSeek V4.1 Flash, GPT-OSS 120B",
|
|
3455
|
+
methods: ["apikey"],
|
|
3456
|
+
apiKeyLabel: "Hugging Face"
|
|
3457
|
+
}
|
|
3458
|
+
];
|
|
3459
|
+
function getAuthProvider(value) {
|
|
3460
|
+
return AUTH_PROVIDERS.find((p) => p.value === value);
|
|
3461
|
+
}
|
|
3462
|
+
function describeAuthMethods(provider) {
|
|
3463
|
+
const meta = getAuthProvider(provider);
|
|
3464
|
+
if (!meta) return [];
|
|
3465
|
+
return meta.methods.map((method) => {
|
|
3466
|
+
const override = meta.methodDetails?.[method];
|
|
3467
|
+
if (override) return { ...override };
|
|
3468
|
+
return method === "oauth" ? {
|
|
3469
|
+
method,
|
|
3470
|
+
label: `Sign in with ${meta.label}`,
|
|
3471
|
+
billing: "Uses your existing plan with this provider.",
|
|
3472
|
+
when: ""
|
|
3473
|
+
} : {
|
|
3474
|
+
method,
|
|
3475
|
+
label: `${meta.apiKeyLabel ?? meta.label} API key`,
|
|
3476
|
+
billing: "Pay-per-token on this provider's API credits.",
|
|
3477
|
+
when: ""
|
|
3478
|
+
};
|
|
3479
|
+
});
|
|
3480
|
+
}
|
|
3481
|
+
function authPriorityNote(provider) {
|
|
3482
|
+
const dual = dualAuthProvider(provider);
|
|
3483
|
+
if (!dual) return void 0;
|
|
3484
|
+
return `Uses ${dual.oauthLabel} first; the ${dual.apiKeyLabel} takes over when it runs out, then switches back.`;
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3330
3487
|
// src/provider-usage.ts
|
|
3331
3488
|
var SubscriptionUsageError = class extends Error {
|
|
3332
3489
|
constructor(message, status, retryAfterMs2) {
|
|
@@ -4063,6 +4220,7 @@ function createAutoUpdater(config) {
|
|
|
4063
4220
|
}
|
|
4064
4221
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4065
4222
|
0 && (module.exports = {
|
|
4223
|
+
AUTH_PROVIDERS,
|
|
4066
4224
|
AuthStorage,
|
|
4067
4225
|
DEFAULT_LOCAL_ENDPOINTS,
|
|
4068
4226
|
DEFAULT_MAX_VIDEO_BYTES,
|
|
@@ -4077,6 +4235,7 @@ function createAutoUpdater(config) {
|
|
|
4077
4235
|
TelegramBot,
|
|
4078
4236
|
XAI_OAUTH_KEY,
|
|
4079
4237
|
XIAOMI_CREDITS_KEY,
|
|
4238
|
+
authPriorityNote,
|
|
4080
4239
|
clampThinkingForPlanMode,
|
|
4081
4240
|
clearLocalDiscoveryCache,
|
|
4082
4241
|
clearRuntimeModels,
|
|
@@ -4084,6 +4243,7 @@ function createAutoUpdater(config) {
|
|
|
4084
4243
|
compareClaudeCodeVersions,
|
|
4085
4244
|
createAutoUpdater,
|
|
4086
4245
|
decodeOggOpus,
|
|
4246
|
+
describeAuthMethods,
|
|
4087
4247
|
discoverLocalModels,
|
|
4088
4248
|
downmixToMono,
|
|
4089
4249
|
dualAuthProvider,
|
|
@@ -4095,6 +4255,7 @@ function createAutoUpdater(config) {
|
|
|
4095
4255
|
generatePKCE,
|
|
4096
4256
|
getAllModels,
|
|
4097
4257
|
getAppPaths,
|
|
4258
|
+
getAuthProvider,
|
|
4098
4259
|
getAuthStorageKey,
|
|
4099
4260
|
getAuthStorageKeys,
|
|
4100
4261
|
getClaudeCliUserAgent,
|