dsh-codearts 1.4.7 → 1.4.8
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 +15 -0
- package/lib/bin.mjs +1 -1
- package/lib/client/index.js +103 -103
- package/lib/index.d.mts +25 -0
- package/lib/index.mjs +32 -5
- package/lib/{version-DNEBIi8C.mjs → version-qgKLf1Cq.mjs} +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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.8] - 2026-11-20
|
|
7
|
+
|
|
8
|
+
### 新增
|
|
9
|
+
|
|
10
|
+
- `llm-codearts.config.retryPolicy`:可按需覆盖 `maxRetries` / `initialDelayMs` /
|
|
11
|
+
`maxDelayMs`。策略在注册 provider 时被宿主快照,改完需要重载插件才生效。
|
|
12
|
+
|
|
13
|
+
### 修复
|
|
14
|
+
|
|
15
|
+
- **重试预算跨得过账号冷却窗了**(#14):软限流 / 5xx 后账号会被冷却 30 秒,期间
|
|
16
|
+
请求回 429 交给宿主重试;而宿主默认预算(5 次指数退避,累计约 15.5 秒)在冷却
|
|
17
|
+
前段**确定性地**烧尽,变成可见的轮次失败。现在 provider 注册的重试策略默认对齐
|
|
18
|
+
到 8 次(0.5+1+2+4+8+10+10+10 ≈45.5 秒,含抖动下限也稳过 30 秒)。
|
|
19
|
+
代价:持续性故障的暴露时间从约 15.5 秒变约 45.5 秒。
|
|
20
|
+
|
|
6
21
|
## [1.4.7] - 2026-11-20
|
|
7
22
|
|
|
8
23
|
### 修复
|
package/lib/bin.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as codeartsAccountsPath, t as CodeArtsAccountStore } from "./auth-BRlNY6dB.mjs";
|
|
3
3
|
import { U as isBenefitModel, l as fetchCallerIdentity } from "./upstream-CgQXomCI.mjs";
|
|
4
|
-
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-
|
|
4
|
+
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-qgKLf1Cq.mjs";
|
|
5
5
|
import { existsSync, statSync } from "node:fs";
|
|
6
6
|
//#region src/bin.ts
|
|
7
7
|
/**
|
package/lib/client/index.js
CHANGED
|
@@ -156,123 +156,123 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
156
156
|
document.head.appendChild(tag);
|
|
157
157
|
}
|
|
158
158
|
var CodeArtsPluginCard_module_css_default = {
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"sectionHead": "xoziZG_sectionHead",
|
|
162
|
-
"accountHint": "xoziZG_accountHint",
|
|
163
|
-
"modelRow": "xoziZG_modelRow",
|
|
164
|
-
"accountName": "xoziZG_accountName",
|
|
165
|
-
"accountMenuAnchor": "xoziZG_accountMenuAnchor",
|
|
166
|
-
"usageBar": "xoziZG_usageBar",
|
|
167
|
-
"barFill": "xoziZG_barFill",
|
|
168
|
-
"actions": "xoziZG_actions",
|
|
159
|
+
"accountMenu": "xoziZG_accountMenu",
|
|
160
|
+
"bar": "xoziZG_bar",
|
|
169
161
|
"modelChart": "xoziZG_modelChart",
|
|
170
|
-
"
|
|
171
|
-
"desc": "xoziZG_desc",
|
|
172
|
-
"accountEntry": "xoziZG_accountEntry",
|
|
173
|
-
"modelShare": "xoziZG_modelShare",
|
|
174
|
-
"doctorName": "xoziZG_doctorName",
|
|
175
|
-
"accountCard": "xoziZG_accountCard",
|
|
176
|
-
"modelRequests": "xoziZG_modelRequests",
|
|
177
|
-
"balanceUnit": "xoziZG_balanceUnit",
|
|
178
|
-
"groupHead": "xoziZG_groupHead",
|
|
179
|
-
"statGrid": "xoziZG_statGrid",
|
|
180
|
-
"accountRow": "xoziZG_accountRow",
|
|
181
|
-
"statCard": "xoziZG_statCard",
|
|
182
|
-
"modelName": "xoziZG_modelName",
|
|
183
|
-
"heatGrid": "xoziZG_heatGrid",
|
|
184
|
-
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
162
|
+
"windowHint": "xoziZG_windowHint",
|
|
185
163
|
"manualSummary": "xoziZG_manualSummary",
|
|
186
|
-
"statusLine": "xoziZG_statusLine",
|
|
187
|
-
"check": "xoziZG_check",
|
|
188
164
|
"balance": "xoziZG_balance",
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"creditRows": "xoziZG_creditRows",
|
|
194
|
-
"windowButton": "xoziZG_windowButton",
|
|
165
|
+
"modelMeta": "xoziZG_modelMeta",
|
|
166
|
+
"manualForm": "xoziZG_manualForm",
|
|
167
|
+
"windowInput": "xoziZG_windowInput",
|
|
168
|
+
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
195
169
|
"groupLabel": "xoziZG_groupLabel",
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"statLabel": "xoziZG_statLabel",
|
|
170
|
+
"tabPanel": "xoziZG_tabPanel",
|
|
171
|
+
"choiceTail": "xoziZG_choiceTail",
|
|
172
|
+
"modelFill": "xoziZG_modelFill",
|
|
173
|
+
"claimAllRow": "xoziZG_claimAllRow",
|
|
174
|
+
"area": "xoziZG_area",
|
|
175
|
+
"creditRow": "xoziZG_creditRow",
|
|
203
176
|
"creditBlock": "xoziZG_creditBlock",
|
|
204
|
-
"
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"
|
|
177
|
+
"modelName": "xoziZG_modelName",
|
|
178
|
+
"heatGrid": "xoziZG_heatGrid",
|
|
179
|
+
"danger": "xoziZG_danger",
|
|
180
|
+
"heatLegend": "xoziZG_heatLegend",
|
|
181
|
+
"choiceRow": "xoziZG_choiceRow",
|
|
182
|
+
"usageTipSep": "xoziZG_usageTipSep",
|
|
183
|
+
"accountName": "xoziZG_accountName",
|
|
184
|
+
"modelCheck": "xoziZG_modelCheck",
|
|
185
|
+
"balanceMeta": "xoziZG_balanceMeta",
|
|
186
|
+
"groupHeadFirst": "xoziZG_groupHeadFirst",
|
|
212
187
|
"fieldLabel": "xoziZG_fieldLabel",
|
|
213
|
-
"
|
|
188
|
+
"modelSpec": "xoziZG_modelSpec",
|
|
189
|
+
"statusLine": "xoziZG_statusLine",
|
|
190
|
+
"windowUnit": "xoziZG_windowUnit",
|
|
191
|
+
"statLabel": "xoziZG_statLabel",
|
|
192
|
+
"modelTokens": "xoziZG_modelTokens",
|
|
193
|
+
"accountHint": "xoziZG_accountHint",
|
|
194
|
+
"modelRow": "xoziZG_modelRow",
|
|
214
195
|
"accountNameRow": "xoziZG_accountNameRow",
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"header": "xoziZG_header",
|
|
219
|
-
"accountMenu": "xoziZG_accountMenu",
|
|
220
|
-
"section": "xoziZG_section",
|
|
221
|
-
"manualForm": "xoziZG_manualForm",
|
|
222
|
-
"groupHeadFirst": "xoziZG_groupHeadFirst",
|
|
223
|
-
"statSub": "xoziZG_statSub",
|
|
224
|
-
"tabs": "xoziZG_tabs",
|
|
196
|
+
"creditHint": "xoziZG_creditHint",
|
|
197
|
+
"creditRows": "xoziZG_creditRows",
|
|
198
|
+
"avatar": "xoziZG_avatar",
|
|
225
199
|
"modelTrack": "xoziZG_modelTrack",
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"windowInputSet": "xoziZG_windowInputSet",
|
|
200
|
+
"statSub": "xoziZG_statSub",
|
|
201
|
+
"doctorRow": "xoziZG_doctorRow",
|
|
202
|
+
"check": "xoziZG_check",
|
|
203
|
+
"windowCaret": "xoziZG_windowCaret",
|
|
231
204
|
"usageTip": "xoziZG_usageTip",
|
|
232
|
-
"area": "xoziZG_area",
|
|
233
|
-
"accountRowActions": "xoziZG_accountRowActions",
|
|
234
205
|
"windowAnchor": "xoziZG_windowAnchor",
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"accountToolbar": "xoziZG_accountToolbar",
|
|
206
|
+
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
207
|
+
"windowRange": "xoziZG_windowRange",
|
|
238
208
|
"usageFill": "xoziZG_usageFill",
|
|
239
|
-
"
|
|
240
|
-
"
|
|
241
|
-
"
|
|
242
|
-
"heatHours": "xoziZG_heatHours",
|
|
243
|
-
"modelMeta": "xoziZG_modelMeta",
|
|
244
|
-
"windowUnit": "xoziZG_windowUnit",
|
|
245
|
-
"choiceTail": "xoziZG_choiceTail",
|
|
246
|
-
"name": "xoziZG_name",
|
|
209
|
+
"error": "xoziZG_error",
|
|
210
|
+
"body": "xoziZG_body",
|
|
211
|
+
"accountEntry": "xoziZG_accountEntry",
|
|
247
212
|
"windowPopoverHead": "xoziZG_windowPopoverHead",
|
|
248
|
-
"
|
|
249
|
-
"
|
|
250
|
-
"
|
|
251
|
-
"meta": "xoziZG_meta",
|
|
252
|
-
"heatLegend": "xoziZG_heatLegend",
|
|
253
|
-
"card": "xoziZG_card",
|
|
213
|
+
"tabs": "xoziZG_tabs",
|
|
214
|
+
"actions": "xoziZG_actions",
|
|
215
|
+
"modelShare": "xoziZG_modelShare",
|
|
254
216
|
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
255
|
-
"
|
|
256
|
-
"error": "xoziZG_error",
|
|
217
|
+
"creditLink": "xoziZG_creditLink",
|
|
257
218
|
"heatWeekday": "xoziZG_heatWeekday",
|
|
258
|
-
"
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
"
|
|
219
|
+
"accountMenuItem": "xoziZG_accountMenuItem",
|
|
220
|
+
"doctorName": "xoziZG_doctorName",
|
|
221
|
+
"statGrid": "xoziZG_statGrid",
|
|
222
|
+
"header": "xoziZG_header",
|
|
223
|
+
"groupHead": "xoziZG_groupHead",
|
|
224
|
+
"accountInfo": "xoziZG_accountInfo",
|
|
225
|
+
"expiryRow": "xoziZG_expiryRow",
|
|
262
226
|
"choices": "xoziZG_choices",
|
|
227
|
+
"accountToggle": "xoziZG_accountToggle",
|
|
228
|
+
"accountRowActions": "xoziZG_accountRowActions",
|
|
229
|
+
"skeleton": "xoziZG_skeleton",
|
|
230
|
+
"meta": "xoziZG_meta",
|
|
231
|
+
"modelRequests": "xoziZG_modelRequests",
|
|
232
|
+
"heatHours": "xoziZG_heatHours",
|
|
233
|
+
"usageTipRow": "xoziZG_usageTipRow",
|
|
234
|
+
"balanceRow": "xoziZG_balanceRow",
|
|
235
|
+
"updated": "xoziZG_updated",
|
|
236
|
+
"balanceUnit": "xoziZG_balanceUnit",
|
|
263
237
|
"skeletonRow": "xoziZG_skeletonRow",
|
|
238
|
+
"count": "xoziZG_count",
|
|
239
|
+
"accountGrid": "xoziZG_accountGrid",
|
|
240
|
+
"field": "xoziZG_field",
|
|
241
|
+
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
242
|
+
"skeletonBreath": "xoziZG_skeletonBreath",
|
|
243
|
+
"barFill": "xoziZG_barFill",
|
|
244
|
+
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
245
|
+
"heatCell": "xoziZG_heatCell",
|
|
246
|
+
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
247
|
+
"usageBar": "xoziZG_usageBar",
|
|
248
|
+
"accountClear": "xoziZG_accountClear",
|
|
249
|
+
"accountCard": "xoziZG_accountCard",
|
|
250
|
+
"windowPopover": "xoziZG_windowPopover",
|
|
251
|
+
"windowInputSet": "xoziZG_windowInputSet",
|
|
252
|
+
"manual": "xoziZG_manual",
|
|
253
|
+
"usageTipName": "xoziZG_usageTipName",
|
|
254
|
+
"accountRow": "xoziZG_accountRow",
|
|
255
|
+
"name": "xoziZG_name",
|
|
256
|
+
"desc": "xoziZG_desc",
|
|
257
|
+
"expiryLabel": "xoziZG_expiryLabel",
|
|
258
|
+
"accountToolbar": "xoziZG_accountToolbar",
|
|
259
|
+
"card": "xoziZG_card",
|
|
260
|
+
"sectionLabel": "xoziZG_sectionLabel",
|
|
261
|
+
"hint": "xoziZG_hint",
|
|
262
|
+
"statCard": "xoziZG_statCard",
|
|
263
|
+
"statValue": "xoziZG_statValue",
|
|
264
264
|
"trendTip": "xoziZG_trendTip",
|
|
265
|
-
"
|
|
266
|
-
"
|
|
267
|
-
"
|
|
265
|
+
"headText": "xoziZG_headText",
|
|
266
|
+
"section": "xoziZG_section",
|
|
267
|
+
"accountMenuAnchor": "xoziZG_accountMenuAnchor",
|
|
268
|
+
"sectionHead": "xoziZG_sectionHead",
|
|
269
|
+
"heatHourCell": "xoziZG_heatHourCell",
|
|
270
|
+
"heatAxis": "xoziZG_heatAxis",
|
|
271
|
+
"windowButton": "xoziZG_windowButton",
|
|
272
|
+
"doctorList": "xoziZG_doctorList",
|
|
273
|
+
"link": "xoziZG_link",
|
|
268
274
|
"creditFooter": "xoziZG_creditFooter",
|
|
269
|
-
"
|
|
270
|
-
"bar": "xoziZG_bar",
|
|
271
|
-
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
272
|
-
"windowInput": "xoziZG_windowInput",
|
|
273
|
-
"creditRow": "xoziZG_creditRow",
|
|
274
|
-
"modelFill": "xoziZG_modelFill",
|
|
275
|
-
"statValue": "xoziZG_statValue"
|
|
275
|
+
"accountClearHint": "xoziZG_accountClearHint"
|
|
276
276
|
};
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/client/CodeArtsPluginCard.tsx
|
|
@@ -3289,14 +3289,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
3289
3289
|
document.head.appendChild(tag);
|
|
3290
3290
|
}
|
|
3291
3291
|
var CodeArtsPanel_module_css_default = {
|
|
3292
|
+
"head": "Z66cgG_head",
|
|
3292
3293
|
"body": "Z66cgG_body",
|
|
3293
3294
|
"page": "Z66cgG_page",
|
|
3294
|
-
"
|
|
3295
|
+
"icon": "Z66cgG_icon",
|
|
3296
|
+
"back": "Z66cgG_back",
|
|
3295
3297
|
"backCaret": "Z66cgG_backCaret",
|
|
3296
3298
|
"title": "Z66cgG_title",
|
|
3297
|
-
"desc": "Z66cgG_desc"
|
|
3298
|
-
"icon": "Z66cgG_icon",
|
|
3299
|
-
"back": "Z66cgG_back"
|
|
3299
|
+
"desc": "Z66cgG_desc"
|
|
3300
3300
|
};
|
|
3301
3301
|
//#endregion
|
|
3302
3302
|
//#region src/client/CodeArtsPanel.tsx
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
import "@deepseek-ai/dsh-llm";
|
|
3
4
|
import { PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
|
|
4
5
|
import { SettingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
5
6
|
import { Context } from "@deepseek-ai/cordis";
|
|
@@ -1675,10 +1676,21 @@ declare function createCodeArtsShim(options: CodeArtsShimOptions): CodeArtsShim;
|
|
|
1675
1676
|
//#region src/adapter.d.ts
|
|
1676
1677
|
/** Provider route this bundle owns. Keep in sync with cordis.patch.yml. */
|
|
1677
1678
|
declare const CODEARTS_PROVIDER = "codearts";
|
|
1679
|
+
/** 用户在 `llm-codearts.config.retryPolicy` 里可调的三个旋钮。 */
|
|
1680
|
+
interface CodeArtsRetryPolicyConfig {
|
|
1681
|
+
/** 首次请求之后最多重试几次(默认 8,覆盖 30s 冷却窗)。 */
|
|
1682
|
+
maxRetries?: number;
|
|
1683
|
+
/** 首档退避毫秒数(默认 500)。 */
|
|
1684
|
+
initialDelayMs?: number;
|
|
1685
|
+
/** 单档退避上限毫秒数(默认 10000)。 */
|
|
1686
|
+
maxDelayMs?: number;
|
|
1687
|
+
}
|
|
1678
1688
|
interface CodeArtsAdapterOptions {
|
|
1679
1689
|
shim: CodeArtsShim;
|
|
1680
1690
|
catalog: CodeArtsCatalog;
|
|
1681
1691
|
enabledModels?: () => readonly string[] | undefined;
|
|
1692
|
+
/** issue #14 的 `retryPolicy` 配置;缺省按默认预算(8 次)注册。 */
|
|
1693
|
+
retryPolicy?: CodeArtsRetryPolicyConfig;
|
|
1682
1694
|
resolveAttachments?: () => AttachmentStore | undefined;
|
|
1683
1695
|
}
|
|
1684
1696
|
interface CodeArtsAdapter {
|
|
@@ -1870,6 +1882,19 @@ interface Config {
|
|
|
1870
1882
|
* 进程内按实测学到的上界仍会在此基础上继续往下钳。
|
|
1871
1883
|
*/
|
|
1872
1884
|
contextWindowOverrides?: Record<string, number>;
|
|
1885
|
+
/**
|
|
1886
|
+
* 宿主的请求重试预算(issue #14)。
|
|
1887
|
+
*
|
|
1888
|
+
* 账号撞上软限流/5xx 会被冷却 30s,期间所有请求回 429 交给宿主重试。宿主的
|
|
1889
|
+
* 默认预算(5 次指数退避 ≈15.5s)跨不过前段 30s 窗口,会变成可见的轮次失败;
|
|
1890
|
+
* 插件默认已对齐到 8 次(≈45.5s),这里允许按需调整。值在注册 provider 时被
|
|
1891
|
+
* 宿主快照,改了要重载插件才生效。
|
|
1892
|
+
*/
|
|
1893
|
+
retryPolicy?: {
|
|
1894
|
+
maxRetries?: number;
|
|
1895
|
+
initialDelayMs?: number;
|
|
1896
|
+
maxDelayMs?: number;
|
|
1897
|
+
};
|
|
1873
1898
|
/** 对话输入框下方那行「积分 N」是否显示。缺省 = 显示(老配置不改行为)。 */
|
|
1874
1899
|
showCreditDock?: boolean;
|
|
1875
1900
|
/** 等上游开流时那行「排队第 N 位」是否显示。缺省 = 显示。 */
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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-BRlNY6dB.mjs";
|
|
2
2
|
import { A as queueFrame, B as filterEnabledModels, C as isWelfareClaimedStatus, D as modelUnavailableReasonText, E as maxTokensCeilingFor, F as CodeArtsCatalog, H as isBenefitBlocked, I as FALLBACK_CODEARTS_MODELS, M as signedGet, N as upstreamErrorMessage, O as pickDailyWelfareCampaign, R as clearBenefitBlocked, S as isTpmLimit, T as learnedContextWindowFor, U as isBenefitModel, V as forgetModelUnavailable, W as markModelUnavailable, _ 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, q as modelUnavailableReason, 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 creditRatioLabel } from "./upstream-CgQXomCI.mjs";
|
|
3
|
-
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-
|
|
3
|
+
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-qgKLf1Cq.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";
|
|
@@ -704,10 +704,30 @@ const CODEARTS_PROVIDER = "codearts";
|
|
|
704
704
|
*
|
|
705
705
|
* 90s 而不是常见的 300s:华为免费推理后端实测会流中途停摆(吐几个 token 后
|
|
706
706
|
* 长时间静默),300s 意味着用户要在"等待"里干等 5 分钟才进入自动重试。
|
|
707
|
-
* 90s 足够容忍首 token 冷启动与推理间隙,又能让 DSH
|
|
708
|
-
*
|
|
707
|
+
* 90s 足够容忍首 token 冷启动与推理间隙,又能让 DSH 的重试策略(TIMEOUT
|
|
708
|
+
* 可重试)更快接管。
|
|
709
709
|
*/
|
|
710
710
|
const CODEARTS_STREAM_IDLE_TIMEOUT_MS = 9e4;
|
|
711
|
+
const DEFAULT_CODEARTS_INITIAL_DELAY_MS = 500;
|
|
712
|
+
const DEFAULT_CODEARTS_MAX_DELAY_MS = 1e4;
|
|
713
|
+
/** 只认有限正整数;非法值忽略而不是抛错(值来自用户写的配置文件)。 */
|
|
714
|
+
function positiveInt(value) {
|
|
715
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
|
|
716
|
+
}
|
|
717
|
+
/** 把插件配置解析成宿主快照用的重试策略;缺省值按上面注释对齐冷却窗。 */
|
|
718
|
+
function resolveCodeArtsRetryPolicy(config) {
|
|
719
|
+
const resolved = {
|
|
720
|
+
mode: "normal",
|
|
721
|
+
maxRetries: positiveInt(config?.maxRetries) ?? 8,
|
|
722
|
+
backoff: {
|
|
723
|
+
initialDelayMs: positiveInt(config?.initialDelayMs) ?? DEFAULT_CODEARTS_INITIAL_DELAY_MS,
|
|
724
|
+
maxDelayMs: positiveInt(config?.maxDelayMs) ?? DEFAULT_CODEARTS_MAX_DELAY_MS
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
const policy = resolveRetryPolicy(resolved, "dsh-codearts retryPolicy");
|
|
728
|
+
if (policy.mode !== "normal") throw new Error("dsh-codearts retry policy must be normal");
|
|
729
|
+
return policy;
|
|
730
|
+
}
|
|
711
731
|
/** No per-token pricing is knowable for a subscription quota; report zero. */
|
|
712
732
|
const NO_COST = {
|
|
713
733
|
input: 0,
|
|
@@ -814,7 +834,7 @@ function createCodeArtsAdapter(options) {
|
|
|
814
834
|
provider: CODEARTS_PROVIDER,
|
|
815
835
|
displayName: "CodeArts",
|
|
816
836
|
streamIdleTimeoutMs: CODEARTS_STREAM_IDLE_TIMEOUT_MS,
|
|
817
|
-
retryPolicy:
|
|
837
|
+
retryPolicy: resolveCodeArtsRetryPolicy(options.retryPolicy),
|
|
818
838
|
configuredMaxTokens: /* @__PURE__ */ new Map(),
|
|
819
839
|
modelErrors: /* @__PURE__ */ new Map(),
|
|
820
840
|
...REQUEST_IMAGE_BUDGETS,
|
|
@@ -1016,7 +1036,8 @@ function writeOpenAIError(res, status, kind, message) {
|
|
|
1016
1036
|
* 种还把真因(比如 billion-context 本地拒签的 403)整个吞掉(issue #1)。
|
|
1017
1037
|
*
|
|
1018
1038
|
* 全部被禁用时回 401(宿主只自动重试 429,401 一次就把「去重新登录」说清);
|
|
1019
|
-
* 只要还有会自己恢复的(冷却/槽位满)就回 429
|
|
1039
|
+
* 只要还有会自己恢复的(冷却/槽位满)就回 429,让宿主重试接住。默认重试预算
|
|
1040
|
+
* 已对齐 30s 冷却窗(8 次指数退避 ≈45.5s,见 `adapter.ts`),冷却前段也跨得过。
|
|
1020
1041
|
*/
|
|
1021
1042
|
function noAccountError(accounts, pausedIds = []) {
|
|
1022
1043
|
const now = Date.now();
|
|
@@ -3126,6 +3147,11 @@ function unwrapConfig(value) {
|
|
|
3126
3147
|
const Config = z.object({
|
|
3127
3148
|
enabledModels: z.array(z.string()).description("Model ids offered in the model pickers (empty means every model)").volatile(),
|
|
3128
3149
|
contextWindowOverrides: z.dict(z.natural()).description("Per-model contextWindow overrides (model id → tokens). Discovery reports the nominal server window, which the free tier may not actually serve (issue #9); an override wins over it, and the in-process learned upper bound still clamps it.").volatile(),
|
|
3150
|
+
retryPolicy: z.object({
|
|
3151
|
+
maxRetries: z.natural(),
|
|
3152
|
+
initialDelayMs: z.natural(),
|
|
3153
|
+
maxDelayMs: z.natural()
|
|
3154
|
+
}).description("Host retry budget for this provider (issue #14). Defaults to 8 retries (≈45.5s of backoff) so it outlasts the 30s account cooldown; changes apply after the plugin reloads.").volatile(),
|
|
3129
3155
|
showCreditDock: z.boolean().default(true).description("Show the remaining-credits line under the chat input box").volatile(),
|
|
3130
3156
|
showQueueDock: z.boolean().default(true).description("Show the upstream queue position under the chat input box").volatile(),
|
|
3131
3157
|
showSidebarPanel: z.boolean().default(false).description("Show a CodeArts icon in the DSH sidebar icon column, opening this page in the middle column").volatile(),
|
|
@@ -3740,6 +3766,7 @@ async function apply(ctx, rawConfig) {
|
|
|
3740
3766
|
shim,
|
|
3741
3767
|
catalog,
|
|
3742
3768
|
enabledModels,
|
|
3769
|
+
retryPolicy: current().retryPolicy,
|
|
3743
3770
|
resolveAttachments: () => ctx.get("attachments")
|
|
3744
3771
|
});
|
|
3745
3772
|
let releaseAdapter;
|
|
@@ -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.8";
|
|
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.8",
|
|
6
6
|
"packageManager": "pnpm@11.24.0",
|
|
7
7
|
"author": "elegant01",
|
|
8
8
|
"keywords": [
|