dsh-multi-router 0.6.8 → 0.6.10
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 +17 -0
- package/README.md +5 -1
- package/cordis.patch.yml +2 -2
- package/lib/accounts.js +2 -2
- package/lib/api-service.js +3 -3
- package/lib/{chunk-YZIARLWT.js → chunk-2UM45OXY.js} +2 -2
- package/lib/{chunk-A4OIPIFX.js → chunk-47YTECKF.js} +3 -3
- package/lib/{chunk-XD52ZGZ5.js → chunk-GEBZMIMA.js} +30 -14
- package/lib/chunk-GEBZMIMA.js.map +7 -0
- package/lib/{chunk-CZKROASU.js → chunk-LH6RKOZD.js} +3 -3
- package/lib/{chunk-TKVFF7LN.js → chunk-LXDLKLM6.js} +3 -3
- package/lib/{chunk-JV4DLVV4.js → chunk-P7CNCBSY.js} +15 -7
- package/lib/chunk-P7CNCBSY.js.map +7 -0
- package/lib/{chunk-Q6A57FN3.js → chunk-R2Z4WGR6.js} +78 -24
- package/lib/chunk-R2Z4WGR6.js.map +7 -0
- package/lib/cli.js +4 -4
- package/lib/client.js +10 -3
- package/lib/client.js.map +2 -2
- package/lib/clients.js +3 -3
- package/lib/{host-v0.6.8.js → host-v0.6.10.js} +7 -7
- package/lib/host.js +7 -7
- package/lib/index.js +7 -7
- package/lib/manager.js +6 -6
- package/lib/router.js +2 -2
- package/lib/shim.js +3 -3
- package/package.json +1 -1
- package/lib/chunk-JV4DLVV4.js.map +0 -7
- package/lib/chunk-Q6A57FN3.js.map +0 -7
- package/lib/chunk-XD52ZGZ5.js.map +0 -7
- /package/lib/{chunk-YZIARLWT.js.map → chunk-2UM45OXY.js.map} +0 -0
- /package/lib/{chunk-A4OIPIFX.js.map → chunk-47YTECKF.js.map} +0 -0
- /package/lib/{chunk-CZKROASU.js.map → chunk-LH6RKOZD.js.map} +0 -0
- /package/lib/{chunk-TKVFF7LN.js.map → chunk-LXDLKLM6.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。版本号从 `0.1` 起以功能迭代为主,接口在 `1.0` 前可能变化。
|
|
4
4
|
|
|
5
|
+
## 0.6.10
|
|
6
|
+
|
|
7
|
+
- 修复「按积分折扣排序」与「积分使用均衡」会打乱临期积分优先级的问题:两者此前都是对全部候选做整体重排,因此一个更便宜、或本轮还没用完额度的非临期账号,可能插到仍有临期积分的账号前面。
|
|
8
|
+
- 现在候选先按临期到期时间分成互不跨越的分组,折扣排序与额度降权都只在**组内**调整先后。临期账号无论倍率高低、本轮是否已用完额度,都保持在非临期账号之前;组内顺序仍遵循各自的规则。
|
|
9
|
+
- 临期优先的排序改为显式比较到期时间并用原索引打破平局,不再依赖 `Infinity - Infinity` 得 `NaN` 时的排序实现细节。
|
|
10
|
+
- 冷却语义不变:仅作用于临期优先本身,普通路由继续照常运行。
|
|
11
|
+
- 新增两组回归:临期账号在更便宜的非临期账号面前保持领先、以及额度降权不跨组;后者已做反向验证(调用点不再传递临期分组时测试立即失败)。
|
|
12
|
+
|
|
13
|
+
## 0.6.9
|
|
14
|
+
|
|
15
|
+
- 路由新增「按积分折扣排序」开关,默认开启。每次请求按各渠道当前公布的积分倍率从小到大排列候选账号,倍率越低越便宜、越先用;倍率随目录刷新实时跟随,限时促销到期后自动恢复,不需要定时任务。
|
|
16
|
+
- 倍率统一解析三家的不同数据形态:Trae 的数值 `creditMultiplier`、WorkBuddy 与 Qoder 的 `x0.11` 字符串,并把生效中的 `promotions[].factor` 作为折上折计入(factor 为 0 表示直接替换)。解析结果与免费模型判定共用同一函数,两条判断不会漂移。
|
|
17
|
+
- 优先级遵循既有约定:临期积分最高,其次是「积分使用均衡」的本轮额度降权,折扣只在同类候选之间决定先后。已用完额度的账号不会因为倍率便宜而继续排在前面;未公布倍率的账号排在最后,不会被当成免费。
|
|
18
|
+
- `creditRates` 是每次发布时从模型目录派生的运行时数据,不是配置。面板回传或手工编辑都会被归一化阶段丢弃,避免把某一刻的倍率固化进 `router.json`。
|
|
19
|
+
- Free 自动免费模型路由不展示该开关,也不参与折扣排序。
|
|
20
|
+
- 新增三组回归:倍率排序与开关关闭后的回退、额度降权优先于倍率、派生字段不进入配置;均已反向验证(移除对应逻辑后测试立即失败)。另补一条端到端测试覆盖目录 → publish → Router 的倍率下发链路。
|
|
21
|
+
|
|
5
22
|
## 0.6.8
|
|
6
23
|
|
|
7
24
|
- 修复「积分使用均衡」在跑完一轮后失效的问题:此前每个账号的积分基线只增不减,当所有账号都达到阈值后顺序永久退回原样,开关不再起任何作用。现在全员达标的这一轮结束时基线整体重置,下一轮每个账号重新获得完整额度,降权继续生效,且新一轮从容忍当前活跃账号开始,与「成功账号承接下一次请求」的既有规则一致。
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
一个插件内置 WorkBuddy、Trae、Qoder 的认证、模型发现和聊天传输,提供三家的多账号池及集中路由。运行不依赖原来三个 DSH 插件;三家代码随安装包一起打包。基于 MIT 上游,固定版本见 `upstream-lock.json`,许可见 `THIRD_PARTY_NOTICES.md`。
|
|
8
8
|
|
|
9
|
-
版本:0.6.
|
|
9
|
+
版本:0.6.10。适配 DSH Desktop / Web 0.2.1-rc.2(同时兼容 0.2.0-rc.2),Node.js ^22.19.0 或 >=24。
|
|
10
10
|
|
|
11
11
|
## 在 DSH 里管理
|
|
12
12
|
|
|
@@ -113,6 +113,10 @@ Qoder 的 `dfmodel` 在真实目录里显示为 DeepSeek-Flash,未声明具体
|
|
|
113
113
|
|
|
114
114
|
`balanceCredits: true` 开启「积分使用均衡」(默认开启,阈值由 `creditBalanceThreshold` 设定,默认 1000)。它只调整尝试顺序,不改变上面任何一种切换规则:某个账号本轮观察到的积分消耗达到阈值后,会被排到仍有余量的账号之后;若所有账号都已达到阈值,则继续按原顺序使用,不会因此返回耗尽。消耗同样来自平台余额下降,可能多出一次请求的用量;余额重置或补充后按新基线重新计算,负数差值不会持续降权。Free 自动免费模型路由不参与该逻辑,面板也不展示此开关。
|
|
115
115
|
|
|
116
|
+
`discountOrder: true` 开启「按积分折扣排序」(默认开启)。每次请求按各渠道当前公布的**积分倍率**从小到大排列候选账号,倍率越低越便宜、越先用。倍率来自模型目录并随目录刷新,限时促销到期后自动恢复,因此不需要定时任务。三家的数据形态不同(Trae 为数值 `creditMultiplier`,WorkBuddy 与 Qoder 为 `x0.11` 字符串),统一解析后把生效中的 `promotions[].factor` 作为折上折计入,`factor` 为 0 表示直接替换成本价。
|
|
117
|
+
|
|
118
|
+
优先级沿用既有约定,且**折扣与额度都不会跨越临期分组**:候选先按临期到期时间分成互不跨越的分组,折扣排序与「积分使用均衡」的额度降权都只在组内调整先后。临期账号无论倍率高低、本轮是否已用完额度,都保持在非临期账号之前;组内则先按到期时间、再按各自规则排列。未公布倍率的账号在组内排在最后,不会被当成免费。冷却只作用于临期优先本身,普通路由照常运行。`creditRates` 是每次发布时从目录派生的运行时数据而非配置,面板回传或手工编辑会在归一化阶段被丢弃。Free 自动免费模型路由不参与,也不展示该开关。
|
|
119
|
+
|
|
116
120
|
额度只决定下一次请求选哪个账号,不中断正在生成的回答;并发请求、最后一次请求可能使阈值超过,积分结算延迟也可能造成超额。这是轮换阈值,不是上游消费硬上限。
|
|
117
121
|
|
|
118
122
|
统计保存于配置旁的 `usage.json`,0600 权限。仅保存账号/路由元数据、计数、平台额度和保留期限内的逐次调用明细,不保存提示词、回答或认证凭证;明细默认保留最近 30 天(滚动 720 小时),由 `usageRetentionDays` 设置 1–365 天,不再限定 80 条;缩短期限立即删除超期明细,延长不会恢复已删除记录。累计用量、额度轮换基线、临期冷却不清零,日趋势独立保留最近 31 天。Token 从本版本启用后开始计量,不回填历史会话。三家积分单位分别展示,不汇总为通用余额;平台余额下降可包含其他应用消费、积分包到期或延迟结算,不宣称是精确的单请求扣费。平台查询失败保留最后数据与错误、时间;没有可用积分数据的账号不参加积分阈值轮换。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
- insert:
|
|
2
|
-
- id: llm-multi-router-v2-0.6.
|
|
3
|
-
name: ./lib/host-v0.6.
|
|
2
|
+
- id: llm-multi-router-v2-0.6.10
|
|
3
|
+
name: ./lib/host-v0.6.10.js
|
package/lib/accounts.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
localAccountKey,
|
|
5
5
|
normalizeLocalAccountKey,
|
|
6
6
|
readPortableCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2UM45OXY.js";
|
|
8
8
|
import "./chunk-FLL3DUVP.js";
|
|
9
9
|
import "./chunk-KWXLQJS5.js";
|
|
10
10
|
import "./chunk-S5KMFAQM.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-GEBZMIMA.js";
|
|
12
12
|
export {
|
|
13
13
|
discoverLocalAccounts,
|
|
14
14
|
importAccount,
|
package/lib/api-service.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-47YTECKF.js";
|
|
4
4
|
import "./chunk-4V52V5GO.js";
|
|
5
5
|
import "./chunk-DNQPZMPF.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-R2Z4WGR6.js";
|
|
7
|
+
import "./chunk-GEBZMIMA.js";
|
|
8
8
|
export {
|
|
9
9
|
ApiService
|
|
10
10
|
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
PROVIDERS,
|
|
14
14
|
writePrivateJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GEBZMIMA.js";
|
|
16
16
|
|
|
17
17
|
// src/accounts.mjs
|
|
18
18
|
import { readFile } from "node:fs/promises";
|
|
@@ -178,4 +178,4 @@ export {
|
|
|
178
178
|
readPortableCredential,
|
|
179
179
|
importAccount
|
|
180
180
|
};
|
|
181
|
-
//# sourceMappingURL=chunk-
|
|
181
|
+
//# sourceMappingURL=chunk-2UM45OXY.js.map
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
RouteError,
|
|
9
9
|
abortable
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-R2Z4WGR6.js";
|
|
11
11
|
import {
|
|
12
12
|
REASONING_EFFORTS,
|
|
13
13
|
beijingDay,
|
|
14
14
|
writePrivateJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GEBZMIMA.js";
|
|
16
16
|
|
|
17
17
|
// src/api-service.mjs
|
|
18
18
|
import { createServer } from "node:http";
|
|
@@ -329,4 +329,4 @@ async function collectCompletion(frames, model) {
|
|
|
329
329
|
export {
|
|
330
330
|
ApiService
|
|
331
331
|
};
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-47YTECKF.js.map
|
|
@@ -121,10 +121,19 @@ var object = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
|
|
|
121
121
|
var nonempty = (x) => typeof x === "string" && x.trim().length > 0;
|
|
122
122
|
var positive = (x) => Number.isSafeInteger(x) && x > 0;
|
|
123
123
|
var beijingDay = (at) => new Date(at).toLocaleDateString("en-CA", { timeZone: "Asia/Shanghai" });
|
|
124
|
+
function creditRate(model, now = Date.now()) {
|
|
125
|
+
const rate = model.creditMultiplier ?? /^x?(\d+(?:\.\d+)?)(?:\s+credits?)?$/i.exec(model.billing?.credits?.trim() ?? "")?.[1];
|
|
126
|
+
const base = Number(rate);
|
|
127
|
+
if (rate === void 0 || !Number.isFinite(base) || base < 0) return void 0;
|
|
128
|
+
const live = (model.promotions ?? []).filter((p) => now >= p.start && now < p.end);
|
|
129
|
+
if (!live.length) return base;
|
|
130
|
+
const best = live.reduce((top, p) => !top || p.priority > top.priority ? p : top, void 0);
|
|
131
|
+
return Number.isFinite(best.factor) ? base * best.factor : base;
|
|
132
|
+
}
|
|
124
133
|
function isFreeModel(model, now = Date.now()) {
|
|
125
134
|
if (model.billing?.rateUnknown === true) return false;
|
|
126
|
-
const rate =
|
|
127
|
-
if (rate === void 0 ||
|
|
135
|
+
const rate = creditRate(model, now);
|
|
136
|
+
if (rate === void 0 || rate !== 0) return false;
|
|
128
137
|
if (model.promotions?.length && !model.promotions.some((p) => now >= p.start && now < p.end)) return false;
|
|
129
138
|
return true;
|
|
130
139
|
}
|
|
@@ -146,17 +155,21 @@ function validateConfig(raw, file = resolve("router.json")) {
|
|
|
146
155
|
};
|
|
147
156
|
});
|
|
148
157
|
if (!object(raw.routes ?? DEFAULT_ROUTES)) throw new Error("Routes must be an object");
|
|
149
|
-
const routes = Object.fromEntries(Object.entries(raw.routes ?? DEFAULT_ROUTES).map(([id, route]) =>
|
|
150
|
-
...route
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
const routes = Object.fromEntries(Object.entries(raw.routes ?? DEFAULT_ROUTES).map(([id, route]) => {
|
|
159
|
+
const { creditRates: _derivedRates, ...declared } = route ?? {};
|
|
160
|
+
return [id, {
|
|
161
|
+
...declared,
|
|
162
|
+
contextMode: declared.contextMode ?? (declared.contextWindow === 2e5 ? "maximum" : "custom"),
|
|
163
|
+
preferExpiringCredits: declared.preferExpiringCredits ?? !declared.freeOnly,
|
|
164
|
+
expiringWithinDays: declared.expiringWithinDays ?? 7,
|
|
165
|
+
// Balance-aware rotation defaults on for paid routes; a free route may only hold the
|
|
166
|
+
// default, so an explicit `true` is rejected by the check below rather than rewritten
|
|
167
|
+
// here — a silently corrected manifest hides the mistake from whoever wrote it.
|
|
168
|
+
balanceCredits: declared.balanceCredits ?? !declared.freeOnly,
|
|
169
|
+
creditBalanceThreshold: declared.creditBalanceThreshold ?? 1e3,
|
|
170
|
+
discountOrder: declared.discountOrder ?? !declared.freeOnly
|
|
171
|
+
}];
|
|
172
|
+
}));
|
|
160
173
|
for (const [alias, route] of Object.entries(routes)) {
|
|
161
174
|
if (!/^[a-zA-Z0-9_.-]{1,128}$/.test(alias) || !object(route) || !Array.isArray(route.targets) || !route.targets.length) throw new Error(`Invalid route ${alias}`);
|
|
162
175
|
for (const key of ["contextWindow", "maxTokens"]) if (!positive(route[key])) throw new Error(`Route ${alias} needs a positive ${key}`);
|
|
@@ -171,6 +184,8 @@ function validateConfig(raw, file = resolve("router.json")) {
|
|
|
171
184
|
if (route.freeOnly && (route.strategy && route.strategy !== "failover" || route.preferExpiringCredits)) throw new Error("Free \u8DEF\u7531\u4EC5\u4F7F\u7528\u514D\u8D39\u6A21\u578B\u6545\u969C\u5207\u6362\uFF0C\u4E0D\u4F7F\u7528\u79EF\u5206\u6216\u989D\u5EA6\u8F6E\u6362");
|
|
172
185
|
if (route.balanceCredits !== void 0 && typeof route.balanceCredits !== "boolean") throw new Error(`Invalid balanceCredits flag in ${alias}`);
|
|
173
186
|
if (route.freeOnly && route.balanceCredits === true) throw new Error("Free \u8DEF\u7531\u4E0D\u4F7F\u7528\u79EF\u5206\u5747\u8861\u5207\u6362");
|
|
187
|
+
if (route.discountOrder !== void 0 && typeof route.discountOrder !== "boolean") throw new Error(`Invalid discountOrder flag in ${alias}`);
|
|
188
|
+
if (route.freeOnly && route.discountOrder === true) throw new Error("Free \u8DEF\u7531\u4E0D\u4F7F\u7528\u79EF\u5206\u6298\u6263\u6392\u5E8F");
|
|
174
189
|
if (route.creditBalanceThreshold !== void 0 && (typeof route.creditBalanceThreshold !== "number" || !Number.isFinite(route.creditBalanceThreshold) || route.creditBalanceThreshold <= 0)) throw new Error(`Invalid credit balance threshold in ${alias}`);
|
|
175
190
|
if (route.preferExpiringCredits !== void 0 && typeof route.preferExpiringCredits !== "boolean") throw new Error(`Invalid expiring credits flag in ${alias}`);
|
|
176
191
|
if (route.expiringWithinDays !== void 0 && (!positive(route.expiringWithinDays) || route.expiringWithinDays > 365)) throw new Error(`Invalid expiry horizon in ${alias}`);
|
|
@@ -263,9 +278,10 @@ export {
|
|
|
263
278
|
ROUTE_PRESETS,
|
|
264
279
|
DEFAULT_ROUTES,
|
|
265
280
|
beijingDay,
|
|
281
|
+
creditRate,
|
|
266
282
|
isFreeModel,
|
|
267
283
|
validateConfig,
|
|
268
284
|
ensureConfig,
|
|
269
285
|
writePrivateJson
|
|
270
286
|
};
|
|
271
|
-
//# sourceMappingURL=chunk-
|
|
287
|
+
//# sourceMappingURL=chunk-GEBZMIMA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/reasoning.mjs", "../src/config.mjs"],
|
|
4
|
+
"sourcesContent": ["export const REASONING_EFFORTS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];\n\n// Keep declared modes only. A fixed-thinking model without a declared set uses platform default.\nexport function reasoningModes(model, provider) {\n const r = model?.reasoning;\n if (!r || (r.supports !== true && !Array.isArray(r.supported))) return [];\n const declared = r.supportedEfforts ?? r.supported ?? [];\n const disable = r.canDisableThinking === true || declared.includes('off');\n const off = disable && !(provider === 'workbuddy' && r.onlyReasoning === true);\n return REASONING_EFFORTS.filter(e => e === 'off' ? off : declared.includes(e));\n}\n\nexport function routeReasoning(models) {\n const efforts = REASONING_EFFORTS.filter(e => models.some(({ model, provider }) => reasoningModes(model, provider).includes(e)));\n if (!efforts.length) return undefined;\n return { supports: true, supportedEfforts: efforts, canDisableThinking: efforts.includes('off'),\n defaultEffort: efforts.includes('high') ? 'high' : efforts[0] };\n}\n", "import { readFile, mkdir, rename, writeFile, chmod } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport { randomUUID } from 'node:crypto';\nimport { withFileLock } from '@deepseek-ai/dsh-atomic-write';\nimport { REASONING_EFFORTS } from './reasoning.mjs';\n\nexport const PROVIDERS = ['workbuddy', 'workbuddy-ai', 'trae', 'trae-global', 'qoder', 'qoder-global'];\nexport const PROVIDER_NAMES = { workbuddy: 'WorkBuddy', 'workbuddy-ai': 'WorkBuddy AI', trae: 'Trae CN',\n 'trae-global': 'Trae Global', qoder: 'Qoder CN', 'qoder-global': 'Qoder Global' };\nexport const FLASH_PRESET = {\n name: 'DeepSeek V4.1 Flash \u00B7 \u81EA\u52A8\u8DEF\u7531', contextMode: 'maximum', contextWindow: 200000, maxTokens: 32000, preferExpiringCredits: true, expiringWithinDays: 7,\n targets: ['workbuddy', 'trae', 'qoder'].map(provider => ({ provider, models: provider.startsWith('qoder')\n ? ['dfmodel'] : ['deepseek-v4.1-flash', 'DeepSeek-V4.1-Flash', 'DeepSeek-V4.1-Flash-Official'] })),\n};\n// IDs differ between providers; keep precise model/version bindings, never fuzzy-match variants.\nconst sharedPreset = (name, workbuddy, trae, qoder) => ({\n name: `${name} \u00B7 \u81EA\u52A8\u8DEF\u7531`, contextMode: 'maximum', contextWindow: 200000, maxTokens: 32000, preferExpiringCredits: true, expiringWithinDays: 7,\n targets: [['workbuddy', workbuddy], ['trae', trae], ['qoder', qoder]]\n .filter(([, models]) => models).map(([provider, models]) => ({ provider, models: Array.isArray(models) ? models : [models] })),\n});\nexport const ROUTE_PRESETS = {\n free: { name: 'Free \u00B7 \u52A8\u6001\u514D\u8D39\u6A21\u578B', freeOnly: true, visible: true, contextMode: 'maximum', contextWindow: 200000, maxTokens: 32000,\n strategy: 'failover', preferExpiringCredits: false, targets: PROVIDERS.map(provider => ({ provider })) },\n 'deepseek-v4.1-flash': FLASH_PRESET,\n 'deepseek-v4-pro': sharedPreset('DeepSeek V4 Pro', 'deepseek-v4-pro', ['DeepSeek-V4-Pro-Official', 'DeepSeek-V4-Pro'], 'dmodel'),\n 'glm-5.3': sharedPreset('GLM-5.3', 'glm-5.3', 'glm-5.3', 'gmodel'),\n 'glm-5.3-flash': sharedPreset('GLM-5.3-Flash', 'glm-5.3-flash', 'glm-5.3-flash', 'gfmodel'),\n 'kimi-k3': sharedPreset('Kimi-K3', 'kimi-k3-1', 'kimi-k3', 'kmodel_latest'),\n 'kimi-k2.8-preview': sharedPreset('Kimi-K2.8-Preview', 'kimi-k2.8-preview', 'kimi-k2.8-preview', 'kmodel'),\n 'minimax-m2.7': sharedPreset('MiniMax-M2.7', 'minimax-m2.7', 'minimax-m2.7', 'mmodel'),\n // WorkBuddy does not advertise these models. Only bind verified Trae/Qoder IDs.\n 'qwen3.8-max': sharedPreset('Qwen3.8-Max', null, 'qwen3.8-max', 'qmodel_38max'),\n 'qwen3.8-flash': sharedPreset('Qwen3.8-Flash', null, 'qwen3.8-flash', 'qfmodel'),\n 'hy4-preview': sharedPreset('Hy4 Preview', 'hy4-preview', null, null),\n};\nexport const DEFAULT_ROUTES = {\n free: ROUTE_PRESETS.free,\n 'ds4.1f': {\n name: 'DeepSeek V4.1 Flash \u00B7 Auto', contextMode: 'maximum', contextWindow: 200000, maxTokens: 32000, preferExpiringCredits: true, expiringWithinDays: 7,\n targets: PROVIDERS.map(provider => ({ provider })),\n },\n ...ROUTE_PRESETS,\n};\n// Before preset history existed, these were already shipped. Missing old IDs\n// represent user removals; only subsequently introduced presets are auto-added.\nconst LEGACY_ROUTE_PRESETS = ['free', 'deepseek-v4.1-flash', 'deepseek-v4-pro', 'glm-5.3',\n 'glm-5.3-flash', 'kimi-k3', 'kimi-k2.8-preview', 'minimax-m2.7'];\nexport function upgradeRoutePresets(raw) {\n const ids = Object.keys(ROUTE_PRESETS);\n if (ids.every(id => raw.seenRoutePresets?.includes(id))) return raw;\n const routes = raw.routes ?? DEFAULT_ROUTES;\n const seen = new Set([...LEGACY_ROUTE_PRESETS, ...(raw.seenRoutePresets ?? []),\n ...Object.keys(routes).filter(id => Object.hasOwn(ROUTE_PRESETS, id))]);\n const additions = ids.filter(id => !seen.has(id));\n return { ...raw, ...(additions.length ? { routes: { ...routes,\n ...Object.fromEntries(additions.map(id => [id, structuredClone(ROUTE_PRESETS[id])])) } } : {}),\n seenRoutePresets: [...new Set([...seen, ...ids])] };\n}\nconst object = x => x !== null && typeof x === 'object' && !Array.isArray(x);\nconst nonempty = x => typeof x === 'string' && x.trim().length > 0;\nconst positive = x => Number.isSafeInteger(x) && x > 0;\nexport const beijingDay = at => new Date(at).toLocaleDateString('en-CA', { timeZone: 'Asia/Shanghai' });\n/**\n * Effective credit rate for one model: how many credits a call spends per unit of\n * the platform's base price, so a smaller number is cheaper.\n *\n * Providers publish it differently \u2014 Trae as a number, WorkBuddy and Qoder as an\n * `x0.11` string \u2014 and a live promotion multiplies the base rate. Returns undefined\n * when the provider gave nothing usable, because an unknown rate is not a cheap one.\n */\nexport function creditRate(model, now = Date.now()) {\n const rate = model.creditMultiplier ?? (/^x?(\\d+(?:\\.\\d+)?)(?:\\s+credits?)?$/i.exec(model.billing?.credits?.trim() ?? '')?.[1]);\n const base = Number(rate);\n if (rate === undefined || !Number.isFinite(base) || base < 0) return undefined;\n // A promotion replaces the rate outright when its factor is zero.\n const live = (model.promotions ?? []).filter(p => now >= p.start && now < p.end);\n if (!live.length) return base;\n const best = live.reduce((top, p) => !top || p.priority > top.priority ? p : top, undefined);\n return Number.isFinite(best.factor) ? base * best.factor : base;\n}\nexport function isFreeModel(model, now = Date.now()) {\n if (model.billing?.rateUnknown === true) return false;\n // A badge or a zero adapter cost is not an account-scoped zero billing rate.\n const rate = creditRate(model, now);\n if (rate === undefined || rate !== 0) return false;\n if (model.promotions?.length && !model.promotions.some(p => now >= p.start && now < p.end)) return false;\n return true;\n}\nexport function validateConfig(raw, file = resolve('router.json')) {\n if (!object(raw) || !Array.isArray(raw.accounts)) throw new Error('Config must contain an accounts array');\n const ids = new Set();\n const accounts = raw.accounts.map(account => {\n if (!object(account) || !/^[a-zA-Z0-9_-]{1,64}$/.test(account.id ?? '') || ids.has(account.id)) throw new Error('Account ids must be unique, 1\u201364 letters, digits, _ or -');\n ids.add(account.id);\n if (!PROVIDERS.includes(account.provider) || !nonempty(account.credentialFile)) throw new Error(`Invalid provider or credentialFile for ${account.id}`);\n if (account.enabled !== undefined && typeof account.enabled !== 'boolean') throw new Error(`Invalid enabled flag for ${account.id}`);\n if (account.autoCheckin !== undefined && (typeof account.autoCheckin !== 'boolean' || (account.autoCheckin && !['workbuddy', 'trae', 'qoder', 'qoder-global'].includes(account.provider)))) throw new Error(`Invalid autoCheckin for ${account.id}`);\n if (account.name !== undefined && (!nonempty(account.name) || account.name.length > 100)) throw new Error(`Invalid account name for ${account.id}`);\n if (account.identityFile !== undefined && !nonempty(account.identityFile)) throw new Error(`Invalid identityFile for ${account.id}`);\n return { ...account, credentialFile: resolve(dirname(file), account.credentialFile),\n ...(account.identityFile ? { identityFile: resolve(dirname(file), account.identityFile) } : {}) };\n });\n if (!object(raw.routes ?? DEFAULT_ROUTES)) throw new Error('Routes must be an object');\n const routes = Object.fromEntries(Object.entries(raw.routes ?? DEFAULT_ROUTES).map(([id, route]) => {\n // `creditRates` is derived per publish from the model catalog, never configuration.\n // Dropping it here means a panel round-trip or a hand-edited file cannot freeze\n // yesterday's rates into router.json, where the next publish would have to clear it.\n const { creditRates: _derivedRates, ...declared } = route ?? {};\n return [id, { ...declared,\n contextMode: declared.contextMode ?? (declared.contextWindow === 200000 ? 'maximum' : 'custom'),\n preferExpiringCredits: declared.preferExpiringCredits ?? !declared.freeOnly, expiringWithinDays: declared.expiringWithinDays ?? 7,\n // Balance-aware rotation defaults on for paid routes; a free route may only hold the\n // default, so an explicit `true` is rejected by the check below rather than rewritten\n // here \u2014 a silently corrected manifest hides the mistake from whoever wrote it.\n balanceCredits: declared.balanceCredits ?? !declared.freeOnly,\n creditBalanceThreshold: declared.creditBalanceThreshold ?? 1000,\n discountOrder: declared.discountOrder ?? !declared.freeOnly }];\n }));\n for (const [alias, route] of Object.entries(routes)) {\n if (!/^[a-zA-Z0-9_.-]{1,128}$/.test(alias) || !object(route) || !Array.isArray(route.targets) || !route.targets.length) throw new Error(`Invalid route ${alias}`);\n for (const key of ['contextWindow', 'maxTokens']) if (!positive(route[key])) throw new Error(`Route ${alias} needs a positive ${key}`);\n if (!['maximum', 'custom'].includes(route.contextMode)) throw new Error(`Invalid contextMode in ${alias}`);\n if (route.maxTokens > route.contextWindow) throw new Error(`Route ${alias}: maxTokens exceeds contextWindow`);\n if (route.supportsImages !== undefined && typeof route.supportsImages !== 'boolean') throw new Error(`Invalid supportsImages for ${alias}`);\n if (route.visible !== undefined && typeof route.visible !== 'boolean') throw new Error(`Invalid visibility for ${alias}`);\n if (route.reasoningEffort != null && !REASONING_EFFORTS.includes(route.reasoningEffort)) throw new Error(`Invalid reasoningEffort for ${alias}`);\n if (route.name !== undefined && (!nonempty(route.name) || route.name.length > 200)) throw new Error(`Invalid route name for ${alias}`);\n if (route.freeOnly !== undefined && typeof route.freeOnly !== 'boolean') throw new Error(`Invalid freeOnly for ${alias}`);\n if (route.freeModels !== undefined && (!route.freeOnly || !object(route.freeModels) || Object.entries(route.freeModels).some(([id, p]) =>\n !/^free_[a-f0-9]{24}$/.test(id) || !object(p) || Object.keys(p).some(k => !['visible', 'reasoningEffort', 'contextWindow'].includes(k))\n || (p.visible !== undefined && typeof p.visible !== 'boolean')\n || (p.contextWindow !== undefined && p.contextWindow !== null && !positive(p.contextWindow))\n || (p.reasoningEffort !== undefined && p.reasoningEffort !== null && !REASONING_EFFORTS.includes(p.reasoningEffort))))) throw new Error('\u514D\u8D39\u6A21\u578B\u5C55\u793A\u6216\u63A8\u7406\u7B49\u7EA7\u8BBE\u7F6E\u65E0\u6548');\n if (route.freeOnly && ((route.strategy && route.strategy !== 'failover') || route.preferExpiringCredits)) throw new Error('Free \u8DEF\u7531\u4EC5\u4F7F\u7528\u514D\u8D39\u6A21\u578B\u6545\u969C\u5207\u6362\uFF0C\u4E0D\u4F7F\u7528\u79EF\u5206\u6216\u989D\u5EA6\u8F6E\u6362');\n if (route.balanceCredits !== undefined && typeof route.balanceCredits !== 'boolean') throw new Error(`Invalid balanceCredits flag in ${alias}`);\n if (route.freeOnly && route.balanceCredits === true) throw new Error('Free \u8DEF\u7531\u4E0D\u4F7F\u7528\u79EF\u5206\u5747\u8861\u5207\u6362');\n if (route.discountOrder !== undefined && typeof route.discountOrder !== 'boolean') throw new Error(`Invalid discountOrder flag in ${alias}`);\n if (route.freeOnly && route.discountOrder === true) throw new Error('Free \u8DEF\u7531\u4E0D\u4F7F\u7528\u79EF\u5206\u6298\u6263\u6392\u5E8F');\n if (route.creditBalanceThreshold !== undefined && (typeof route.creditBalanceThreshold !== 'number' || !Number.isFinite(route.creditBalanceThreshold) || route.creditBalanceThreshold <= 0)) throw new Error(`Invalid credit balance threshold in ${alias}`);\n if (route.preferExpiringCredits !== undefined && typeof route.preferExpiringCredits !== 'boolean') throw new Error(`Invalid expiring credits flag in ${alias}`);\n if (route.expiringWithinDays !== undefined && (!positive(route.expiringWithinDays) || route.expiringWithinDays > 365)) throw new Error(`Invalid expiry horizon in ${alias}`);\n if (route.strategy !== undefined && !['failover', 'weighted', 'tokens', 'credits'].includes(route.strategy)) throw new Error(`Invalid strategy in ${alias}`);\n for (const target of route.targets) {\n if (!object(target)) throw new Error(`Invalid target in ${alias}`);\n if (target.weight !== undefined && (!positive(target.weight) || target.weight > 1000)) throw new Error(`Invalid target weight in ${alias}`);\n if (target.tokenBudget !== undefined && !positive(target.tokenBudget)) throw new Error(`Invalid token budget in ${alias}`);\n if (target.creditBudget !== undefined && (typeof target.creditBudget !== 'number' || !Number.isFinite(target.creditBudget) || target.creditBudget <= 0)) throw new Error(`Invalid credit budget in ${alias}`);\n if (route.strategy === 'tokens' && !positive(target.tokenBudget)) throw new Error(`Route ${alias} needs token budgets`);\n if (route.strategy === 'credits' && !(target.creditBudget > 0)) throw new Error(`Route ${alias} needs credit budgets`);\n if (!object(target) || !PROVIDERS.includes(target.provider) || (target.model !== undefined && !nonempty(target.model))) throw new Error(`Invalid target in ${alias}`);\n if (target.models !== undefined && (!Array.isArray(target.models) || !target.models.length || target.models.length > 20 || !target.models.every(nonempty))) throw new Error(`Invalid target models in ${alias}`);\n if (target.model !== undefined && target.models !== undefined) throw new Error(`Choose model or models in ${alias}`);\n if (target.account !== undefined && !accounts.some(a => a.id === target.account && a.provider === target.provider)) throw new Error(`Unknown target account in ${alias}`);\n if (!target.model && !target.models && alias !== 'ds4.1f' && !route.freeOnly) throw new Error(`Route ${alias} requires explicit target model ids`);\n }\n }\n const models = raw.models ?? {};\n if (!object(models)) throw new Error('Models must be an object');\n for (const [provider, preferences] of Object.entries(models)) {\n if (!PROVIDERS.includes(provider) || !object(preferences)) throw new Error('Invalid model provider');\n for (const [id, preference] of Object.entries(preferences)) {\n if (!nonempty(id) || id.length > 256 || !object(preference)\n || (preference.name !== undefined && (!nonempty(preference.name) || preference.name.length > 200))\n || (preference.visible !== undefined && typeof preference.visible !== 'boolean')\n || (preference.contextWindow !== undefined && preference.contextWindow !== null && !positive(preference.contextWindow))\n || (preference.supportsImages !== undefined && typeof preference.supportsImages !== 'boolean')\n || (preference.reasoningEffort !== undefined && preference.reasoningEffort !== null && !REASONING_EFFORTS.includes(preference.reasoningEffort))) throw new Error('Invalid model preference');\n }\n }\n const modelVisibility = raw.modelVisibility ?? {};\n if (!object(modelVisibility) || Object.entries(modelVisibility).some(([provider, visible]) => !PROVIDERS.includes(provider) || typeof visible !== 'boolean')) throw new Error('Invalid modelVisibility');\n for (const key of ['cooldownMs', 'requestTimeoutMs', 'catalogTtlMs']) if (raw[key] !== undefined && !positive(raw[key])) throw new Error(`Invalid ${key}`);\n if (raw.retryServerErrors !== undefined && typeof raw.retryServerErrors !== 'boolean') throw new Error('Invalid retryServerErrors');\n if (raw.sidebarUsage !== undefined && typeof raw.sidebarUsage !== 'boolean') throw new Error('\u4FA7\u680F\u7528\u91CF\u5F00\u5173\u5FC5\u987B\u662F\u5E03\u5C14\u503C');\n if (raw.ignoredLocalAccounts !== undefined && (!Array.isArray(raw.ignoredLocalAccounts) || raw.ignoredLocalAccounts.some(k => typeof k !== 'string' || k.length > 1024))) throw new Error('Invalid ignoredLocalAccounts');\n if (raw.seenRoutePresets !== undefined && (!Array.isArray(raw.seenRoutePresets) || raw.seenRoutePresets.length > 500\n || raw.seenRoutePresets.some(id => typeof id !== 'string' || !/^[a-zA-Z0-9_.-]{1,128}$/.test(id)))) throw new Error('Invalid seenRoutePresets');\n if (raw.usageRetentionDays !== undefined && (!positive(raw.usageRetentionDays) || raw.usageRetentionDays > 365)) throw new Error('Token \u660E\u7EC6\u4FDD\u7559\u5929\u6570\u5FC5\u987B\u4E3A 1\u2013365 \u7684\u6574\u6570');\n const checkinSchedule = raw.checkinSchedule ?? { mode: 'scheduled', time: '10:05' };\n if (!object(checkinSchedule) || !['startup', 'scheduled'].includes(checkinSchedule.mode)\n || !/^([01]\\d|2[0-3]):[0-5]\\d$/.test(checkinSchedule.time ?? '')\n || Object.keys(checkinSchedule).some(k => !['mode', 'time'].includes(k))) throw new Error('\u7B7E\u5230\u8BA1\u5212\u5FC5\u987B\u9009\u62E9\u542F\u52A8\u6216\u5B9A\u65F6\uFF0C\u5E76\u586B\u5199\u6709\u6548\u7684\u5317\u4EAC\u65F6\u95F4\uFF08HH:mm\uFF09');\n return { ...raw, accounts, routes, models, modelVisibility, cooldownMs: raw.cooldownMs ?? 60000,\n checkinSchedule: { ...checkinSchedule }, sidebarUsage: raw.sidebarUsage ?? true,\n requestTimeoutMs: raw.requestTimeoutMs ?? 300000, catalogTtlMs: raw.catalogTtlMs ?? 300000,\n retryServerErrors: raw.retryServerErrors ?? false, usageRetentionDays: raw.usageRetentionDays ?? 30 };\n}\nexport async function readConfig(file) {\n return validateConfig(JSON.parse(await readFile(file, 'utf8')), resolve(file));\n}\nexport async function ensureConfig(file) {\n try {\n const raw = JSON.parse(await readFile(file, 'utf8')), config = validateConfig(raw, resolve(file));\n if (upgradeRoutePresets(raw) === raw) return config;\n } catch (error) { if (error.code !== 'ENOENT') throw error; }\n await mkdir(dirname(file), { recursive: true, mode: 0o700 });\n return withFileLock(file, async () => {\n let raw, created = false;\n try { raw = JSON.parse(await readFile(file, 'utf8')); } catch (error) {\n if (error.code !== 'ENOENT') throw error;\n raw = { accounts: [], routes: ROUTE_PRESETS }; created = true;\n }\n validateConfig(raw, resolve(file));\n const next = upgradeRoutePresets(raw), config = validateConfig(next, resolve(file));\n if (created || next !== raw) await writePrivateJson(file, next);\n return config;\n }, { waitMs: 30000 });\n}\nexport async function writePrivateJson(file, value) {\n await mkdir(dirname(file), { recursive: true, mode: 0o700 });\n const temp = `${file}.${randomUUID()}.tmp`;\n await writeFile(temp, `${JSON.stringify(value, null, 2)}\\n`, { mode: 0o600, flag: 'wx' });\n await rename(temp, file);\n await chmod(file, 0o600);\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,oBAAoB,CAAC,OAAO,WAAW,OAAO,UAAU,QAAQ,SAAS,KAAK;AAGpF,SAAS,eAAe,OAAO,UAAU;AAC9C,QAAM,IAAI,OAAO;AACjB,MAAI,CAAC,KAAM,EAAE,aAAa,QAAQ,CAAC,MAAM,QAAQ,EAAE,SAAS,EAAI,QAAO,CAAC;AACxE,QAAM,WAAW,EAAE,oBAAoB,EAAE,aAAa,CAAC;AACvD,QAAM,UAAU,EAAE,uBAAuB,QAAQ,SAAS,SAAS,KAAK;AACxE,QAAM,MAAM,WAAW,EAAE,aAAa,eAAe,EAAE,kBAAkB;AACzE,SAAO,kBAAkB,OAAO,OAAK,MAAM,QAAQ,MAAM,SAAS,SAAS,CAAC,CAAC;AAC/E;AAEO,SAAS,eAAe,QAAQ;AACrC,QAAM,UAAU,kBAAkB,OAAO,OAAK,OAAO,KAAK,CAAC,EAAE,OAAO,SAAS,MAAM,eAAe,OAAO,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAC/H,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAC5B,SAAO;AAAA,IAAE,UAAU;AAAA,IAAM,kBAAkB;AAAA,IAAS,oBAAoB,QAAQ,SAAS,KAAK;AAAA,IAC5F,eAAe,QAAQ,SAAS,MAAM,IAAI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AAC;AAAA,GAAM,EAAE,MAAM,KAAO,MAAM,KAAK,CAAC;AACxF,QAAM,OAAO,MAAM,IAAI;AACvB,QAAM,MAAM,MAAM,GAAK;AACzB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-DNQPZMPF.js";
|
|
5
5
|
import {
|
|
6
6
|
RouteError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-R2Z4WGR6.js";
|
|
8
8
|
import {
|
|
9
9
|
REASONING_EFFORTS
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GEBZMIMA.js";
|
|
11
11
|
|
|
12
12
|
// src/shim.mjs
|
|
13
13
|
import { createServer } from "node:http";
|
|
@@ -117,4 +117,4 @@ function createShim(router, { modelPrefix = "" } = {}) {
|
|
|
117
117
|
export {
|
|
118
118
|
createShim
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-LH6RKOZD.js.map
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
RouteError,
|
|
23
23
|
abortable,
|
|
24
24
|
qoderContextModel
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-R2Z4WGR6.js";
|
|
26
26
|
import {
|
|
27
27
|
beijingDay,
|
|
28
28
|
writePrivateJson
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-GEBZMIMA.js";
|
|
30
30
|
|
|
31
31
|
// src/clients.mjs
|
|
32
32
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -5418,4 +5418,4 @@ export {
|
|
|
5418
5418
|
refreshWorkBuddyCheckinCredential,
|
|
5419
5419
|
createWorkBuddyCheckin
|
|
5420
5420
|
};
|
|
5421
|
-
//# sourceMappingURL=chunk-
|
|
5421
|
+
//# sourceMappingURL=chunk-LXDLKLM6.js.map
|
|
@@ -6,20 +6,20 @@ import {
|
|
|
6
6
|
refreshWorkBuddyCheckinCredential,
|
|
7
7
|
supportsCheckin,
|
|
8
8
|
workbuddyToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LXDLKLM6.js";
|
|
10
10
|
import {
|
|
11
11
|
discoverLocalAccounts,
|
|
12
12
|
importAccount,
|
|
13
13
|
localAccountKey,
|
|
14
14
|
normalizeLocalAccountKey,
|
|
15
15
|
readPortableCredential
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2UM45OXY.js";
|
|
17
17
|
import {
|
|
18
18
|
modelWithCurrentPromotion
|
|
19
19
|
} from "./chunk-KWXLQJS5.js";
|
|
20
20
|
import {
|
|
21
21
|
ApiService
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-47YTECKF.js";
|
|
23
23
|
import {
|
|
24
24
|
hostIsLoopback
|
|
25
25
|
} from "./chunk-DNQPZMPF.js";
|
|
@@ -28,23 +28,24 @@ import {
|
|
|
28
28
|
contextInfo,
|
|
29
29
|
matchModel,
|
|
30
30
|
resolveContext
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-R2Z4WGR6.js";
|
|
32
32
|
import {
|
|
33
33
|
PROVIDERS,
|
|
34
34
|
PROVIDER_NAMES,
|
|
35
35
|
ROUTE_PRESETS,
|
|
36
36
|
beijingDay,
|
|
37
|
+
creditRate,
|
|
37
38
|
isFreeModel,
|
|
38
39
|
routeReasoning,
|
|
39
40
|
validateConfig,
|
|
40
41
|
writePrivateJson
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-GEBZMIMA.js";
|
|
42
43
|
|
|
43
44
|
// src/manager.mjs
|
|
44
45
|
import { createHash, randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
|
|
45
46
|
|
|
46
47
|
// package.json
|
|
47
|
-
var version = "0.6.
|
|
48
|
+
var version = "0.6.10";
|
|
48
49
|
|
|
49
50
|
// src/manager.mjs
|
|
50
51
|
import { readFile as readFile4, mkdir as mkdir2, mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
|
|
@@ -1387,6 +1388,12 @@ var Manager = class {
|
|
|
1387
1388
|
const context = resolveContext(sources.map((s) => s.model), row.contextMode === "custom" ? row.contextWindow : null, row.contextWindow);
|
|
1388
1389
|
const eligible = sources.filter((s) => contextInfo(s.model).maxContextWindow >= context.contextWindow);
|
|
1389
1390
|
const models = eligible.map((s) => s.model), reasoning = routeReasoning(eligible);
|
|
1391
|
+
const rates = {};
|
|
1392
|
+
for (const source of eligible) {
|
|
1393
|
+
const rate = creditRate(source.model, this.telemetry.now());
|
|
1394
|
+
if (rate === void 0) continue;
|
|
1395
|
+
rates[source.accountId] = rates[source.accountId] === void 0 ? rate : Math.min(rates[source.accountId], rate);
|
|
1396
|
+
}
|
|
1390
1397
|
return {
|
|
1391
1398
|
...row,
|
|
1392
1399
|
...context,
|
|
@@ -1394,6 +1401,7 @@ var Manager = class {
|
|
|
1394
1401
|
supportsImages: models.length > 0 && models.every((m) => m.supportsImages),
|
|
1395
1402
|
reasoning,
|
|
1396
1403
|
eligibleAccountIds: [...new Set(eligible.map((s) => s.accountId))],
|
|
1404
|
+
creditRates: rates,
|
|
1397
1405
|
maxTokens: Math.min(row.maxTokens, context.contextWindow, ...models.map((m) => m.maxTokens)),
|
|
1398
1406
|
id,
|
|
1399
1407
|
name: row.name ?? id,
|
|
@@ -2048,4 +2056,4 @@ export {
|
|
|
2048
2056
|
Manager,
|
|
2049
2057
|
managementHandler
|
|
2050
2058
|
};
|
|
2051
|
-
//# sourceMappingURL=chunk-
|
|
2059
|
+
//# sourceMappingURL=chunk-P7CNCBSY.js.map
|