dsh-multi-router 0.6.1 → 0.6.2
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 +6 -0
- package/README.md +3 -1
- package/cordis.patch.yml +2 -2
- package/lib/accounts.js +2 -2
- package/lib/api-service.js +3 -3
- package/lib/{chunk-BSAI3SW5.js → chunk-3O3L3526.js} +3 -3
- package/lib/{chunk-ZQZSXCVR.js → chunk-4EO5V6FW.js} +10 -8
- package/lib/chunk-4EO5V6FW.js.map +7 -0
- package/lib/{chunk-DZ4ZUAYH.js → chunk-5KYJADJ4.js} +2 -2
- package/lib/{chunk-NGVWVIBM.js → chunk-5R3IOPSF.js} +41 -8
- package/lib/chunk-5R3IOPSF.js.map +7 -0
- package/lib/{chunk-2LH6TD2U.js → chunk-74WQLVJO.js} +3 -3
- package/lib/{chunk-VZPXRK7Q.js → chunk-KGVTRS5K.js} +2 -2
- package/lib/{chunk-625KMEYS.js → chunk-Q34JSMGN.js} +3 -3
- package/lib/cli.js +4 -4
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/clients.js +3 -3
- package/lib/{host-v0.6.1.js → host-v0.6.2.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-NGVWVIBM.js.map +0 -7
- package/lib/chunk-ZQZSXCVR.js.map +0 -7
- /package/lib/{chunk-BSAI3SW5.js.map → chunk-3O3L3526.js.map} +0 -0
- /package/lib/{chunk-DZ4ZUAYH.js.map → chunk-5KYJADJ4.js.map} +0 -0
- /package/lib/{chunk-2LH6TD2U.js.map → chunk-74WQLVJO.js.map} +0 -0
- /package/lib/{chunk-VZPXRK7Q.js.map → chunk-KGVTRS5K.js.map} +0 -0
- /package/lib/{chunk-625KMEYS.js.map → chunk-Q34JSMGN.js.map} +0 -0
|
@@ -88,6 +88,35 @@ var DEFAULT_ROUTES = {
|
|
|
88
88
|
},
|
|
89
89
|
...ROUTE_PRESETS
|
|
90
90
|
};
|
|
91
|
+
var LEGACY_ROUTE_PRESETS = [
|
|
92
|
+
"free",
|
|
93
|
+
"deepseek-v4.1-flash",
|
|
94
|
+
"deepseek-v4-pro",
|
|
95
|
+
"glm-5.3",
|
|
96
|
+
"glm-5.3-flash",
|
|
97
|
+
"kimi-k3",
|
|
98
|
+
"kimi-k2.8-preview",
|
|
99
|
+
"minimax-m2.7"
|
|
100
|
+
];
|
|
101
|
+
function upgradeRoutePresets(raw) {
|
|
102
|
+
const ids = Object.keys(ROUTE_PRESETS);
|
|
103
|
+
if (ids.every((id) => raw.seenRoutePresets?.includes(id))) return raw;
|
|
104
|
+
const routes = raw.routes ?? DEFAULT_ROUTES;
|
|
105
|
+
const seen = /* @__PURE__ */ new Set([
|
|
106
|
+
...LEGACY_ROUTE_PRESETS,
|
|
107
|
+
...raw.seenRoutePresets ?? [],
|
|
108
|
+
...Object.keys(routes).filter((id) => Object.hasOwn(ROUTE_PRESETS, id))
|
|
109
|
+
]);
|
|
110
|
+
const additions = ids.filter((id) => !seen.has(id));
|
|
111
|
+
return {
|
|
112
|
+
...raw,
|
|
113
|
+
...additions.length ? { routes: {
|
|
114
|
+
...routes,
|
|
115
|
+
...Object.fromEntries(additions.map((id) => [id, structuredClone(ROUTE_PRESETS[id])]))
|
|
116
|
+
} } : {},
|
|
117
|
+
seenRoutePresets: [.../* @__PURE__ */ new Set([...seen, ...ids])]
|
|
118
|
+
};
|
|
119
|
+
}
|
|
91
120
|
var object = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
|
|
92
121
|
var nonempty = (x) => typeof x === "string" && x.trim().length > 0;
|
|
93
122
|
var positive = (x) => Number.isSafeInteger(x) && x > 0;
|
|
@@ -165,6 +194,7 @@ function validateConfig(raw, file = resolve("router.json")) {
|
|
|
165
194
|
if (raw.retryServerErrors !== void 0 && typeof raw.retryServerErrors !== "boolean") throw new Error("Invalid retryServerErrors");
|
|
166
195
|
if (raw.sidebarUsage !== void 0 && typeof raw.sidebarUsage !== "boolean") throw new Error("\u4FA7\u680F\u7528\u91CF\u5F00\u5173\u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
167
196
|
if (raw.ignoredLocalAccounts !== void 0 && (!Array.isArray(raw.ignoredLocalAccounts) || raw.ignoredLocalAccounts.some((k) => typeof k !== "string" || k.length > 1024))) throw new Error("Invalid ignoredLocalAccounts");
|
|
197
|
+
if (raw.seenRoutePresets !== void 0 && (!Array.isArray(raw.seenRoutePresets) || raw.seenRoutePresets.length > 500 || raw.seenRoutePresets.some((id) => typeof id !== "string" || !/^[a-zA-Z0-9_.-]{1,128}$/.test(id)))) throw new Error("Invalid seenRoutePresets");
|
|
168
198
|
if (raw.usageRetentionDays !== void 0 && (!positive(raw.usageRetentionDays) || raw.usageRetentionDays > 365)) throw new Error("Token \u660E\u7EC6\u4FDD\u7559\u5929\u6570\u5FC5\u987B\u4E3A 1\u2013365 \u7684\u6574\u6570");
|
|
169
199
|
const checkinSchedule = raw.checkinSchedule ?? { mode: "scheduled", time: "10:05" };
|
|
170
200
|
if (!object(checkinSchedule) || !["startup", "scheduled"].includes(checkinSchedule.mode) || !/^([01]\d|2[0-3]):[0-5]\d$/.test(checkinSchedule.time ?? "") || 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");
|
|
@@ -183,24 +213,27 @@ function validateConfig(raw, file = resolve("router.json")) {
|
|
|
183
213
|
usageRetentionDays: raw.usageRetentionDays ?? 30
|
|
184
214
|
};
|
|
185
215
|
}
|
|
186
|
-
async function readConfig(file) {
|
|
187
|
-
return validateConfig(JSON.parse(await readFile(file, "utf8")), resolve(file));
|
|
188
|
-
}
|
|
189
216
|
async function ensureConfig(file) {
|
|
190
217
|
try {
|
|
191
|
-
|
|
218
|
+
const raw = JSON.parse(await readFile(file, "utf8")), config = validateConfig(raw, resolve(file));
|
|
219
|
+
if (upgradeRoutePresets(raw) === raw) return config;
|
|
192
220
|
} catch (error) {
|
|
193
221
|
if (error.code !== "ENOENT") throw error;
|
|
194
222
|
}
|
|
195
223
|
await mkdir(dirname(file), { recursive: true, mode: 448 });
|
|
196
224
|
return withFileLock(file, async () => {
|
|
225
|
+
let raw, created = false;
|
|
197
226
|
try {
|
|
198
|
-
|
|
227
|
+
raw = JSON.parse(await readFile(file, "utf8"));
|
|
199
228
|
} catch (error) {
|
|
200
229
|
if (error.code !== "ENOENT") throw error;
|
|
230
|
+
raw = { accounts: [], routes: ROUTE_PRESETS };
|
|
231
|
+
created = true;
|
|
201
232
|
}
|
|
202
|
-
|
|
203
|
-
|
|
233
|
+
validateConfig(raw, resolve(file));
|
|
234
|
+
const next = upgradeRoutePresets(raw), config = validateConfig(next, resolve(file));
|
|
235
|
+
if (created || next !== raw) await writePrivateJson(file, next);
|
|
236
|
+
return config;
|
|
204
237
|
}, { waitMs: 3e4 });
|
|
205
238
|
}
|
|
206
239
|
async function writePrivateJson(file, value) {
|
|
@@ -226,4 +259,4 @@ export {
|
|
|
226
259
|
ensureConfig,
|
|
227
260
|
writePrivateJson
|
|
228
261
|
};
|
|
229
|
-
//# sourceMappingURL=chunk-
|
|
262
|
+
//# sourceMappingURL=chunk-5R3IOPSF.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' });\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 = model.creditMultiplier ?? (/^x?(\\d+(?:\\.\\d+)?)(?:\\s+credits?)?$/i.exec(model.billing?.credits?.trim() ?? '')?.[1]);\n if (rate === undefined || !Number.isFinite(Number(rate)) || Number(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]) => [id, { ...route,\n contextMode: route?.contextMode ?? (route?.contextWindow === 200000 ? 'maximum' : 'custom'),\n preferExpiringCredits: route?.preferExpiringCredits ?? !route?.freeOnly, expiringWithinDays: route?.expiringWithinDays ?? 7 }]));\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.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.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,EA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AAM,OAAO,oBAAoB,GAAG,GAAG,SAAS,eAAe,MAAM,QAAQ,IAAI,CAAC;AAClF,QAAI,WAAW,SAAS,IAAK,OAAM,iBAAiB,MAAM,IAAI;AAC9D,WAAO;AAAA,EACT,GAAG,EAAE,QAAQ,IAAM,CAAC;AACtB;AACA,eAAsB,iBAAiB,MAAM,OAAO;AAClD,QAAM,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AAC3D,QAAM,OAAO,GAAG,IAAI,IAAI,WAAW,CAAC;AACpC,QAAM,UAAU,MAAM,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;AAAA,GAAM,EAAE,MAAM,KAAO,MAAM,KAAK,CAAC;AACxF,QAAM,OAAO,MAAM,IAAI;AACvB,QAAM,MAAM,MAAM,GAAK;AACzB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
RouteError,
|
|
23
23
|
abortable,
|
|
24
24
|
qoderContextModel
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-5KYJADJ4.js";
|
|
26
26
|
import {
|
|
27
27
|
beijingDay,
|
|
28
28
|
writePrivateJson
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5R3IOPSF.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-74WQLVJO.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
PROVIDERS,
|
|
14
14
|
writePrivateJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5R3IOPSF.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-KGVTRS5K.js.map
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
RouteError,
|
|
9
9
|
abortable
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5KYJADJ4.js";
|
|
11
11
|
import {
|
|
12
12
|
REASONING_EFFORTS,
|
|
13
13
|
beijingDay,
|
|
14
14
|
writePrivateJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5R3IOPSF.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-Q34JSMGN.js.map
|
package/lib/cli.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createAccountClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-74WQLVJO.js";
|
|
5
5
|
import {
|
|
6
6
|
importAccount
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KGVTRS5K.js";
|
|
8
8
|
import "./chunk-OK2T2UAZ.js";
|
|
9
9
|
import "./chunk-TEZ2FMEO.js";
|
|
10
10
|
import "./chunk-S5KMFAQM.js";
|
|
11
11
|
import "./chunk-4V52V5GO.js";
|
|
12
12
|
import {
|
|
13
13
|
Router
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5KYJADJ4.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_ROUTES,
|
|
17
17
|
PROVIDERS,
|
|
18
18
|
validateConfig,
|
|
19
19
|
writePrivateJson
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-5R3IOPSF.js";
|
|
21
21
|
|
|
22
22
|
// src/cli.mjs
|
|
23
23
|
import { parseArgs } from "node:util";
|
package/lib/client.js
CHANGED