dsh-xdpool 2.7.4 → 3.0.0
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/CHANGELOG.md +151 -0
- package/assets/dashboard.png +0 -0
- package/lib/bin.js +425 -11
- package/lib/client.js +15716 -14212
- package/lib/index.d.ts +136 -4
- package/lib/index.js +11648 -1160
- package/package.json +6 -3
- package/scripts/extract-design-css.mjs +322 -0
- package/scripts/link-host-peers.mjs +3 -3
- package/scripts/make-rail-icons.mjs +46 -0
- package/scripts/probe-channels.mjs +142 -0
package/lib/bin.js
CHANGED
|
@@ -1354,7 +1354,22 @@ var WorkBuddyUpstreamClient = class {
|
|
|
1354
1354
|
const parsed = parseUpstreamModel(model);
|
|
1355
1355
|
if (parsed !== void 0) byId.set(parsed.id, parsed);
|
|
1356
1356
|
}
|
|
1357
|
-
|
|
1357
|
+
/**
|
|
1358
|
+
* Every modelled entry, not just the CLI agent's whitelist.
|
|
1359
|
+
*
|
|
1360
|
+
* The payload carries 13 agents and one of them — `cli` — lists the 16 models IT offers.
|
|
1361
|
+
* Applying that as a filter was inherited from a client that only ever served that agent,
|
|
1362
|
+
* and it hid half the catalogue: models an account can call (`hunyuan-chat`, `glm-5.0`,
|
|
1363
|
+
* `deepseek-v3-2-volc`, the `fast/balanced/deep` aliases) never reached the picker, which
|
|
1364
|
+
* read as "the refresh found nothing new".
|
|
1365
|
+
*
|
|
1366
|
+
* The whitelist is still consulted, but only to ORDER: a model the CLI agent offers is one
|
|
1367
|
+
* the vendor considers first-class, so it stays at the front. Nothing is dropped for being
|
|
1368
|
+
* absent from it.
|
|
1369
|
+
*/
|
|
1370
|
+
const whitelisted = new Set(cliIds ?? []);
|
|
1371
|
+
const all = [...byId.values()];
|
|
1372
|
+
const models = all.length === 0 ? [] : [...all.filter((model) => whitelisted.has(model.id)), ...all.filter((model) => !whitelisted.has(model.id))];
|
|
1358
1373
|
if (models.length === 0) throw new Error("workbuddy model catalog resolved to an empty list");
|
|
1359
1374
|
return models;
|
|
1360
1375
|
}
|
|
@@ -3065,6 +3080,15 @@ function ensureAtRestKeys() {
|
|
|
3065
3080
|
return inflightKeys;
|
|
3066
3081
|
}
|
|
3067
3082
|
/**
|
|
3083
|
+
* The desktop app's at-rest field key for a given key id, or undefined when no
|
|
3084
|
+
* installed build yielded that key (app not installed, an older build without
|
|
3085
|
+
* the native module, a future build that rotates the payload, or every probe
|
|
3086
|
+
* failed within the backoff window).
|
|
3087
|
+
*/
|
|
3088
|
+
function readAtRestKeyById(keyId) {
|
|
3089
|
+
return ensureAtRestKeys().then(() => atRestKeyById.get(keyId));
|
|
3090
|
+
}
|
|
3091
|
+
/**
|
|
3068
3092
|
* Synchronous key lookup for a key id already loaded by {@link ensureAtRestKeys}.
|
|
3069
3093
|
*
|
|
3070
3094
|
* The account pool warms the cache up front (via {@link readAtRestKey}) and then
|
|
@@ -3474,7 +3498,20 @@ async function skipReasonFor(path) {
|
|
|
3474
3498
|
} catch {
|
|
3475
3499
|
return "unreadable";
|
|
3476
3500
|
}
|
|
3477
|
-
if (text.includes("\"$wbEncrypted\""))
|
|
3501
|
+
if (text.includes("\"$wbEncrypted\"")) {
|
|
3502
|
+
/**
|
|
3503
|
+
* Distinguish "the key is not loaded yet" from "the key no longer exists".
|
|
3504
|
+
*
|
|
3505
|
+
* The envelope records the keyId it was sealed under; asking for that id answers
|
|
3506
|
+
* whether an installed build can ever produce it. When it cannot, the desktop app is
|
|
3507
|
+
* not the problem and starting it is wasted effort.
|
|
3508
|
+
*/
|
|
3509
|
+
const sealedUnder = /"keyId"\s*:\s*"([0-9a-f]{16})"/u.exec(text)?.[1];
|
|
3510
|
+
if (sealedUnder !== void 0) {
|
|
3511
|
+
if (await readAtRestKeyById(sealedUnder) === void 0) return "key-rotated";
|
|
3512
|
+
}
|
|
3513
|
+
return "encrypted";
|
|
3514
|
+
}
|
|
3478
3515
|
let parsed;
|
|
3479
3516
|
try {
|
|
3480
3517
|
parsed = JSON.parse(text);
|
|
@@ -3589,6 +3626,14 @@ function isCredentialDeadError(error) {
|
|
|
3589
3626
|
var WorkBuddyAccountPool = class {
|
|
3590
3627
|
logger;
|
|
3591
3628
|
authDirs;
|
|
3629
|
+
/**
|
|
3630
|
+
* The directories the CALLER named, or undefined when the plugin guessed them.
|
|
3631
|
+
*
|
|
3632
|
+
* Only an explicit list is scanned now: the default pointed at the desktop app's credential
|
|
3633
|
+
* store, which no account arrives from any more. Keeping the distinction means the import
|
|
3634
|
+
* path and the tests can still point the pool at a directory.
|
|
3635
|
+
*/
|
|
3636
|
+
explicitAuthDirs;
|
|
3592
3637
|
cooldownMs;
|
|
3593
3638
|
/**
|
|
3594
3639
|
* How long an account stays out of rotation after the upstream reports its
|
|
@@ -3774,6 +3819,8 @@ var WorkBuddyAccountPool = class {
|
|
|
3774
3819
|
constructor(options = {}) {
|
|
3775
3820
|
this.logger = options.logger;
|
|
3776
3821
|
this.authDirs = options.authDirs ?? candidateAuthDirs();
|
|
3822
|
+
/** Whether the caller named the directories, rather than the plugin guessing them. */
|
|
3823
|
+
this.explicitAuthDirs = options.authDirs;
|
|
3777
3824
|
this.cooldownMs = options.cooldownMs ?? 6e4;
|
|
3778
3825
|
this.exhaustCooldownMs = options.exhaustCooldownMs ?? EXHAUST_COOLDOWN_MS;
|
|
3779
3826
|
this.credentialDeadCooldownMs = options.credentialDeadCooldownMs ?? CREDENTIAL_DEAD_COOLDOWN_MS;
|
|
@@ -3882,7 +3929,31 @@ var WorkBuddyAccountPool = class {
|
|
|
3882
3929
|
async scan() {
|
|
3883
3930
|
const found = [];
|
|
3884
3931
|
const skipped = [];
|
|
3885
|
-
|
|
3932
|
+
/**
|
|
3933
|
+
* Only the plugin's own snapshot directory is scanned (2.7.7).
|
|
3934
|
+
*
|
|
3935
|
+
* `authDirs` pointed at the desktop app's credential store, which is how this plugin started:
|
|
3936
|
+
* every account came from a file the WorkBuddy client had written. That is no longer how any
|
|
3937
|
+
* account arrives — a scan login writes `channel-pack:buddy:BUDDY_ACCOUNT_*`, and the pack
|
|
3938
|
+
* serves it — so reading the desktop store only produced DUPLICATE entries for accounts the
|
|
3939
|
+
* user had already signed into, with a second credential to keep fresh.
|
|
3940
|
+
*
|
|
3941
|
+
* The snapshots directory stays: `import` writes deliberate copies there, and every file in
|
|
3942
|
+
* it is an account the user parked on purpose.
|
|
3943
|
+
*
|
|
3944
|
+
* The UI is untouched: the pool still lists, names, measures and switches whatever accounts
|
|
3945
|
+
* exist; only the ONE source that nothing uses any more is gone.
|
|
3946
|
+
*/
|
|
3947
|
+
/**
|
|
3948
|
+
* Scan the plugin's snapshots, plus any directory the caller EXPLICITLY supplied.
|
|
3949
|
+
*
|
|
3950
|
+
* `authDirs` is no longer discovered by default (see above), but the option is kept: it is
|
|
3951
|
+
* how a caller points the pool at a directory of its own — the import path does, and so do
|
|
3952
|
+
* the tests that prove one unreadable file cannot empty the pool. Removing the parameter
|
|
3953
|
+
* would remove the only way to exercise that.
|
|
3954
|
+
*/
|
|
3955
|
+
const explicit = this.explicitAuthDirs;
|
|
3956
|
+
const scanDirs = explicit === void 0 ? [snapshotDirPath()] : [snapshotDirPath(), ...explicit];
|
|
3886
3957
|
for (const dir of scanDirs) {
|
|
3887
3958
|
const files = dir === snapshotDirPath() ? await snapshotFilesIn(dir) : await authFilesIn(dir);
|
|
3888
3959
|
for (const file of files) {
|
|
@@ -5012,6 +5083,96 @@ const DEFAULT_AUTOMATION_HOURS = {
|
|
|
5012
5083
|
travel: [9, 21],
|
|
5013
5084
|
compensation: [13]
|
|
5014
5085
|
};
|
|
5086
|
+
Object.entries({
|
|
5087
|
+
"monkeycode-basic/deepseek-flash": {
|
|
5088
|
+
name: "DeepSeek Flash(basic 额度)",
|
|
5089
|
+
contextWindow: 1048576,
|
|
5090
|
+
maxOutputTokens: 8192,
|
|
5091
|
+
reasoning: true
|
|
5092
|
+
},
|
|
5093
|
+
"monkeycode-basic/deepseek-v4-flash": {
|
|
5094
|
+
name: "DeepSeek V4 Flash(basic 额度)",
|
|
5095
|
+
contextWindow: 1048576,
|
|
5096
|
+
maxOutputTokens: 8192,
|
|
5097
|
+
reasoning: true
|
|
5098
|
+
},
|
|
5099
|
+
"monkeycode-pro/deepseek-flash": {
|
|
5100
|
+
name: "DeepSeek Flash(pro 额度)",
|
|
5101
|
+
contextWindow: 1048576,
|
|
5102
|
+
maxOutputTokens: 8192,
|
|
5103
|
+
reasoning: true
|
|
5104
|
+
},
|
|
5105
|
+
"monkeycode-pro/deepseek-v4-pro": {
|
|
5106
|
+
name: "DeepSeek V4 Pro(pro 额度)",
|
|
5107
|
+
contextWindow: 1048576,
|
|
5108
|
+
maxOutputTokens: 8192,
|
|
5109
|
+
reasoning: true
|
|
5110
|
+
},
|
|
5111
|
+
"monkeycode-ultra/deepseek-v4-pro": {
|
|
5112
|
+
name: "DeepSeek V4 Pro(ultra 额度)",
|
|
5113
|
+
contextWindow: 1048576,
|
|
5114
|
+
maxOutputTokens: 8192,
|
|
5115
|
+
reasoning: true
|
|
5116
|
+
},
|
|
5117
|
+
"deepseek-flash": {
|
|
5118
|
+
name: "DeepSeek Flash(按积分计费)",
|
|
5119
|
+
contextWindow: 1048576,
|
|
5120
|
+
maxOutputTokens: 8192,
|
|
5121
|
+
reasoning: true
|
|
5122
|
+
},
|
|
5123
|
+
"deepseek-v4-flash": {
|
|
5124
|
+
name: "DeepSeek V4 Flash(按积分计费)",
|
|
5125
|
+
contextWindow: 1048576,
|
|
5126
|
+
maxOutputTokens: 8192,
|
|
5127
|
+
reasoning: true
|
|
5128
|
+
},
|
|
5129
|
+
"deepseek-v4-pro": {
|
|
5130
|
+
name: "DeepSeek V4 Pro(按积分计费)",
|
|
5131
|
+
contextWindow: 1048576,
|
|
5132
|
+
maxOutputTokens: 8192,
|
|
5133
|
+
reasoning: true
|
|
5134
|
+
},
|
|
5135
|
+
/**
|
|
5136
|
+
* GLM-5, deliberately without the DeepSeek neighbours' window and without `reasoning`.
|
|
5137
|
+
*
|
|
5138
|
+
* Its real window is 128K — declaring 1M would be a fabrication that also moves the host's
|
|
5139
|
+
* overflow threshold past anything the gateway accepts. And this gateway gives it no
|
|
5140
|
+
* controlled thinking ladder, so claiming one makes the host send an effort that is dropped.
|
|
5141
|
+
*/
|
|
5142
|
+
"glm-5": {
|
|
5143
|
+
name: "GLM-5(按积分计费)",
|
|
5144
|
+
contextWindow: 128e3,
|
|
5145
|
+
maxOutputTokens: 8192,
|
|
5146
|
+
reasoning: false
|
|
5147
|
+
}
|
|
5148
|
+
}).map(([id, spec]) => ({
|
|
5149
|
+
id,
|
|
5150
|
+
name: spec.name,
|
|
5151
|
+
contextWindow: spec.contextWindow,
|
|
5152
|
+
maxOutputTokens: spec.maxOutputTokens,
|
|
5153
|
+
reasoning: spec.reasoning
|
|
5154
|
+
}));
|
|
5155
|
+
//#endregion
|
|
5156
|
+
//#region src/magicrew-protocol.ts
|
|
5157
|
+
const MAGICREW_CN = Object.freeze({
|
|
5158
|
+
id: "magicrew",
|
|
5159
|
+
site: "cn",
|
|
5160
|
+
displayName: "超级麦吉",
|
|
5161
|
+
host: "https://i-magic-service.letsmagic.cn",
|
|
5162
|
+
webOrigin: "https://www.letsmagic.cn",
|
|
5163
|
+
needsOrg: false,
|
|
5164
|
+
defaultRef: "magicrew"
|
|
5165
|
+
});
|
|
5166
|
+
const MAGICREW_INTL = Object.freeze({
|
|
5167
|
+
id: "magicrewintl",
|
|
5168
|
+
site: "intl",
|
|
5169
|
+
displayName: "MagiCrew 国际",
|
|
5170
|
+
host: "https://magic-service.magicrew.ai",
|
|
5171
|
+
webOrigin: "https://www.magicrew.ai",
|
|
5172
|
+
needsOrg: true,
|
|
5173
|
+
defaultRef: "magicrewintl"
|
|
5174
|
+
});
|
|
5175
|
+
Object.freeze([MAGICREW_CN, MAGICREW_INTL]);
|
|
5015
5176
|
//#endregion
|
|
5016
5177
|
//#region src/catalog.ts
|
|
5017
5178
|
/**
|
|
@@ -5066,6 +5227,39 @@ const FALLBACK_WORKBUDDY_MODELS = [
|
|
|
5066
5227
|
supportsImages: true,
|
|
5067
5228
|
tags: ["craft"]
|
|
5068
5229
|
},
|
|
5230
|
+
(
|
|
5231
|
+
/**
|
|
5232
|
+
* Hy4 and Hy4 flash, read off the live catalog.
|
|
5233
|
+
*
|
|
5234
|
+
* `hy4std` is the flagship (0.29x) and `hy4flash` its cheap sibling (0.03x); `hy4flash-free`
|
|
5235
|
+
* costs nothing and is what the `hy3` / `hy3-x` ids alias to — the same relationship the live
|
|
5236
|
+
* payload reports in its `aliases` field. The previous table carried only `hy4-preview`, an id
|
|
5237
|
+
* the gateway no longer lists, so a refresh dropped the whole family.
|
|
5238
|
+
*/
|
|
5239
|
+
{
|
|
5240
|
+
id: "hy4std",
|
|
5241
|
+
name: "Hy4",
|
|
5242
|
+
contextWindow: 96e4,
|
|
5243
|
+
maxOutputTokens: 64e3,
|
|
5244
|
+
supportsImages: true,
|
|
5245
|
+
tags: ["craft"]
|
|
5246
|
+
}),
|
|
5247
|
+
{
|
|
5248
|
+
id: "hy4flash",
|
|
5249
|
+
name: "Hy4 flash",
|
|
5250
|
+
contextWindow: 96e4,
|
|
5251
|
+
maxOutputTokens: 64e3,
|
|
5252
|
+
supportsImages: true,
|
|
5253
|
+
supportedEfforts: ["high"]
|
|
5254
|
+
},
|
|
5255
|
+
{
|
|
5256
|
+
id: "hy4flash-free",
|
|
5257
|
+
name: "Hy4 flash",
|
|
5258
|
+
contextWindow: 96e4,
|
|
5259
|
+
maxOutputTokens: 64e3,
|
|
5260
|
+
supportsImages: true,
|
|
5261
|
+
supportedEfforts: ["high"]
|
|
5262
|
+
},
|
|
5069
5263
|
{
|
|
5070
5264
|
id: "hy4-preview",
|
|
5071
5265
|
name: "Hy4 preview",
|
|
@@ -5094,14 +5288,26 @@ const FALLBACK_WORKBUDDY_MODELS = [
|
|
|
5094
5288
|
name: "Space-Bunny",
|
|
5095
5289
|
contextWindow: 1e6,
|
|
5096
5290
|
maxOutputTokens: 64e3,
|
|
5097
|
-
supportsImages: true
|
|
5291
|
+
supportsImages: true,
|
|
5292
|
+
supportedEfforts: [
|
|
5293
|
+
"low",
|
|
5294
|
+
"medium",
|
|
5295
|
+
"high",
|
|
5296
|
+
"xhigh",
|
|
5297
|
+
"max"
|
|
5298
|
+
]
|
|
5098
5299
|
},
|
|
5099
5300
|
{
|
|
5100
5301
|
id: "deepseek-v4.1-flash",
|
|
5101
5302
|
name: "Deepseek-V4.1-Flash",
|
|
5102
5303
|
contextWindow: 1e6,
|
|
5103
5304
|
maxOutputTokens: 128e3,
|
|
5104
|
-
supportsImages: true
|
|
5305
|
+
supportsImages: true,
|
|
5306
|
+
supportedEfforts: [
|
|
5307
|
+
"low",
|
|
5308
|
+
"high",
|
|
5309
|
+
"max"
|
|
5310
|
+
]
|
|
5105
5311
|
},
|
|
5106
5312
|
{
|
|
5107
5313
|
id: "deepseek-v4-pro",
|
|
@@ -5122,14 +5328,24 @@ const FALLBACK_WORKBUDDY_MODELS = [
|
|
|
5122
5328
|
name: "GLM-5.3",
|
|
5123
5329
|
contextWindow: 1e6,
|
|
5124
5330
|
maxOutputTokens: 64e3,
|
|
5125
|
-
supportsImages: true
|
|
5331
|
+
supportsImages: true,
|
|
5332
|
+
supportedEfforts: [
|
|
5333
|
+
"low",
|
|
5334
|
+
"high",
|
|
5335
|
+
"max"
|
|
5336
|
+
]
|
|
5126
5337
|
},
|
|
5127
5338
|
{
|
|
5128
5339
|
id: "glm-5.3-flash",
|
|
5129
5340
|
name: "GLM-5.3-Flash",
|
|
5130
5341
|
contextWindow: 1e6,
|
|
5131
5342
|
maxOutputTokens: 131072,
|
|
5132
|
-
supportsImages: true
|
|
5343
|
+
supportsImages: true,
|
|
5344
|
+
supportedEfforts: [
|
|
5345
|
+
"low",
|
|
5346
|
+
"high",
|
|
5347
|
+
"max"
|
|
5348
|
+
]
|
|
5133
5349
|
},
|
|
5134
5350
|
{
|
|
5135
5351
|
id: "glm-5.2",
|
|
@@ -5158,7 +5374,12 @@ const FALLBACK_WORKBUDDY_MODELS = [
|
|
|
5158
5374
|
name: "Kimi-K3",
|
|
5159
5375
|
contextWindow: 1e6,
|
|
5160
5376
|
maxOutputTokens: 32e3,
|
|
5161
|
-
supportsImages: true
|
|
5377
|
+
supportsImages: true,
|
|
5378
|
+
supportedEfforts: [
|
|
5379
|
+
"low",
|
|
5380
|
+
"high",
|
|
5381
|
+
"max"
|
|
5382
|
+
]
|
|
5162
5383
|
},
|
|
5163
5384
|
{
|
|
5164
5385
|
id: "kimi-k2.8-preview",
|
|
@@ -5210,14 +5431,161 @@ const FALLBACK_WORKBUDDY_MODELS = [
|
|
|
5210
5431
|
* `maxOutputTokens` / `supportsImages` for 25 rows would put fabricated fields in
|
|
5211
5432
|
* front of the user — strictly worse than the shared list it replaces.
|
|
5212
5433
|
*/
|
|
5213
|
-
|
|
5434
|
+
/**
|
|
5435
|
+
* The models only the international gateway serves.
|
|
5436
|
+
*
|
|
5437
|
+
* Read off the live `/v3/config` payload. The table used to be the CN one with the promo badges
|
|
5438
|
+
* stripped, which meant a failed refresh offered none of these — and half of them are the reason
|
|
5439
|
+
* a user picks the international lane at all (GPT-6, Grok, Gemini 4).
|
|
5440
|
+
*/
|
|
5441
|
+
const GLOBAL_ONLY_MODELS = [
|
|
5442
|
+
{
|
|
5443
|
+
id: "default-model",
|
|
5444
|
+
name: "Auto",
|
|
5445
|
+
contextWindow: 176e3,
|
|
5446
|
+
maxOutputTokens: 64e3,
|
|
5447
|
+
supportsImages: true
|
|
5448
|
+
},
|
|
5449
|
+
{
|
|
5450
|
+
id: "max-model",
|
|
5451
|
+
name: "Max",
|
|
5452
|
+
contextWindow: 272e3,
|
|
5453
|
+
maxOutputTokens: 64e3,
|
|
5454
|
+
supportsImages: true
|
|
5455
|
+
},
|
|
5456
|
+
{
|
|
5457
|
+
id: "deepseek-v4.1-flash-sg",
|
|
5458
|
+
name: "Deepseek-V4.1-Flash",
|
|
5459
|
+
contextWindow: 1e6,
|
|
5460
|
+
maxOutputTokens: 128e3,
|
|
5461
|
+
supportsImages: true
|
|
5462
|
+
},
|
|
5463
|
+
{
|
|
5464
|
+
id: "gpt-6-astra",
|
|
5465
|
+
name: "GPT-6-Astra",
|
|
5466
|
+
contextWindow: 1e6,
|
|
5467
|
+
maxOutputTokens: 64e3,
|
|
5468
|
+
supportsImages: true
|
|
5469
|
+
},
|
|
5470
|
+
{
|
|
5471
|
+
id: "gpt-6.1-sol",
|
|
5472
|
+
name: "GPT-6.1-Sol",
|
|
5473
|
+
contextWindow: 1e6,
|
|
5474
|
+
maxOutputTokens: 64e3,
|
|
5475
|
+
supportsImages: true
|
|
5476
|
+
},
|
|
5477
|
+
{
|
|
5478
|
+
id: "gpt-6-sol",
|
|
5479
|
+
name: "GPT-6-Sol",
|
|
5480
|
+
contextWindow: 1e6,
|
|
5481
|
+
maxOutputTokens: 64e3,
|
|
5482
|
+
supportsImages: true
|
|
5483
|
+
},
|
|
5484
|
+
{
|
|
5485
|
+
id: "gpt-6-luna",
|
|
5486
|
+
name: "GPT-6-Luna",
|
|
5487
|
+
contextWindow: 1e6,
|
|
5488
|
+
maxOutputTokens: 64e3,
|
|
5489
|
+
supportsImages: true
|
|
5490
|
+
},
|
|
5491
|
+
{
|
|
5492
|
+
id: "gpt-5.6-sol",
|
|
5493
|
+
name: "GPT-5.6-Sol",
|
|
5494
|
+
contextWindow: 1e6,
|
|
5495
|
+
maxOutputTokens: 64e3,
|
|
5496
|
+
supportsImages: true
|
|
5497
|
+
},
|
|
5498
|
+
{
|
|
5499
|
+
id: "gpt-5.6-terra",
|
|
5500
|
+
name: "GPT-5.6-Terra",
|
|
5501
|
+
contextWindow: 1e6,
|
|
5502
|
+
maxOutputTokens: 64e3,
|
|
5503
|
+
supportsImages: true
|
|
5504
|
+
},
|
|
5505
|
+
{
|
|
5506
|
+
id: "gpt-5.6-luna",
|
|
5507
|
+
name: "GPT-5.6-Luna",
|
|
5508
|
+
contextWindow: 1e6,
|
|
5509
|
+
maxOutputTokens: 64e3,
|
|
5510
|
+
supportsImages: true
|
|
5511
|
+
},
|
|
5512
|
+
{
|
|
5513
|
+
id: "grok-4.7",
|
|
5514
|
+
name: "Grok-4.7",
|
|
5515
|
+
contextWindow: 5e5,
|
|
5516
|
+
maxOutputTokens: 64e3,
|
|
5517
|
+
supportsImages: true
|
|
5518
|
+
},
|
|
5519
|
+
{
|
|
5520
|
+
id: "gemini-3.8-flash",
|
|
5521
|
+
name: "Gemini-3.8-Flash",
|
|
5522
|
+
contextWindow: 1e6,
|
|
5523
|
+
maxOutputTokens: 64e3,
|
|
5524
|
+
supportsImages: true
|
|
5525
|
+
},
|
|
5526
|
+
{
|
|
5527
|
+
id: "gemini-4-carbon",
|
|
5528
|
+
name: "Gemini-4-Carbon",
|
|
5529
|
+
contextWindow: 1e6,
|
|
5530
|
+
maxOutputTokens: 64e3,
|
|
5531
|
+
supportsImages: true
|
|
5532
|
+
},
|
|
5533
|
+
{
|
|
5534
|
+
id: "gemini-4-argon",
|
|
5535
|
+
name: "Gemini-4-Argon",
|
|
5536
|
+
contextWindow: 1e6,
|
|
5537
|
+
maxOutputTokens: 64e3,
|
|
5538
|
+
supportsImages: true
|
|
5539
|
+
},
|
|
5540
|
+
{
|
|
5541
|
+
id: "kimi-k3.1-pro",
|
|
5542
|
+
name: "Kimi-K3.1-Pro",
|
|
5543
|
+
contextWindow: 1e6,
|
|
5544
|
+
maxOutputTokens: 64e3,
|
|
5545
|
+
supportsImages: true,
|
|
5546
|
+
supportedEfforts: [
|
|
5547
|
+
"low",
|
|
5548
|
+
"high",
|
|
5549
|
+
"max"
|
|
5550
|
+
]
|
|
5551
|
+
},
|
|
5552
|
+
{
|
|
5553
|
+
id: "kimi-k3.1-pro-highspeed",
|
|
5554
|
+
name: "Kimi-K3.1-Pro-Highspeed",
|
|
5555
|
+
contextWindow: 1e6,
|
|
5556
|
+
maxOutputTokens: 64e3,
|
|
5557
|
+
supportsImages: true
|
|
5558
|
+
},
|
|
5559
|
+
{
|
|
5560
|
+
id: "kimi-k3",
|
|
5561
|
+
name: "Kimi-K3",
|
|
5562
|
+
contextWindow: 1e6,
|
|
5563
|
+
maxOutputTokens: 64e3,
|
|
5564
|
+
supportsImages: true
|
|
5565
|
+
},
|
|
5566
|
+
{
|
|
5567
|
+
id: "minimax-m3.1-flash",
|
|
5568
|
+
name: "MiniMax-M3.1-Flash",
|
|
5569
|
+
contextWindow: 1e6,
|
|
5570
|
+
maxOutputTokens: 64e3,
|
|
5571
|
+
supportsImages: true,
|
|
5572
|
+
supportedEfforts: [
|
|
5573
|
+
"low",
|
|
5574
|
+
"medium",
|
|
5575
|
+
"high",
|
|
5576
|
+
"xhigh",
|
|
5577
|
+
"max"
|
|
5578
|
+
]
|
|
5579
|
+
}
|
|
5580
|
+
];
|
|
5581
|
+
const FALLBACK_WORKBUDDY_MODELS_GLOBAL = [...FALLBACK_WORKBUDDY_MODELS.map((model) => {
|
|
5214
5582
|
const tags = (model.tags ?? []).filter((tag) => !tag.startsWith(BADGE_TAG_PREFIX));
|
|
5215
5583
|
if (tags.length === (model.tags?.length ?? 0)) return model;
|
|
5216
5584
|
return {
|
|
5217
5585
|
...model,
|
|
5218
5586
|
...tags.length === 0 ? {} : { tags }
|
|
5219
5587
|
};
|
|
5220
|
-
});
|
|
5588
|
+
}), ...GLOBAL_ONLY_MODELS];
|
|
5221
5589
|
/** The static fallback table for one region. Defaults to `cn`. */
|
|
5222
5590
|
function fallbackModelsFor(region = "cn") {
|
|
5223
5591
|
return region === "global" ? FALLBACK_WORKBUDDY_MODELS_GLOBAL : FALLBACK_WORKBUDDY_MODELS;
|
|
@@ -5403,7 +5771,35 @@ function toModelInfo(model) {
|
|
|
5403
5771
|
*/
|
|
5404
5772
|
function catalogFromUpstream(models, region = "cn") {
|
|
5405
5773
|
if (models.length === 0) return fallbackModelsFor(region);
|
|
5406
|
-
|
|
5774
|
+
const rows = models.map(toModelInfo);
|
|
5775
|
+
/**
|
|
5776
|
+
* Disambiguate display names the gateway repeats.
|
|
5777
|
+
*
|
|
5778
|
+
* `hy4flash` and `hy4flash-free` are both published as 「Hy4 flash」, so a picker showed two
|
|
5779
|
+
* identical rows and a reader had no way to tell the paid one from the free one. The ids are
|
|
5780
|
+
* distinct, which is what a request uses; only the LABEL needs the suffix.
|
|
5781
|
+
*/
|
|
5782
|
+
const seen = /* @__PURE__ */ new Map();
|
|
5783
|
+
for (const row of rows) seen.set(row.name, (seen.get(row.name) ?? 0) + 1);
|
|
5784
|
+
const used = /* @__PURE__ */ new Map();
|
|
5785
|
+
return rows.map((row) => {
|
|
5786
|
+
if ((seen.get(row.name) ?? 0) <= 1) return row;
|
|
5787
|
+
const at = (used.get(row.name) ?? 0) + 1;
|
|
5788
|
+
used.set(row.name, at);
|
|
5789
|
+
/**
|
|
5790
|
+
* Only the collision counter, not a free marker.
|
|
5791
|
+
*
|
|
5792
|
+
* The 「(免费)」 suffix used to be written into the NAME, so the one fact a reader scans for was
|
|
5793
|
+
* grey text inside the title while the same fact was a green badge on every other card. The free
|
|
5794
|
+
* state is already carried by the tag system (`freeBadgeKind`); the name only needs to
|
|
5795
|
+
* disambiguate two rows that share a display name.
|
|
5796
|
+
*/
|
|
5797
|
+
const suffix = row.id.endsWith("-free") ? "" : `(${String(at)})`;
|
|
5798
|
+
return {
|
|
5799
|
+
...row,
|
|
5800
|
+
name: `${row.name}${suffix}`
|
|
5801
|
+
};
|
|
5802
|
+
});
|
|
5407
5803
|
}
|
|
5408
5804
|
//#endregion
|
|
5409
5805
|
//#region src/channels.ts
|
|
@@ -12310,6 +12706,24 @@ z.object({
|
|
|
12310
12706
|
"sticky",
|
|
12311
12707
|
"expiry"
|
|
12312
12708
|
]).default("priority").description("How requests are spread: priority (drain one), round-robin (in order), balanced (idle-weighted random), sticky (one account per conversation, new conversations rotate), or expiry (spend the account whose credit packs expire soonest)")),
|
|
12709
|
+
/**
|
|
12710
|
+
* Per-channel usage order, overriding `distribution` for that channel alone.
|
|
12711
|
+
*
|
|
12712
|
+
* The pool-wide setting is right for the two WorkBuddy lanes, where the accounts are one
|
|
12713
|
+
* vendor's and one strategy suits them all. It is wrong for a channel with two or three
|
|
12714
|
+
* accounts of its own: draining one CodeArts account first is a different decision from
|
|
12715
|
+
* draining one WorkBuddy account first, and until now there was no way to say so.
|
|
12716
|
+
*
|
|
12717
|
+
* A channel with no entry uses `distribution`, so nothing changes for anyone who does not set
|
|
12718
|
+
* one — the same shape `creditReserves` uses for per-account overrides.
|
|
12719
|
+
*/
|
|
12720
|
+
channelDistribution: asVolatile(z.dict(z.union([
|
|
12721
|
+
"priority",
|
|
12722
|
+
"round-robin",
|
|
12723
|
+
"balanced",
|
|
12724
|
+
"sticky",
|
|
12725
|
+
"expiry"
|
|
12726
|
+
])).default({}).description("Per-channel usage order; a channel with no entry follows the pool-wide setting")),
|
|
12313
12727
|
disabledAccountIds: asVolatile(z.array(z.string()).default([]).description("Account ids excluded from the pool (empty = every discovered account participates)")),
|
|
12314
12728
|
creditReserves: asVolatile(z.dict(z.number().step(1).min(0)).default({}).description("Per-account credit floor: stop using an account once its balance reaches this value")),
|
|
12315
12729
|
enabledModelIds: asVolatile(z.array(z.string()).default([]).description("Legacy shared model-id list; used by a region that has no per-region selection yet")),
|