dsh-codearts 1.4.2 → 1.4.3
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 +16 -0
- package/lib/{auth-CsAz93vO.mjs → auth-Cd2SvQIy.mjs} +1 -1
- package/lib/bin.mjs +3 -3
- package/lib/client/index.d.cts +3 -0
- package/lib/client/index.js +131 -95
- package/lib/index.d.mts +29 -9
- package/lib/index.mjs +182 -47
- package/lib/keeper-main.mjs +1 -1
- package/lib/{upstream-BsoeSKrY.mjs → upstream-BV4XWB4l.mjs} +58 -3
- package/lib/{version-DLMVdsWB.mjs → version-DqzkoxeU.mjs} +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.3] - 2026-11-17
|
|
7
|
+
|
|
8
|
+
### 修复
|
|
9
|
+
|
|
10
|
+
- **排队不再直接报失败**(#10):发请求前的「挂号」以前会白等 20 秒(实测上游
|
|
11
|
+
chat 请求并不校验这张票 —— 拿第 535 位的票去 POST,942ms 就开流了),等不到
|
|
12
|
+
就自己回 400。issue 里「本轮运行失败 400:您排在第 16 位」其实是插件自己造出来的。
|
|
13
|
+
现在挂号只做 5 秒提示(底部仍显示「排队第 N 位」),没轮到也照发;只有上游
|
|
14
|
+
明确回排队拒绝(HTTP 400 `code=queued` 或流内帧)时才本地退避重发
|
|
15
|
+
(5s → 10s → 20s → 30s,与换号共用一个 75 秒截止点),真等不到才把上游原话
|
|
16
|
+
连同本地已等时长报给用户。
|
|
17
|
+
- **排队时一直等到轮到**(卡片「显示」页新开关,默认关):打开后,上游明确回
|
|
18
|
+
排队拒绝时不再短退避,而是提前打开 SSE、每 20 秒发一个空帧保住宿主连接(宿主
|
|
19
|
+
只按可解析的流事件算 90 秒空闲),轮询排队位置直到轮到再继续,最长 15 分钟;
|
|
20
|
+
等待期间底部照常显示「排队第 N 位」,点「停止生成」随时中止。
|
|
21
|
+
|
|
6
22
|
## [1.4.2] - 2026-11-16
|
|
7
23
|
|
|
8
24
|
### 修复
|
|
@@ -428,7 +428,7 @@ async function clearCredential(path) {
|
|
|
428
428
|
async function claimIfPossible(cred) {
|
|
429
429
|
if (!cred.accessKeyId || !cred.secretAccessKey) return;
|
|
430
430
|
try {
|
|
431
|
-
const { claimBenefit } = await import("./upstream-
|
|
431
|
+
const { claimBenefit } = await import("./upstream-BV4XWB4l.mjs").then((n) => n.P);
|
|
432
432
|
await claimBenefit({
|
|
433
433
|
token: cred.token,
|
|
434
434
|
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-Cd2SvQIy.mjs";
|
|
3
|
+
import { H as isBenefitModel, l as fetchCallerIdentity } from "./upstream-BV4XWB4l.mjs";
|
|
4
|
+
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DqzkoxeU.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,9 @@ interface CodeArtsSettingsKey {
|
|
|
201
201
|
displayAutoClaimTitle: string;
|
|
202
202
|
displayAutoClaimHint: string;
|
|
203
203
|
displayAutoClaimToggle: string;
|
|
204
|
+
displayQueueWaitTitle: string;
|
|
205
|
+
displayQueueWaitHint: string;
|
|
206
|
+
displayQueueWaitToggle: string;
|
|
204
207
|
displayKeeperTitle: string;
|
|
205
208
|
displayKeeperHint: string;
|
|
206
209
|
displayKeeperToggle: string;
|
package/lib/client/index.js
CHANGED
|
@@ -73,7 +73,8 @@ const DEFAULT_DOCK_FLAGS = {
|
|
|
73
73
|
settingsEntry: true,
|
|
74
74
|
modelDetail: true,
|
|
75
75
|
autoClaim: false,
|
|
76
|
-
keepAliveDaemon: false
|
|
76
|
+
keepAliveDaemon: false,
|
|
77
|
+
queueWait: false
|
|
77
78
|
};
|
|
78
79
|
//#endregion
|
|
79
80
|
//#region src/client/dock-store.ts
|
|
@@ -155,112 +156,112 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
155
156
|
document.head.appendChild(tag);
|
|
156
157
|
}
|
|
157
158
|
var CodeArtsPluginCard_module_css_default = {
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
159
|
+
"skeletonBreath": "xoziZG_skeletonBreath",
|
|
160
|
+
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
161
|
+
"creditRow": "xoziZG_creditRow",
|
|
162
|
+
"usageFill": "xoziZG_usageFill",
|
|
163
|
+
"claimAllRow": "xoziZG_claimAllRow",
|
|
164
|
+
"check": "xoziZG_check",
|
|
165
|
+
"usageTipSep": "xoziZG_usageTipSep",
|
|
165
166
|
"accountRow": "xoziZG_accountRow",
|
|
166
|
-
"
|
|
167
|
-
"
|
|
167
|
+
"modelFill": "xoziZG_modelFill",
|
|
168
|
+
"accountToggle": "xoziZG_accountToggle",
|
|
168
169
|
"accountHint": "xoziZG_accountHint",
|
|
169
|
-
"creditFooter": "xoziZG_creditFooter",
|
|
170
|
-
"creditLink": "xoziZG_creditLink",
|
|
171
|
-
"sectionHead": "xoziZG_sectionHead",
|
|
172
|
-
"bar": "xoziZG_bar",
|
|
173
170
|
"accountName": "xoziZG_accountName",
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"heatAxis": "xoziZG_heatAxis",
|
|
181
|
-
"statSub": "xoziZG_statSub",
|
|
182
|
-
"accountToggle": "xoziZG_accountToggle",
|
|
171
|
+
"hint": "xoziZG_hint",
|
|
172
|
+
"link": "xoziZG_link",
|
|
173
|
+
"balanceMeta": "xoziZG_balanceMeta",
|
|
174
|
+
"heatWeekday": "xoziZG_heatWeekday",
|
|
175
|
+
"heatHours": "xoziZG_heatHours",
|
|
176
|
+
"heatHourCell": "xoziZG_heatHourCell",
|
|
183
177
|
"accountToggleLabel": "xoziZG_accountToggleLabel",
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"windowAnchor": "xoziZG_windowAnchor",
|
|
188
|
-
"desc": "xoziZG_desc",
|
|
189
|
-
"balanceRow": "xoziZG_balanceRow",
|
|
190
|
-
"updated": "xoziZG_updated",
|
|
191
|
-
"creditRows": "xoziZG_creditRows",
|
|
192
|
-
"modelRequests": "xoziZG_modelRequests",
|
|
193
|
-
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
194
|
-
"skeleton": "xoziZG_skeleton",
|
|
195
|
-
"usageFill": "xoziZG_usageFill",
|
|
196
|
-
"statusLine": "xoziZG_statusLine",
|
|
197
|
-
"windowPopover": "xoziZG_windowPopover",
|
|
198
|
-
"creditRow": "xoziZG_creditRow",
|
|
178
|
+
"statGrid": "xoziZG_statGrid",
|
|
179
|
+
"trendTip": "xoziZG_trendTip",
|
|
180
|
+
"windowPopoverHead": "xoziZG_windowPopoverHead",
|
|
199
181
|
"accountEntry": "xoziZG_accountEntry",
|
|
182
|
+
"heatAxis": "xoziZG_heatAxis",
|
|
183
|
+
"accountToolbar": "xoziZG_accountToolbar",
|
|
184
|
+
"creditLink": "xoziZG_creditLink",
|
|
185
|
+
"error": "xoziZG_error",
|
|
186
|
+
"usageTipRow": "xoziZG_usageTipRow",
|
|
187
|
+
"statCard": "xoziZG_statCard",
|
|
188
|
+
"skeleton": "xoziZG_skeleton",
|
|
189
|
+
"modelSpec": "xoziZG_modelSpec",
|
|
190
|
+
"avatar": "xoziZG_avatar",
|
|
191
|
+
"card": "xoziZG_card",
|
|
192
|
+
"heatGrid": "xoziZG_heatGrid",
|
|
193
|
+
"balance": "xoziZG_balance",
|
|
194
|
+
"windowCaret": "xoziZG_windowCaret",
|
|
195
|
+
"windowRange": "xoziZG_windowRange",
|
|
196
|
+
"modelRequests": "xoziZG_modelRequests",
|
|
197
|
+
"creditBlock": "xoziZG_creditBlock",
|
|
198
|
+
"windowInput": "xoziZG_windowInput",
|
|
199
|
+
"accountInfo": "xoziZG_accountInfo",
|
|
200
|
+
"count": "xoziZG_count",
|
|
200
201
|
"modelName": "xoziZG_modelName",
|
|
201
|
-
"meta": "xoziZG_meta",
|
|
202
|
-
"expiryRow": "xoziZG_expiryRow",
|
|
203
|
-
"choices": "xoziZG_choices",
|
|
204
|
-
"balanceUnit": "xoziZG_balanceUnit",
|
|
205
|
-
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
206
|
-
"heatCell": "xoziZG_heatCell",
|
|
207
|
-
"manualSummary": "xoziZG_manualSummary",
|
|
208
202
|
"accountCard": "xoziZG_accountCard",
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"modelChart": "xoziZG_modelChart",
|
|
213
|
-
"usageTip": "xoziZG_usageTip",
|
|
203
|
+
"section": "xoziZG_section",
|
|
204
|
+
"name": "xoziZG_name",
|
|
205
|
+
"fieldLabel": "xoziZG_fieldLabel",
|
|
214
206
|
"modelTokens": "xoziZG_modelTokens",
|
|
215
|
-
"
|
|
207
|
+
"modelShare": "xoziZG_modelShare",
|
|
208
|
+
"choices": "xoziZG_choices",
|
|
216
209
|
"skeletonRow": "xoziZG_skeletonRow",
|
|
217
|
-
"
|
|
218
|
-
"
|
|
210
|
+
"accountNameRow": "xoziZG_accountNameRow",
|
|
211
|
+
"tabPanel": "xoziZG_tabPanel",
|
|
212
|
+
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
219
213
|
"modelTrack": "xoziZG_modelTrack",
|
|
220
|
-
"section": "xoziZG_section",
|
|
221
|
-
"statValue": "xoziZG_statValue",
|
|
222
|
-
"headText": "xoziZG_headText",
|
|
223
|
-
"accountToolbar": "xoziZG_accountToolbar",
|
|
224
|
-
"manualForm": "xoziZG_manualForm",
|
|
225
|
-
"body": "xoziZG_body",
|
|
226
|
-
"heatGrid": "xoziZG_heatGrid",
|
|
227
|
-
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
228
|
-
"avatar": "xoziZG_avatar",
|
|
229
|
-
"error": "xoziZG_error",
|
|
230
|
-
"windowPopoverHead": "xoziZG_windowPopoverHead",
|
|
231
|
-
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
232
214
|
"windowUnit": "xoziZG_windowUnit",
|
|
233
|
-
"
|
|
234
|
-
"
|
|
215
|
+
"doctorRow": "xoziZG_doctorRow",
|
|
216
|
+
"body": "xoziZG_body",
|
|
217
|
+
"actions": "xoziZG_actions",
|
|
218
|
+
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
219
|
+
"windowPopover": "xoziZG_windowPopover",
|
|
235
220
|
"windowHint": "xoziZG_windowHint",
|
|
236
|
-
"
|
|
237
|
-
"
|
|
221
|
+
"modelChart": "xoziZG_modelChart",
|
|
222
|
+
"field": "xoziZG_field",
|
|
223
|
+
"headText": "xoziZG_headText",
|
|
224
|
+
"statusLine": "xoziZG_statusLine",
|
|
225
|
+
"creditFooter": "xoziZG_creditFooter",
|
|
226
|
+
"header": "xoziZG_header",
|
|
227
|
+
"meta": "xoziZG_meta",
|
|
228
|
+
"expiryRow": "xoziZG_expiryRow",
|
|
238
229
|
"creditHint": "xoziZG_creditHint",
|
|
239
|
-
"
|
|
240
|
-
"
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"statLabel": "xoziZG_statLabel",
|
|
245
|
-
"windowRange": "xoziZG_windowRange",
|
|
246
|
-
"windowInput": "xoziZG_windowInput",
|
|
247
|
-
"windowInputSet": "xoziZG_windowInputSet",
|
|
248
|
-
"tabPanel": "xoziZG_tabPanel",
|
|
230
|
+
"bar": "xoziZG_bar",
|
|
231
|
+
"balanceRow": "xoziZG_balanceRow",
|
|
232
|
+
"barFill": "xoziZG_barFill",
|
|
233
|
+
"statSub": "xoziZG_statSub",
|
|
234
|
+
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
249
235
|
"doctorName": "xoziZG_doctorName",
|
|
250
|
-
"
|
|
251
|
-
"
|
|
252
|
-
"
|
|
236
|
+
"sectionLabel": "xoziZG_sectionLabel",
|
|
237
|
+
"desc": "xoziZG_desc",
|
|
238
|
+
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
239
|
+
"manualSummary": "xoziZG_manualSummary",
|
|
253
240
|
"expiryLabel": "xoziZG_expiryLabel",
|
|
241
|
+
"usageTipName": "xoziZG_usageTipName",
|
|
242
|
+
"windowAnchor": "xoziZG_windowAnchor",
|
|
243
|
+
"accountRowActions": "xoziZG_accountRowActions",
|
|
244
|
+
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
245
|
+
"heatLegend": "xoziZG_heatLegend",
|
|
246
|
+
"danger": "xoziZG_danger",
|
|
247
|
+
"statLabel": "xoziZG_statLabel",
|
|
248
|
+
"windowButton": "xoziZG_windowButton",
|
|
249
|
+
"sectionHead": "xoziZG_sectionHead",
|
|
250
|
+
"usageBar": "xoziZG_usageBar",
|
|
251
|
+
"area": "xoziZG_area",
|
|
254
252
|
"manual": "xoziZG_manual",
|
|
255
|
-
"
|
|
256
|
-
"
|
|
257
|
-
"
|
|
253
|
+
"statValue": "xoziZG_statValue",
|
|
254
|
+
"windowInputSet": "xoziZG_windowInputSet",
|
|
255
|
+
"doctorList": "xoziZG_doctorList",
|
|
256
|
+
"heatCell": "xoziZG_heatCell",
|
|
258
257
|
"modelRow": "xoziZG_modelRow",
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
"
|
|
258
|
+
"usageTip": "xoziZG_usageTip",
|
|
259
|
+
"balanceUnit": "xoziZG_balanceUnit",
|
|
260
|
+
"choiceRow": "xoziZG_choiceRow",
|
|
261
|
+
"tabs": "xoziZG_tabs",
|
|
262
|
+
"manualForm": "xoziZG_manualForm",
|
|
263
|
+
"creditRows": "xoziZG_creditRows",
|
|
264
|
+
"updated": "xoziZG_updated"
|
|
264
265
|
};
|
|
265
266
|
//#endregion
|
|
266
267
|
//#region src/client/CodeArtsPluginCard.tsx
|
|
@@ -2354,6 +2355,35 @@ function CodeArtsPluginCard({ t }) {
|
|
|
2354
2355
|
})
|
|
2355
2356
|
]
|
|
2356
2357
|
}),
|
|
2358
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2359
|
+
className: CodeArtsPluginCard_module_css_default.section,
|
|
2360
|
+
children: [
|
|
2361
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2362
|
+
className: CodeArtsPluginCard_module_css_default.sectionHead,
|
|
2363
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2364
|
+
className: CodeArtsPluginCard_module_css_default.sectionLabel,
|
|
2365
|
+
children: t("displayQueueWaitTitle")
|
|
2366
|
+
})
|
|
2367
|
+
}),
|
|
2368
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2369
|
+
className: CodeArtsPluginCard_module_css_default.hint,
|
|
2370
|
+
children: t("displayQueueWaitHint")
|
|
2371
|
+
}),
|
|
2372
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2373
|
+
className: CodeArtsPluginCard_module_css_default.choices,
|
|
2374
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2375
|
+
className: CodeArtsPluginCard_module_css_default.choiceRow,
|
|
2376
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Checkbox, {
|
|
2377
|
+
className: CodeArtsPluginCard_module_css_default.check,
|
|
2378
|
+
checked: dock.queueWait === true,
|
|
2379
|
+
disabled: !dockWritable || dockSavingKeys.has("queueWait"),
|
|
2380
|
+
onChange: (on) => void toggleDock("queueWait", on),
|
|
2381
|
+
label: t("displayQueueWaitToggle")
|
|
2382
|
+
})
|
|
2383
|
+
})
|
|
2384
|
+
})
|
|
2385
|
+
]
|
|
2386
|
+
}),
|
|
2357
2387
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2358
2388
|
className: CodeArtsPluginCard_module_css_default.section,
|
|
2359
2389
|
children: [
|
|
@@ -3187,14 +3217,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
3187
3217
|
document.head.appendChild(tag);
|
|
3188
3218
|
}
|
|
3189
3219
|
var CodeArtsPanel_module_css_default = {
|
|
3190
|
-
"page": "Z66cgG_page",
|
|
3191
3220
|
"body": "Z66cgG_body",
|
|
3192
|
-
"
|
|
3221
|
+
"backCaret": "Z66cgG_backCaret",
|
|
3193
3222
|
"icon": "Z66cgG_icon",
|
|
3194
|
-
"desc": "Z66cgG_desc",
|
|
3195
|
-
"title": "Z66cgG_title",
|
|
3196
3223
|
"head": "Z66cgG_head",
|
|
3197
|
-
"
|
|
3224
|
+
"page": "Z66cgG_page",
|
|
3225
|
+
"back": "Z66cgG_back",
|
|
3226
|
+
"title": "Z66cgG_title",
|
|
3227
|
+
"desc": "Z66cgG_desc"
|
|
3198
3228
|
};
|
|
3199
3229
|
//#endregion
|
|
3200
3230
|
//#region src/client/CodeArtsPanel.tsx
|
|
@@ -3522,6 +3552,9 @@ const zh = {
|
|
|
3522
3552
|
displayAutoClaimTitle: "每日签到积分",
|
|
3523
3553
|
displayAutoClaimHint: "打开后,DSH 启动约 30 秒会自动把每个已登录账号的每日签到积分领一遍;没领到会隔 30 分钟再试,最多 3 次。上游按天去重,重复领取不会出错。领取结果可以点开积分条查看。注意:这个功能只在 DSH 运行时生效,关掉 DSH 后不会替你领。",
|
|
3524
3554
|
displayAutoClaimToggle: "自动领取每日签到积分(默认关闭)",
|
|
3555
|
+
displayQueueWaitTitle: "排队等待",
|
|
3556
|
+
displayQueueWaitHint: "上游在高峰期会回「当前请求量较大,您排在第 N 位」。打开这一项后,插件不再直接报错,而是提前打开回复流、每 20 秒发一个空帧保住连接,一直轮询到轮到再继续(最长 15 分钟)。代价:等待期间界面上已经开始「回复」,而且这一条请求会一直占着;想立刻做别的事可以点「停止生成」。默认关闭,因为这是让你自己决定要不要等。",
|
|
3557
|
+
displayQueueWaitToggle: "排队时一直等到轮到(最长 15 分钟,默认关闭)",
|
|
3525
3558
|
displayKeeperTitle: "常驻保活(DSH 关掉后仍续登录)",
|
|
3526
3559
|
displayKeeperHint: "上游给的登录凭证只活 2 小时,但要靠它换新的登录凭证(refresh token),那个能活 30 天。打开这一项后,DSH 会在系统里另起一个独立的后台进程,每 20 分钟替你续一次——所以哪怕 DSH 关着、好几天不开,回来也不用重新登录。这个进程不随 DSH 退出,要用下面的「结束」按钮手动停。默认关闭:不经你同意就在系统里留一个常驻进程不合适。",
|
|
3527
3560
|
displayKeeperToggle: "开启常驻保活进程(默认关闭)",
|
|
@@ -3734,6 +3767,9 @@ const en = {
|
|
|
3734
3767
|
displayAutoClaimTitle: "Daily sign-in credits",
|
|
3735
3768
|
displayAutoClaimHint: "When on, about 30 seconds after DSH starts the plugin claims the daily sign-in credits for every signed-in account; if nothing was claimed it retries after 30 minutes, up to 3 times. Upstream deduplicates by day, so claiming twice is harmless. Open the credits bar to see the result. Note: this only runs while DSH is running — it cannot claim for you once DSH is closed.",
|
|
3736
3769
|
displayAutoClaimToggle: "Claim daily sign-in credits automatically (off by default)",
|
|
3770
|
+
displayQueueWaitTitle: "Queue waiting",
|
|
3771
|
+
displayQueueWaitHint: "At peak times upstream answers \"the request volume is high, you are #N in the queue\". With this on, the plugin stops failing immediately: it opens the reply stream early and sends an empty frame every 20 seconds to keep the connection alive, polling until your turn (up to 15 minutes). The trade-off: the UI already looks like an answer in progress, and the request stays occupied — press \"Stop generating\" if you need to do something else. Off by default, because whether to wait is your call.",
|
|
3772
|
+
displayQueueWaitToggle: "Wait for your turn when queued (up to 15 minutes, off by default)",
|
|
3737
3773
|
displayKeeperTitle: "Keep-alive process (stays signed in while DSH is closed)",
|
|
3738
3774
|
displayKeeperHint: "The login token upstream hands out only lives 2 hours, but the refresh token behind it lives 30 days. With this on, DSH starts a separate background process that refreshes the credential every 20 minutes — so even after DSH has been closed for days, you come back without signing in again. That process outlives DSH; stop it with the button below. Off by default: leaving a resident process on your machine without asking is not something a plugin should do.",
|
|
3739
3775
|
displayKeeperToggle: "Run the keep-alive background process (off by default)",
|
package/lib/index.d.mts
CHANGED
|
@@ -1367,19 +1367,19 @@ type CodeArtsQueueOutcome =
|
|
|
1367
1367
|
{
|
|
1368
1368
|
kind: 'working';
|
|
1369
1369
|
} |
|
|
1370
|
-
/**
|
|
1370
|
+
/** 短探没轮到:只是提示,shim 照常发请求。 */
|
|
1371
1371
|
{
|
|
1372
1372
|
kind: 'queued';
|
|
1373
1373
|
position: number;
|
|
1374
1374
|
length: number;
|
|
1375
1375
|
message: string;
|
|
1376
1376
|
} |
|
|
1377
|
-
/**
|
|
1377
|
+
/** 队列本身已满;同样只是提示,不拦请求。 */
|
|
1378
1378
|
{
|
|
1379
1379
|
kind: 'queue_full';
|
|
1380
1380
|
message: string;
|
|
1381
1381
|
} |
|
|
1382
|
-
/**
|
|
1382
|
+
/** 排队接口连续失败:拿不到位置就安静地照发,不影响请求。 */
|
|
1383
1383
|
{
|
|
1384
1384
|
kind: 'error';
|
|
1385
1385
|
message: string;
|
|
@@ -1391,7 +1391,7 @@ type CodeArtsQueueOutcome =
|
|
|
1391
1391
|
interface CodeArtsQueueGateOptions {
|
|
1392
1392
|
/** 两次查询之间的间隔(官方客户端是 5 秒)。 */
|
|
1393
1393
|
intervalMs?: number;
|
|
1394
|
-
/**
|
|
1394
|
+
/** 短探多久(只影响底部提示的可见时长,不拦请求)。 */
|
|
1395
1395
|
maxWaitMs?: number;
|
|
1396
1396
|
/** 连续失败几次就放弃。 */
|
|
1397
1397
|
maxErrors?: number;
|
|
@@ -1412,10 +1412,12 @@ declare class CodeArtsQueueGate {
|
|
|
1412
1412
|
private readonly now;
|
|
1413
1413
|
constructor(options?: CodeArtsQueueGateOptions);
|
|
1414
1414
|
/**
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1415
|
+
* 占号并**最多探 `maxWaitMs`**。调用方只拿结果做提示:`working` 表示正好轮到,
|
|
1416
|
+
* 其余结果照发 chat 请求(这张票不拦请求,见模块注释)。
|
|
1417
1417
|
*/
|
|
1418
|
-
wait(credential: CodeArtsResolved, chatId: string, model: string, signal?: AbortSignal
|
|
1418
|
+
wait(credential: CodeArtsResolved, chatId: string, model: string, signal?: AbortSignal,
|
|
1419
|
+
/** 覆盖这次探测的时长(「一直等到轮到」开关会传几分钟)。 */
|
|
1420
|
+
budgetMs?: number): Promise<CodeArtsQueueOutcome>;
|
|
1419
1421
|
/** 正在排队的条目(给底部条)。 */
|
|
1420
1422
|
snapshot(): readonly CodeArtsQueueEntry[];
|
|
1421
1423
|
dispose(): void;
|
|
@@ -1627,8 +1629,8 @@ interface CodeArtsShimOptions {
|
|
|
1627
1629
|
/** 用量账本。给了就在转发流的同时把 usage 帧记下来(卡片上的「今日用量」)。 */
|
|
1628
1630
|
usage?: CodeArtsUsageTracker;
|
|
1629
1631
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1632
|
+
* 上游排队闸门。给了就在发请求前短探一次排队位置(底部展示「排队第 N 位」),
|
|
1633
|
+
* **没轮到也照发** —— 实测 chat 请求不校验这张票(issue #10)。
|
|
1632
1634
|
*/
|
|
1633
1635
|
queue?: CodeArtsQueueGate;
|
|
1634
1636
|
logger?: ShimLogger;
|
|
@@ -1642,6 +1644,15 @@ interface CodeArtsShimOptions {
|
|
|
1642
1644
|
debug?: (message: string) => void;
|
|
1643
1645
|
/** 本地槽位满时最多等多久(缺省 30 秒)。测试用它把等待压到毫秒级。 */
|
|
1644
1646
|
localSlotWaitMs?: number;
|
|
1647
|
+
/** 上游回排队拒绝后的首次退避(缺省 5 秒,之后翻倍)。测试用它把等待压到毫秒级。 */
|
|
1648
|
+
queueRetryGapMs?: number;
|
|
1649
|
+
/**
|
|
1650
|
+
* 「排队时一直等到轮到」(每次请求实时读,缺省关)。
|
|
1651
|
+
*
|
|
1652
|
+
* 打开后,上游明确回排队拒绝时不再换号/短退避,而是提前开流 + 每 20 秒一个空帧
|
|
1653
|
+
* 保住宿主连接,轮询这张票直到 working(最长 15 分钟),再用同一个号发请求。
|
|
1654
|
+
*/
|
|
1655
|
+
waitInQueue?: () => boolean;
|
|
1645
1656
|
/**
|
|
1646
1657
|
* 按模型 id 覆盖 contextWindow(用户配置,每次请求实时读取)。
|
|
1647
1658
|
*
|
|
@@ -1892,6 +1903,15 @@ interface Config {
|
|
|
1892
1903
|
* 打开后卡片上会显示它的 pid,并给一个「结束」按钮。
|
|
1893
1904
|
*/
|
|
1894
1905
|
keepAliveDaemon?: boolean;
|
|
1906
|
+
/**
|
|
1907
|
+
* 「排队时一直等到轮到」(issue #10)。缺省 = **关**。
|
|
1908
|
+
*
|
|
1909
|
+
* 打开后,上游明确回排队拒绝时插件不再直接报错,而是提前打开 SSE、每 20 秒发
|
|
1910
|
+
* 一个空帧保住连接(宿主的 90 秒空闲超时只认可解析事件),轮询排队位置直到
|
|
1911
|
+
* 轮到,最长等 15 分钟。代价:等待期间界面上已经开始「回复」,属于用户知情后
|
|
1912
|
+
* 主动选择的行为,所以不默认开。
|
|
1913
|
+
*/
|
|
1914
|
+
queueWaitUntilReady?: boolean;
|
|
1895
1915
|
}
|
|
1896
1916
|
declare const Config: z<Config>;
|
|
1897
1917
|
declare function apply(ctx: Context, rawConfig: Config): void;
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as codeartsAuthPath, c as credentialFromOAuth, i as codeartsAccountsPath, m as startLogin, n as CodeArtsCredentialStore, o as codeartsDebugLogPath, r as MANUAL_ACCOUNT_ID, s as codeartsRefreshLogPath, t as CodeArtsAccountStore } from "./auth-
|
|
2
|
-
import { A as
|
|
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, i as codeartsAccountsPath, m as startLogin, n as CodeArtsCredentialStore, o as codeartsDebugLogPath, r as MANUAL_ACCOUNT_ID, s as codeartsRefreshLogPath, t as CodeArtsAccountStore } from "./auth-Cd2SvQIy.mjs";
|
|
2
|
+
import { A as queueFrame, B as forgetModelUnavailable, C as isWelfareClaimedStatus, D as modelUnavailableReasonText, E as maxTokensCeilingFor, F as CodeArtsCatalog, H as isBenefitModel, I as FALLBACK_CODEARTS_MODELS, K as modelUnavailableReason, L as clearBenefitBlocked, M as signedGet, N as upstreamErrorMessage, O as pickDailyWelfareCampaign, R as creditRatioLabel, S as isTpmLimit, T as learnedContextWindowFor, U as markModelUnavailable, V as isBenefitBlocked, _ as isNotMultimodal, a as claimDailyWelfare, b as isQueueRejectText, c as degradeTokenCeiling, d as fetchQueueStatus, f as fetchWelfareCampaigns, g as isModelNotAccessible, h as isIamTokenError, i as chatStream, j as rateLimitFrame, k as prepareChatBody, l as fetchCallerIdentity, m as isConcurrencyCap, n as SNAP_HOST, o as clearQueueStatus, p as firstFrameError, r as canonicalModel, s as contextWindowOverrideFor, t as MAX_TOKENS_FLOOR, u as fetchModels, v as isParamInvalidFrame, w as learnContextWindow, x as isQueueableRate, y as isQueueReject, z as filterEnabledModels } from "./upstream-BV4XWB4l.mjs";
|
|
3
|
+
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DqzkoxeU.mjs";
|
|
4
4
|
import { i as lazyApi, r as createProvider } from "./models-CgKCibpk.mjs";
|
|
5
5
|
import { c as keeperLogPath, d as keeperStats, f as spawnKeeper, i as clearKeeperHandoff, l as keeperScriptPath, n as KEEPER_STALE_MS, p as stopKeeper, s as keeperHandoffRecent } from "./keeper-DJLwIiR4.mjs";
|
|
6
6
|
import { appendFileSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -294,16 +294,16 @@ var CodeArtsAccountPool = class {
|
|
|
294
294
|
* 官方客户端的做法是:只对 `enable_queue` 的模型,先轮询排队接口,等状态变成
|
|
295
295
|
* `working` 才发聊天请求(见 vscode-codebot 的 `startQueuePolling`)。
|
|
296
296
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* - 等到 working → 放行;
|
|
302
|
-
* - 还在队里 → 返回 `queued` 带上位置和队长度,由 shim 直接回一句「排队中,
|
|
303
|
-
* 稍后再试」,让用户自己决定要不要再发一次;
|
|
304
|
-
* - 队列已满 → `queue_full`;连续失败 → `error`。
|
|
297
|
+
* 这张票的定位是**提示,不是门禁**(issue #10):真正的 chat 请求并不校验它,
|
|
298
|
+
* 所以 `wait()` 只做一次短探(`maxWaitMs`,默认 5 秒),结果交给 shim ——
|
|
299
|
+
* 没轮到也照发请求,底部积分条在这几秒里显示「排队第 N 位」。以前等满 20 秒
|
|
300
|
+
* 就直接回 400,用户看到的失败其实是插件自己造出来的。
|
|
305
301
|
*
|
|
306
|
-
*
|
|
302
|
+
* 宿主也等不起:流空闲超时只有 90 秒(等待期间一个字节都发不出去,SSE 注释帧
|
|
303
|
+
* 也不算事件),而 flash 高峰期队尾有 500+ 号、要等二十几分钟。真正值得等的位置
|
|
304
|
+
* 在 POST 被上游明确拒绝之后(还没写任何字节,重发安全),由 shim 退避重试。
|
|
305
|
+
*
|
|
306
|
+
* 收尾(轮到/超时/取消/失败)都会 DELETE 清号,别把幽灵排队留在上游撑大队列。
|
|
307
307
|
*
|
|
308
308
|
* @module dsh-codearts/queue
|
|
309
309
|
*/
|
|
@@ -319,17 +319,17 @@ var CodeArtsQueueGate = class {
|
|
|
319
319
|
now;
|
|
320
320
|
constructor(options = {}) {
|
|
321
321
|
this.intervalMs = options.intervalMs ?? 5e3;
|
|
322
|
-
this.maxWaitMs = options.maxWaitMs ??
|
|
322
|
+
this.maxWaitMs = options.maxWaitMs ?? 5e3;
|
|
323
323
|
this.maxErrors = options.maxErrors ?? 3;
|
|
324
324
|
this.query = options.fetchStatus ?? fetchQueueStatus;
|
|
325
325
|
this.clear = options.clearStatus ?? ((credential, chatId, model) => clearQueueStatus(credential, chatId, model, AbortSignal.timeout(CLEAR_TIMEOUT_MS)));
|
|
326
326
|
this.now = options.now ?? Date.now;
|
|
327
327
|
}
|
|
328
328
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
329
|
+
* 占号并**最多探 `maxWaitMs`**。调用方只拿结果做提示:`working` 表示正好轮到,
|
|
330
|
+
* 其余结果照发 chat 请求(这张票不拦请求,见模块注释)。
|
|
331
331
|
*/
|
|
332
|
-
async wait(credential, chatId, model, signal) {
|
|
332
|
+
async wait(credential, chatId, model, signal, budgetMs = this.maxWaitMs) {
|
|
333
333
|
if (chatId === "") return { kind: "working" };
|
|
334
334
|
if (signal?.aborted === true) return { kind: "aborted" };
|
|
335
335
|
const controller = new AbortController();
|
|
@@ -346,7 +346,7 @@ var CodeArtsQueueGate = class {
|
|
|
346
346
|
};
|
|
347
347
|
this.entries.set(chatId, entry);
|
|
348
348
|
let errors = 0;
|
|
349
|
-
const deadlineAt = this.now() +
|
|
349
|
+
const deadlineAt = this.now() + budgetMs;
|
|
350
350
|
try {
|
|
351
351
|
for (;;) {
|
|
352
352
|
if (controller.signal.aborted) return { kind: "aborted" };
|
|
@@ -1011,14 +1011,6 @@ function writeOpenAIError(res, status, kind, message) {
|
|
|
1011
1011
|
} });
|
|
1012
1012
|
}
|
|
1013
1013
|
/**
|
|
1014
|
-
* 排队没等到时回给用户的那句:优先用上游自己的文案(它就是写给人看的,带位置和
|
|
1015
|
-
* 「建议切换模型/升级套餐」),上游没给才自己拼。
|
|
1016
|
-
*/
|
|
1017
|
-
function queuedMessage(model, gate) {
|
|
1018
|
-
const upstream = gate.message.trim();
|
|
1019
|
-
return `${upstream === "" ? `上游排队中:${model} 第 ${gate.position} 位(共 ${gate.length} 条)` : upstream} 插件没有一直等下去,请稍后重试。`;
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
1014
|
* 「一个账号都选不出来」时的报错:把真实原因说清 —— 是禁用(附最后错误)、冷却
|
|
1023
1015
|
* (附剩余秒数),还是本地槽位全满。以前三种都回同一句「没有可用账号」,禁用那
|
|
1024
1016
|
* 种还把真因(比如 billion-context 本地拒签的 403)整个吞掉(issue #1)。
|
|
@@ -1091,7 +1083,7 @@ const MAX_CEILING_HEALS = 3;
|
|
|
1091
1083
|
*/
|
|
1092
1084
|
const ROTATE_MIN_ATTEMPTS = 3;
|
|
1093
1085
|
const ROTATE_MAX_ATTEMPTS = 6;
|
|
1094
|
-
/**
|
|
1086
|
+
/** 开始下一次尝试前必须留下的预算:一次挂号短探(默认 5 秒)再加一次开流。 */
|
|
1095
1087
|
const ATTEMPT_RESERVE_MS = 2e4;
|
|
1096
1088
|
/**
|
|
1097
1089
|
* 一次请求在「换号轮换 + 回落到同一账号原地重发」上总共能花的墙上时间,从进入
|
|
@@ -1108,6 +1100,17 @@ const ATTEMPT_RESERVE_MS = 2e4;
|
|
|
1108
1100
|
*/
|
|
1109
1101
|
const CAP_WAIT_LIMIT = 75e3;
|
|
1110
1102
|
const CAP_RETRY_GAP = 3e3;
|
|
1103
|
+
/** 上游回「排队」拒绝后的首次退避,之后翻倍(5s → 10s → 20s → 30s)。 */
|
|
1104
|
+
const QUEUE_RETRY_GAP = 5e3;
|
|
1105
|
+
/**
|
|
1106
|
+
* 「排队时一直等到轮到」开关打开后替用户挂多久。
|
|
1107
|
+
*
|
|
1108
|
+
* 默认关(卡片「显示」页):这一段会提前打开 SSE 并每 20 秒发一个空帧保活,
|
|
1109
|
+
* 等待期间界面上已经开始「回复」了 —— 属于用户应当主动选择的行为。
|
|
1110
|
+
*/
|
|
1111
|
+
const QUEUE_WAIT_LIMIT_MS = 9e5;
|
|
1112
|
+
/** 空帧间隔:宿主按「可解析的流事件」算 90 秒空闲,20 秒留足余量。 */
|
|
1113
|
+
const QUEUE_HEARTBEAT_MS = 2e4;
|
|
1111
1114
|
/** 上游 5xx 后短时冷却该账号。 */
|
|
1112
1115
|
const SERVER_COOLDOWN_MS = 3e4;
|
|
1113
1116
|
/** 零散错误累计到阈值后冷却该账号。 */
|
|
@@ -1156,6 +1159,7 @@ function createCodeArtsShim(options) {
|
|
|
1156
1159
|
const queue = options.queue;
|
|
1157
1160
|
const debug = options.debug;
|
|
1158
1161
|
const localSlotWaitBudgetMs = options.localSlotWaitMs ?? 3e4;
|
|
1162
|
+
const queueRetryGapMs = options.queueRetryGapMs ?? QUEUE_RETRY_GAP;
|
|
1159
1163
|
const pool = options.pool ?? new CodeArtsAccountPool([]);
|
|
1160
1164
|
const SHARED_SECRET = randomBytes(32).toString("base64url");
|
|
1161
1165
|
function bearerOk(req) {
|
|
@@ -1286,6 +1290,21 @@ function createCodeArtsShim(options) {
|
|
|
1286
1290
|
}
|
|
1287
1291
|
};
|
|
1288
1292
|
}
|
|
1293
|
+
const queued = headText === void 0 ? void 0 : queueFrame(headText);
|
|
1294
|
+
if (queued !== void 0) {
|
|
1295
|
+
reader.releaseLock();
|
|
1296
|
+
await result.stream.cancel().catch(() => {});
|
|
1297
|
+
logger?.warn(`dsh-codearts: ${prepared.model} 首帧被判排队,本地退避重发`);
|
|
1298
|
+
return {
|
|
1299
|
+
prepared,
|
|
1300
|
+
result: {
|
|
1301
|
+
ok: false,
|
|
1302
|
+
kind: "client",
|
|
1303
|
+
status: 400,
|
|
1304
|
+
message: `queued: ${queued.message}`
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1289
1308
|
const upstreamError = headText === void 0 ? void 0 : firstFrameError(headText);
|
|
1290
1309
|
if (upstreamError !== void 0) {
|
|
1291
1310
|
const detail = `${upstreamError.code}: ${upstreamError.message}`.replace(/^: /, "");
|
|
@@ -1345,11 +1364,15 @@ function createCodeArtsShim(options) {
|
|
|
1345
1364
|
* 间隔逐次翻倍(3s → 6s → 12s → 24s,封顶 30s),避免在配额已经满的时候
|
|
1346
1365
|
* 把重试本身也打成一波流量。
|
|
1347
1366
|
*
|
|
1367
|
+
* 「排队」拒绝(issue #10)同理:上游让等一会儿再来,从 5 秒起翻倍重发;
|
|
1368
|
+
* 这段等待发生在 POST 被拒之后 —— 还没写给宿主任何字节,重发安全。
|
|
1369
|
+
*
|
|
1348
1370
|
* 命中限流不甩给 pi-ai:429 会被重试 5 次,每次再撞一次限流,越试越满。
|
|
1349
1371
|
*/
|
|
1350
1372
|
async function openStream(credential, raw, contextWindow, signal, untilAt) {
|
|
1351
1373
|
const started = Date.now();
|
|
1352
1374
|
let gap = CAP_RETRY_GAP;
|
|
1375
|
+
let queueGap = queueRetryGapMs;
|
|
1353
1376
|
for (;;) {
|
|
1354
1377
|
const opened = await openWithCeilingHeal(credential, raw, contextWindow, signal);
|
|
1355
1378
|
const waitedMs = Date.now() - started;
|
|
@@ -1362,6 +1385,10 @@ function createCodeArtsShim(options) {
|
|
|
1362
1385
|
waitedMs
|
|
1363
1386
|
};
|
|
1364
1387
|
if (isTpmLimit(opened.result)) gap = Math.min(gap * 2, 3e4);
|
|
1388
|
+
if (isQueueReject(opened.result)) {
|
|
1389
|
+
gap = queueGap;
|
|
1390
|
+
queueGap = Math.min(queueGap * 2, 3e4);
|
|
1391
|
+
}
|
|
1365
1392
|
if (Date.now() + gap > untilAt) return {
|
|
1366
1393
|
...opened,
|
|
1367
1394
|
waitedMs
|
|
@@ -1427,6 +1454,7 @@ function createCodeArtsShim(options) {
|
|
|
1427
1454
|
const refreshed = /* @__PURE__ */ new Set();
|
|
1428
1455
|
let cappedAccount;
|
|
1429
1456
|
let tpmAccount;
|
|
1457
|
+
let queuedAccount;
|
|
1430
1458
|
let queueWaitedMs = 0;
|
|
1431
1459
|
let localSlotWaitedMs = 0;
|
|
1432
1460
|
let lastKind;
|
|
@@ -1463,16 +1491,7 @@ function createCodeArtsShim(options) {
|
|
|
1463
1491
|
if (queue !== void 0) {
|
|
1464
1492
|
const gate = await queue.wait(credential, checked.chatId, checked.model, controller.signal);
|
|
1465
1493
|
if (controller.signal.aborted) return;
|
|
1466
|
-
if (gate.kind
|
|
1467
|
-
usage?.noteFailure("queued", id);
|
|
1468
|
-
writeOpenAIError(res, 400, "queued", queuedMessage(checked.model, gate));
|
|
1469
|
-
return;
|
|
1470
|
-
}
|
|
1471
|
-
if (gate.kind === "queue_full" || gate.kind === "error") {
|
|
1472
|
-
usage?.noteFailure(gate.kind, id);
|
|
1473
|
-
writeOpenAIError(res, gate.kind === "queue_full" ? 429 : 502, gate.kind, gate.message);
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1494
|
+
if (gate.kind !== "working") debug?.(`queue ${gate.kind} req=${requestTag} ${id}`);
|
|
1476
1495
|
}
|
|
1477
1496
|
const opened = await openWithCeilingHeal(credential, raw, contextWindow, controller.signal);
|
|
1478
1497
|
const { prepared, result } = opened;
|
|
@@ -1502,6 +1521,10 @@ function createCodeArtsShim(options) {
|
|
|
1502
1521
|
tpmAccount = id;
|
|
1503
1522
|
break;
|
|
1504
1523
|
}
|
|
1524
|
+
if (isQueueReject(result)) {
|
|
1525
|
+
queuedAccount = id;
|
|
1526
|
+
break;
|
|
1527
|
+
}
|
|
1505
1528
|
if (result.kind === "iam_stale") {
|
|
1506
1529
|
if (!refreshed.has(id)) {
|
|
1507
1530
|
refreshed.add(id);
|
|
@@ -1541,7 +1564,11 @@ function createCodeArtsShim(options) {
|
|
|
1541
1564
|
if (!got) break;
|
|
1542
1565
|
}
|
|
1543
1566
|
if (controller.signal.aborted) return;
|
|
1544
|
-
|
|
1567
|
+
if (queuedAccount !== void 0 && options.waitInQueue?.() === true) {
|
|
1568
|
+
await waitForQueueTurn(queuedAccount);
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1571
|
+
const queueAccount = cappedAccount ?? tpmAccount ?? queuedAccount;
|
|
1545
1572
|
if (queueAccount !== void 0) {
|
|
1546
1573
|
if (pool.acquire(queueAccount)) try {
|
|
1547
1574
|
const credential = await store.resolve(queueAccount);
|
|
@@ -1583,8 +1610,110 @@ function createCodeArtsShim(options) {
|
|
|
1583
1610
|
if (queueWaitedMs >= 1e3) waits.push(`排队重试 ${Math.round(queueWaitedMs / 1e3)} 秒`);
|
|
1584
1611
|
if (localSlotWaitedMs >= 1e3) waits.push(`等本地槽位 ${Math.round(localSlotWaitedMs / 1e3)} 秒`);
|
|
1585
1612
|
const waited = waits.length > 0 ? `(本地已${waits.join("、")})` : "";
|
|
1586
|
-
|
|
1587
|
-
|
|
1613
|
+
const failedKind = isQueueRejectText(lastMessage) ? "queued" : lastKind;
|
|
1614
|
+
usage?.noteFailure(failedKind, lastAccountId);
|
|
1615
|
+
writeOpenAIError(res, KIND_STATUS[lastKind], failedKind, `${explanation}${waited}`);
|
|
1616
|
+
/**
|
|
1617
|
+
* 「一直等到轮到」:提前开流保住宿主连接,轮询这张票直到 working,再发请求。
|
|
1618
|
+
*
|
|
1619
|
+
* 和上面的兜底通道有一个本质区别:响应头已经发出去了,后面任何失败都**不能再
|
|
1620
|
+
* 换号、也不能回 HTTP 状态码**,只能以流内错误帧交代。所以只有上游明确回排队
|
|
1621
|
+
* 拒绝时才会走到这里 —— 那时换别的号去撞同一张票也没有意义。
|
|
1622
|
+
*/
|
|
1623
|
+
async function waitForQueueTurn(id) {
|
|
1624
|
+
const gate = queue;
|
|
1625
|
+
if (gate === void 0) return;
|
|
1626
|
+
const credential = await store.resolve(id);
|
|
1627
|
+
if (credential === void 0) return;
|
|
1628
|
+
const waitStartedAt = Date.now();
|
|
1629
|
+
const heartbeat = startHeartbeat(checked.model);
|
|
1630
|
+
try {
|
|
1631
|
+
const verdict = await gate.wait(credential, checked.chatId, checked.model, controller.signal, QUEUE_WAIT_LIMIT_MS);
|
|
1632
|
+
if (controller.signal.aborted || verdict.kind === "aborted") return;
|
|
1633
|
+
if (verdict.kind !== "working") {
|
|
1634
|
+
usage?.noteFailure(verdict.kind === "error" ? "queued" : verdict.kind, id);
|
|
1635
|
+
failStream(res, verdict.kind === "queued" ? `等了 ${Math.round(QUEUE_WAIT_LIMIT_MS / 6e4)} 分钟仍未轮到(第 ${verdict.position} 位,共 ${verdict.length} 条)。请稍后重试,或临时切换模型。` : verdict.message);
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
let acquired = pool.acquire(id);
|
|
1639
|
+
if (!acquired) acquired = await pool.waitForFreeSlot(1e4, controller.signal) && pool.acquire(id);
|
|
1640
|
+
if (!acquired) {
|
|
1641
|
+
failStream(res, "轮到排队后本地账号槽位仍被占用,请稍后重试。");
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
try {
|
|
1645
|
+
const opened = await openStream(credential, raw, contextWindow, controller.signal, Date.now() + 6e4);
|
|
1646
|
+
queueWaitedMs = opened.waitedMs;
|
|
1647
|
+
if (controller.signal.aborted) {
|
|
1648
|
+
if (opened.result.ok) await opened.result.stream.cancel().catch(() => {});
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
if (opened.result.ok) {
|
|
1652
|
+
pool.noteSuccess(id);
|
|
1653
|
+
await pipeToResponse(res, opened.result.stream, controller.signal, {
|
|
1654
|
+
accountId: id,
|
|
1655
|
+
model: opened.prepared.model,
|
|
1656
|
+
startedAt: requestStartedAt
|
|
1657
|
+
}, opened.head);
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
usage?.noteFailure(isQueueReject(opened.result) ? "queued" : opened.result.kind, id);
|
|
1661
|
+
const waitedSec = Math.round((Date.now() - waitStartedAt) / 1e3);
|
|
1662
|
+
const suffix = waitedSec >= 1 ? `(本地已排队 ${waitedSec} 秒)` : "";
|
|
1663
|
+
failStream(res, `${upstreamErrorMessage(opened.result.message, opened.result.status)}${suffix}`);
|
|
1664
|
+
} finally {
|
|
1665
|
+
pool.release(id);
|
|
1666
|
+
}
|
|
1667
|
+
} finally {
|
|
1668
|
+
heartbeat.stop();
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* 等待期间的空帧:宿主只看「可解析的流事件」续空闲计时(SSE 注释不算),
|
|
1673
|
+
* 空 delta 不产生任何可见文字,但足以让连接活着。
|
|
1674
|
+
*/
|
|
1675
|
+
function startHeartbeat(model) {
|
|
1676
|
+
if (!res.headersSent) res.writeHead(200, {
|
|
1677
|
+
"Content-Type": "text/event-stream",
|
|
1678
|
+
"Cache-Control": "no-cache",
|
|
1679
|
+
"Connection": "keep-alive",
|
|
1680
|
+
"X-Accel-Buffering": "no"
|
|
1681
|
+
});
|
|
1682
|
+
const beat = () => {
|
|
1683
|
+
if (!res.writable || res.writableEnded) return;
|
|
1684
|
+
res.write(`data: ${JSON.stringify({
|
|
1685
|
+
id: "codearts-queue",
|
|
1686
|
+
object: "chat.completion.chunk",
|
|
1687
|
+
created: Math.floor(Date.now() / 1e3),
|
|
1688
|
+
model,
|
|
1689
|
+
choices: [{
|
|
1690
|
+
index: 0,
|
|
1691
|
+
delta: {},
|
|
1692
|
+
finish_reason: null
|
|
1693
|
+
}]
|
|
1694
|
+
})}\n\n`);
|
|
1695
|
+
};
|
|
1696
|
+
beat();
|
|
1697
|
+
const timer = setInterval(beat, QUEUE_HEARTBEAT_MS);
|
|
1698
|
+
timer.unref?.();
|
|
1699
|
+
return { stop: () => clearInterval(timer) };
|
|
1700
|
+
}
|
|
1701
|
+
/** 响应头已经发出之后的失败:只能作为流内错误帧交代,不能再改状态码。 */
|
|
1702
|
+
function failStream(response, message) {
|
|
1703
|
+
if (!response.writable || response.writableEnded) return;
|
|
1704
|
+
response.write(`data: ${JSON.stringify({
|
|
1705
|
+
choices: [{
|
|
1706
|
+
index: 0,
|
|
1707
|
+
delta: { content: "" },
|
|
1708
|
+
finish_reason: "stop"
|
|
1709
|
+
}],
|
|
1710
|
+
error: {
|
|
1711
|
+
code: "queued",
|
|
1712
|
+
message
|
|
1713
|
+
}
|
|
1714
|
+
})}\n\n`);
|
|
1715
|
+
response.end("data: [DONE]\n\n");
|
|
1716
|
+
}
|
|
1588
1717
|
}
|
|
1589
1718
|
/**
|
|
1590
1719
|
* 记下一帧里的上游流内错误。判据宽松(帧文本含 "error" 才解析),解析不出来就忽略 ——
|
|
@@ -1602,7 +1731,7 @@ function createCodeArtsShim(options) {
|
|
|
1602
1731
|
}
|
|
1603
1732
|
/** 把上游 SSE 按事件边界转发给 DSH,直到流结束或被中止。 */
|
|
1604
1733
|
async function pipeToResponse(res, stream, signal, attribution, head) {
|
|
1605
|
-
res.writeHead(200, {
|
|
1734
|
+
if (!res.headersSent) res.writeHead(200, {
|
|
1606
1735
|
"Content-Type": "text/event-stream",
|
|
1607
1736
|
"Cache-Control": "no-cache",
|
|
1608
1737
|
"Connection": "keep-alive",
|
|
@@ -1812,7 +1941,8 @@ const DEFAULT_DOCK_FLAGS = {
|
|
|
1812
1941
|
settingsEntry: true,
|
|
1813
1942
|
modelDetail: true,
|
|
1814
1943
|
autoClaim: false,
|
|
1815
|
-
keepAliveDaemon: false
|
|
1944
|
+
keepAliveDaemon: false,
|
|
1945
|
+
queueWait: false
|
|
1816
1946
|
};
|
|
1817
1947
|
/**
|
|
1818
1948
|
* 把逐账号的领取结果汇总成一条:HTTP 层只看 ok,卡片看 results 逐号展示。
|
|
@@ -2199,10 +2329,11 @@ function dockHandler(deps) {
|
|
|
2199
2329
|
"settingsEntry",
|
|
2200
2330
|
"modelDetail",
|
|
2201
2331
|
"autoClaim",
|
|
2202
|
-
"keepAliveDaemon"
|
|
2332
|
+
"keepAliveDaemon",
|
|
2333
|
+
"queueWait"
|
|
2203
2334
|
].filter((key) => body[key] !== void 0);
|
|
2204
2335
|
if (touched.length === 0 || touched.some((key) => typeof body[key] !== "boolean")) {
|
|
2205
|
-
json(res, 400, { error: "expected {\"credits\"?: boolean, \"queue\"?: boolean, \"sidebar\"?: boolean, \"settingsEntry\"?: boolean, \"modelDetail\"?: boolean, \"autoClaim\"?: boolean, \"keepAliveDaemon\"?: boolean}" });
|
|
2336
|
+
json(res, 400, { error: "expected {\"credits\"?: boolean, \"queue\"?: boolean, \"sidebar\"?: boolean, \"settingsEntry\"?: boolean, \"modelDetail\"?: boolean, \"autoClaim\"?: boolean, \"keepAliveDaemon\"?: boolean, \"queueWait\"?: boolean}" });
|
|
2206
2337
|
return;
|
|
2207
2338
|
}
|
|
2208
2339
|
if (!await deps.setDock(Object.fromEntries(touched.map((key) => [key, body[key]])))) {
|
|
@@ -3001,7 +3132,8 @@ const Config = z.object({
|
|
|
3001
3132
|
showSettingsEntry: z.boolean().default(true).description("Show a CodeArts entry in the left navigation of DSH Settings (default: shown)").volatile(),
|
|
3002
3133
|
showModelDetailDock: z.boolean().default(true).description("Show \"Model … · x ratio\" on the line under the chat input box (Provider CodeArts always shows)").volatile(),
|
|
3003
3134
|
autoClaim: z.boolean().default(false).description("Automatically claim the daily sign-in credits for every signed-in account").volatile(),
|
|
3004
|
-
keepAliveDaemon: z.boolean().default(false).description("Keep a detached background process that refreshes the OAuth credential while DSH is closed").volatile()
|
|
3135
|
+
keepAliveDaemon: z.boolean().default(false).description("Keep a detached background process that refreshes the OAuth credential while DSH is closed").volatile(),
|
|
3136
|
+
queueWaitUntilReady: z.boolean().default(false).description("When upstream rejects with \"queued\", keep the stream alive and wait up to 15 minutes for a turn instead of failing (issue #10)").volatile()
|
|
3005
3137
|
});
|
|
3006
3138
|
function settingsCompatNamespace(ctx) {
|
|
3007
3139
|
return resolveSettingsNamespaceCompat(ctx, ctx.get("settings"), CODEARTS_SETTINGS_NS);
|
|
@@ -3134,7 +3266,8 @@ function apply(ctx, rawConfig) {
|
|
|
3134
3266
|
settingsEntry: current().showSettingsEntry !== false,
|
|
3135
3267
|
modelDetail: current().showModelDetailDock !== false,
|
|
3136
3268
|
autoClaim: current().autoClaim === true,
|
|
3137
|
-
keepAliveDaemon: current().keepAliveDaemon === true
|
|
3269
|
+
keepAliveDaemon: current().keepAliveDaemon === true,
|
|
3270
|
+
queueWait: current().queueWaitUntilReady === true
|
|
3138
3271
|
});
|
|
3139
3272
|
const setDock = async (patch) => {
|
|
3140
3273
|
const settings = ctx.get("settings");
|
|
@@ -3146,7 +3279,8 @@ function apply(ctx, rawConfig) {
|
|
|
3146
3279
|
...patch.settingsEntry === void 0 ? {} : { showSettingsEntry: patch.settingsEntry },
|
|
3147
3280
|
...patch.modelDetail === void 0 ? {} : { showModelDetailDock: patch.modelDetail },
|
|
3148
3281
|
...patch.autoClaim === void 0 ? {} : { autoClaim: patch.autoClaim },
|
|
3149
|
-
...patch.keepAliveDaemon === void 0 ? {} : { keepAliveDaemon: patch.keepAliveDaemon }
|
|
3282
|
+
...patch.keepAliveDaemon === void 0 ? {} : { keepAliveDaemon: patch.keepAliveDaemon },
|
|
3283
|
+
...patch.queueWait === void 0 ? {} : { queueWaitUntilReady: patch.queueWait }
|
|
3150
3284
|
});
|
|
3151
3285
|
return true;
|
|
3152
3286
|
};
|
|
@@ -3556,7 +3690,8 @@ function apply(ctx, rawConfig) {
|
|
|
3556
3690
|
queue,
|
|
3557
3691
|
logger: ctx.logger,
|
|
3558
3692
|
debug: writeDebugLog,
|
|
3559
|
-
contextWindowOverrides: () => current().contextWindowOverrides
|
|
3693
|
+
contextWindowOverrides: () => current().contextWindowOverrides,
|
|
3694
|
+
waitInQueue: () => current().queueWaitUntilReady === true
|
|
3560
3695
|
});
|
|
3561
3696
|
usage.load().catch(() => {});
|
|
3562
3697
|
shim.ready.then(async () => {
|
package/lib/keeper-main.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as OAuthTokenError, f as defaultLoginConfig, i as codeartsAccountsPath, l as readAccountDocument, p as refreshToken, u as writeJsonAtomic } from "./auth-
|
|
1
|
+
import { d as OAuthTokenError, f as defaultLoginConfig, i as codeartsAccountsPath, l as readAccountDocument, p as refreshToken, u as writeJsonAtomic } from "./auth-Cd2SvQIy.mjs";
|
|
2
2
|
import { a as clearKeeperState, c as keeperLogPath, d as keeperStats, g as writeKeeperState, h as writeKeeperHandoff, i as clearKeeperHandoff, m as stopRequested, o as isDshInstallerTempDir, r as KEEPER_TICK_MS, t as KEEPER_HEARTBEAT_MS, u as keeperStatePath } from "./keeper-DJLwIiR4.mjs";
|
|
3
3
|
import { appendFileSync, existsSync, unlinkSync, watch } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -478,6 +478,8 @@ var upstream_exports = /* @__PURE__ */ __exportAll({
|
|
|
478
478
|
isModelNotAccessible: () => isModelNotAccessible,
|
|
479
479
|
isNotMultimodal: () => isNotMultimodal,
|
|
480
480
|
isParamInvalidFrame: () => isParamInvalidFrame,
|
|
481
|
+
isQueueReject: () => isQueueReject,
|
|
482
|
+
isQueueRejectText: () => isQueueRejectText,
|
|
481
483
|
isQueueableRate: () => isQueueableRate,
|
|
482
484
|
isResignRefusal: () => isResignRefusal,
|
|
483
485
|
isTpmLimit: () => isTpmLimit,
|
|
@@ -488,6 +490,8 @@ var upstream_exports = /* @__PURE__ */ __exportAll({
|
|
|
488
490
|
modelUnavailableReasonText: () => modelUnavailableReasonText,
|
|
489
491
|
pickDailyWelfareCampaign: () => pickDailyWelfareCampaign,
|
|
490
492
|
prepareChatBody: () => prepareChatBody,
|
|
493
|
+
queueFrame: () => queueFrame,
|
|
494
|
+
queueRejectMessage: () => queueRejectMessage,
|
|
491
495
|
rateLimitFrame: () => rateLimitFrame,
|
|
492
496
|
signedGet: () => signedGet,
|
|
493
497
|
upstreamErrorMessage: () => upstreamErrorMessage
|
|
@@ -966,9 +970,56 @@ function isTpmLimit(result) {
|
|
|
966
970
|
if (result.ok) return false;
|
|
967
971
|
return MODEL_RATE_CODE.test(result.message) || MODEL_RATE_TEXT.test(result.message);
|
|
968
972
|
}
|
|
969
|
-
/**
|
|
973
|
+
/** 撞到这几类限流/排队都值得原地等,而不是直接甩给 pi-ai 重试。 */
|
|
970
974
|
function isQueueableRate(result) {
|
|
971
|
-
return isConcurrencyCap(result) || isTpmLimit(result);
|
|
975
|
+
return isConcurrencyCap(result) || isTpmLimit(result) || isQueueReject(result);
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* 上游明确回「排队」拒绝(issue #10):HTTP 400 的 body 形如
|
|
979
|
+
* `{"message":"当前请求量较大,您排在第16位。…","type":"queued","code":"queued"}`。
|
|
980
|
+
*
|
|
981
|
+
* 它不是请求写错了,是让客户端等一会儿再来 —— 本地退避重发就有机会。流内首帧
|
|
982
|
+
* (HTTP 200 + error_code/推送帧)也会被 `queueFrame` 归一成 `queued: <文案>`。
|
|
983
|
+
*/
|
|
984
|
+
function isQueueRejectText(text) {
|
|
985
|
+
return /"code"\s*:\s*"queued"|"type"\s*:\s*"queued"|^\s*queued\s*:/i.test(text);
|
|
986
|
+
}
|
|
987
|
+
function isQueueReject(result) {
|
|
988
|
+
return !result.ok && isQueueRejectText(result.message);
|
|
989
|
+
}
|
|
990
|
+
/** 从排队拒绝里取出给人看的那句(JSON 的 message 字段或 `queued: …` 前缀)。 */
|
|
991
|
+
function queueRejectMessage(text) {
|
|
992
|
+
const prefixed = /^\s*queued\s*:\s*/i.exec(text);
|
|
993
|
+
if (prefixed !== null) return text.slice(prefixed[0].length).trim();
|
|
994
|
+
try {
|
|
995
|
+
const parsed = JSON.parse(text);
|
|
996
|
+
return String(parsed.message ?? parsed.error?.message ?? "").trim();
|
|
997
|
+
} catch {
|
|
998
|
+
return "";
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* 从首帧里认出上游的「排队」拒绝(HTTP 200 + 流内帧的形态)。
|
|
1003
|
+
*
|
|
1004
|
+
* 与 `rateLimitFrame` 同理:只在**还没有任何内容产出**的首帧上使用,此时重发安全。
|
|
1005
|
+
*/
|
|
1006
|
+
function queueFrame(text) {
|
|
1007
|
+
for (const line of text.split("\n")) {
|
|
1008
|
+
const trimmed = line.trim();
|
|
1009
|
+
if (!trimmed.startsWith("data:")) continue;
|
|
1010
|
+
const payload = trimmed.slice(5).trim();
|
|
1011
|
+
if (payload === "" || payload === "[DONE]") continue;
|
|
1012
|
+
let ev;
|
|
1013
|
+
try {
|
|
1014
|
+
ev = JSON.parse(payload);
|
|
1015
|
+
} catch {
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
const code = String(ev.error?.code ?? ev.error_code ?? ev.code ?? "");
|
|
1019
|
+
const type = String(ev.error?.type ?? ev.type ?? "");
|
|
1020
|
+
if (!/^queued$/i.test(code) && !/^queued$/i.test(type)) continue;
|
|
1021
|
+
return { message: String(ev.error?.message ?? ev.error_msg ?? ev.message ?? "") };
|
|
1022
|
+
}
|
|
972
1023
|
}
|
|
973
1024
|
/**
|
|
974
1025
|
* 从一帧已转成 OpenAI 形状的 SSE 里认出「可排队限流」。
|
|
@@ -1014,6 +1065,10 @@ function upstreamErrorMessage(message, status = 0) {
|
|
|
1014
1065
|
if (MODEL_RATE_CODE.test(message) || MODEL_RATE_TEXT.test(message)) return "华为侧该模型当前请求过多(共享 TPM 超限),不是你的账号或插件问题。稍后重试,或临时改用 GLM-5.2 / GLM-5.3。";
|
|
1015
1066
|
if (message.includes("TM.00001041")) return "CodeArts 免费档同时只允许 3 个会话,当前槽位一直占满(被打断的会话约 1 分钟才释放)。请稍后重试。";
|
|
1016
1067
|
if (isBenefitMissing("", message)) return "这个模型属于限时福利,当前福利通道不可用(不是账号问题)。可以刷新模型列表,改用非福利模型。";
|
|
1068
|
+
if (isQueueRejectText(message)) {
|
|
1069
|
+
const inner = queueRejectMessage(message);
|
|
1070
|
+
return `${inner === "" ? "上游提示请求量较大、需要排队。" : inner} 插件已在本地排队重试,仍未轮到,请稍后重试或临时切换模型。`;
|
|
1071
|
+
}
|
|
1017
1072
|
if (isIamTokenError(message)) return "上游判定本次登录凭据(IAM token)已失效。插件已尝试自动续期;若反复出现,请到设置卡片重新登录。";
|
|
1018
1073
|
if (isModelNotAccessible(message)) return "上游说这个模型不存在或当前账号没有权限(可能已下线或改名)。请刷新模型列表后换一个模型;换号没有用,这是模型级的限制。";
|
|
1019
1074
|
if (isNotMultimodal(message)) return "这个模型不支持图片输入(上游 406)。请移除消息里的图片,或改用支持识图的模型。";
|
|
@@ -1961,4 +2016,4 @@ async function claimDailyWelfare(credential, signal) {
|
|
|
1961
2016
|
};
|
|
1962
2017
|
}
|
|
1963
2018
|
//#endregion
|
|
1964
|
-
export {
|
|
2019
|
+
export { queueFrame as A, forgetModelUnavailable as B, isWelfareClaimedStatus as C, modelUnavailableReasonText as D, maxTokensCeilingFor as E, CodeArtsCatalog as F, modelDisplayName as G, isBenefitModel as H, FALLBACK_CODEARTS_MODELS as I, modelUnavailableReason as K, clearBenefitBlocked as L, signedGet as M, upstreamErrorMessage as N, pickDailyWelfareCampaign as O, upstream_exports as P, creditRatioLabel as R, isTpmLimit as S, learnedContextWindowFor as T, markModelUnavailable as U, isBenefitBlocked as V, mergeModelLists as W, isNotMultimodal as _, claimDailyWelfare as a, isQueueRejectText as b, degradeTokenCeiling as c, fetchQueueStatus as d, fetchWelfareCampaigns as f, isModelNotAccessible as g, isIamTokenError as h, chatStream as i, rateLimitFrame as j, prepareChatBody as k, fetchCallerIdentity as l, isConcurrencyCap as m, SNAP_HOST as n, clearQueueStatus as o, firstFrameError as p, setDiscoveredBenefitModels as q, canonicalModel as r, contextWindowOverrideFor as s, MAX_TOKENS_FLOOR as t, fetchModels as u, isParamInvalidFrame as v, learnContextWindow as w, isQueueableRate as x, isQueueReject as y, filterEnabledModels as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as writeJsonAtomic } from "./auth-
|
|
2
|
-
import {
|
|
1
|
+
import { u as writeJsonAtomic } from "./auth-Cd2SvQIy.mjs";
|
|
2
|
+
import { G as modelDisplayName, H as isBenefitModel, W as mergeModelLists, q as setDiscoveredBenefitModels, u as fetchModels } from "./upstream-BV4XWB4l.mjs";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -535,6 +535,6 @@ function percentileOf(buckets, ratio) {
|
|
|
535
535
|
}
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region src/version.ts
|
|
538
|
-
const CODEARTS_VERSION = "1.4.
|
|
538
|
+
const CODEARTS_VERSION = "1.4.3";
|
|
539
539
|
//#endregion
|
|
540
540
|
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.3",
|
|
6
6
|
"packageManager": "pnpm@11.24.0",
|
|
7
7
|
"author": "elegant01",
|
|
8
8
|
"keywords": [
|