dsh-codearts 1.4.13 → 1.4.14
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 +23 -0
- package/lib/{auth-D-RmpxN3.mjs → auth-fN1w-DqH.mjs} +1 -1
- package/lib/bin.mjs +3 -3
- package/lib/client/index.d.cts +2 -0
- package/lib/client/index.js +167 -146
- package/lib/index.mjs +87 -10
- package/lib/keeper-main.mjs +1 -1
- package/lib/{upstream-DeRNnZdN.mjs → upstream-DA3AC1mv.mjs} +19 -1
- package/lib/{version-BnCFPeBL.mjs → version-DcfKEx5Z.mjs} +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
本文件记录本插件的重要改动。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
|
|
4
4
|
版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
5
5
|
|
|
6
|
+
## [1.4.14] - 2026-11-26
|
|
7
|
+
|
|
8
|
+
### 修复
|
|
9
|
+
|
|
10
|
+
- **带图请求必失败**(#21):`REQUEST_IMAGE_BUDGETS` 是手搓的 resolved profile,漏了
|
|
11
|
+
宿主 0.2.3 起用来算字节预算的 `requestImageBudgetCount`;除法得到 NaN,`NaN < 1`
|
|
12
|
+
绕过宿主自检,请求在附件层抛 `INVALID_ATTACHMENT_REF`。补上该字段(取 4:6 MiB
|
|
13
|
+
总预算下,均分仍盖过 1 MiB 单图上限),并补齐 0.2.3 改了名字的 `maxImageBytes`
|
|
14
|
+
以及 0.2.2-rc.1 起的必填项 `maxRequestImages` / `imageOffloadCountQuantum`。
|
|
15
|
+
- **单账号积分耗尽不再判死整轮**(#20):上游回 HTTP 400 + `TM.00001050`(同一错误
|
|
16
|
+
也会以流内首帧出现)时识别为 `hard_credit`,轮转循环换下一个号并冷却 30 分钟;
|
|
17
|
+
全部账号耗尽时回 402 并说明「积分按账号独立计算、不能跨号挪用」。流内报错日志里
|
|
18
|
+
的错误码不再被脱敏器打成 `****`。
|
|
19
|
+
- **provider 注册不再被首轮发现拖住**(#19):启动引导改为先注册 provider、再做
|
|
20
|
+
首轮发现(一次性宿主仍然等首轮发现拿清单);体检新增 `provider` 一项(是否注册、
|
|
21
|
+
卡在哪个阶段、注册报错原文),启动等待超时时也会留一条可见的 warn。
|
|
22
|
+
|
|
23
|
+
### 新增
|
|
24
|
+
|
|
25
|
+
- **积分弹层标出耗尽的号**(#20):余额为 0 的账号在卡片里降为警戒色圆点并挂
|
|
26
|
+
「已耗尽」标签;账号多于一个时,表头下方补一句「积分按账号独立计算、不能跨号
|
|
27
|
+
挪用;底部合计是所有号的总和」。合计数字本身不变。
|
|
28
|
+
|
|
6
29
|
## [1.4.13] - 2026-11-24
|
|
7
30
|
|
|
8
31
|
### 修复
|
|
@@ -584,7 +584,7 @@ async function clearCredential(path) {
|
|
|
584
584
|
async function claimIfPossible(cred) {
|
|
585
585
|
if (!cred.accessKeyId || !cred.secretAccessKey) return;
|
|
586
586
|
try {
|
|
587
|
-
const { claimBenefit } = await import("./upstream-
|
|
587
|
+
const { claimBenefit } = await import("./upstream-DA3AC1mv.mjs").then((n) => n.z);
|
|
588
588
|
await claimBenefit({
|
|
589
589
|
token: cred.token,
|
|
590
590
|
accessKeyId: cred.accessKeyId,
|
package/lib/bin.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as codeartsAccountsPath, t as CodeArtsAccountStore } from "./auth-
|
|
3
|
-
import {
|
|
4
|
-
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-
|
|
2
|
+
import { i as codeartsAccountsPath, t as CodeArtsAccountStore } from "./auth-fN1w-DqH.mjs";
|
|
3
|
+
import { J as isBenefitModel, l as fetchCallerIdentity } from "./upstream-DA3AC1mv.mjs";
|
|
4
|
+
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DcfKEx5Z.mjs";
|
|
5
5
|
import { existsSync, statSync } from "node:fs";
|
|
6
6
|
//#region src/bin.ts
|
|
7
7
|
/**
|
package/lib/client/index.d.cts
CHANGED
|
@@ -201,6 +201,8 @@ interface CodeArtsSettingsKey {
|
|
|
201
201
|
creditsDockEmpty: string;
|
|
202
202
|
creditsDockExpiring: string;
|
|
203
203
|
creditsDockUpdated: string;
|
|
204
|
+
creditsDockExhausted: string;
|
|
205
|
+
creditsDockPerAccountNote: string;
|
|
204
206
|
dockProvider: string;
|
|
205
207
|
dockModel: string;
|
|
206
208
|
dockNoModel: string;
|
package/lib/client/index.js
CHANGED
|
@@ -194,129 +194,129 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
194
194
|
document.head.appendChild(tag);
|
|
195
195
|
}
|
|
196
196
|
var CodeArtsPluginCard_module_css_default = {
|
|
197
|
-
"
|
|
198
|
-
"
|
|
197
|
+
"windowInputSet": "xoziZG_windowInputSet",
|
|
198
|
+
"count": "xoziZG_count",
|
|
199
|
+
"windowUnit": "xoziZG_windowUnit",
|
|
200
|
+
"area": "xoziZG_area",
|
|
201
|
+
"creditBlock": "xoziZG_creditBlock",
|
|
202
|
+
"modelSpec": "xoziZG_modelSpec",
|
|
203
|
+
"usageTipName": "xoziZG_usageTipName",
|
|
204
|
+
"body": "xoziZG_body",
|
|
205
|
+
"manualSummary": "xoziZG_manualSummary",
|
|
206
|
+
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
207
|
+
"windowRange": "xoziZG_windowRange",
|
|
208
|
+
"sectionHead": "xoziZG_sectionHead",
|
|
209
|
+
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
210
|
+
"heatCell": "xoziZG_heatCell",
|
|
211
|
+
"creditRow": "xoziZG_creditRow",
|
|
212
|
+
"windowButton": "xoziZG_windowButton",
|
|
213
|
+
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
214
|
+
"field": "xoziZG_field",
|
|
215
|
+
"accountNameRow": "xoziZG_accountNameRow",
|
|
199
216
|
"updated": "xoziZG_updated",
|
|
217
|
+
"claimAllRow": "xoziZG_claimAllRow",
|
|
218
|
+
"windowHint": "xoziZG_windowHint",
|
|
219
|
+
"link": "xoziZG_link",
|
|
220
|
+
"modelTokens": "xoziZG_modelTokens",
|
|
221
|
+
"fieldLabel": "xoziZG_fieldLabel",
|
|
222
|
+
"error": "xoziZG_error",
|
|
223
|
+
"name": "xoziZG_name",
|
|
224
|
+
"usageFill": "xoziZG_usageFill",
|
|
225
|
+
"heatLegend": "xoziZG_heatLegend",
|
|
226
|
+
"check": "xoziZG_check",
|
|
227
|
+
"concurrencyStepper": "xoziZG_concurrencyStepper",
|
|
228
|
+
"tabPanel": "xoziZG_tabPanel",
|
|
229
|
+
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
230
|
+
"modelCheck": "xoziZG_modelCheck",
|
|
231
|
+
"accountClearHint": "xoziZG_accountClearHint",
|
|
232
|
+
"balanceUnit": "xoziZG_balanceUnit",
|
|
233
|
+
"accountToolbar": "xoziZG_accountToolbar",
|
|
234
|
+
"manual": "xoziZG_manual",
|
|
235
|
+
"windowSection": "xoziZG_windowSection",
|
|
236
|
+
"accountCard": "xoziZG_accountCard",
|
|
237
|
+
"modelName": "xoziZG_modelName",
|
|
238
|
+
"heatGrid": "xoziZG_heatGrid",
|
|
239
|
+
"accountConcurrencyInline": "xoziZG_accountConcurrencyInline",
|
|
240
|
+
"windowInput": "xoziZG_windowInput",
|
|
241
|
+
"section": "xoziZG_section",
|
|
242
|
+
"skeleton": "xoziZG_skeleton",
|
|
243
|
+
"headText": "xoziZG_headText",
|
|
200
244
|
"hint": "xoziZG_hint",
|
|
201
|
-
"
|
|
245
|
+
"modelMeta": "xoziZG_modelMeta",
|
|
202
246
|
"expiryRow": "xoziZG_expiryRow",
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
206
|
-
"choiceRow": "xoziZG_choiceRow",
|
|
207
|
-
"creditRows": "xoziZG_creditRows",
|
|
247
|
+
"creditFooter": "xoziZG_creditFooter",
|
|
248
|
+
"modelTrack": "xoziZG_modelTrack",
|
|
208
249
|
"accountEntry": "xoziZG_accountEntry",
|
|
209
|
-
"link": "xoziZG_link",
|
|
210
|
-
"concurrencyStepper": "xoziZG_concurrencyStepper",
|
|
211
|
-
"balance": "xoziZG_balance",
|
|
212
|
-
"accountConcurrencyLabel": "xoziZG_accountConcurrencyLabel",
|
|
213
|
-
"trendTip": "xoziZG_trendTip",
|
|
214
|
-
"accountInfo": "xoziZG_accountInfo",
|
|
215
|
-
"meta": "xoziZG_meta",
|
|
216
|
-
"statCard": "xoziZG_statCard",
|
|
217
|
-
"concurrencyValue": "xoziZG_concurrencyValue",
|
|
218
250
|
"accountMenu": "xoziZG_accountMenu",
|
|
219
|
-
"
|
|
251
|
+
"concurrencyValue": "xoziZG_concurrencyValue",
|
|
220
252
|
"usageTipSep": "xoziZG_usageTipSep",
|
|
221
|
-
"creditHint": "xoziZG_creditHint",
|
|
222
|
-
"modelChart": "xoziZG_modelChart",
|
|
223
|
-
"choices": "xoziZG_choices",
|
|
224
|
-
"claimAllRow": "xoziZG_claimAllRow",
|
|
225
|
-
"concurrencyButton": "xoziZG_concurrencyButton",
|
|
226
253
|
"modelRow": "xoziZG_modelRow",
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"sectionHead": "xoziZG_sectionHead",
|
|
231
|
-
"heatLegend": "xoziZG_heatLegend",
|
|
232
|
-
"accountGrid": "xoziZG_accountGrid",
|
|
233
|
-
"statusLine": "xoziZG_statusLine",
|
|
234
|
-
"accountRow": "xoziZG_accountRow",
|
|
235
|
-
"card": "xoziZG_card",
|
|
236
|
-
"field": "xoziZG_field",
|
|
237
|
-
"accountMenuAnchor": "xoziZG_accountMenuAnchor",
|
|
238
|
-
"tabs": "xoziZG_tabs",
|
|
254
|
+
"modelShare": "xoziZG_modelShare",
|
|
255
|
+
"manualForm": "xoziZG_manualForm",
|
|
256
|
+
"heatHourCell": "xoziZG_heatHourCell",
|
|
239
257
|
"usageTip": "xoziZG_usageTip",
|
|
240
|
-
"
|
|
241
|
-
"
|
|
242
|
-
"
|
|
258
|
+
"statValue": "xoziZG_statValue",
|
|
259
|
+
"creditHint": "xoziZG_creditHint",
|
|
260
|
+
"doctorList": "xoziZG_doctorList",
|
|
261
|
+
"choiceRow": "xoziZG_choiceRow",
|
|
262
|
+
"desc": "xoziZG_desc",
|
|
263
|
+
"choiceTail": "xoziZG_choiceTail",
|
|
264
|
+
"heatAxis": "xoziZG_heatAxis",
|
|
265
|
+
"modelRequests": "xoziZG_modelRequests",
|
|
266
|
+
"heatHours": "xoziZG_heatHours",
|
|
267
|
+
"accountMenuItem": "xoziZG_accountMenuItem",
|
|
268
|
+
"accountToggle": "xoziZG_accountToggle",
|
|
269
|
+
"meta": "xoziZG_meta",
|
|
270
|
+
"accountRow": "xoziZG_accountRow",
|
|
271
|
+
"statCard": "xoziZG_statCard",
|
|
272
|
+
"windowAnchor": "xoziZG_windowAnchor",
|
|
273
|
+
"concurrencyButton": "xoziZG_concurrencyButton",
|
|
243
274
|
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
275
|
+
"accountClear": "xoziZG_accountClear",
|
|
276
|
+
"doctorRow": "xoziZG_doctorRow",
|
|
277
|
+
"windowCaret": "xoziZG_windowCaret",
|
|
278
|
+
"header": "xoziZG_header",
|
|
279
|
+
"card": "xoziZG_card",
|
|
280
|
+
"balance": "xoziZG_balance",
|
|
281
|
+
"barFill": "xoziZG_barFill",
|
|
247
282
|
"windowPopover": "xoziZG_windowPopover",
|
|
283
|
+
"avatar": "xoziZG_avatar",
|
|
284
|
+
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
285
|
+
"accountMenuAnchor": "xoziZG_accountMenuAnchor",
|
|
286
|
+
"balanceMeta": "xoziZG_balanceMeta",
|
|
287
|
+
"choices": "xoziZG_choices",
|
|
288
|
+
"accountInfo": "xoziZG_accountInfo",
|
|
289
|
+
"accountConcurrencyLabel": "xoziZG_accountConcurrencyLabel",
|
|
248
290
|
"bar": "xoziZG_bar",
|
|
249
|
-
"usageTipRow": "xoziZG_usageTipRow",
|
|
250
|
-
"actions": "xoziZG_actions",
|
|
251
|
-
"usageBar": "xoziZG_usageBar",
|
|
252
|
-
"accountCard": "xoziZG_accountCard",
|
|
253
|
-
"creditLink": "xoziZG_creditLink",
|
|
254
|
-
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
255
|
-
"windowInput": "xoziZG_windowInput",
|
|
256
|
-
"modelFill": "xoziZG_modelFill",
|
|
257
|
-
"statLabel": "xoziZG_statLabel",
|
|
258
|
-
"windowUnit": "xoziZG_windowUnit",
|
|
259
|
-
"modelMeta": "xoziZG_modelMeta",
|
|
260
|
-
"modelCheck": "xoziZG_modelCheck",
|
|
261
|
-
"groupLabel": "xoziZG_groupLabel",
|
|
262
|
-
"body": "xoziZG_body",
|
|
263
|
-
"statValue": "xoziZG_statValue",
|
|
264
|
-
"heatGrid": "xoziZG_heatGrid",
|
|
265
|
-
"modelTokens": "xoziZG_modelTokens",
|
|
266
|
-
"modelRequests": "xoziZG_modelRequests",
|
|
267
|
-
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
268
|
-
"heatAxis": "xoziZG_heatAxis",
|
|
269
|
-
"statSub": "xoziZG_statSub",
|
|
270
|
-
"danger": "xoziZG_danger",
|
|
271
|
-
"windowInputSet": "xoziZG_windowInputSet",
|
|
272
|
-
"manual": "xoziZG_manual",
|
|
273
291
|
"groupHead": "xoziZG_groupHead",
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"
|
|
292
|
+
"statLabel": "xoziZG_statLabel",
|
|
293
|
+
"doctorName": "xoziZG_doctorName",
|
|
294
|
+
"usageBar": "xoziZG_usageBar",
|
|
295
|
+
"balanceRow": "xoziZG_balanceRow",
|
|
296
|
+
"accountRowActions": "xoziZG_accountRowActions",
|
|
297
|
+
"groupHeadFirst": "xoziZG_groupHeadFirst",
|
|
298
|
+
"expiryLabel": "xoziZG_expiryLabel",
|
|
299
|
+
"tabs": "xoziZG_tabs",
|
|
300
|
+
"actions": "xoziZG_actions",
|
|
278
301
|
"skeletonBreath": "xoziZG_skeletonBreath",
|
|
279
|
-
"
|
|
280
|
-
"
|
|
302
|
+
"danger": "xoziZG_danger",
|
|
303
|
+
"statSub": "xoziZG_statSub",
|
|
304
|
+
"modelChart": "xoziZG_modelChart",
|
|
305
|
+
"usageTipRow": "xoziZG_usageTipRow",
|
|
306
|
+
"sectionLabel": "xoziZG_sectionLabel",
|
|
281
307
|
"accountName": "xoziZG_accountName",
|
|
282
|
-
"
|
|
283
|
-
"
|
|
284
|
-
"
|
|
308
|
+
"accountGrid": "xoziZG_accountGrid",
|
|
309
|
+
"modelFill": "xoziZG_modelFill",
|
|
310
|
+
"skeletonRow": "xoziZG_skeletonRow",
|
|
311
|
+
"statGrid": "xoziZG_statGrid",
|
|
312
|
+
"statusLine": "xoziZG_statusLine",
|
|
285
313
|
"accountHint": "xoziZG_accountHint",
|
|
286
|
-
"
|
|
287
|
-
"
|
|
288
|
-
"
|
|
314
|
+
"creditRows": "xoziZG_creditRows",
|
|
315
|
+
"creditLink": "xoziZG_creditLink",
|
|
316
|
+
"trendTip": "xoziZG_trendTip",
|
|
317
|
+
"groupLabel": "xoziZG_groupLabel",
|
|
289
318
|
"heatWeekday": "xoziZG_heatWeekday",
|
|
290
|
-
"
|
|
291
|
-
"doctorName": "xoziZG_doctorName",
|
|
292
|
-
"heatHours": "xoziZG_heatHours",
|
|
293
|
-
"groupHeadFirst": "xoziZG_groupHeadFirst",
|
|
294
|
-
"modelSpec": "xoziZG_modelSpec",
|
|
295
|
-
"doctorRow": "xoziZG_doctorRow",
|
|
296
|
-
"windowRange": "xoziZG_windowRange",
|
|
297
|
-
"accountToolbar": "xoziZG_accountToolbar",
|
|
298
|
-
"modelName": "xoziZG_modelName",
|
|
299
|
-
"heatCell": "xoziZG_heatCell",
|
|
300
|
-
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
301
|
-
"desc": "xoziZG_desc",
|
|
302
|
-
"accountToggle": "xoziZG_accountToggle",
|
|
303
|
-
"fieldLabel": "xoziZG_fieldLabel",
|
|
304
|
-
"balanceMeta": "xoziZG_balanceMeta",
|
|
305
|
-
"doctorList": "xoziZG_doctorList",
|
|
306
|
-
"accountClear": "xoziZG_accountClear",
|
|
307
|
-
"skeletonRow": "xoziZG_skeletonRow",
|
|
308
|
-
"accountClearHint": "xoziZG_accountClearHint",
|
|
309
|
-
"usageFill": "xoziZG_usageFill",
|
|
310
|
-
"barFill": "xoziZG_barFill",
|
|
311
|
-
"accountNameRow": "xoziZG_accountNameRow",
|
|
312
|
-
"sectionLabel": "xoziZG_sectionLabel",
|
|
313
|
-
"balanceRow": "xoziZG_balanceRow",
|
|
314
|
-
"skeleton": "xoziZG_skeleton",
|
|
315
|
-
"windowButton": "xoziZG_windowButton",
|
|
316
|
-
"usageTipName": "xoziZG_usageTipName",
|
|
317
|
-
"balanceUnit": "xoziZG_balanceUnit",
|
|
318
|
-
"area": "xoziZG_area",
|
|
319
|
-
"accountRowActions": "xoziZG_accountRowActions"
|
|
319
|
+
"windowPopoverHead": "xoziZG_windowPopoverHead"
|
|
320
320
|
};
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/client/CodeArtsPluginCard.tsx
|
|
@@ -3553,52 +3553,69 @@ function CodeArtsCreditDock({ useProjection, t, zone = "dock", onOpenSettings })
|
|
|
3553
3553
|
fontSize: 12,
|
|
3554
3554
|
color: "var(--dsw-alias-label-tertiary)"
|
|
3555
3555
|
},
|
|
3556
|
-
children: [
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
flexDirection: "column",
|
|
3560
|
-
gap: 2,
|
|
3561
|
-
minWidth: 0
|
|
3562
|
-
},
|
|
3563
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3556
|
+
children: [
|
|
3557
|
+
rows.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("creditsDockEmpty") }),
|
|
3558
|
+
rows.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3564
3559
|
style: {
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3560
|
+
fontSize: 11,
|
|
3561
|
+
lineHeight: "15px"
|
|
3562
|
+
},
|
|
3563
|
+
children: t("creditsDockPerAccountNote")
|
|
3564
|
+
}),
|
|
3565
|
+
rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3566
|
+
style: {
|
|
3567
|
+
display: "flex",
|
|
3568
|
+
flexDirection: "column",
|
|
3569
|
+
gap: 2,
|
|
3569
3570
|
minWidth: 0
|
|
3570
3571
|
},
|
|
3571
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
3572
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3572
3573
|
style: {
|
|
3573
|
-
display: "
|
|
3574
|
+
display: "grid",
|
|
3575
|
+
gridTemplateColumns: PANEL_ROW_COLUMNS,
|
|
3576
|
+
gap: "0 8px",
|
|
3574
3577
|
alignItems: "center",
|
|
3575
|
-
gap: 5,
|
|
3576
3578
|
minWidth: 0
|
|
3577
3579
|
},
|
|
3578
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3580
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3579
3581
|
style: {
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3582
|
+
display: "flex",
|
|
3583
|
+
alignItems: "center",
|
|
3584
|
+
gap: 5,
|
|
3585
|
+
minWidth: 0
|
|
3584
3586
|
},
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
+
children: [
|
|
3588
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: row.remain === null || row.remain < 1 ? "warning" : "done" }),
|
|
3589
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3590
|
+
style: {
|
|
3591
|
+
overflow: "hidden",
|
|
3592
|
+
textOverflow: "ellipsis",
|
|
3593
|
+
whiteSpace: "nowrap",
|
|
3594
|
+
color: "var(--dsw-alias-label-primary)"
|
|
3595
|
+
},
|
|
3596
|
+
title: row.error === void 0 ? row.name : row.error,
|
|
3597
|
+
children: row.name
|
|
3598
|
+
}),
|
|
3599
|
+
row.remain !== null && row.remain < 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
3600
|
+
tone: "warning",
|
|
3601
|
+
children: t("creditsDockExhausted")
|
|
3602
|
+
})
|
|
3603
|
+
]
|
|
3604
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3605
|
+
style: PANEL_NUM_CELL,
|
|
3606
|
+
children: row.remain === null ? "—" : formatNumber(row.remain)
|
|
3587
3607
|
})]
|
|
3588
3608
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3589
|
-
style:
|
|
3590
|
-
|
|
3609
|
+
style: {
|
|
3610
|
+
paddingLeft: 11,
|
|
3611
|
+
fontSize: 11,
|
|
3612
|
+
lineHeight: "15px",
|
|
3613
|
+
color: "var(--dsw-alias-label-tertiary)"
|
|
3614
|
+
},
|
|
3615
|
+
children: row.usage === void 0 ? t("creditsDockNoTokens") : `${t("usageToday")} ${usageLine(row.usage, t)}`
|
|
3591
3616
|
})]
|
|
3592
|
-
}
|
|
3593
|
-
|
|
3594
|
-
paddingLeft: 11,
|
|
3595
|
-
fontSize: 11,
|
|
3596
|
-
lineHeight: "15px",
|
|
3597
|
-
color: "var(--dsw-alias-label-tertiary)"
|
|
3598
|
-
},
|
|
3599
|
-
children: row.usage === void 0 ? t("creditsDockNoTokens") : `${t("usageToday")} ${usageLine(row.usage, t)}`
|
|
3600
|
-
})]
|
|
3601
|
-
}, row.id))]
|
|
3617
|
+
}, row.id))
|
|
3618
|
+
]
|
|
3602
3619
|
}),
|
|
3603
3620
|
rows.filter((row) => row.expiring > 0).map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3604
3621
|
style: {
|
|
@@ -3631,14 +3648,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
3631
3648
|
document.head.appendChild(tag);
|
|
3632
3649
|
}
|
|
3633
3650
|
var CodeArtsPanel_module_css_default = {
|
|
3634
|
-
"icon": "Z66cgG_icon",
|
|
3635
|
-
"head": "Z66cgG_head",
|
|
3636
|
-
"page": "Z66cgG_page",
|
|
3637
3651
|
"desc": "Z66cgG_desc",
|
|
3638
|
-
"back": "Z66cgG_back",
|
|
3639
3652
|
"body": "Z66cgG_body",
|
|
3653
|
+
"back": "Z66cgG_back",
|
|
3654
|
+
"icon": "Z66cgG_icon",
|
|
3640
3655
|
"backCaret": "Z66cgG_backCaret",
|
|
3641
|
-
"title": "Z66cgG_title"
|
|
3656
|
+
"title": "Z66cgG_title",
|
|
3657
|
+
"head": "Z66cgG_head",
|
|
3658
|
+
"page": "Z66cgG_page"
|
|
3642
3659
|
};
|
|
3643
3660
|
//#endregion
|
|
3644
3661
|
//#region src/client/CodeArtsPanel.tsx
|
|
@@ -3964,6 +3981,8 @@ const zh = {
|
|
|
3964
3981
|
creditsDockEmpty: "暂时没有积分数据",
|
|
3965
3982
|
creditsDockExpiring: "{account}:{expiring} 积分将在本周期结束时作废",
|
|
3966
3983
|
creditsDockUpdated: "最近刷新 {time}",
|
|
3984
|
+
creditsDockExhausted: "已耗尽",
|
|
3985
|
+
creditsDockPerAccountNote: "积分按账号独立计算、不能跨号挪用;底部合计是所有号的总和。",
|
|
3967
3986
|
dockProvider: "Provider {provider}",
|
|
3968
3987
|
dockModel: "Model {model}",
|
|
3969
3988
|
dockNoModel: "未选择模型",
|
|
@@ -4191,6 +4210,8 @@ const en = {
|
|
|
4191
4210
|
creditsDockEmpty: "No credit data yet",
|
|
4192
4211
|
creditsDockExpiring: "{account}: {expiring} credits expire when this cycle ends",
|
|
4193
4212
|
creditsDockUpdated: "Last updated {time}",
|
|
4213
|
+
creditsDockExhausted: "Exhausted",
|
|
4214
|
+
creditsDockPerAccountNote: "Credits are counted per account and cannot be pooled; the dock total is just the sum of every account.",
|
|
4194
4215
|
dockProvider: "Provider {provider}",
|
|
4195
4216
|
dockModel: "Model {model}",
|
|
4196
4217
|
dockNoModel: "No model selected",
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as codeartsAuthPath, c as credentialFromOAuth, g as startLogin, i as codeartsAccountsPath, n as CodeArtsCredentialStore, o as codeartsDebugLogPath, r as MANUAL_ACCOUNT_ID, s as codeartsRefreshLogPath, t as CodeArtsAccountStore } from "./auth-
|
|
2
|
-
import {
|
|
3
|
-
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-
|
|
1
|
+
import { a as codeartsAuthPath, c as credentialFromOAuth, g as startLogin, i as codeartsAccountsPath, n as CodeArtsCredentialStore, o as codeartsDebugLogPath, r as MANUAL_ACCOUNT_ID, s as codeartsRefreshLogPath, t as CodeArtsAccountStore } from "./auth-fN1w-DqH.mjs";
|
|
2
|
+
import { A as overrideValueFor, B as CodeArtsCatalog, C as isQueueableRate, D as learnedContextWindowFor, E as learnContextWindow, F as setMaxTokenOverride, G as filterEnabledModels, I as setMaxTokenOverrides, J as isBenefitModel, K as forgetModelUnavailable, L as signedGet, M as prepareChatBody, N as queueFrame, O as maxTokensCeilingFor, P as rateLimitFrame, Q as modelUnavailableReason, R as upstreamErrorMessage, S as isQueueRejectText, T as isWelfareClaimedStatus, U as clearBenefitBlocked, V as FALLBACK_CODEARTS_MODELS, W as creditRatioLabel, Y as markModelUnavailable, _ as isIamTokenError, a as claimDailyWelfare, b as isParamInvalidFrame, c as degradeTokenCeiling, d as fetchQueueStatus, et as withContextWindowOverride, f as fetchWelfareCampaigns, g as isCreditExhausted, h as isContextOverflowText, i as chatStream, j as pickDailyWelfareCampaign, k as modelUnavailableReasonText, l as fetchCallerIdentity, m as isConcurrencyCap, n as SNAP_HOST, o as clearQueueStatus, p as firstFrameError, q as isBenefitBlocked, r as canonicalModel, s as contextWindowOverrideFor, t as MAX_TOKENS_FLOOR, tt as withMaxTokensOverride, u as fetchModels, v as isModelNotAccessible, w as isTpmLimit, x as isQueueReject, y as isNotMultimodal } from "./upstream-DA3AC1mv.mjs";
|
|
3
|
+
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DcfKEx5Z.mjs";
|
|
4
4
|
import { i as lazyApi, r as createProvider } from "./models-CgKCibpk.mjs";
|
|
5
5
|
import { c as keeperLogPath, f as keeperStats, i as clearKeeperHandoff, l as keeperNextPassAt, m as stopKeeper, n as KEEPER_STALE_MS, p as spawnKeeper, s as keeperHandoffRecent, u as keeperScriptPath } from "./keeper-BWHQDFAh.mjs";
|
|
6
6
|
import { appendFileSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -820,7 +820,32 @@ const NO_COST = {
|
|
|
820
820
|
const REQUEST_IMAGE_BUDGETS = {
|
|
821
821
|
maxRequestImageBytes: 6291456,
|
|
822
822
|
requestImagePixelBudget: 4194304,
|
|
823
|
-
|
|
823
|
+
/**
|
|
824
|
+
* 单图上限。这个字段在宿主里有两个拼写:0.2.2 及以前读 `requestImageMaxBytes`,
|
|
825
|
+
* 0.2.3 起 resolved profile 改叫 `maxImageBytes`(配置里的旧名由 resolveProfiles
|
|
826
|
+
* 映射过去)。本插件是手搓 profile、不走 resolveProfiles,两处都得写,各自忽略
|
|
827
|
+
* 不认识的那一个。
|
|
828
|
+
*/
|
|
829
|
+
requestImageMaxBytes: 1048576,
|
|
830
|
+
maxImageBytes: 1048576,
|
|
831
|
+
/**
|
|
832
|
+
* 0.2.3 起宿主要求的字节预算除数(issue #21):
|
|
833
|
+
* allocated = floor(maxRequestImageBytes / requestImageBudgetCount / 4) * 3
|
|
834
|
+
* cap = min(allocated, maxImageBytes)
|
|
835
|
+
* 漏掉它时分母是 undefined ⇒ NaN,`NaN < 1` 为 false 绕过宿主自检,带图请求
|
|
836
|
+
* 必然在附件层抛 INVALID_ATTACHMENT_REF。
|
|
837
|
+
*
|
|
838
|
+
* 取 4 而不是宿主默认的 20:allocated 只是 min() 的候选,除数必须让商仍盖过
|
|
839
|
+
* 1 MiB 单图上限,否则没人选的更小数字会悄悄顶替单图上限(6 MiB 时
|
|
840
|
+
* 20 → 235,929 字节,4 → 1,179,648)。5 已差一点(943,716),所以是 4。
|
|
841
|
+
*/
|
|
842
|
+
requestImageBudgetCount: 4,
|
|
843
|
+
/**
|
|
844
|
+
* 0.2.2-rc.1 起 resolved profile 的必填项(宿主默认 50 / 10)。
|
|
845
|
+
* 不写等于「数量不设限」,在带图长会话里会先撞上游请求体上限才轮到宿主 offload。
|
|
846
|
+
*/
|
|
847
|
+
maxRequestImages: 50,
|
|
848
|
+
imageOffloadCountQuantum: 10
|
|
824
849
|
};
|
|
825
850
|
/** Inert pi-ai auth plane: the codearts route authenticates only via the shim secret. */
|
|
826
851
|
const INERT_AUTH = {
|
|
@@ -1218,6 +1243,13 @@ const QUEUE_HEARTBEAT_MS = 2e4;
|
|
|
1218
1243
|
const SERVER_COOLDOWN_MS = 3e4;
|
|
1219
1244
|
/** 零散错误累计到阈值后冷却该账号。 */
|
|
1220
1245
|
const ERROR_COOLDOWN_MS = 6e4;
|
|
1246
|
+
/**
|
|
1247
|
+
* 积分耗尽后的冷却。积分是账号级的,不会在几十秒内回来(要等套餐周期刷新或
|
|
1248
|
+
* 领取活动积分),30 秒的短冷却只会让它被反复选中、反复失败一遍。30 分钟是
|
|
1249
|
+
* 「不反复白撞」与「用户中途领到积分后还能恢复」之间的折中;用户也可以在
|
|
1250
|
+
* 卡片上暂停这个号。
|
|
1251
|
+
*/
|
|
1252
|
+
const CREDIT_COOLDOWN_MS = 18e5;
|
|
1221
1253
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1222
1254
|
const recentShapes = [];
|
|
1223
1255
|
/** 最近的请求形状,最新在前。 */
|
|
@@ -1411,12 +1443,12 @@ function createCodeArtsShim(options) {
|
|
|
1411
1443
|
const upstreamError = headText === void 0 ? void 0 : firstFrameError(headText);
|
|
1412
1444
|
if (upstreamError !== void 0) {
|
|
1413
1445
|
const detail = `${upstreamError.code}: ${upstreamError.message}`.replace(/^: /, "");
|
|
1414
|
-
if (isIamTokenError(detail) || isModelNotAccessible(detail) || isNotMultimodal(detail)) {
|
|
1446
|
+
if (isIamTokenError(detail) || isModelNotAccessible(detail) || isNotMultimodal(detail) || isCreditExhausted(detail)) {
|
|
1415
1447
|
reader.releaseLock();
|
|
1416
1448
|
await result.stream.cancel().catch(() => {});
|
|
1417
1449
|
logger?.warn(`dsh-codearts: ${prepared.model} 首帧报上游错误(${detail.slice(0, 160)})`);
|
|
1418
1450
|
if (isModelNotAccessible(detail)) markModelUnavailable(prepared.model, modelUnavailableReasonText(detail));
|
|
1419
|
-
const kind = isIamTokenError(detail) ? "iam_stale" : isModelNotAccessible(detail) ? "not_found" : "client";
|
|
1451
|
+
const kind = isIamTokenError(detail) ? "iam_stale" : isModelNotAccessible(detail) ? "not_found" : isCreditExhausted(detail) ? "hard_credit" : "client";
|
|
1420
1452
|
return {
|
|
1421
1453
|
prepared,
|
|
1422
1454
|
result: {
|
|
@@ -1657,6 +1689,10 @@ function createCodeArtsShim(options) {
|
|
|
1657
1689
|
pool.disable(id, result.message);
|
|
1658
1690
|
continue;
|
|
1659
1691
|
}
|
|
1692
|
+
if (result.kind === "hard_credit") {
|
|
1693
|
+
pool.cooldown(id, CREDIT_COOLDOWN_MS, "该账号积分已耗尽(TM.00001050),额度刷新或领取积分后恢复");
|
|
1694
|
+
continue;
|
|
1695
|
+
}
|
|
1660
1696
|
if (result.kind === "server" || result.kind === "soft_rate") {
|
|
1661
1697
|
pool.cooldown(id, SERVER_COOLDOWN_MS, result.message);
|
|
1662
1698
|
break;
|
|
@@ -1842,7 +1878,7 @@ function createCodeArtsShim(options) {
|
|
|
1842
1878
|
if (ev.error === void 0) return;
|
|
1843
1879
|
const code = String(ev.error.code ?? "");
|
|
1844
1880
|
const message = String(ev.error.message ?? "").slice(0, 200);
|
|
1845
|
-
logger?.error(`dsh-codearts: 上游流内报错 model=${model}
|
|
1881
|
+
logger?.error(`dsh-codearts: 上游流内报错 model=${model} 错误码 ${code} msg=${message}`);
|
|
1846
1882
|
} catch {}
|
|
1847
1883
|
}
|
|
1848
1884
|
/** 把上游 SSE 按事件边界转发给 DSH,直到流结束或被中止。 */
|
|
@@ -2382,6 +2418,15 @@ async function doctorReport(deps) {
|
|
|
2382
2418
|
detail: `${models.length}`
|
|
2383
2419
|
});
|
|
2384
2420
|
if (models.length === 0) hints.add("empty-catalog");
|
|
2421
|
+
const provider = deps.providerStatus?.();
|
|
2422
|
+
if (provider !== void 0) {
|
|
2423
|
+
checks.push({
|
|
2424
|
+
id: "provider",
|
|
2425
|
+
ok: provider.registered,
|
|
2426
|
+
detail: provider.registered ? `registered (stage=${provider.stage})` : `not registered (stage=${provider.stage}${provider.error === void 0 ? "" : `; ${provider.error}`})`
|
|
2427
|
+
});
|
|
2428
|
+
if (!provider.registered) hints.add("provider-not-registered");
|
|
2429
|
+
}
|
|
2385
2430
|
checks.push({
|
|
2386
2431
|
id: "usage",
|
|
2387
2432
|
ok: deps.usage !== void 0,
|
|
@@ -3850,9 +3895,25 @@ async function apply(ctx, rawConfig) {
|
|
|
3850
3895
|
}
|
|
3851
3896
|
return summarizeClaims(results);
|
|
3852
3897
|
};
|
|
3898
|
+
/**
|
|
3899
|
+
* 启动引导的进度(issue #19)。
|
|
3900
|
+
*
|
|
3901
|
+
* 「插件 HTTP 面全活、模型选择器里却没有 CodeArts」是宿主上真实出现过的分裂状态;
|
|
3902
|
+
* 那一刻唯一能区分「shim 没起来 / 注册被首轮发现拖住 / 注册抛错」的证据就在这里,
|
|
3903
|
+
* 由 /api/codearts/doctor 的 `provider` 一项读出去。
|
|
3904
|
+
*/
|
|
3905
|
+
const startup = {
|
|
3906
|
+
stage: "shim",
|
|
3907
|
+
registered: false
|
|
3908
|
+
};
|
|
3853
3909
|
ctx.inject(["webServer"], (webCtx) => registerCodeArtsStatusRoute(webCtx, {
|
|
3854
3910
|
store,
|
|
3855
3911
|
models: () => catalog.current(),
|
|
3912
|
+
providerStatus: () => ({
|
|
3913
|
+
registered: startup.registered,
|
|
3914
|
+
stage: startup.stage,
|
|
3915
|
+
...startup.error === void 0 ? {} : { error: startup.error }
|
|
3916
|
+
}),
|
|
3856
3917
|
enabledModels,
|
|
3857
3918
|
setEnabledModels,
|
|
3858
3919
|
contextWindowOverrides: () => current().contextWindowOverrides,
|
|
@@ -4112,10 +4173,10 @@ async function apply(ctx, rawConfig) {
|
|
|
4112
4173
|
keepAliveLoop();
|
|
4113
4174
|
armAutoClaim();
|
|
4114
4175
|
armKeepAliveDaemon();
|
|
4115
|
-
|
|
4116
|
-
if (stopped) return;
|
|
4176
|
+
startup.stage = "register";
|
|
4117
4177
|
const incompatible = await probePiAiCompat();
|
|
4118
4178
|
if (incompatible !== void 0) ctx.logger.error(`dsh-codearts: ${incompatible}`);
|
|
4179
|
+
writeDebugLog?.(`bootstrap: shim ready, registering provider (catalog=${catalog.current().length})`);
|
|
4119
4180
|
const codearts = createCodeArtsAdapter({
|
|
4120
4181
|
shim,
|
|
4121
4182
|
catalog,
|
|
@@ -4134,6 +4195,11 @@ async function apply(ctx, rawConfig) {
|
|
|
4134
4195
|
settingsPath: [],
|
|
4135
4196
|
declared: false
|
|
4136
4197
|
}]);
|
|
4198
|
+
startup.registered = true;
|
|
4199
|
+
writeDebugLog?.("bootstrap: provider registered");
|
|
4200
|
+
} catch (error) {
|
|
4201
|
+
startup.error = error instanceof Error ? error.message : String(error);
|
|
4202
|
+
throw error;
|
|
4137
4203
|
} finally {
|
|
4138
4204
|
if (releaseAdapter === void 0 || releaseDirectory === void 0) {
|
|
4139
4205
|
releaseAdapter?.();
|
|
@@ -4149,14 +4215,25 @@ async function apply(ctx, rawConfig) {
|
|
|
4149
4215
|
releaseAdapter?.();
|
|
4150
4216
|
releaseDirectory?.();
|
|
4151
4217
|
}
|
|
4218
|
+
startup.stage = "discovery";
|
|
4219
|
+
await discover(AbortSignal.any([abort.signal, AbortSignal.timeout(STARTUP_DISCOVERY_MS)]));
|
|
4220
|
+
if (stopped) return;
|
|
4152
4221
|
if (catalog.current().length === 0) ctx.logger.warn("dsh-codearts: CodeArts provider registered with an empty model catalog; models stay unavailable until discovery succeeds");
|
|
4222
|
+
startup.stage = "ready";
|
|
4223
|
+
writeDebugLog?.(`bootstrap: ready (catalog=${catalog.current().length})`);
|
|
4153
4224
|
if (!stopped) scheduleDiscovery(nextDiscoveryDelay());
|
|
4154
4225
|
}).catch((error) => {
|
|
4226
|
+
startup.error = error instanceof Error ? error.message : String(error);
|
|
4155
4227
|
ctx.logger.error("dsh-codearts: loopback shim failed to start; provider not registered", error);
|
|
4156
4228
|
});
|
|
4229
|
+
let startupTimedOut = false;
|
|
4157
4230
|
await Promise.race([settled, new Promise((resolve) => {
|
|
4158
|
-
setTimeout(
|
|
4231
|
+
setTimeout(() => {
|
|
4232
|
+
startupTimedOut = true;
|
|
4233
|
+
resolve();
|
|
4234
|
+
}, STARTUP_WAIT_MS).unref?.();
|
|
4159
4235
|
})]);
|
|
4236
|
+
if (startupTimedOut) ctx.logger.warn(`dsh-codearts: 启动等待超时(阶段 ${startup.stage},provider ${startup.registered ? "已注册" : "尚未注册"}),引导链继续在后台执行;可打开设置卡片查看体检,或读取 /api/codearts/doctor 自查`);
|
|
4160
4237
|
}
|
|
4161
4238
|
//#endregion
|
|
4162
4239
|
export { BENEFIT_GATEWAY_HOST, CODEARTS_PROVIDER, CODEARTS_SETTINGS_NS, CodeArtsAccountPool, CodeArtsAccountStore, CodeArtsCatalog, CodeArtsCredentialStore, CodeArtsCreditCache, CodeArtsUsageTracker, Config, FALLBACK_CODEARTS_MODELS, SNAP_HOST, apply, canonicalModel, chatStream, codeartsAccountsPath, codeartsAuthPath, codeartsUsagePath, createCodeArtsAdapter, createCodeArtsShim, discoverModels, fetchCredits, fetchModels, filterEnabledModels, inject, maxTokensCeilingFor, name, parseCreditStatistics, parseTokenBalance, prepareChatBody, refreshCatalog };
|
package/lib/keeper-main.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as refreshLockPath, f as withRefreshLock, h as refreshToken, i as codeartsAccountsPath, l as readAccountDocument, m as defaultLoginConfig, p as OAuthTokenError, u as writeJsonAtomic } from "./auth-
|
|
1
|
+
import { d as refreshLockPath, f as withRefreshLock, h as refreshToken, i as codeartsAccountsPath, l as readAccountDocument, m as defaultLoginConfig, p as OAuthTokenError, u as writeJsonAtomic } from "./auth-fN1w-DqH.mjs";
|
|
2
2
|
import { _ as writeKeeperState, a as clearKeeperState, c as keeperLogPath, d as keeperStatePath, f as keeperStats, g as writeKeeperHandoff, h as stopRequested, i as clearKeeperHandoff, o as isDshInstallerTempDir, r as KEEPER_TICK_MS, t as KEEPER_HEARTBEAT_MS } from "./keeper-BWHQDFAh.mjs";
|
|
3
3
|
import { appendFileSync, existsSync, unlinkSync, watch } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
@@ -545,6 +545,7 @@ function signRequest(req, body, cred) {
|
|
|
545
545
|
var upstream_exports = /* @__PURE__ */ __exportAll({
|
|
546
546
|
BENEFIT_MISSING_CODE: () => BENEFIT_MISSING_CODE,
|
|
547
547
|
CONCURRENCY_CAP_CODE: () => CONCURRENCY_CAP_CODE,
|
|
548
|
+
CREDIT_EXHAUSTED_CODE: () => CREDIT_EXHAUSTED_CODE,
|
|
548
549
|
MAX_TOKENS_CEILING: () => MAX_TOKENS_CEILING,
|
|
549
550
|
MAX_TOKENS_FLOOR: () => MAX_TOKENS_FLOOR,
|
|
550
551
|
PARAM_INVALID_CODE: () => PARAM_INVALID_CODE,
|
|
@@ -568,6 +569,7 @@ var upstream_exports = /* @__PURE__ */ __exportAll({
|
|
|
568
569
|
isBenefitMissing: () => isBenefitMissing,
|
|
569
570
|
isConcurrencyCap: () => isConcurrencyCap,
|
|
570
571
|
isContextOverflowText: () => isContextOverflowText,
|
|
572
|
+
isCreditExhausted: () => isCreditExhausted,
|
|
571
573
|
isIamTokenError: () => isIamTokenError,
|
|
572
574
|
isModelNotAccessible: () => isModelNotAccessible,
|
|
573
575
|
isNotMultimodal: () => isNotMultimodal,
|
|
@@ -1246,12 +1248,27 @@ function upstreamErrorMessage(message, status = 0) {
|
|
|
1246
1248
|
return `${inner === "" ? "上游提示请求量较大、需要排队。" : inner} 插件已在本地排队重试,仍未轮到,请稍后重试或临时切换模型。`;
|
|
1247
1249
|
}
|
|
1248
1250
|
if (isIamTokenError(message)) return "上游判定本次登录凭据(IAM token)已失效。插件已尝试自动续期;若反复出现,请到设置卡片重新登录。";
|
|
1251
|
+
if (isCreditExhausted(message)) return "该账号的 CodeArts 积分已耗尽(上游 TM.00001050)。积分按账号独立计算、不能跨号挪用:多账号时到这个号的冷却结束或暂停它即可,积分周期刷新/领取活动积分后自动恢复。";
|
|
1249
1252
|
if (isModelNotAccessible(message)) return "上游说这个模型不存在或当前账号没有权限(可能已下线或改名)。请刷新模型列表后换一个模型;换号没有用,这是模型级的限制。";
|
|
1250
1253
|
if (isNotMultimodal(message)) return "这个模型不支持图片输入(上游 406)。请移除消息里的图片,或改用支持识图的模型。";
|
|
1251
1254
|
if (message.toLowerCase().includes("model is not registered")) return "上游没有注册这个模型,它可能已经下线;请刷新模型列表后重选。";
|
|
1252
1255
|
return `codearts 上游错误 (http ${status}): ${message.slice(0, 400)}`;
|
|
1253
1256
|
}
|
|
1254
1257
|
/**
|
|
1258
|
+
* 「这个账号的套餐积分已耗尽」。
|
|
1259
|
+
*
|
|
1260
|
+
* 2026-11-25 实测(issue #20):上游回 HTTP 400 + body
|
|
1261
|
+
* `{"text":"[DONE]","error_code":"TM.00001050","error_msg":"您的积分已耗尽…"}`;
|
|
1262
|
+
* 同一错误也可能以**流内首帧**(HTTP 200)出现,所以两条路都要认。
|
|
1263
|
+
*
|
|
1264
|
+
* 它是**确定不可恢复的单号属性**:积分是账号级的,不能跨号挪用,重发同一个号
|
|
1265
|
+
* 只会再撞一次。处置和 iam_stale 一样 —— 换下一个号,并把这个号冷却足够久。
|
|
1266
|
+
*/
|
|
1267
|
+
const CREDIT_EXHAUSTED_CODE = "TM.00001050";
|
|
1268
|
+
function isCreditExhausted(text) {
|
|
1269
|
+
return text.includes("TM.00001050") || text.includes("积分已耗尽");
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1255
1272
|
* 「这个账号当前没有该模型的限时福利权益」。2026-10-21 实测:上游回 HTTP 200,
|
|
1256
1273
|
* 错误在**流内帧**里(不在状态码上),所以它既不走 retry 也不走换号,用户看到的
|
|
1257
1274
|
* 就是正文里裸裸一句 `benefit not found`。
|
|
@@ -1336,6 +1353,7 @@ function classify(status, message) {
|
|
|
1336
1353
|
if (isResignRefusal(message)) return "client";
|
|
1337
1354
|
if (isIamTokenError(message)) return "iam_stale";
|
|
1338
1355
|
if (isModelNotAccessible(message)) return "not_found";
|
|
1356
|
+
if (isCreditExhausted(message)) return "hard_credit";
|
|
1339
1357
|
if (status === 401 || status === 403) return "session_dead";
|
|
1340
1358
|
if (status === 402) return "hard_credit";
|
|
1341
1359
|
if (status === 429) return "soft_rate";
|
|
@@ -2270,4 +2288,4 @@ async function claimDailyWelfare(credential, signal) {
|
|
|
2270
2288
|
};
|
|
2271
2289
|
}
|
|
2272
2290
|
//#endregion
|
|
2273
|
-
export {
|
|
2291
|
+
export { setDiscoveredBenefitModels as $, overrideValueFor as A, CodeArtsCatalog as B, isQueueableRate as C, learnedContextWindowFor as D, learnContextWindow as E, setMaxTokenOverride as F, filterEnabledModels as G, carryKnownWindows as H, setMaxTokenOverrides as I, isBenefitModel as J, forgetModelUnavailable as K, signedGet as L, prepareChatBody as M, queueFrame as N, maxTokensCeilingFor as O, rateLimitFrame as P, modelUnavailableReason as Q, upstreamErrorMessage as R, isQueueRejectText as S, isWelfareClaimedStatus as T, clearBenefitBlocked as U, FALLBACK_CODEARTS_MODELS as V, creditRatioLabel as W, mergeModelLists as X, markModelUnavailable as Y, modelDisplayName as Z, isIamTokenError as _, claimDailyWelfare as a, isParamInvalidFrame as b, degradeTokenCeiling as c, fetchQueueStatus as d, withContextWindowOverride as et, fetchWelfareCampaigns as f, isCreditExhausted as g, isContextOverflowText as h, chatStream as i, pickDailyWelfareCampaign as j, modelUnavailableReasonText as k, fetchCallerIdentity as l, isConcurrencyCap as m, SNAP_HOST as n, clearQueueStatus as o, firstFrameError as p, isBenefitBlocked as q, canonicalModel as r, contextWindowOverrideFor as s, MAX_TOKENS_FLOOR as t, withMaxTokensOverride as tt, fetchModels as u, isModelNotAccessible as v, isTpmLimit as w, isQueueReject as x, isNotMultimodal as y, upstream_exports as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as writeJsonAtomic } from "./auth-
|
|
2
|
-
import {
|
|
1
|
+
import { u as writeJsonAtomic } from "./auth-fN1w-DqH.mjs";
|
|
2
|
+
import { $ as setDiscoveredBenefitModels, H as carryKnownWindows, J as isBenefitModel, X as mergeModelLists, Z as modelDisplayName, u as fetchModels } from "./upstream-DA3AC1mv.mjs";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -536,6 +536,6 @@ function percentileOf(buckets, ratio) {
|
|
|
536
536
|
}
|
|
537
537
|
//#endregion
|
|
538
538
|
//#region src/version.ts
|
|
539
|
-
const CODEARTS_VERSION = "1.4.
|
|
539
|
+
const CODEARTS_VERSION = "1.4.14";
|
|
540
540
|
//#endregion
|
|
541
541
|
export { refreshCatalog as a, discoverModels as i, CodeArtsUsageTracker as n, codeartsUsagePath as r, CODEARTS_VERSION as t };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dsh-codearts",
|
|
3
3
|
"displayName": "DSH CodeArts Connect",
|
|
4
4
|
"description": "把华为云 CodeArts 接入 DeepSeek Harness —— 内置 OAuth2 登录(PKCE + DPoP),登录后即可在 DSH 对话窗口使用 CodeArts 的模型。",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.14",
|
|
6
6
|
"packageManager": "pnpm@11.24.0",
|
|
7
7
|
"author": "elegant01",
|
|
8
8
|
"keywords": [
|