dsh-xdpool 2.7.5 → 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 +113 -0
- package/assets/dashboard.png +0 -0
- package/lib/bin.js +425 -11
- package/lib/client.js +16328 -14897
- package/lib/index.d.ts +136 -4
- package/lib/index.js +11535 -1232
- 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/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,119 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
本项目的所有重要变更都会记录在此文件。
|
|
3
3
|
版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
## 2.7.6 — 十家新渠道、模型目录修复
|
|
5
|
+
|
|
6
|
+
> 十家新渠道、模型目录修复、账号池接线修复、界面统一。
|
|
7
|
+
|
|
8
|
+
### 十家新渠道(渠道总数 15 → 25)
|
|
9
|
+
|
|
10
|
+
每家都有官方图标、模型目录、上下文窗口、思考档位,能登录、能对话、能看额度。
|
|
11
|
+
|
|
12
|
+
| 渠道 | 登录方式 | 额度 |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| **AStudio 讯飞** | 粘贴桌面端凭据(bearer / cookie / 整段 json 都认) | 每日登录积分,靠流水认定 |
|
|
15
|
+
| **超级麦吉 MagiCrew 国内** | 粘贴登录令牌 | 每日 200 + 新手福利任务一键领取 |
|
|
16
|
+
| **MagiCrew 国际** | 同上(独立账号) | 每日 50 |
|
|
17
|
+
| **Accio 阿里** | 粘贴 access_token | 每日 / 每月 / 推荐三套积分分开 |
|
|
18
|
+
| **七牛云 AI** | API Key | 91 个模型;额度档位自己声明 |
|
|
19
|
+
| **MonkeyCode 国内** | 粘贴会话 Cookie | 积分 + 每日 token |
|
|
20
|
+
| **MonkeyCode 国际** | 同上(独立账号) | 同上 |
|
|
21
|
+
| **百智云** | API Key | 每日临时积分(需解一道本地工作量证明) |
|
|
22
|
+
| **AutoClaw 国际** | 粘贴 accessToken / refreshToken | 奖励 / 每日 / 签约 / 加油包四类钱包 |
|
|
23
|
+
| **AutoClaw 国内** | 同上(独立账号) | 同上 |
|
|
24
|
+
|
|
25
|
+
**没有接入的两家**:Lingxi 与 Dola 的参考实现被作者设为私有,无法接入。
|
|
26
|
+
|
|
27
|
+
### 模型目录
|
|
28
|
+
|
|
29
|
+
- **七牛的目录从 3 个补到 97 个** —— 之前只列了三个限免模型;上游实际服务 91 个,静态表额外保留了 6 个已下线但可能恢复的。
|
|
30
|
+
- **WorkBuddy 国内版从 16 个补到 32 个**(静态表 21 条,其中含 Hy4 三档) —— 上游在响应里带了一份「CLI 客户端」的 16 模型白名单,代码把它当成了过滤器,于是另一半模型永远不出现。现在白名单只用于排序,不再隐藏任何模型。
|
|
31
|
+
- **WorkBuddy 国际版静态表补了 18 个独有模型** —— 之前它直接复制国内表,GPT-6、Grok、Gemini 4 这些「选国际版的理由」在回退时全部消失。
|
|
32
|
+
- **Hy4 系列补齐** —— `hy4std` / `hy4flash` / `hy4flash-free` 之前只在静态表里缺,刷新失败就看不到。
|
|
33
|
+
- **重名修正** —— `hy4flash` 与 `hy4flash-free` 上游都叫「Hy4 flash」,现在后者标注「(免费)」。
|
|
34
|
+
|
|
35
|
+
### 账号池
|
|
36
|
+
|
|
37
|
+
- **登录后选择器立刻出现** —— 宿主会缓存每个渠道的模型列表,只有重新提交 route set 才会重建。之前登录成功但选择器里看不到,必须重启。
|
|
38
|
+
- **并发保存不再丢账号** —— 各渠道的存储都是「读 → 改 → 写」,两个渠道同时保存会互相覆盖,丢掉一个。现在按文件串行化。
|
|
39
|
+
- **换账号不再显示上一个账号的模型** —— 缓存没有记录它属于哪个账号,十分钟内换号后看到的还是旧列表。
|
|
40
|
+
- **假凭据会被拒绝** —— 六家里有三家的「验凭据」其实是假的(AStudio 完全没验证,MagiCrew 保存后才读且不检查结果,Accio 判错了字段),任何字符串都能「登录成功」,直到第一次对话才报错。现在都会先验证再保存。
|
|
41
|
+
- **七牛云的验证换了接口** —— 它之前用 `/v1/models` 验证,而那个接口**匿名可读**,假 key 也能列出 91 个模型。
|
|
42
|
+
|
|
43
|
+
### 界面
|
|
44
|
+
|
|
45
|
+
- **跨渠道的模型隐藏生效了** —— 之前未勾选的模型仍会列出(那是给「按 id 调用」留的后门),现在只列已勾选的。
|
|
46
|
+
- **渠道卡片和 WorkBuddy 卡片同一套排版** —— 按钮行的类名、面板容器、内边距全部对齐。
|
|
47
|
+
- **「账号使用方式」展开在下方** —— 之前用 `display:contents` 让按钮和面板都成为按钮行的子元素,展开的面板挤在按钮之间。
|
|
48
|
+
- **「账号使用方式」和「积分自动化」并到按钮行** —— 不再独占一行把卡片撑高。
|
|
49
|
+
- **模型列表的右侧留白** —— 根因是 `margin-left:22px` 把内容推右而盒子仍占满宽。
|
|
50
|
+
- **渠道模型支持折叠** —— 默认只显示已启用的,底部有「显示其余 N 个」,和 WorkBuddy 一致。
|
|
51
|
+
- **25 家渠道全部有官方图标** —— 从各家官网/参考实现取得;Loomy 用提供的头像。
|
|
52
|
+
- **四组图标首字母冲突修正** —— WorkBuddy 国内/国际、Qoder 国内/国际、AutoClaw 国际/七牛云、AutoClaw 国内/Accio 之前显示成一样的方块。
|
|
53
|
+
- **页面标题改为「渠道」** —— 这一页早已不只是扫码登录。
|
|
54
|
+
|
|
55
|
+
### 其它
|
|
56
|
+
|
|
57
|
+
- **错误信息可读了** —— 之前把上游的原始 JSON 直接塞进卡片(300 字符),现在提取出 `message` 字段;HTML 错误页会剥掉标签。
|
|
58
|
+
- **粘贴错内容时提示准确** —— 粘贴整个网页、`null`、超长文档时,之前会被当成凭据存下,然后在第一次调用时报 401。现在解析阶段就拒绝,并说明该粘贴什么。
|
|
59
|
+
- **凭据失效的提示** —— 401/403/429 现在会说「登录态已失效,请重新登录」而不是裸的 `HTTP 401`。
|
|
60
|
+
|
|
61
|
+
### 修复的三个 issue
|
|
62
|
+
|
|
63
|
+
- **#169** 豆包无登录态时模型仍出现在选择器 —— 补上了其他渠道都有的门控。
|
|
64
|
+
- **#171** 登录第二个豆包账户会踢掉第一个 —— 存储从单会话改成账号列表,旧文件自动迁移。
|
|
65
|
+
- **#177** 链成员全是扫码渠道模型时无法列出、无法调用 —— 两处解析都缺渠道行,只有路由页是通的,所以「页面显示正常、一调就 503」。
|
|
66
|
+
- **#178** 密钥轮换后的提示误导 —— 新增 `key-rotated` 分类,明说「启动 WorkBuddy 也打不开」。
|
|
67
|
+
- **#179** 目录回退后已选模型静默消失 —— 卡片上直接显示,并说明是目录拉取失败。
|
|
68
|
+
- **#181** qoder cn 集体风控 —— 根因是拿不到机器指纹时请求不带 `Cosy-MachineToken`,现在用本机信息派生一个稳定指纹。
|
|
69
|
+
|
|
70
|
+
### 验证
|
|
71
|
+
|
|
72
|
+
- 145 个测试文件 / 1656 个用例全绿
|
|
73
|
+
- 双端 `tsc` 通过
|
|
74
|
+
- `lib/client.js` 无 `node:` 模块
|
|
75
|
+
- 七家端点实测可达,响应形状与代码预期一致
|
|
76
|
+
- 20 条路由的字段契约与客户端读取一致
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 3.0.0 — 修复了一些已知问题,凭空想象改动了亿点点未知问题
|
|
81
|
+
|
|
82
|
+
> UI 重做更新,顺手补了几个一直空着的功能,修掉几处会丢数据的地方。
|
|
83
|
+
|
|
84
|
+
### 界面
|
|
85
|
+
|
|
86
|
+
- 账号池:中栏渠道列表 + 右栏详情(三格统计 · 使用方式 · 积分自动化 · 账号卡两列网格 · 模型区块)
|
|
87
|
+
- 账号卡重做:状态点、开关、大字余额、进度条、可展开明细
|
|
88
|
+
- 登录通道、聚合渠道、数据看板、路由、网关、备份逐页对齐
|
|
89
|
+
- 加了一些渠道
|
|
90
|
+
|
|
91
|
+
### 功能
|
|
92
|
+
|
|
93
|
+
- 数据看板:导出 CSV、清空用量、时间范围、只看失败
|
|
94
|
+
- 登录通道:渠道搜索
|
|
95
|
+
- 账号池:设为首选、就地添加账号(不再跳页)
|
|
96
|
+
- 网关:重启、复制地址、模型共享方式(按池 / 自定义)
|
|
97
|
+
- 备份:历史备份列表;检查更新移到版本号旁边
|
|
98
|
+
- Marvis:每个账号各自的 token 用量与重置时间
|
|
99
|
+
- Marvis:支持微信登录
|
|
100
|
+
- 新增超级麦吉 / MagiCrew 两站(开窗登录)
|
|
101
|
+
- 积分自动化覆盖所有可签到的渠道
|
|
102
|
+
- 更新前自动备份,失败可回退
|
|
103
|
+
|
|
104
|
+
### 修复
|
|
105
|
+
|
|
106
|
+
- 读到坏 JSON 时不再被下一次保存覆盖,原文件先改名保留
|
|
107
|
+
- `aggregate.json` 里不认识的厂商 id 不再被丢掉
|
|
108
|
+
- 登录成功后账号池立刻同步,不再等缓存过期
|
|
109
|
+
- 窄屏改用容器宽度判断(媒体查询在设置对话框里从不触发)
|
|
110
|
+
- 账号卡不再显示 pack 的占位名
|
|
111
|
+
|
|
112
|
+
### 其它
|
|
113
|
+
|
|
114
|
+
- 检查更新从备份页移走
|
|
115
|
+
- 页面标题统一
|
|
116
|
+
|
|
4
117
|
## 2.7.5 — 一键安装更新
|
|
5
118
|
|
|
6
119
|
> 2.7.4 加了「检查更新」,但查到了只会告诉你「去插件设置里更新」。现在有安装按钮。
|
|
Binary file
|
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")),
|