dsh-unified-router 0.7.2 → 0.7.4
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/lib/apikey-channel.js +72 -2
- package/lib/apikey-providers.js +129 -5
- package/lib/backend.js +4 -1
- package/lib/browser-login.js +12 -1
- package/lib/client.js +45 -12
- package/lib/daily-checkin.js +22 -1
- package/lib/managed-providers/codearts.js +21 -1
- package/lib/model-catalog.js +2 -1
- package/package.json +1 -1
package/lib/apikey-channel.js
CHANGED
|
@@ -36,6 +36,76 @@ const CATALOG_TIMEOUT_MS = 10_000
|
|
|
36
36
|
const BALANCE_TIMEOUT_MS = 5_000
|
|
37
37
|
const CATALOG_REUSE_MS = 60_000
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* 归一化用户粘贴的控制台会话凭据(全渠道共用,不含渠道名判断)。
|
|
41
|
+
* 兼容五类常见复制形态,方便手机抓包与桌面开发者工具一键粘贴:
|
|
42
|
+
* 1) 完整 `curl` 命令(提取 `-H 'Cookie: ...'` / `-H "Cookie: ..."` / `-b '...'` / `--cookie '...'`);
|
|
43
|
+
* 2) JSON 对象(`{"cookie":"..."}` 直接取 cookie;`{"accessKeyId":...,"accessKeySecret":...}` 保留 JSON);
|
|
44
|
+
* 3) 多行原始 HTTP 请求头块(提取其中的 `Cookie:` 行);
|
|
45
|
+
* 4) 单行 `Cookie: k=v; ...` 前缀(剥离前缀);
|
|
46
|
+
* 5) 原始 `k=v; ...`、裸 Token(如 Step Plan `Oasis-Token`)或 `AccessKeyId:AccessKeySecret`。
|
|
47
|
+
*/
|
|
48
|
+
export function normalizeConsoleCookieInput(raw) {
|
|
49
|
+
if (typeof raw !== 'string') return ''
|
|
50
|
+
let text = raw.trim()
|
|
51
|
+
if (!text) return ''
|
|
52
|
+
// 1) JSON:书签工具或结构化 AK/SK
|
|
53
|
+
if (text.startsWith('{') && text.endsWith('}')) {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(text)
|
|
56
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
57
|
+
const cookieVal = parsed.cookie ?? parsed.Cookie
|
|
58
|
+
if (typeof cookieVal === 'string' && cookieVal.trim()) return cookieVal.trim()
|
|
59
|
+
const akId = parsed.accessKeyId ?? parsed.AccessKeyId
|
|
60
|
+
const akSec = parsed.accessKeySecret ?? parsed.AccessKeySecret
|
|
61
|
+
if (typeof akId === 'string' && akId.trim() && typeof akSec === 'string' && akSec.trim()) {
|
|
62
|
+
return JSON.stringify({ accessKeyId: akId.trim(), accessKeySecret: akSec.trim() })
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} catch {}
|
|
66
|
+
}
|
|
67
|
+
// 2) cURL 命令(bash / cmd / PowerShell,兼容多行续行与 <input> 压成单行的形态)
|
|
68
|
+
if (/^\s*curl(?:\.exe)?\s/i.test(text)) {
|
|
69
|
+
const flat = text.replace(/\s*[\\^`]\s*[\r\n]+\s*/g, ' ')
|
|
70
|
+
const patterns = [
|
|
71
|
+
/(?:-H|--header)\s+(?:'([^']*(?:\\'|[^'])*)'|"([^"]*(?:\\"|[^"])*)")/gi,
|
|
72
|
+
/(?:-b|--cookie)\s+(?:'([^']+)'|"([^"]+)")/gi,
|
|
73
|
+
]
|
|
74
|
+
for (const m of flat.matchAll(patterns[0])) {
|
|
75
|
+
const header = (m[1] ?? m[2] ?? '').replace(/\\(['"])/g, '$1').trim()
|
|
76
|
+
const cookieMatch = /^cookie\s*:\s*(.+)$/i.exec(header)
|
|
77
|
+
if (cookieMatch?.[1]?.trim()) return cookieMatch[1].trim()
|
|
78
|
+
}
|
|
79
|
+
for (const m of flat.matchAll(patterns[1])) {
|
|
80
|
+
const val = (m[1] ?? m[2] ?? '').replace(/\\(['"])/g, '$1').trim()
|
|
81
|
+
if (val) return val
|
|
82
|
+
}
|
|
83
|
+
// 也兼容 cURL 中直接携带 Oasis-Token 请求头
|
|
84
|
+
for (const m of flat.matchAll(patterns[0])) {
|
|
85
|
+
const header = (m[1] ?? m[2] ?? '').replace(/\\(['"])/g, '$1').trim()
|
|
86
|
+
const tokenMatch = /^oasis-token\s*:\s*(.+)$/i.exec(header)
|
|
87
|
+
if (tokenMatch?.[1]?.trim()) return tokenMatch[1].trim()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// 3) 多行原始请求头:从中提取 Cookie: 或 Oasis-Token: 行
|
|
91
|
+
if (/[\r\n]/.test(text)) {
|
|
92
|
+
const lines = text.split(/\r?\n/)
|
|
93
|
+
for (const line of lines) {
|
|
94
|
+
const m = /^\s*cookie\s*:\s*(.+)$/i.exec(line)
|
|
95
|
+
if (m?.[1]?.trim()) return m[1].trim()
|
|
96
|
+
}
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
const m = /^\s*oasis-token\s*:\s*(.+)$/i.exec(line)
|
|
99
|
+
if (m?.[1]?.trim()) return m[1].trim()
|
|
100
|
+
}
|
|
101
|
+
return ''
|
|
102
|
+
}
|
|
103
|
+
// 4) 单行带前缀 `Cookie: ...` 或 `Oasis-Token: ...`
|
|
104
|
+
const prefix = /^(?:cookie|oasis-token)\s*:\s*(.+)$/i.exec(text)
|
|
105
|
+
if (prefix?.[1]?.trim()) return prefix[1].trim()
|
|
106
|
+
return text
|
|
107
|
+
}
|
|
108
|
+
|
|
39
109
|
function serviceOf(ctx, name) {
|
|
40
110
|
try {
|
|
41
111
|
if (typeof ctx?.get === 'function') {
|
|
@@ -529,8 +599,8 @@ export function createApiKeyManager(ctx, spec, deps = {}) {
|
|
|
529
599
|
|
|
530
600
|
const setConsoleSession = async (payload, signal) => {
|
|
531
601
|
if (!spec.consoleCredentialRef) throw new Error('不支持此渠道')
|
|
532
|
-
const cookie =
|
|
533
|
-
if (!cookie || cookie.length > 8192 || /[\r\n]/.test(cookie)) throw new Error('
|
|
602
|
+
const cookie = normalizeConsoleCookieInput(payload.cookie)
|
|
603
|
+
if (!cookie || cookie.length > 8192 || /[\r\n]/.test(cookie)) throw new Error('控制台凭据无效')
|
|
534
604
|
signal?.throwIfAborted()
|
|
535
605
|
return queue(async () => {
|
|
536
606
|
signal?.throwIfAborted()
|
package/lib/apikey-providers.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// 渠道事实(哪些是实测、哪些来自官方文档)见同文件 §1。这里不写文档外
|
|
4
4
|
// 的能力假设:未确认的上下文/输出记 0,未确认的能力一律 false / []。
|
|
5
5
|
|
|
6
|
+
import { createHash, createHmac, randomUUID } from 'node:crypto'
|
|
6
7
|
import {
|
|
7
8
|
apiQuotaAmount as amount, apiQuotaClampedAmount as clampedAmount,
|
|
8
9
|
apiQuotaGift as giftOf, apiQuotaWindow as windowOf,
|
|
@@ -641,6 +642,127 @@ const bailianRow = id => {
|
|
|
641
642
|
const BAILIAN_USAGE_API = 'zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage'
|
|
642
643
|
const BAILIAN_CONSOLE_PAGE = 'https://bailian.console.aliyun.com/cn-beijing?tab=plan'
|
|
643
644
|
const BAILIAN_GATEWAY_URL = `https://bailian-cs.console.aliyun.com/data/api.json?action=BroadScopeAspnGateway&product=sfm_bailian&api=${encodeURIComponent(BAILIAN_USAGE_API)}`
|
|
645
|
+
const BAILIAN_CLI_TOKEN_URL = 'https://modelstudio.cn-beijing.aliyuncs.com/modelstudio/cli/generateAccessToken'
|
|
646
|
+
const BAILIAN_CLI_GATEWAY_URL = `https://bailian-cs.console.aliyun.com/cli/api.json?action=BroadScopeAspnGateway&product=sfm_bailian&api=${encodeURIComponent(BAILIAN_USAGE_API)}`
|
|
647
|
+
const bailianCliTokenCache = new Map()
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* 解析阿里云 AccessKey 凭据(支持 `AccessKeyId:AccessKeySecret` 或 JSON 对象)。
|
|
651
|
+
* 与 Cookie 区分:Cookie 一定含 `=` 且不以 `LTAI` 开头,或经显式 JSON 指定。
|
|
652
|
+
*/
|
|
653
|
+
export function parseAliyunAccessKey(raw) {
|
|
654
|
+
if (typeof raw !== 'string') return null
|
|
655
|
+
const text = raw.trim()
|
|
656
|
+
if (!text) return null
|
|
657
|
+
if (text.startsWith('{') && text.endsWith('}')) {
|
|
658
|
+
try {
|
|
659
|
+
const parsed = JSON.parse(text)
|
|
660
|
+
const id = String(parsed?.accessKeyId ?? parsed?.AccessKeyId ?? '').trim()
|
|
661
|
+
const secret = String(parsed?.accessKeySecret ?? parsed?.AccessKeySecret ?? '').trim()
|
|
662
|
+
if (id && secret && !/\s/.test(id) && !/\s/.test(secret)) return { id, secret }
|
|
663
|
+
} catch { return null }
|
|
664
|
+
return null
|
|
665
|
+
}
|
|
666
|
+
const colon = text.indexOf(':')
|
|
667
|
+
if (colon <= 0 || text.includes(';')) return null
|
|
668
|
+
const id = text.slice(0, colon).trim()
|
|
669
|
+
const secret = text.slice(colon + 1).trim()
|
|
670
|
+
if (!/^[A-Za-z0-9_-]{8,128}$/.test(id) || !secret || /\s/.test(secret) || secret.length > 256) return null
|
|
671
|
+
return { id, secret }
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/** 阿里云 OpenAPI V3 签名(ACS3-HMAC-SHA256),零外部依赖。 */
|
|
675
|
+
export function signAliyunAcs3({ accessKeyId, accessKeySecret, method = 'POST', url, action, version, body = '', now = new Date(), nonce = randomUUID() }) {
|
|
676
|
+
const parsed = new URL(url)
|
|
677
|
+
const payloadHash = createHash('sha256').update(body, 'utf8').digest('hex')
|
|
678
|
+
const date = now.toISOString().replace(/\.\d{3}Z$/, 'Z')
|
|
679
|
+
const canonicalHeaders = {
|
|
680
|
+
host: parsed.host,
|
|
681
|
+
'x-acs-action': action,
|
|
682
|
+
'x-acs-content-sha256': payloadHash,
|
|
683
|
+
'x-acs-date': date,
|
|
684
|
+
'x-acs-signature-nonce': nonce,
|
|
685
|
+
'x-acs-version': version,
|
|
686
|
+
}
|
|
687
|
+
const signedNames = Object.keys(canonicalHeaders).sort()
|
|
688
|
+
const headerLines = signedNames.map(name => `${name}:${canonicalHeaders[name]}\n`).join('')
|
|
689
|
+
const signedHeaders = signedNames.join(';')
|
|
690
|
+
const queryPairs = [...parsed.searchParams.entries()]
|
|
691
|
+
.sort((a, b) => a[0].localeCompare(b[0]) || a[1].localeCompare(b[1]))
|
|
692
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
693
|
+
.join('&')
|
|
694
|
+
const canonicalRequest = [method.toUpperCase(), parsed.pathname || '/', queryPairs, headerLines, signedHeaders, payloadHash].join('\n')
|
|
695
|
+
const hashedCanonical = createHash('sha256').update(canonicalRequest, 'utf8').digest('hex')
|
|
696
|
+
const stringToSign = `ACS3-HMAC-SHA256\n${hashedCanonical}`
|
|
697
|
+
const signature = createHmac('sha256', accessKeySecret).update(stringToSign, 'utf8').digest('hex')
|
|
698
|
+
return {
|
|
699
|
+
...canonicalHeaders,
|
|
700
|
+
accept: 'application/json',
|
|
701
|
+
'content-type': 'application/json',
|
|
702
|
+
authorization: `ACS3-HMAC-SHA256 Credential=${accessKeyId},SignedHeaders=${signedHeaders},Signature=${signature}`,
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
async function mintBailianCliToken(ak, fetchJson, signal, { force = false } = {}) {
|
|
707
|
+
const cacheKey = createHash('sha256').update(`${ak.id}:${ak.secret}`).digest('hex').slice(0, 16)
|
|
708
|
+
const cached = !force ? bailianCliTokenCache.get(cacheKey) : null
|
|
709
|
+
if (cached && cached.expiresAt > Date.now()) return cached.token
|
|
710
|
+
const body = '{}'
|
|
711
|
+
const headers = signAliyunAcs3({
|
|
712
|
+
accessKeyId: ak.id,
|
|
713
|
+
accessKeySecret: ak.secret,
|
|
714
|
+
method: 'POST',
|
|
715
|
+
url: BAILIAN_CLI_TOKEN_URL,
|
|
716
|
+
action: 'GenerateCLIAccessToken',
|
|
717
|
+
version: '2026-02-10',
|
|
718
|
+
body,
|
|
719
|
+
})
|
|
720
|
+
const json = await fetchJson({ url: BAILIAN_CLI_TOKEN_URL, method: 'POST', headers, body }, signal)
|
|
721
|
+
const token = json?.cliAccessToken ?? json?.data?.cliAccessToken ?? json?.Data?.cliAccessToken
|
|
722
|
+
if (typeof token !== 'string' || !token.trim()) {
|
|
723
|
+
const err = new Error('bailian_ak_invalid')
|
|
724
|
+
err.expired = true
|
|
725
|
+
throw err
|
|
726
|
+
}
|
|
727
|
+
// 官方 token 有效期约 20 分钟;本地缓存 15 分钟,遇到 NotLogined 强制重签一次。
|
|
728
|
+
bailianCliTokenCache.set(cacheKey, { token: token.trim(), expiresAt: Date.now() + 15 * 60_000 })
|
|
729
|
+
return token.trim()
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
async function fetchBailianCliGateway(ak, fetchJson, signal) {
|
|
733
|
+
const invoke = async force => {
|
|
734
|
+
const cliToken = await mintBailianCliToken(ak, fetchJson, signal, { force })
|
|
735
|
+
const params = JSON.stringify({
|
|
736
|
+
Api: BAILIAN_USAGE_API,
|
|
737
|
+
V: '1.0',
|
|
738
|
+
Data: {},
|
|
739
|
+
})
|
|
740
|
+
const body = new URLSearchParams({
|
|
741
|
+
product: 'sfm_bailian',
|
|
742
|
+
action: 'BroadScopeAspnGateway',
|
|
743
|
+
region: 'cn-beijing',
|
|
744
|
+
params,
|
|
745
|
+
}).toString()
|
|
746
|
+
return fetchJson({
|
|
747
|
+
url: BAILIAN_CLI_GATEWAY_URL,
|
|
748
|
+
method: 'POST',
|
|
749
|
+
headers: {
|
|
750
|
+
authorization: `Bearer ${cliToken}`,
|
|
751
|
+
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
752
|
+
accept: 'application/json',
|
|
753
|
+
},
|
|
754
|
+
body,
|
|
755
|
+
}, signal)
|
|
756
|
+
}
|
|
757
|
+
let json = await invoke(false)
|
|
758
|
+
const isExpired = res => {
|
|
759
|
+
const code = String(res?.code ?? '')
|
|
760
|
+
const errCode = String(res?.data?.errorCode ?? res?.errorCode ?? '')
|
|
761
|
+
return code === '401' || code === '403' || /NotLogined|Unauth|Login/i.test(errCode)
|
|
762
|
+
}
|
|
763
|
+
if (isExpired(json)) json = await invoke(true)
|
|
764
|
+
return { expired: isExpired(json), json }
|
|
765
|
+
}
|
|
644
766
|
|
|
645
767
|
function bailianPercentWindow(id, rawPct, rawResetMs, now) {
|
|
646
768
|
const pct = amount(rawPct)
|
|
@@ -654,13 +776,15 @@ function bailianPercentWindow(id, rawPct, rawResetMs, now) {
|
|
|
654
776
|
}
|
|
655
777
|
|
|
656
778
|
/**
|
|
657
|
-
*
|
|
658
|
-
* 1)
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
779
|
+
* 读取百炼 Token Plan 个人版用量,支持两种凭据形态:
|
|
780
|
+
* 1) 阿里云 AccessKey(`AccessKeyId:AccessKeySecret` / JSON):走官方 `bl` CLI 同款
|
|
781
|
+
* ACS3-HMAC-SHA256 `GenerateCLIAccessToken` → `POST /cli/api.json`(全平台免浏览器、长期有效);
|
|
782
|
+
* 2) 控制台浏览器 Cookie:GET 控制台页提取 `SEC_TOKEN` → `POST /data/api.json`。
|
|
783
|
+
* ⚠️ Cookie 模式 `cornerstoneParam` 绝不可硬编码某账号的 `switchAgent`。
|
|
662
784
|
*/
|
|
663
785
|
async function fetchBailianConsoleGateway(session, fetchJson, signal) {
|
|
786
|
+
const ak = parseAliyunAccessKey(session)
|
|
787
|
+
if (ak) return fetchBailianCliGateway(ak, fetchJson, signal)
|
|
664
788
|
const html = await fetchJson({
|
|
665
789
|
url: BAILIAN_CONSOLE_PAGE,
|
|
666
790
|
headers: { cookie: session, accept: 'text/html,application/xhtml+xml' },
|
package/lib/backend.js
CHANGED
|
@@ -2367,6 +2367,7 @@ var obsoleteIdentities = /* @__PURE__ */ new Set([
|
|
|
2367
2367
|
"glm-5",
|
|
2368
2368
|
"glm-5-1",
|
|
2369
2369
|
"glm-5-2",
|
|
2370
|
+
"glm-5-3",
|
|
2370
2371
|
"glm-5v-turbo",
|
|
2371
2372
|
"glm-5-2-sft-harmony",
|
|
2372
2373
|
"kimi-k2-5",
|
|
@@ -2504,6 +2505,7 @@ var OFFICIAL_MODEL_SPECS = Object.freeze({
|
|
|
2504
2505
|
"deepseek-v4-pro": { context: 1048576, maxOutput: 393216 },
|
|
2505
2506
|
"deepseek-v4-pro-0813": { context: 1048576, maxOutput: 393216 },
|
|
2506
2507
|
"deepseek-v4-flash": { context: 1048576, maxOutput: 393216 },
|
|
2508
|
+
"glm-5-4": { context: 1e6, maxOutput: 131072 },
|
|
2507
2509
|
"glm-5-3": { context: 1048576, maxOutput: 131072 },
|
|
2508
2510
|
"glm-5-3-flash": { context: 1048576, maxOutput: 131072 },
|
|
2509
2511
|
"glm-5-3-flashx": { context: 1048576, maxOutput: 131072 },
|
|
@@ -3262,7 +3264,6 @@ var QODER_CN_FALLBACK_MODELS = [
|
|
|
3262
3264
|
{ id: "fast", name: "Fast", contextWindow: 2e5, supportsImage: true, supportsThinking: false, priceFactor: 0.8 },
|
|
3263
3265
|
// 2026-11-19 --list-models lists these titles without publishing their backend keys or capabilities.
|
|
3264
3266
|
{ id: "Qwen4-Max", name: "Qwen4-Max", contextWindow: 1e6, supportsImage: true, supportsThinking: true, priceFactor: 0.4, efforts: ["xhigh", "low", "medium"], defaultEffort: "medium", supportsDisable: true },
|
|
3265
|
-
{ id: "Qwen4-Max-Preview", name: "Qwen4-Max-Preview", contextWindow: 0 },
|
|
3266
3267
|
{
|
|
3267
3268
|
id: "qmodel_38max",
|
|
3268
3269
|
name: "Qwen3.8-Max",
|
|
@@ -3291,6 +3292,8 @@ var QODER_CN_FALLBACK_MODELS = [
|
|
|
3291
3292
|
{ id: "dmodel", name: "DeepSeek-V4-Pro", contextWindow: 1e6, supportsImage: true, supportsThinking: true, priceFactor: 0.5, efforts: ["low", "high", "max"], defaultEffort: "max", supportsDisable: true },
|
|
3292
3293
|
// 滚动别名按渠道原名保留,不凭别名推断具体快照版本。
|
|
3293
3294
|
{ id: "dfmodel", name: "DeepSeek-Flash", contextWindow: 1e6, maxTokens: 393216, supportsImage: true, priceFactor: 0.1, efforts: ["low", "high", "max"], defaultEffort: "high", supportsDisable: true },
|
|
3295
|
+
// 2026-11-26 实跑 --list-models 新增 GLM-5.4(CLI 不下发能力字段);规格取智谱官方文档(1M/128K、原生视觉、三档思考),倍率未知不编造。
|
|
3296
|
+
{ id: "GLM-5.4", name: "GLM-5.4", contextWindow: 1e6, maxTokens: 131072, supportsImage: true, supportsThinking: true, efforts: ["low", "high", "max"], defaultEffort: "high" },
|
|
3294
3297
|
{ id: "gmodel", name: "GLM-5.3", contextWindow: 1e6, supportsImage: true, supportsThinking: true, priceFactor: 0.8, efforts: ["low", "high", "max"], defaultEffort: "high" },
|
|
3295
3298
|
{ id: "gfmodel", name: "GLM-5.3-Flash", contextWindow: 1e6, supportsImage: true, supportsThinking: true, priceFactor: 0.1, efforts: ["high", "max"], defaultEffort: "max" },
|
|
3296
3299
|
{ id: "kmodel_latest", name: "Kimi-K3.1-Pro", contextWindow: 1e6, supportsImage: true, priceFactor: 1, efforts: ["low", "high", "max"], defaultEffort: "high" },
|
package/lib/browser-login.js
CHANGED
|
@@ -46,6 +46,14 @@ export function findChromiumBrowser(platform = process.platform, env = process.e
|
|
|
46
46
|
'/usr/bin/chromium-browser',
|
|
47
47
|
'/snap/bin/chromium',
|
|
48
48
|
'/usr/bin/microsoft-edge',
|
|
49
|
+
'/usr/bin/brave-browser',
|
|
50
|
+
...(String(env.PATH || '').split(':').filter(Boolean).flatMap(dir => [
|
|
51
|
+
join(dir, 'google-chrome'),
|
|
52
|
+
join(dir, 'google-chrome-stable'),
|
|
53
|
+
join(dir, 'chromium'),
|
|
54
|
+
join(dir, 'chromium-browser'),
|
|
55
|
+
join(dir, 'microsoft-edge'),
|
|
56
|
+
])),
|
|
49
57
|
]
|
|
50
58
|
return candidates.find(candidate => candidate && existsSync(candidate)) || ''
|
|
51
59
|
}
|
|
@@ -254,9 +262,12 @@ export function captureRedirect(wsUrl, url, callbackOrigin, matchRedirect, signa
|
|
|
254
262
|
async function launchIsolatedBrowser({ url, startupUrl, onUrl, signal, timeoutMs = 5 * 60_000, pollIntervalMs, inspect }) {
|
|
255
263
|
const safe = validateBrowserUrl(url)
|
|
256
264
|
if (!safe) throw new Error('登录地址无效')
|
|
265
|
+
if (process.platform !== 'win32' && process.platform !== 'darwin' && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY) {
|
|
266
|
+
throw new Error('当前宿主无图形桌面,无法自动拉起浏览器,请直接打开控制台登录后粘贴 Cookie 或凭据')
|
|
267
|
+
}
|
|
257
268
|
const browserPath = findChromiumBrowser()
|
|
258
269
|
if (!browserPath) {
|
|
259
|
-
throw new Error('未找到本机 Chrome 或 Edge
|
|
270
|
+
throw new Error('未找到本机 Chrome 或 Edge 浏览器,请改用「导入本机登录」或直接粘贴凭据 / Cookie')
|
|
260
271
|
}
|
|
261
272
|
const port = await getFreeLoopbackPort()
|
|
262
273
|
let profileDir = ''
|
package/lib/client.js
CHANGED
|
@@ -332,7 +332,7 @@ const providerNamedSuccessors = {
|
|
|
332
332
|
// 其他现代推荐模型,也默认移出推荐(仍保留在目录中供手动启用,且绝不清空整个渠道)。
|
|
333
333
|
const obsoleteIdentities = new Set([
|
|
334
334
|
'deepseek-v3', 'deepseek-v3-1', 'deepseek-v4-flash', 'deepseek-v4-pro',
|
|
335
|
-
'glm-4-7', 'glm-5', 'glm-5-1', 'glm-5-2', 'glm-5v-turbo', 'glm-5-2-sft-harmony',
|
|
335
|
+
'glm-4-7', 'glm-5', 'glm-5-1', 'glm-5-2', 'glm-5-3', 'glm-5v-turbo', 'glm-5-2-sft-harmony',
|
|
336
336
|
'kimi-k2-5', 'kimi-k2-6', 'kimi-k2-7-code', 'kimi-k2-8-preview', 'kimi-k3',
|
|
337
337
|
'qwen-3-5', 'qwen-3-6-plus', 'qwen-3-7-plus', 'qwen-3-8-flash',
|
|
338
338
|
'minimax-m2-7', 'minimax-m3',
|
|
@@ -477,6 +477,7 @@ const OFFICIAL_MODEL_SPECS = Object.freeze({
|
|
|
477
477
|
'deepseek-v4-pro': { context: 1_048_576, maxOutput: 393_216 },
|
|
478
478
|
'deepseek-v4-pro-0813': { context: 1_048_576, maxOutput: 393_216 },
|
|
479
479
|
'deepseek-v4-flash': { context: 1_048_576, maxOutput: 393_216 },
|
|
480
|
+
'glm-5-4': { context: 1_000_000, maxOutput: 131_072 },
|
|
480
481
|
'glm-5-3': { context: 1_048_576, maxOutput: 131_072 },
|
|
481
482
|
'glm-5-3-flash': { context: 1_048_576, maxOutput: 131_072 },
|
|
482
483
|
'glm-5-3-flashx': { context: 1_048_576, maxOutput: 131_072 },
|
|
@@ -2629,10 +2630,14 @@ function createRouterStore(call, provider = PROVIDERS[0].id) {
|
|
|
2629
2630
|
if (result.status !== 'fulfilled' || !result.value || typeof result.value !== 'object') return
|
|
2630
2631
|
sources[side] = CACHE_MODEL_SOURCES.has(result.value.source) ? result.value.source : 'fallback'
|
|
2631
2632
|
})
|
|
2632
|
-
|
|
2633
|
+
// 写后重读必须走实时路径(live: true),否则会读回宿主旧快照里的 `cached` 覆盖刚刷新的 `remote`。
|
|
2634
|
+
const fresh = await Promise.all(sides.map(side => request('model.list', { provider: side, live: true }, controller.signal)))
|
|
2633
2635
|
if (disposed || controller.signal.aborted || state.provider !== channel) return false
|
|
2634
2636
|
const refreshedAt = Date.now()
|
|
2635
2637
|
for (const side of sides) newestModelRead.set(side, refreshedAt)
|
|
2638
|
+
sides.forEach((side, index) => {
|
|
2639
|
+
if (!sources[side] && CACHE_MODEL_SOURCES.has(fresh[index]?.source)) sources[side] = fresh[index].source
|
|
2640
|
+
})
|
|
2636
2641
|
const refreshed = new Map(sides.map((side, index) => [side, modelsFrom(fresh[index], side)]))
|
|
2637
2642
|
publish({
|
|
2638
2643
|
models: modelProvidersOf(channel).flatMap(side => refreshed.has(side)
|
|
@@ -3237,6 +3242,7 @@ const CLIENT_STYLES = `
|
|
|
3237
3242
|
.eac-params-note{margin:0;color:var(--eac-faint);font-size:var(--eac-fs-xs);line-height:1.5}
|
|
3238
3243
|
|
|
3239
3244
|
/* ---------- OpenDesign CoRouter 上下文分段:设置页与输入栏变体 ---------- */
|
|
3245
|
+
.eac-params .eac-context-tiers{flex-wrap:wrap;max-width:100%}
|
|
3240
3246
|
.eac-context-control{display:flex;align-items:center;flex-wrap:wrap;gap:var(--eac-s2);min-width:0;color:var(--eac-text);font-size:var(--eac-fs-sm)}
|
|
3241
3247
|
.eac-context-tiers{display:inline-flex;align-items:center;gap:0;min-width:0;padding:var(--eac-s1);border:1px solid var(--eac-border);border-radius:var(--eac-s2)}
|
|
3242
3248
|
.eac-context-control .eac-context-segment{display:inline-flex;align-items:center;justify-content:center;min-height:var(--eac-s6);min-width:0;padding:var(--eac-s1) var(--eac-s2);margin:0;border:1px solid transparent;border-radius:var(--eac-s1);background:transparent;color:var(--eac-muted);font:inherit;font-variant-numeric:tabular-nums;white-space:nowrap;cursor:pointer}
|
|
@@ -3329,6 +3335,11 @@ html[data-dsh-go-island][data-dsh-go-island-form="panel"] .eac-quota-popover{pos
|
|
|
3329
3335
|
}
|
|
3330
3336
|
:where(body[data-ds-dark-theme],.dark,[data-theme=dark],[data-color-scheme=dark]) :is(.eac-settings,.eac-context-pill,.eac-quota-pill,.eac-quota-popover),:is(.eac-settings,.eac-context-pill,.eac-quota-pill,.eac-quota-popover):where(.dark,[data-theme=dark],[data-color-scheme=dark]){color-scheme:dark;--eac-surface:var(--dsw-alias-bg-layer-1,#191b20);--eac-subtle:color-mix(in srgb,currentColor 4%,transparent);--eac-hover:color-mix(in srgb,currentColor 7%,transparent);--eac-text:var(--dsw-alias-label-primary,#f2f4f7);--eac-muted:color-mix(in srgb,currentColor 66%,transparent);--eac-faint:color-mix(in srgb,currentColor 50%,transparent);--eac-border:color-mix(in srgb,currentColor 20%,transparent);--eac-divider:color-mix(in srgb,currentColor 12%,transparent);--eac-accent:#3b82f6;--eac-on-accent:#fff;--eac-success:#22c55e;--eac-warn:#eab308;--eac-danger:#ef4444;--eac-shadow:0 1px 2px rgba(0,0,0,.18)}
|
|
3331
3337
|
:where(.light,[data-theme=light],[data-color-scheme=light]) :is(.eac-settings,.eac-context-pill,.eac-quota-pill,.eac-quota-popover),:is(.eac-settings,.eac-context-pill,.eac-quota-pill,.eac-quota-popover):where(.light,[data-theme=light],[data-color-scheme=light]){color-scheme:light;--eac-surface:var(--dsw-alias-bg-layer-1,#fff);--eac-subtle:color-mix(in srgb,currentColor 4%,transparent);--eac-hover:color-mix(in srgb,currentColor 7%,transparent);--eac-text:var(--dsw-alias-label-primary,#182230);--eac-muted:color-mix(in srgb,currentColor 66%,transparent);--eac-faint:color-mix(in srgb,currentColor 50%,transparent);--eac-border:color-mix(in srgb,currentColor 20%,transparent);--eac-divider:color-mix(in srgb,currentColor 12%,transparent);--eac-accent:#3b82f6;--eac-on-accent:#fff;--eac-success:#22c55e;--eac-warn:#eab308;--eac-danger:#ef4444;--eac-shadow:0 1px 2px rgba(16,24,40,.04)}
|
|
3338
|
+
@container eac (max-width:720px){
|
|
3339
|
+
.eac-row-item:has(.eac-row-controls .eac-tier-row){grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"main switch" "more more"}
|
|
3340
|
+
.eac-row-item:has(.eac-row-controls .eac-tier-row)>.eac-row-controls{justify-content:flex-start}
|
|
3341
|
+
.eac-row-item:has(.eac-row-controls .eac-tier-row) .eac-tier-row{width:100%}
|
|
3342
|
+
}
|
|
3332
3343
|
@container eac (max-width:640px){
|
|
3333
3344
|
.eac-header{align-items:center}
|
|
3334
3345
|
.eac-workspace{padding:var(--eac-s2) var(--eac-s3) var(--eac-s4)}
|
|
@@ -3337,9 +3348,9 @@ html[data-dsh-go-island][data-dsh-go-island-form="panel"] .eac-quota-popover{pos
|
|
|
3337
3348
|
.eac-workspace[data-panel=models] .eac-section-head{flex-direction:row;align-items:center;flex-wrap:wrap;gap:var(--eac-s2)}
|
|
3338
3349
|
.eac-workspace[data-panel=models] .eac-section-actions{max-width:100%}
|
|
3339
3350
|
.eac-row-item{grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:"main switch more" "metric metric metric";gap:var(--eac-s2);padding:var(--eac-s3)}
|
|
3340
|
-
.eac-row-item:has(.eac-row-controls .eac-button){grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"main switch" "more more"}
|
|
3341
|
-
.eac-row-item:has(.eac-row-controls .eac-button)>.eac-row-controls{justify-content:flex-start}
|
|
3342
|
-
.eac-row-item:has(.eac-row-controls .eac-button)>.eac-row-metric{grid-area:auto;grid-column:1/-1}
|
|
3351
|
+
.eac-row-item:has(.eac-row-controls :is(.eac-button,.eac-tier-row)){grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"main switch" "more more"}
|
|
3352
|
+
.eac-row-item:has(.eac-row-controls :is(.eac-button,.eac-tier-row))>.eac-row-controls{justify-content:flex-start}
|
|
3353
|
+
.eac-row-item:has(.eac-row-controls :is(.eac-button,.eac-tier-row))>.eac-row-metric{grid-area:auto;grid-column:1/-1}
|
|
3343
3354
|
.eac-workspace[data-panel=advanced] .eac-row-name{white-space:normal;overflow-wrap:anywhere}
|
|
3344
3355
|
.eac-row-credit{justify-content:flex-start}
|
|
3345
3356
|
.eac-row-item>.eac-row-more{grid-area:auto;grid-column:1/-1;margin-top:0}
|
|
@@ -3635,15 +3646,23 @@ function PlanKeyForm({ disabled, onSave }) {
|
|
|
3635
3646
|
h('label', { className: 'eac-field' }, h('span', null, 'API Key'), h('input', { className: 'eac-input', type: 'password', autoComplete: 'off', required: true, disabled, value: apiKey, onChange: e => setApiKey(e.target.value) })),
|
|
3636
3647
|
h('div', { className: 'eac-form-actions' }, primary('保存 API Key', undefined, disabled, { type: 'submit' })))
|
|
3637
3648
|
}
|
|
3638
|
-
//
|
|
3639
|
-
function ConsoleCookieForm({ disabled, onSave }) {
|
|
3649
|
+
// 控制台会话粘贴表单:展示渠道专属字段引导,接受 Cookie / 请求头 / cURL / JSON / 阿里云 AccessKey。
|
|
3650
|
+
function ConsoleCookieForm({ disabled, hint, guide, onSave }) {
|
|
3640
3651
|
const [cookie, setCookie] = React.useState('')
|
|
3641
3652
|
return h('form', { className: 'eac-account-form', onSubmit: async event => {
|
|
3642
3653
|
event.preventDefault()
|
|
3643
3654
|
const saved = await onSave(cookie)
|
|
3644
3655
|
if (saved) setCookie('')
|
|
3645
3656
|
} },
|
|
3646
|
-
h('label', { className: 'eac-field' },
|
|
3657
|
+
h('label', { className: 'eac-field' },
|
|
3658
|
+
h('span', null, '控制台凭据 / Cookie'),
|
|
3659
|
+
h('input', {
|
|
3660
|
+
className: 'eac-input', type: 'password', autoComplete: 'off', required: true, disabled,
|
|
3661
|
+
placeholder: hint || '粘贴控制台 Cookie、请求头或 cURL',
|
|
3662
|
+
value: cookie, onChange: e => setCookie(e.target.value),
|
|
3663
|
+
}),
|
|
3664
|
+
guide ? h('p', { className: 'eac-params-note' }, guide) : null,
|
|
3665
|
+
h('p', { className: 'eac-params-note' }, '浏览器登录仅在宿主桌面端弹出;手机或无桌面环境请先打开控制台,按上方说明粘贴保存。')),
|
|
3647
3666
|
h('div', { className: 'eac-form-actions' }, primary('保存会话', undefined, disabled, { type: 'submit' })))
|
|
3648
3667
|
}
|
|
3649
3668
|
function CredentialImportForm({ disabled, hint, onSave, onCancel }) {
|
|
@@ -3830,7 +3849,10 @@ function renderForm(form, ui, key, scope) {
|
|
|
3830
3849
|
if (!form) return null
|
|
3831
3850
|
const save = (...args) => ui.invoke(...form.call, ...args)
|
|
3832
3851
|
const formScope = scope || `channel:${ui.providerId}`
|
|
3833
|
-
return h(SETTINGS_FORMS[form.kind], {
|
|
3852
|
+
return h(SETTINGS_FORMS[form.kind], {
|
|
3853
|
+
key, account: form.account, hint: form.hint, guide: form.guide,
|
|
3854
|
+
disabled: form.disabled === true || ui.loading || ui.isPending(formScope), save, onSave: save,
|
|
3855
|
+
})
|
|
3834
3856
|
}
|
|
3835
3857
|
|
|
3836
3858
|
/** 单选分段控件(智能选号模式):复用参数编辑器的 .eac-tier 外观与 aria-pressed。 */
|
|
@@ -5414,6 +5436,8 @@ function apiKeyChannel({
|
|
|
5414
5436
|
toolsLabel = '多模态能力工具',
|
|
5415
5437
|
toolsMeta = '语音转写 · 语音合成 · 声音克隆 · 文档解析 · 信息抽取',
|
|
5416
5438
|
consoleMeta = '用于读取控制台额度',
|
|
5439
|
+
consoleFormHint = '',
|
|
5440
|
+
consoleFormGuide = '',
|
|
5417
5441
|
freeTier = false,
|
|
5418
5442
|
preferCreditsWindows = false,
|
|
5419
5443
|
}) {
|
|
@@ -5514,7 +5538,7 @@ function apiKeyChannel({
|
|
|
5514
5538
|
tags: [current && !current.hasApiKey && ['先配置 API Key', 'warn'],
|
|
5515
5539
|
current?.toolsEnabled && !current.toolsRegistered && ['待注册', 'warn']],
|
|
5516
5540
|
}] : []),
|
|
5517
|
-
//
|
|
5541
|
+
// 控制台会话:额度读取的凭据。桌面端支持浏览器自动收割;手机或无头环境可直接打开控制台并粘贴 Cookie / cURL / AK:SK。
|
|
5518
5542
|
...(current && 'hasConsoleSession' in current ? [{
|
|
5519
5543
|
id: 'console', name: '控制台会话',
|
|
5520
5544
|
meta: signingIn ? '浏览器登录进行中,可取消;完成后自动保存' : consoleMeta,
|
|
@@ -5523,9 +5547,10 @@ function apiKeyChannel({
|
|
|
5523
5547
|
{ label: '取消登录', call: [id + 'CancelConsoleLogin'] },
|
|
5524
5548
|
] : [
|
|
5525
5549
|
{ label: current.hasConsoleSession ? '重新登录' : '浏览器登录', call: [id + 'ConsoleLogin'], primary: !current.hasConsoleSession },
|
|
5550
|
+
...(current.consoleQuotaUrl ? [{ label: '打开控制台', href: current.consoleQuotaUrl }] : []),
|
|
5526
5551
|
...(current.hasConsoleSession ? [{ label: '清除会话', call: [id + 'ClearConsole'], danger: true }] : []),
|
|
5527
5552
|
],
|
|
5528
|
-
form: { kind: 'console', call: [id + 'SetConsole'], disabled: signingIn },
|
|
5553
|
+
form: { kind: 'console', call: [id + 'SetConsole'], disabled: signingIn, hint: consoleFormHint, guide: consoleFormGuide },
|
|
5529
5554
|
}] : []),
|
|
5530
5555
|
...(current?.rateLimit?.until > Date.now() ? [{ id: 'rate-limit', name: '限速提醒',
|
|
5531
5556
|
meta: h(ApiKeyCooldown, { key: current.rateLimit.until, limit: current.rateLimit }) }] : []),
|
|
@@ -5673,6 +5698,8 @@ const unisound = apiKeyChannel({
|
|
|
5673
5698
|
title: '云知声',
|
|
5674
5699
|
host: 'maas-api.unisound.com',
|
|
5675
5700
|
consoleMeta: '用于读取控制台额度(U Plan 积分 / 按量余额)',
|
|
5701
|
+
consoleFormHint: '粘贴 maas.unisound.com 的 Cookie(含 JSESSIONID)或 cURL',
|
|
5702
|
+
consoleFormGuide: '登录 maas.unisound.com 后,复制任意 /manager/ 请求的 Cookie 头或整段 cURL(需含 JSESSIONID)粘贴。',
|
|
5676
5703
|
})
|
|
5677
5704
|
|
|
5678
5705
|
// ── src/client/providers/qianfan.js ──
|
|
@@ -5681,6 +5708,8 @@ const qianfan = apiKeyChannel({
|
|
|
5681
5708
|
title: '千帆 Token Plan',
|
|
5682
5709
|
host: 'qianfan.baidubce.com',
|
|
5683
5710
|
consoleMeta: '用于读取千帆 Token Plan 个人版月度额度',
|
|
5711
|
+
consoleFormHint: '粘贴 console.bce.baidu.com 的 Cookie(含 BDUSS)或 cURL',
|
|
5712
|
+
consoleFormGuide: '登录千帆控制台后,复制 tokenPlanPersonal/resource 请求的 Cookie 头或整段 cURL(需含 BDUSS)粘贴。',
|
|
5684
5713
|
})
|
|
5685
5714
|
|
|
5686
5715
|
// ── src/client/providers/bailian.js ──
|
|
@@ -5688,7 +5717,9 @@ const bailian = apiKeyChannel({
|
|
|
5688
5717
|
id: 'bailian',
|
|
5689
5718
|
title: '阿里云百炼',
|
|
5690
5719
|
host: 'token-plan.cn-beijing.maas.aliyuncs.com',
|
|
5691
|
-
consoleMeta: '用于读取百炼 Token Plan
|
|
5720
|
+
consoleMeta: '用于读取百炼 Token Plan 个人版周期额度(支持阿里云 AK/SK 或 Cookie)',
|
|
5721
|
+
consoleFormHint: '粘贴 AccessKeyId:AccessKeySecret,或百炼控制台 Cookie / cURL',
|
|
5722
|
+
consoleFormGuide: '手机/无桌面推荐粘贴阿里云 RAM 子账号的 AccessKeyId:AccessKeySecret(长期有效),也可粘贴 bailian.console.aliyun.com 的 Cookie 或 cURL。',
|
|
5692
5723
|
})
|
|
5693
5724
|
|
|
5694
5725
|
// ── src/client/providers/stepfun.js ──
|
|
@@ -5697,6 +5728,8 @@ const stepfun = apiKeyChannel({
|
|
|
5697
5728
|
title: 'Step Plan',
|
|
5698
5729
|
host: 'api.stepfun.com',
|
|
5699
5730
|
consoleMeta: '用于读取阶跃星辰 Step Plan 周期与月度 Credit 额度',
|
|
5731
|
+
consoleFormHint: '粘贴 platform.stepfun.com 的 Oasis-Token、Cookie 或 cURL',
|
|
5732
|
+
consoleFormGuide: '登录 platform.stepfun.com/step-plan 后,复制请求头中的 Oasis-Token 值,或整段 Cookie / cURL 粘贴。',
|
|
5700
5733
|
})
|
|
5701
5734
|
|
|
5702
5735
|
// ── src/client/providers/astudio.js ──
|
package/lib/daily-checkin.js
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
const MINUTE = 60_000
|
|
13
13
|
// preflight 明确"未提交"后的自动重查退避。
|
|
14
14
|
const PREFLIGHT_BACKOFF = 15 * MINUTE
|
|
15
|
+
// pending 主记录(已提交、等待上游结算确认)的自动只读核实间隔:只查不重放。
|
|
16
|
+
const PENDING_VERIFY_INTERVAL = 5 * MINUTE
|
|
15
17
|
const OUTCOMES = new Set(['claimed', 'already-claimed', 'inactive', 'ineligible', 'failed', 'pending'])
|
|
16
18
|
// 上游确认已签(核实终态,可修复本地账本)。
|
|
17
19
|
const DONE_KINDS = new Set(['claimed', 'already-claimed'])
|
|
@@ -56,6 +58,7 @@ export function createDailyCheckin({ dir, adapters, enabled = true, isEnabled, n
|
|
|
56
58
|
let timer = null
|
|
57
59
|
let running = null
|
|
58
60
|
const localJobs = new Map()
|
|
61
|
+
const pendingVerifiedAt = new Map()
|
|
59
62
|
const providerEnabled = provider => typeof isEnabled === 'function' ? isEnabled(provider) === true : enabled === true
|
|
60
63
|
const anyEnabled = () => typeof isEnabled === 'function'
|
|
61
64
|
? (adapters.size ? [...adapters.keys()].some(providerEnabled) : isEnabled() === true)
|
|
@@ -200,6 +203,9 @@ export function createDailyCheckin({ dir, adapters, enabled = true, isEnabled, n
|
|
|
200
203
|
outcome: verdict.outcome, local: record,
|
|
201
204
|
localIsDone: localDone, confirmed, confirmedIsDone: secured,
|
|
202
205
|
})
|
|
206
|
+
if (verified && verdict.state === 'done' && !localDone && !secured) {
|
|
207
|
+
await onChange?.(provider, outcome)
|
|
208
|
+
}
|
|
203
209
|
results.push({ ...row, outcome, repeated: true, verified })
|
|
204
210
|
}
|
|
205
211
|
return results
|
|
@@ -229,7 +235,22 @@ export function createDailyCheckin({ dir, adapters, enabled = true, isEnabled, n
|
|
|
229
235
|
if (!providerEnabled(provider)) continue
|
|
230
236
|
// 只在本轮日界之后执行:Qoder 10:00 日界在 10:00 前属于上一轮,已在上一轮签过。
|
|
231
237
|
if (dayOf(now(), adapter.resetHour) !== dayOf(now())) continue
|
|
232
|
-
try {
|
|
238
|
+
try {
|
|
239
|
+
const rows = await claim(provider, undefined, lifetime.signal, true)
|
|
240
|
+
// 已有 pending 主记录(已提交但结算未确认)且适配器有只读 verify:
|
|
241
|
+
// 按间隔自动只读核实,上游结算后落 .confirmed 票据并刷新快照,绝不重复提交 claim。
|
|
242
|
+
if (typeof adapter.verify === 'function') {
|
|
243
|
+
for (const row of rows) {
|
|
244
|
+
if (lifetime.signal.aborted) break
|
|
245
|
+
if (row.outcome?.kind !== 'pending' || !row.repeated) continue
|
|
246
|
+
const key = `${provider}:${row.accountId}`
|
|
247
|
+
const last = pendingVerifiedAt.get(key) ?? 0
|
|
248
|
+
if (now() - last < PENDING_VERIFY_INTERVAL) continue
|
|
249
|
+
pendingVerifiedAt.set(key, now())
|
|
250
|
+
try { await query(provider, row.accountId, lifetime.signal) } catch {}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
233
254
|
catch { if (!lifetime.signal.aborted) logger?.warn?.('[unified-router] 自动签到暂未完成') }
|
|
234
255
|
}
|
|
235
256
|
})().finally(() => { running = null })
|
|
@@ -923,7 +923,27 @@ export const codeartsSpec = {
|
|
|
923
923
|
for (const { item, ch } of campaigns) {
|
|
924
924
|
const campaignId = item?.campaignId ?? item?.id
|
|
925
925
|
if (codeArtsDailyClaimed(item)) { doneCount++; continue }
|
|
926
|
-
if (String(item?.status ?? '').toUpperCase() === 'CLAIMED') {
|
|
926
|
+
if (String(item?.status ?? '').toUpperCase() === 'CLAIMED') {
|
|
927
|
+
// 已领取待确认:不重发 claim,只尝试补发一次 confirm 推进结算。
|
|
928
|
+
const existingBenefitId = item?.userBenefitId ?? item?.benefitRecordId
|
|
929
|
+
if ((ch === 'IDE' && campaignId) || existingBenefitId != null) {
|
|
930
|
+
const confirmRes = await codeArtsPostOps(handle, cred, '/v1/ops/confirm',
|
|
931
|
+
ch === 'IDE' ? { campaignId } : { userBenefitId: existingBenefitId }, signal)
|
|
932
|
+
if (codeArtsBizOk(confirmRes)) {
|
|
933
|
+
claimed++
|
|
934
|
+
creditSum += Number(item?.benefitAmount ?? item?.creditAmount) || 0
|
|
935
|
+
continue
|
|
936
|
+
}
|
|
937
|
+
const seenItem = campaignId ? await codeArtsFindDailyItem(handle, cred, signal, campaignId) : null
|
|
938
|
+
if (codeArtsDailyClaimed(seenItem) && String(seenItem?.status ?? '').toUpperCase() !== 'CLAIMED') {
|
|
939
|
+
claimed++
|
|
940
|
+
creditSum += Number(item?.benefitAmount ?? item?.creditAmount) || 0
|
|
941
|
+
continue
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
pendingCount++
|
|
945
|
+
continue
|
|
946
|
+
}
|
|
927
947
|
if (item?.claimable !== true) continue
|
|
928
948
|
if (!campaignId) { failedCount++; continue }
|
|
929
949
|
submitted = true
|
package/lib/model-catalog.js
CHANGED
|
@@ -241,7 +241,7 @@ const providerNamedSuccessors = {
|
|
|
241
241
|
// 其他现代推荐模型,也默认移出推荐(仍保留在目录中供手动启用,且绝不清空整个渠道)。
|
|
242
242
|
const obsoleteIdentities = new Set([
|
|
243
243
|
'deepseek-v3', 'deepseek-v3-1', 'deepseek-v4-flash', 'deepseek-v4-pro',
|
|
244
|
-
'glm-4-7', 'glm-5', 'glm-5-1', 'glm-5-2', 'glm-5v-turbo', 'glm-5-2-sft-harmony',
|
|
244
|
+
'glm-4-7', 'glm-5', 'glm-5-1', 'glm-5-2', 'glm-5-3', 'glm-5v-turbo', 'glm-5-2-sft-harmony',
|
|
245
245
|
'kimi-k2-5', 'kimi-k2-6', 'kimi-k2-7-code', 'kimi-k2-8-preview', 'kimi-k3',
|
|
246
246
|
'qwen-3-5', 'qwen-3-6-plus', 'qwen-3-7-plus', 'qwen-3-8-flash',
|
|
247
247
|
'minimax-m2-7', 'minimax-m3',
|
|
@@ -386,6 +386,7 @@ const OFFICIAL_MODEL_SPECS = Object.freeze({
|
|
|
386
386
|
'deepseek-v4-pro': { context: 1_048_576, maxOutput: 393_216 },
|
|
387
387
|
'deepseek-v4-pro-0813': { context: 1_048_576, maxOutput: 393_216 },
|
|
388
388
|
'deepseek-v4-flash': { context: 1_048_576, maxOutput: 393_216 },
|
|
389
|
+
'glm-5-4': { context: 1_000_000, maxOutput: 131_072 },
|
|
389
390
|
'glm-5-3': { context: 1_048_576, maxOutput: 131_072 },
|
|
390
391
|
'glm-5-3-flash': { context: 1_048_576, maxOutput: 131_072 },
|
|
391
392
|
'glm-5-3-flashx': { context: 1_048_576, maxOutput: 131_072 },
|