dsh-codearts 1.4.10 → 1.4.12
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 +29 -0
- package/lib/{auth-BaxN0iKC.mjs → auth-D-RmpxN3.mjs} +1 -1
- package/lib/bin.mjs +3 -3
- package/lib/client/index.js +115 -108
- package/lib/index.mjs +45 -8
- package/lib/keeper-main.mjs +1 -1
- package/lib/{upstream-BX6-klXI.mjs → upstream-DeRNnZdN.mjs} +20 -2
- package/lib/{version-CUnRcNkz.mjs → version-BGniJF-q.mjs} +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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.12] - 2026-11-24
|
|
7
|
+
|
|
8
|
+
### 修复
|
|
9
|
+
|
|
10
|
+
- **不再把「请求体过大」误学成窗口上界**(#18):上游对真超窗和图片/附件撑大
|
|
11
|
+
请求体回同一个 `InferHub.001001005.400`。以前 max_tokens 降到地板就无条件把
|
|
12
|
+
本次 prompt 估算记成窗口上界,一次图片超限之后每条请求(含 `/compact`)都被
|
|
13
|
+
本地拦住。现在只有报错文案明确是 `input token limit is N` 才学习窗口;其余
|
|
14
|
+
按「请求体过大」报错,提示减少图片/附件,不再引导压缩上下文。
|
|
15
|
+
- 内联图片总预算从 20 MiB 降到 6 MiB:上游对约 10 MB 的请求体就回同一个 400,
|
|
16
|
+
超预算时改由宿主把最老的图片换成占位文本(`read_image` 按需重读),不再让
|
|
17
|
+
请求带着全部图片去撞上游。
|
|
18
|
+
- `MALFORMED_RESPONSE` 纳入默认重试码:模型偶尔把工具参数写成非法 JSON,
|
|
19
|
+
pi-ai 在派发工具前就判整轮失败,表现为「本轮运行失败、选项不弹」。重发让
|
|
20
|
+
模型重新生成,多数可自愈。
|
|
21
|
+
|
|
22
|
+
### 新增
|
|
23
|
+
|
|
24
|
+
- `CODEARTS_IGNORE_LEARNED=1`:读取窗口上界时忽略已学值(不清表),用于自救
|
|
25
|
+
被旧逻辑锁死的会话。
|
|
26
|
+
|
|
27
|
+
## [1.4.11] - 2026-11-23
|
|
28
|
+
|
|
29
|
+
### 修复
|
|
30
|
+
|
|
31
|
+
- 模型行 `▾` 按钮收起弹层时不提交草稿(#15):清空窗口或输出上限后点 `▾`
|
|
32
|
+
收起,改动不生效、徽标停在旧值;只有点弹层外面或按 Esc 才会提交。现在三种
|
|
33
|
+
收起方式共用同一条提交路径;从 A 模型直接切到 B 时,也会先提交 A 的草稿。
|
|
34
|
+
|
|
6
35
|
## [1.4.10] - 2026-11-23
|
|
7
36
|
|
|
8
37
|
### 修复
|
|
@@ -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-DeRNnZdN.mjs").then((n) => n.R);
|
|
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-D-RmpxN3.mjs";
|
|
3
|
+
import { l as fetchCallerIdentity, q as isBenefitModel } from "./upstream-DeRNnZdN.mjs";
|
|
4
|
+
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-BGniJF-q.mjs";
|
|
5
5
|
import { existsSync, statSync } from "node:fs";
|
|
6
6
|
//#region src/bin.ts
|
|
7
7
|
/**
|
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
|
-
"creditRow": "xoziZG_creditRow",
|
|
198
|
-
"manual": "xoziZG_manual",
|
|
199
|
-
"trendTip": "xoziZG_trendTip",
|
|
200
|
-
"choiceTail": "xoziZG_choiceTail",
|
|
201
197
|
"skeletonRow": "xoziZG_skeletonRow",
|
|
202
|
-
"
|
|
203
|
-
"
|
|
198
|
+
"usageTipRow": "xoziZG_usageTipRow",
|
|
199
|
+
"accountToggle": "xoziZG_accountToggle",
|
|
200
|
+
"windowHint": "xoziZG_windowHint",
|
|
201
|
+
"accountInfo": "xoziZG_accountInfo",
|
|
202
|
+
"tabs": "xoziZG_tabs",
|
|
203
|
+
"creditBlock": "xoziZG_creditBlock",
|
|
204
204
|
"balanceUnit": "xoziZG_balanceUnit",
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"usageFill": "xoziZG_usageFill",
|
|
211
|
-
"accountConcurrencyInline": "xoziZG_accountConcurrencyInline",
|
|
212
|
-
"concurrencyValue": "xoziZG_concurrencyValue",
|
|
205
|
+
"check": "xoziZG_check",
|
|
206
|
+
"fieldLabel": "xoziZG_fieldLabel",
|
|
207
|
+
"heatAxis": "xoziZG_heatAxis",
|
|
208
|
+
"choices": "xoziZG_choices",
|
|
209
|
+
"modelTokens": "xoziZG_modelTokens",
|
|
213
210
|
"heatCell": "xoziZG_heatCell",
|
|
214
|
-
"
|
|
215
|
-
"usageTipSep": "xoziZG_usageTipSep",
|
|
216
|
-
"heatHours": "xoziZG_heatHours",
|
|
217
|
-
"tabs": "xoziZG_tabs",
|
|
218
|
-
"accountMenu": "xoziZG_accountMenu",
|
|
219
|
-
"modelRequests": "xoziZG_modelRequests",
|
|
220
|
-
"windowButton": "xoziZG_windowButton",
|
|
221
|
-
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
211
|
+
"balanceMeta": "xoziZG_balanceMeta",
|
|
222
212
|
"skeleton": "xoziZG_skeleton",
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"name": "xoziZG_name",
|
|
227
|
-
"header": "xoziZG_header",
|
|
228
|
-
"desc": "xoziZG_desc",
|
|
213
|
+
"heatHours": "xoziZG_heatHours",
|
|
214
|
+
"windowAnchor": "xoziZG_windowAnchor",
|
|
215
|
+
"windowInput": "xoziZG_windowInput",
|
|
229
216
|
"accountMenuAnchor": "xoziZG_accountMenuAnchor",
|
|
230
|
-
"
|
|
231
|
-
"doctorList": "xoziZG_doctorList",
|
|
232
|
-
"statGrid": "xoziZG_statGrid",
|
|
233
|
-
"accountInfo": "xoziZG_accountInfo",
|
|
234
|
-
"body": "xoziZG_body",
|
|
235
|
-
"manualForm": "xoziZG_manualForm",
|
|
217
|
+
"manual": "xoziZG_manual",
|
|
236
218
|
"windowPopover": "xoziZG_windowPopover",
|
|
237
|
-
"
|
|
238
|
-
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
219
|
+
"doctorList": "xoziZG_doctorList",
|
|
239
220
|
"doctorRow": "xoziZG_doctorRow",
|
|
240
|
-
"
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
221
|
+
"windowButton": "xoziZG_windowButton",
|
|
222
|
+
"concurrencyButton": "xoziZG_concurrencyButton",
|
|
223
|
+
"danger": "xoziZG_danger",
|
|
224
|
+
"error": "xoziZG_error",
|
|
225
|
+
"usageTip": "xoziZG_usageTip",
|
|
226
|
+
"choiceTail": "xoziZG_choiceTail",
|
|
227
|
+
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
228
|
+
"trendTip": "xoziZG_trendTip",
|
|
247
229
|
"statValue": "xoziZG_statValue",
|
|
248
|
-
"
|
|
249
|
-
"
|
|
250
|
-
"
|
|
230
|
+
"modelShare": "xoziZG_modelShare",
|
|
231
|
+
"windowSection": "xoziZG_windowSection",
|
|
232
|
+
"modelRow": "xoziZG_modelRow",
|
|
233
|
+
"bar": "xoziZG_bar",
|
|
234
|
+
"creditLink": "xoziZG_creditLink",
|
|
235
|
+
"usageTipName": "xoziZG_usageTipName",
|
|
236
|
+
"creditRow": "xoziZG_creditRow",
|
|
251
237
|
"accountCard": "xoziZG_accountCard",
|
|
252
|
-
"
|
|
253
|
-
"
|
|
238
|
+
"field": "xoziZG_field",
|
|
239
|
+
"accountConcurrencyLabel": "xoziZG_accountConcurrencyLabel",
|
|
240
|
+
"manualForm": "xoziZG_manualForm",
|
|
241
|
+
"body": "xoziZG_body",
|
|
254
242
|
"creditRows": "xoziZG_creditRows",
|
|
255
|
-
"
|
|
256
|
-
"windowInput": "xoziZG_windowInput",
|
|
257
|
-
"concurrencyButton": "xoziZG_concurrencyButton",
|
|
258
|
-
"windowAnchor": "xoziZG_windowAnchor",
|
|
243
|
+
"groupLabel": "xoziZG_groupLabel",
|
|
259
244
|
"groupHeadFirst": "xoziZG_groupHeadFirst",
|
|
260
|
-
"
|
|
261
|
-
"
|
|
245
|
+
"usageTipSep": "xoziZG_usageTipSep",
|
|
246
|
+
"choiceRow": "xoziZG_choiceRow",
|
|
247
|
+
"area": "xoziZG_area",
|
|
248
|
+
"modelFill": "xoziZG_modelFill",
|
|
262
249
|
"headText": "xoziZG_headText",
|
|
263
|
-
"
|
|
264
|
-
"
|
|
265
|
-
"
|
|
266
|
-
"
|
|
250
|
+
"accountClear": "xoziZG_accountClear",
|
|
251
|
+
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
252
|
+
"windowInputSet": "xoziZG_windowInputSet",
|
|
253
|
+
"modelSpec": "xoziZG_modelSpec",
|
|
254
|
+
"name": "xoziZG_name",
|
|
255
|
+
"expiryLabel": "xoziZG_expiryLabel",
|
|
267
256
|
"balance": "xoziZG_balance",
|
|
268
|
-
"actions": "xoziZG_actions",
|
|
269
|
-
"choiceRow": "xoziZG_choiceRow",
|
|
270
|
-
"accountHint": "xoziZG_accountHint",
|
|
271
|
-
"usageTip": "xoziZG_usageTip",
|
|
272
|
-
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
273
|
-
"windowHint": "xoziZG_windowHint",
|
|
274
|
-
"hint": "xoziZG_hint",
|
|
275
|
-
"danger": "xoziZG_danger",
|
|
276
|
-
"sectionLabel": "xoziZG_sectionLabel",
|
|
277
|
-
"usageTipRow": "xoziZG_usageTipRow",
|
|
278
|
-
"field": "xoziZG_field",
|
|
279
257
|
"doctorName": "xoziZG_doctorName",
|
|
280
|
-
"
|
|
281
|
-
"windowRange": "xoziZG_windowRange",
|
|
282
|
-
"claimAllRow": "xoziZG_claimAllRow",
|
|
283
|
-
"accountClearHint": "xoziZG_accountClearHint",
|
|
284
|
-
"section": "xoziZG_section",
|
|
285
|
-
"accountToggle": "xoziZG_accountToggle",
|
|
286
|
-
"meta": "xoziZG_meta",
|
|
287
|
-
"accountEntry": "xoziZG_accountEntry",
|
|
288
|
-
"heatWeekday": "xoziZG_heatWeekday",
|
|
289
|
-
"expiryLabel": "xoziZG_expiryLabel",
|
|
290
|
-
"accountToolbar": "xoziZG_accountToolbar",
|
|
258
|
+
"desc": "xoziZG_desc",
|
|
291
259
|
"creditHint": "xoziZG_creditHint",
|
|
292
|
-
"
|
|
260
|
+
"modelMeta": "xoziZG_modelMeta",
|
|
261
|
+
"accountNameRow": "xoziZG_accountNameRow",
|
|
262
|
+
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
263
|
+
"count": "xoziZG_count",
|
|
264
|
+
"accountMenu": "xoziZG_accountMenu",
|
|
265
|
+
"modelRequests": "xoziZG_modelRequests",
|
|
266
|
+
"accountConcurrencyInline": "xoziZG_accountConcurrencyInline",
|
|
267
|
+
"modelTrack": "xoziZG_modelTrack",
|
|
268
|
+
"statSub": "xoziZG_statSub",
|
|
269
|
+
"accountName": "xoziZG_accountName",
|
|
293
270
|
"heatLegend": "xoziZG_heatLegend",
|
|
271
|
+
"windowUnit": "xoziZG_windowUnit",
|
|
272
|
+
"heatHourCell": "xoziZG_heatHourCell",
|
|
273
|
+
"heatGrid": "xoziZG_heatGrid",
|
|
274
|
+
"accountMenuItem": "xoziZG_accountMenuItem",
|
|
275
|
+
"usageBar": "xoziZG_usageBar",
|
|
276
|
+
"manualSummary": "xoziZG_manualSummary",
|
|
277
|
+
"accountGrid": "xoziZG_accountGrid",
|
|
278
|
+
"windowPopoverHead": "xoziZG_windowPopoverHead",
|
|
279
|
+
"modelName": "xoziZG_modelName",
|
|
280
|
+
"section": "xoziZG_section",
|
|
281
|
+
"statusLine": "xoziZG_statusLine",
|
|
282
|
+
"sectionLabel": "xoziZG_sectionLabel",
|
|
294
283
|
"barFill": "xoziZG_barFill",
|
|
295
|
-
"
|
|
296
|
-
"
|
|
284
|
+
"avatar": "xoziZG_avatar",
|
|
285
|
+
"claimAllRow": "xoziZG_claimAllRow",
|
|
286
|
+
"statGrid": "xoziZG_statGrid",
|
|
287
|
+
"windowCaret": "xoziZG_windowCaret",
|
|
297
288
|
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
289
|
+
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
298
290
|
"concurrencyStepper": "xoziZG_concurrencyStepper",
|
|
299
|
-
"
|
|
300
|
-
"
|
|
291
|
+
"accountHint": "xoziZG_accountHint",
|
|
292
|
+
"groupHead": "xoziZG_groupHead",
|
|
293
|
+
"balanceRow": "xoziZG_balanceRow",
|
|
294
|
+
"accountClearHint": "xoziZG_accountClearHint",
|
|
295
|
+
"modelCheck": "xoziZG_modelCheck",
|
|
296
|
+
"meta": "xoziZG_meta",
|
|
297
|
+
"link": "xoziZG_link",
|
|
298
|
+
"header": "xoziZG_header",
|
|
299
|
+
"statLabel": "xoziZG_statLabel",
|
|
300
|
+
"actions": "xoziZG_actions",
|
|
301
301
|
"modelChart": "xoziZG_modelChart",
|
|
302
|
-
"
|
|
303
|
-
"accountClear": "xoziZG_accountClear",
|
|
304
|
-
"updated": "xoziZG_updated",
|
|
305
|
-
"accountGrid": "xoziZG_accountGrid",
|
|
306
|
-
"statSub": "xoziZG_statSub",
|
|
302
|
+
"usageFill": "xoziZG_usageFill",
|
|
307
303
|
"skeletonBreath": "xoziZG_skeletonBreath",
|
|
308
|
-
"
|
|
309
|
-
"
|
|
310
|
-
"
|
|
311
|
-
"
|
|
312
|
-
"
|
|
313
|
-
"
|
|
314
|
-
"
|
|
315
|
-
"
|
|
316
|
-
"
|
|
317
|
-
"
|
|
318
|
-
"
|
|
319
|
-
"accountRowActions": "xoziZG_accountRowActions"
|
|
304
|
+
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
305
|
+
"windowRange": "xoziZG_windowRange",
|
|
306
|
+
"accountEntry": "xoziZG_accountEntry",
|
|
307
|
+
"updated": "xoziZG_updated",
|
|
308
|
+
"accountToolbar": "xoziZG_accountToolbar",
|
|
309
|
+
"statCard": "xoziZG_statCard",
|
|
310
|
+
"accountRow": "xoziZG_accountRow",
|
|
311
|
+
"expiryRow": "xoziZG_expiryRow",
|
|
312
|
+
"heatWeekday": "xoziZG_heatWeekday",
|
|
313
|
+
"sectionHead": "xoziZG_sectionHead",
|
|
314
|
+
"hint": "xoziZG_hint",
|
|
315
|
+
"accountRowActions": "xoziZG_accountRowActions",
|
|
316
|
+
"concurrencyValue": "xoziZG_concurrencyValue",
|
|
317
|
+
"card": "xoziZG_card",
|
|
318
|
+
"creditFooter": "xoziZG_creditFooter",
|
|
319
|
+
"tabPanel": "xoziZG_tabPanel"
|
|
320
320
|
};
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/client/CodeArtsPluginCard.tsx
|
|
@@ -2452,7 +2452,14 @@ function CodeArtsPluginCard({ t }) {
|
|
|
2452
2452
|
model: modelName(choice),
|
|
2453
2453
|
value: formatWindow(choice.contextWindowDiscovered ?? choice.contextWindow)
|
|
2454
2454
|
}),
|
|
2455
|
-
onClick: () =>
|
|
2455
|
+
onClick: () => {
|
|
2456
|
+
if (windowOpenFor === choice.id) {
|
|
2457
|
+
closeWindow();
|
|
2458
|
+
return;
|
|
2459
|
+
}
|
|
2460
|
+
if (windowOpenFor !== null) closeWindow();
|
|
2461
|
+
setWindowOpenFor(choice.id);
|
|
2462
|
+
},
|
|
2456
2463
|
children: [t("modelSpec", {
|
|
2457
2464
|
context: formatWindow(windowNumberValue(choice)),
|
|
2458
2465
|
output: formatWindow(choice.maxTokens)
|
|
@@ -3623,14 +3630,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
3623
3630
|
document.head.appendChild(tag);
|
|
3624
3631
|
}
|
|
3625
3632
|
var CodeArtsPanel_module_css_default = {
|
|
3626
|
-
"title": "Z66cgG_title",
|
|
3627
|
-
"back": "Z66cgG_back",
|
|
3628
3633
|
"head": "Z66cgG_head",
|
|
3634
|
+
"desc": "Z66cgG_desc",
|
|
3629
3635
|
"backCaret": "Z66cgG_backCaret",
|
|
3630
|
-
"body": "Z66cgG_body",
|
|
3631
3636
|
"icon": "Z66cgG_icon",
|
|
3632
|
-
"
|
|
3633
|
-
"
|
|
3637
|
+
"page": "Z66cgG_page",
|
|
3638
|
+
"back": "Z66cgG_back",
|
|
3639
|
+
"title": "Z66cgG_title",
|
|
3640
|
+
"body": "Z66cgG_body"
|
|
3634
3641
|
};
|
|
3635
3642
|
//#endregion
|
|
3636
3643
|
//#region src/client/CodeArtsPanel.tsx
|
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 { $ 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, 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-D-RmpxN3.mjs";
|
|
2
|
+
import { $ as withContextWindowOverride, A as pickDailyWelfareCampaign, B as FALLBACK_CODEARTS_MODELS, C as isTpmLimit, D as maxTokensCeilingFor, E as learnedContextWindowFor, F as setMaxTokenOverrides, G as forgetModelUnavailable, H as clearBenefitBlocked, I as signedGet, J as markModelUnavailable, K as isBenefitBlocked, L as upstreamErrorMessage, M as queueFrame, N as rateLimitFrame, O as modelUnavailableReasonText, P as setMaxTokenOverride, S as isQueueableRate, T as learnContextWindow, U as creditRatioLabel, W as filterEnabledModels, Z as modelUnavailableReason, _ as isModelNotAccessible, a as claimDailyWelfare, b as isQueueReject, c as degradeTokenCeiling, d as fetchQueueStatus, et as withMaxTokensOverride, f as fetchWelfareCampaigns, g as isIamTokenError, h as isContextOverflowText, i as chatStream, j as prepareChatBody, k as overrideValueFor, l as fetchCallerIdentity, m as isConcurrencyCap, n as SNAP_HOST, o as clearQueueStatus, p as firstFrameError, q as isBenefitModel, r as canonicalModel, s as contextWindowOverrideFor, t as MAX_TOKENS_FLOOR, u as fetchModels, v as isNotMultimodal, w as isWelfareClaimedStatus, x as isQueueRejectText, y as isParamInvalidFrame, z as CodeArtsCatalog } from "./upstream-DeRNnZdN.mjs";
|
|
3
|
+
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-BGniJF-q.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";
|
|
@@ -768,6 +768,22 @@ const CODEARTS_PROVIDER = "codearts";
|
|
|
768
768
|
const CODEARTS_STREAM_IDLE_TIMEOUT_MS = 9e4;
|
|
769
769
|
const DEFAULT_CODEARTS_INITIAL_DELAY_MS = 500;
|
|
770
770
|
const DEFAULT_CODEARTS_MAX_DELAY_MS = 1e4;
|
|
771
|
+
/**
|
|
772
|
+
* 重试码 = 宿主默认五项 + MALFORMED_RESPONSE。
|
|
773
|
+
*
|
|
774
|
+
* 模型偶尔把 tool_call 参数写成非法 JSON(未转义引号、流内 JSON 损坏),
|
|
775
|
+
* pi-ai 在**派发工具之前**就判整轮失败 —— 用户看到的是一轮报错、选项全无。
|
|
776
|
+
* 重发一次让模型重新生成,多数自愈。宿主的默认集合不含这个码,而
|
|
777
|
+
* `retryableCodes` 是替换语义(不是并入),所以五项默认值必须显式列全。
|
|
778
|
+
*/
|
|
779
|
+
const RETRYABLE_CODES = [
|
|
780
|
+
"EMPTY_RESPONSE",
|
|
781
|
+
"RATE_LIMIT",
|
|
782
|
+
"SERVER",
|
|
783
|
+
"TIMEOUT",
|
|
784
|
+
"TRANSPORT",
|
|
785
|
+
"MALFORMED_RESPONSE"
|
|
786
|
+
];
|
|
771
787
|
/** 只认有限正整数;非法值忽略而不是抛错(值来自用户写的配置文件)。 */
|
|
772
788
|
function positiveInt(value) {
|
|
773
789
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
|
|
@@ -777,6 +793,7 @@ function resolveCodeArtsRetryPolicy(config) {
|
|
|
777
793
|
const resolved = {
|
|
778
794
|
mode: "normal",
|
|
779
795
|
maxRetries: positiveInt(config?.maxRetries) ?? 8,
|
|
796
|
+
retryableCodes: [...RETRYABLE_CODES],
|
|
780
797
|
backoff: {
|
|
781
798
|
initialDelayMs: positiveInt(config?.initialDelayMs) ?? DEFAULT_CODEARTS_INITIAL_DELAY_MS,
|
|
782
799
|
maxDelayMs: positiveInt(config?.maxDelayMs) ?? DEFAULT_CODEARTS_MAX_DELAY_MS
|
|
@@ -793,8 +810,15 @@ const NO_COST = {
|
|
|
793
810
|
cacheRead: 0,
|
|
794
811
|
cacheWrite: 0
|
|
795
812
|
};
|
|
813
|
+
/**
|
|
814
|
+
* 6 MiB 而不是 20 MiB:上游网关对**整个请求体**约 10 MB 就拒(issue #18 实测
|
|
815
|
+
* 9.71 MB 过、10.41 MB 拒,且纯文本 1 MB 能过 ⇒ 是字节而非 token)。20 MiB 的
|
|
816
|
+
* 预算会让图片总量 10 MB 左右的请求直接发给上游,撞 InferHub.001001005.400,
|
|
817
|
+
* 再被误判成上下文超限。压到 6 MiB 后,宿主会把最老的图片换成占位文本
|
|
818
|
+
* (`read_image` 按需重读),给文本与工具定义留出约 4 MB 余量。
|
|
819
|
+
*/
|
|
796
820
|
const REQUEST_IMAGE_BUDGETS = {
|
|
797
|
-
maxRequestImageBytes:
|
|
821
|
+
maxRequestImageBytes: 6291456,
|
|
798
822
|
requestImagePixelBudget: 4194304,
|
|
799
823
|
requestImageMaxBytes: 1048576
|
|
800
824
|
};
|
|
@@ -1414,18 +1438,31 @@ function createCodeArtsShim(options) {
|
|
|
1414
1438
|
};
|
|
1415
1439
|
await result.stream.cancel().catch(() => {});
|
|
1416
1440
|
if (degradeTokenCeiling(prepared.model) === 0) {
|
|
1417
|
-
|
|
1441
|
+
const overflow = isContextOverflowText(headText ?? "");
|
|
1442
|
+
if (overflow && prepared.promptTokens > 0) {
|
|
1418
1443
|
const learned = learnContextWindow(prepared.model, prepared.promptTokens);
|
|
1419
|
-
logger?.warn(`dsh-codearts: ${prepared.model}
|
|
1444
|
+
logger?.warn(`dsh-codearts: ${prepared.model} 上游明确报超窗,按本次 prompt 估算 ${prepared.promptTokens} tokens 学习窗口上界 ${learned}`);
|
|
1445
|
+
}
|
|
1446
|
+
if (overflow) {
|
|
1447
|
+
const estimate = prepared.promptTokens > 0 ? `本次 prompt 估算约 ${prepared.promptTokens} tokens,` : "";
|
|
1448
|
+
return {
|
|
1449
|
+
prepared,
|
|
1450
|
+
result: {
|
|
1451
|
+
ok: false,
|
|
1452
|
+
kind: "client",
|
|
1453
|
+
status: 400,
|
|
1454
|
+
message: `${prepared.model}: 上下文放不下 —— ${estimate}max_tokens 已降到 ${MAX_TOKENS_FLOOR} 仍被上游判参数非法。请压缩上下文(/compact)或新建会话;如果目录里的窗口值不准,可在设置里覆盖该模型的 contextWindow。`
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1420
1457
|
}
|
|
1421
|
-
|
|
1458
|
+
logger?.warn(`dsh-codearts: ${prepared.model} 在 max_tokens 地板仍被判参数非法,但文案不是超窗 —— 按请求体过大处理,不学习窗口上界`);
|
|
1422
1459
|
return {
|
|
1423
1460
|
prepared,
|
|
1424
1461
|
result: {
|
|
1425
1462
|
ok: false,
|
|
1426
1463
|
kind: "client",
|
|
1427
1464
|
status: 400,
|
|
1428
|
-
message: `${prepared.model}:
|
|
1465
|
+
message: `${prepared.model}: 上游判定参数非法,但 max_tokens 已降到 ${MAX_TOKENS_FLOOR},报错里也没有超窗口文案 —— 多半是请求体过大(内联图片/附件过多,上游约 10 MB 就拒)。请减少图片或附件后重试;这不是上下文窗口问题,本次没有记录窗口上界。`
|
|
1429
1466
|
}
|
|
1430
1467
|
};
|
|
1431
1468
|
}
|
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-D-RmpxN3.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";
|
|
@@ -567,6 +567,7 @@ var upstream_exports = /* @__PURE__ */ __exportAll({
|
|
|
567
567
|
firstFrameError: () => firstFrameError,
|
|
568
568
|
isBenefitMissing: () => isBenefitMissing,
|
|
569
569
|
isConcurrencyCap: () => isConcurrencyCap,
|
|
570
|
+
isContextOverflowText: () => isContextOverflowText,
|
|
570
571
|
isIamTokenError: () => isIamTokenError,
|
|
571
572
|
isModelNotAccessible: () => isModelNotAccessible,
|
|
572
573
|
isNotMultimodal: () => isNotMultimodal,
|
|
@@ -697,6 +698,16 @@ function isParamInvalidFrame(text) {
|
|
|
697
698
|
return text.includes("InferHub.001001005.400") || text.includes("The request param is invalid");
|
|
698
699
|
}
|
|
699
700
|
/**
|
|
701
|
+
* 上游的**真超窗**文案(`input token limit is 1048576`)。
|
|
702
|
+
*
|
|
703
|
+
* `InferHub.001001005.400` 是通用「参数非法」,图片/附件把请求体撑到约 10 MB
|
|
704
|
+
* 也会回它(issue #18)。两者共用错误码,只有超窗这一种才能拿来学窗口上界;
|
|
705
|
+
* 把字节问题当 token 问题上限记下来会把会话永久锁死。
|
|
706
|
+
*/
|
|
707
|
+
function isContextOverflowText(text) {
|
|
708
|
+
return /input token limit is\s*\d+/i.test(text);
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
700
711
|
* 本次进程内学到的上限(小写 id → 上限)。
|
|
701
712
|
*
|
|
702
713
|
* 上游会把「实测过」的值悄悄调低(GLM-5.2 的 131072 于 2026-10-10 被收),
|
|
@@ -784,8 +795,15 @@ function degradeTokenCeiling(id) {
|
|
|
784
795
|
* 上游窗口只会收紧、不会放宽,所以取历史最小值,不被后面更大的估算抬高。
|
|
785
796
|
*/
|
|
786
797
|
const learnedContextWindow = /* @__PURE__ */ new Map();
|
|
787
|
-
/**
|
|
798
|
+
/**
|
|
799
|
+
* 该模型学到的真实窗口上界;没学过返回 undefined。
|
|
800
|
+
*
|
|
801
|
+
* `CODEARTS_IGNORE_LEARNED=1` 是逃生门:旧版把请求体字节超限误学成 token
|
|
802
|
+
* 上界,会话会在本地被永久拦住(issue #18)。置这个环境变量后读取侧忽略
|
|
803
|
+
* 已学值(不清表),重启进程仍有效,用于自救已锁死的会话。
|
|
804
|
+
*/
|
|
788
805
|
function learnedContextWindowFor(id) {
|
|
806
|
+
if (process.env.CODEARTS_IGNORE_LEARNED === "1") return void 0;
|
|
789
807
|
return learnedContextWindow.get(ceilingKey(id));
|
|
790
808
|
}
|
|
791
809
|
/**
|
|
@@ -2252,4 +2270,4 @@ async function claimDailyWelfare(credential, signal) {
|
|
|
2252
2270
|
};
|
|
2253
2271
|
}
|
|
2254
2272
|
//#endregion
|
|
2255
|
-
export {
|
|
2273
|
+
export { withContextWindowOverride as $, pickDailyWelfareCampaign as A, FALLBACK_CODEARTS_MODELS as B, isTpmLimit as C, maxTokensCeilingFor as D, learnedContextWindowFor as E, setMaxTokenOverrides as F, forgetModelUnavailable as G, clearBenefitBlocked as H, signedGet as I, markModelUnavailable as J, isBenefitBlocked as K, upstreamErrorMessage as L, queueFrame as M, rateLimitFrame as N, modelUnavailableReasonText as O, setMaxTokenOverride as P, setDiscoveredBenefitModels as Q, upstream_exports as R, isQueueableRate as S, learnContextWindow as T, creditRatioLabel as U, carryKnownWindows as V, filterEnabledModels as W, modelDisplayName as X, mergeModelLists as Y, modelUnavailableReason as Z, isModelNotAccessible as _, claimDailyWelfare as a, isQueueReject as b, degradeTokenCeiling as c, fetchQueueStatus as d, withMaxTokensOverride as et, fetchWelfareCampaigns as f, isIamTokenError as g, isContextOverflowText as h, chatStream as i, prepareChatBody as j, overrideValueFor as k, fetchCallerIdentity as l, isConcurrencyCap as m, SNAP_HOST as n, clearQueueStatus as o, firstFrameError as p, isBenefitModel as q, canonicalModel as r, contextWindowOverrideFor as s, MAX_TOKENS_FLOOR as t, fetchModels as u, isNotMultimodal as v, isWelfareClaimedStatus as w, isQueueRejectText as x, isParamInvalidFrame as y, CodeArtsCatalog as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as writeJsonAtomic } from "./auth-
|
|
2
|
-
import {
|
|
1
|
+
import { u as writeJsonAtomic } from "./auth-D-RmpxN3.mjs";
|
|
2
|
+
import { Q as setDiscoveredBenefitModels, V as carryKnownWindows, X as modelDisplayName, Y as mergeModelLists, q as isBenefitModel, u as fetchModels } from "./upstream-DeRNnZdN.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.12";
|
|
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.12",
|
|
6
6
|
"packageManager": "pnpm@11.24.0",
|
|
7
7
|
"author": "elegant01",
|
|
8
8
|
"keywords": [
|