dsh-codearts 1.4.1 → 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 CHANGED
@@ -3,6 +3,47 @@
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
+
22
+ ## [1.4.2] - 2026-11-16
23
+
24
+ ### 修复
25
+
26
+ - **更新安装不再被守护进程挡住**:守护进程以前借 DSH 本体的进程名运行
27
+ (`ELECTRON_RUN_AS_NODE`),而安装器在 `%TEMP%\ns*.tmp` 阶段按进程名查找
28
+ `DeepSeek Harness.exe`,看到它就静默中止 —— 表现是安装失败、应用不被拉回。
29
+ 现在优先用 DSH 自带的 `node.exe` 启动,进程名不再冲突;万一只能借本体启动,
30
+ 守护进程会盯着 `%TEMP%`,发现安装器就主动退出并写交接标记,更新装完应用重启后
31
+ 自动重新拉起,保活开关保持原样(不会被误当成「你手动关了」)。
32
+ - **守护进程启动时误判「已有实例」**:状态文件里的旧 pid 被 Windows 复用给别的
33
+ 进程时,以前只查 pid 还活着就直接退出,保活开关刚打开又被自动关掉。现在要求
34
+ 心跳新鲜、且确实是守护进程才认。
35
+ - **上下文窗口把兜底值当成上游规格展示**(#9):backfill 之后
36
+ `contextWindowKnown` 恒为真,合成的 32768 也被当成上游真实窗口显示。现在
37
+ 「展示是否可信」与「守卫用哪个数」分开:只有上游确实给了窗口(或用户显式覆盖)
38
+ 才标记为已知,兜底值只参与守卫计算,不再对外展示。
39
+
40
+ ### 调整
41
+
42
+ - 账号页「粘贴 Token 添加 / 添加账号」两个按钮改用 36px 中号(`md`),避免拉满
43
+ 整行时显得过扁;行内的「置顶 / 重新登录 / 删除」等仍保持 28px 小号。
44
+ - 保活关闭时的提示不再断言「开关已关闭」:现在也可能是进程被结束、为更新让路或
45
+ 启动失败,文案改为列出这几种可能。
46
+
6
47
  ## [1.4.1] - 2026-11-14
7
48
 
8
49
  ### 新增
@@ -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-D1wYeXC7.mjs").then((n) => n.j);
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-C00dJphV.mjs";
3
- import { l as fetchCallerIdentity, z as isBenefitModel } from "./upstream-D1wYeXC7.mjs";
4
- import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DC5JRWls.mjs";
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
  /**
@@ -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;
@@ -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
- "windowButton": "xoziZG_windowButton",
159
- "actions": "xoziZG_actions",
160
- "danger": "xoziZG_danger",
161
- "statCard": "xoziZG_statCard",
162
- "accountRowActions": "xoziZG_accountRowActions",
159
+ "skeletonBreath": "xoziZG_skeletonBreath",
160
+ "windowPopoverRow": "xoziZG_windowPopoverRow",
161
+ "creditRow": "xoziZG_creditRow",
162
+ "usageFill": "xoziZG_usageFill",
163
+ "claimAllRow": "xoziZG_claimAllRow",
164
+ "check": "xoziZG_check",
163
165
  "usageTipSep": "xoziZG_usageTipSep",
164
- "modelTrack": "xoziZG_modelTrack",
165
- "heatGrid": "xoziZG_heatGrid",
166
+ "accountRow": "xoziZG_accountRow",
167
+ "modelFill": "xoziZG_modelFill",
168
+ "accountToggle": "xoziZG_accountToggle",
169
+ "accountHint": "xoziZG_accountHint",
170
+ "accountName": "xoziZG_accountName",
171
+ "hint": "xoziZG_hint",
172
+ "link": "xoziZG_link",
173
+ "balanceMeta": "xoziZG_balanceMeta",
174
+ "heatWeekday": "xoziZG_heatWeekday",
166
175
  "heatHours": "xoziZG_heatHours",
167
- "heatLegendChip": "xoziZG_heatLegendChip",
176
+ "heatHourCell": "xoziZG_heatHourCell",
177
+ "accountToggleLabel": "xoziZG_accountToggleLabel",
178
+ "statGrid": "xoziZG_statGrid",
179
+ "trendTip": "xoziZG_trendTip",
180
+ "windowPopoverHead": "xoziZG_windowPopoverHead",
168
181
  "accountEntry": "xoziZG_accountEntry",
169
- "body": "xoziZG_body",
170
- "tabPanel": "xoziZG_tabPanel",
171
- "header": "xoziZG_header",
172
- "accountNameRow": "xoziZG_accountNameRow",
173
- "creditBlock": "xoziZG_creditBlock",
174
- "balance": "xoziZG_balance",
175
- "expiryLabel": "xoziZG_expiryLabel",
182
+ "heatAxis": "xoziZG_heatAxis",
183
+ "accountToolbar": "xoziZG_accountToolbar",
176
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",
201
+ "modelName": "xoziZG_modelName",
202
+ "accountCard": "xoziZG_accountCard",
177
203
  "section": "xoziZG_section",
178
- "accountName": "xoziZG_accountName",
179
- "sectionHead": "xoziZG_sectionHead",
180
- "link": "xoziZG_link",
181
- "claimAllRow": "xoziZG_claimAllRow",
182
- "statValue": "xoziZG_statValue",
183
- "desc": "xoziZG_desc",
184
- "choices": "xoziZG_choices",
185
204
  "name": "xoziZG_name",
186
- "modelName": "xoziZG_modelName",
205
+ "fieldLabel": "xoziZG_fieldLabel",
187
206
  "modelTokens": "xoziZG_modelTokens",
188
- "creditRows": "xoziZG_creditRows",
189
- "heatLegend": "xoziZG_heatLegend",
190
- "manual": "xoziZG_manual",
191
- "skeletonBreath": "xoziZG_skeletonBreath",
192
- "modelSpec": "xoziZG_modelSpec",
207
+ "modelShare": "xoziZG_modelShare",
208
+ "choices": "xoziZG_choices",
209
+ "skeletonRow": "xoziZG_skeletonRow",
210
+ "accountNameRow": "xoziZG_accountNameRow",
211
+ "tabPanel": "xoziZG_tabPanel",
193
212
  "windowPopoverValue": "xoziZG_windowPopoverValue",
194
- "sectionLabel": "xoziZG_sectionLabel",
195
- "windowPopoverRow": "xoziZG_windowPopoverRow",
196
- "windowInput": "xoziZG_windowInput",
197
- "heatHourCell": "xoziZG_heatHourCell",
213
+ "modelTrack": "xoziZG_modelTrack",
214
+ "windowUnit": "xoziZG_windowUnit",
215
+ "doctorRow": "xoziZG_doctorRow",
216
+ "body": "xoziZG_body",
217
+ "actions": "xoziZG_actions",
218
+ "heatLegendChip": "xoziZG_heatLegendChip",
219
+ "windowPopover": "xoziZG_windowPopover",
198
220
  "windowHint": "xoziZG_windowHint",
199
- "windowCaret": "xoziZG_windowCaret",
221
+ "modelChart": "xoziZG_modelChart",
222
+ "field": "xoziZG_field",
223
+ "headText": "xoziZG_headText",
200
224
  "statusLine": "xoziZG_statusLine",
201
- "bar": "xoziZG_bar",
202
- "usageTip": "xoziZG_usageTip",
203
- "updated": "xoziZG_updated",
204
- "heatCell": "xoziZG_heatCell",
205
- "heatAxisSlot": "xoziZG_heatAxisSlot",
206
- "trendTip": "xoziZG_trendTip",
207
- "windowButtonOpen": "xoziZG_windowButtonOpen",
208
- "doctorName": "xoziZG_doctorName",
209
- "windowPopoverHead": "xoziZG_windowPopoverHead",
210
- "statGrid": "xoziZG_statGrid",
211
- "area": "xoziZG_area",
212
- "fieldLabel": "xoziZG_fieldLabel",
213
- "expiryRow": "xoziZG_expiryRow",
214
- "skeletonRow": "xoziZG_skeletonRow",
215
- "doctorList": "xoziZG_doctorList",
216
- "count": "xoziZG_count",
217
- "accountInfo": "xoziZG_accountInfo",
218
- "accountCard": "xoziZG_accountCard",
225
+ "creditFooter": "xoziZG_creditFooter",
226
+ "header": "xoziZG_header",
219
227
  "meta": "xoziZG_meta",
220
- "check": "xoziZG_check",
221
- "accountRow": "xoziZG_accountRow",
228
+ "expiryRow": "xoziZG_expiryRow",
229
+ "creditHint": "xoziZG_creditHint",
230
+ "bar": "xoziZG_bar",
222
231
  "balanceRow": "xoziZG_balanceRow",
223
- "creditRow": "xoziZG_creditRow",
224
- "skeleton": "xoziZG_skeleton",
225
- "tabs": "xoziZG_tabs",
226
- "accountToggle": "xoziZG_accountToggle",
227
- "field": "xoziZG_field",
232
+ "barFill": "xoziZG_barFill",
228
233
  "statSub": "xoziZG_statSub",
229
- "windowButtonSet": "xoziZG_windowButtonSet",
230
- "usageFill": "xoziZG_usageFill",
231
- "hint": "xoziZG_hint",
232
- "modelFill": "xoziZG_modelFill",
233
- "modelChart": "xoziZG_modelChart",
234
- "creditHint": "xoziZG_creditHint",
235
- "windowRange": "xoziZG_windowRange",
236
- "accountToolbar": "xoziZG_accountToolbar",
234
+ "windowButtonOpen": "xoziZG_windowButtonOpen",
235
+ "doctorName": "xoziZG_doctorName",
236
+ "sectionLabel": "xoziZG_sectionLabel",
237
+ "desc": "xoziZG_desc",
238
+ "heatAxisSlot": "xoziZG_heatAxisSlot",
237
239
  "manualSummary": "xoziZG_manualSummary",
238
- "heatWeekday": "xoziZG_heatWeekday",
239
- "heatAxis": "xoziZG_heatAxis",
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",
240
247
  "statLabel": "xoziZG_statLabel",
241
- "windowPopover": "xoziZG_windowPopover",
248
+ "windowButton": "xoziZG_windowButton",
249
+ "sectionHead": "xoziZG_sectionHead",
242
250
  "usageBar": "xoziZG_usageBar",
243
- "accountHint": "xoziZG_accountHint",
244
- "choiceRow": "xoziZG_choiceRow",
245
- "modelRow": "xoziZG_modelRow",
246
- "manualForm": "xoziZG_manualForm",
247
- "doctorRow": "xoziZG_doctorRow",
251
+ "area": "xoziZG_area",
252
+ "manual": "xoziZG_manual",
253
+ "statValue": "xoziZG_statValue",
248
254
  "windowInputSet": "xoziZG_windowInputSet",
249
- "card": "xoziZG_card",
250
- "error": "xoziZG_error",
251
- "usageTipName": "xoziZG_usageTipName",
252
- "headText": "xoziZG_headText",
253
- "accountToggleLabel": "xoziZG_accountToggleLabel",
254
- "usageTipRow": "xoziZG_usageTipRow",
255
- "modelShare": "xoziZG_modelShare",
256
- "barFill": "xoziZG_barFill",
257
- "balanceMeta": "xoziZG_balanceMeta",
258
- "modelRequests": "xoziZG_modelRequests",
255
+ "doctorList": "xoziZG_doctorList",
256
+ "heatCell": "xoziZG_heatCell",
257
+ "modelRow": "xoziZG_modelRow",
258
+ "usageTip": "xoziZG_usageTip",
259
259
  "balanceUnit": "xoziZG_balanceUnit",
260
- "creditFooter": "xoziZG_creditFooter",
261
- "windowUnit": "xoziZG_windowUnit",
262
- "avatar": "xoziZG_avatar",
263
- "windowAnchor": "xoziZG_windowAnchor"
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
@@ -1877,14 +1878,14 @@ function CodeArtsPluginCard({ t }) {
1877
1878
  className: CodeArtsPluginCard_module_css_default.accountToolbar,
1878
1879
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1879
1880
  variant: "outline",
1880
- size: "sm",
1881
+ size: "md",
1881
1882
  "aria-expanded": manualOpen,
1882
1883
  disabled: busy,
1883
1884
  onClick: () => setManualOpen((open) => !open),
1884
1885
  children: t("pasteTokenAdd")
1885
1886
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1886
1887
  variant: "primary",
1887
- size: "sm",
1888
+ size: "md",
1888
1889
  disabled: busy || loginPending,
1889
1890
  onClick: () => void startOAuthLogin(),
1890
1891
  children: loginPending ? t("signingIn") : t("addAccount")
@@ -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
- "desc": "Z66cgG_desc",
3220
+ "body": "Z66cgG_body",
3221
+ "backCaret": "Z66cgG_backCaret",
3191
3222
  "icon": "Z66cgG_icon",
3192
- "back": "Z66cgG_back",
3193
3223
  "head": "Z66cgG_head",
3194
- "title": "Z66cgG_title",
3195
3224
  "page": "Z66cgG_page",
3196
- "backCaret": "Z66cgG_backCaret",
3197
- "body": "Z66cgG_body"
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,12 +3552,15 @@ 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: "开启常驻保活进程(默认关闭)",
3528
3561
  displayKeeperRunning: "后台进程运行中 · PID {pid} · 最近心跳 {time}",
3529
3562
  displayKeeperStarting: "后台进程正在启动……稍等几秒刷新这一页。",
3530
- displayKeeperDown: "后台进程没有在跑(可能被你结束或启动失败),保活开关已关闭。{message}",
3563
+ displayKeeperDown: "后台进程没有在跑(可能被你结束、为更新让路或启动失败)。{message}",
3531
3564
  displayKeeperStop: "结束进程",
3532
3565
  displayKeeperStopping: "正在结束……",
3533
3566
  displayKeeperStopped: "后台进程已结束,保活开关已同时关闭。",
@@ -3734,12 +3767,15 @@ 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)",
3740
3776
  displayKeeperRunning: "Background process running · PID {pid} · last heartbeat {time}",
3741
3777
  displayKeeperStarting: "The background process is starting… refresh this page in a few seconds.",
3742
- displayKeeperDown: "The background process is not running (stopped by you, or it failed to start); the keep-alive switch has been turned off. {message}",
3778
+ displayKeeperDown: "The background process is not running (stopped by you, stepped aside for an update, or it failed to start). {message}",
3743
3779
  displayKeeperStop: "Stop process",
3744
3780
  displayKeeperStopping: "Stopping…",
3745
3781
  displayKeeperStopped: "Background process stopped and the keep-alive switch turned off.",
package/lib/index.d.mts CHANGED
@@ -788,9 +788,14 @@ interface CodeArtsModelInfo {
788
788
  name: string;
789
789
  contextWindow: number;
790
790
  /**
791
- * `contextWindow` 是上游真的给的,还是兜底值(32768)。
791
+ * 这个 `contextWindow` 能不能当「上游真实规格」展示。
792
792
  *
793
- * 卡片只在上游给值时印「1M 上下文」这类规格;兜底值印出来就是假数据。
793
+ * 由各发现源在解析时置位(上游真给了字段、且 > 0),再一路带过合并与 `backfillParams`;
794
+ * 用户按模型覆盖、或进程内实测学到上界时,`fetchModels` 也会把它置位(那些值是我们
795
+ * 确认过的,可以展示)。
796
+ *
797
+ * 参数表补出来的值**永远不带**这个标记:`contextWindow` 同时是守卫输入,补一个保守值
798
+ * 让它保守拦截是对的;但把兜底值印成上游规格就是假数据(issue #9 的遗留项)。
794
799
  */
795
800
  contextWindowKnown?: boolean;
796
801
  /**
@@ -1362,19 +1367,19 @@ type CodeArtsQueueOutcome =
1362
1367
  {
1363
1368
  kind: 'working';
1364
1369
  } |
1365
- /** 等了 `maxWaitMs` 还在队里:把位置报给用户,让他稍后再发。 */
1370
+ /** 短探没轮到:只是提示,shim 照常发请求。 */
1366
1371
  {
1367
1372
  kind: 'queued';
1368
1373
  position: number;
1369
1374
  length: number;
1370
1375
  message: string;
1371
1376
  } |
1372
- /** 队列本身已满,上游让用户换模型/升级套餐。 */
1377
+ /** 队列本身已满;同样只是提示,不拦请求。 */
1373
1378
  {
1374
1379
  kind: 'queue_full';
1375
1380
  message: string;
1376
1381
  } |
1377
- /** 排队接口连续失败,放弃排队并报出原因。 */
1382
+ /** 排队接口连续失败:拿不到位置就安静地照发,不影响请求。 */
1378
1383
  {
1379
1384
  kind: 'error';
1380
1385
  message: string;
@@ -1386,7 +1391,7 @@ type CodeArtsQueueOutcome =
1386
1391
  interface CodeArtsQueueGateOptions {
1387
1392
  /** 两次查询之间的间隔(官方客户端是 5 秒)。 */
1388
1393
  intervalMs?: number;
1389
- /** 最多替用户等多久。超过就回 `queued`,别把请求挂着。 */
1394
+ /** 短探多久(只影响底部提示的可见时长,不拦请求)。 */
1390
1395
  maxWaitMs?: number;
1391
1396
  /** 连续失败几次就放弃。 */
1392
1397
  maxErrors?: number;
@@ -1407,10 +1412,12 @@ declare class CodeArtsQueueGate {
1407
1412
  private readonly now;
1408
1413
  constructor(options?: CodeArtsQueueGateOptions);
1409
1414
  /**
1410
- * 占号并**最多等 `maxWaitMs`** 轮到。调用方拿到 `working` 后才发 chat 请求;
1411
- * 其余结果(含 `queued`)都不要再发 —— `queued` 是要把位置原样告诉用户。
1415
+ * 占号并**最多探 `maxWaitMs`**。调用方只拿结果做提示:`working` 表示正好轮到,
1416
+ * 其余结果照发 chat 请求(这张票不拦请求,见模块注释)。
1412
1417
  */
1413
- wait(credential: CodeArtsResolved, chatId: string, model: string, signal?: AbortSignal): Promise<CodeArtsQueueOutcome>;
1418
+ wait(credential: CodeArtsResolved, chatId: string, model: string, signal?: AbortSignal,
1419
+ /** 覆盖这次探测的时长(「一直等到轮到」开关会传几分钟)。 */
1420
+ budgetMs?: number): Promise<CodeArtsQueueOutcome>;
1414
1421
  /** 正在排队的条目(给底部条)。 */
1415
1422
  snapshot(): readonly CodeArtsQueueEntry[];
1416
1423
  dispose(): void;
@@ -1622,8 +1629,8 @@ interface CodeArtsShimOptions {
1622
1629
  /** 用量账本。给了就在转发流的同时把 usage 帧记下来(卡片上的「今日用量」)。 */
1623
1630
  usage?: CodeArtsUsageTracker;
1624
1631
  /**
1625
- * 上游排队闸门。给了就在发请求前占号、轮询到轮到再开流
1626
- * (底部积分条旁边展示「排队第 N 位」)。
1632
+ * 上游排队闸门。给了就在发请求前短探一次排队位置(底部展示「排队第 N 位」),
1633
+ * **没轮到也照发** —— 实测 chat 请求不校验这张票(issue #10)。
1627
1634
  */
1628
1635
  queue?: CodeArtsQueueGate;
1629
1636
  logger?: ShimLogger;
@@ -1637,6 +1644,15 @@ interface CodeArtsShimOptions {
1637
1644
  debug?: (message: string) => void;
1638
1645
  /** 本地槽位满时最多等多久(缺省 30 秒)。测试用它把等待压到毫秒级。 */
1639
1646
  localSlotWaitMs?: number;
1647
+ /** 上游回排队拒绝后的首次退避(缺省 5 秒,之后翻倍)。测试用它把等待压到毫秒级。 */
1648
+ queueRetryGapMs?: number;
1649
+ /**
1650
+ * 「排队时一直等到轮到」(每次请求实时读,缺省关)。
1651
+ *
1652
+ * 打开后,上游明确回排队拒绝时不再换号/短退避,而是提前开流 + 每 20 秒一个空帧
1653
+ * 保住宿主连接,轮询这张票直到 working(最长 15 分钟),再用同一个号发请求。
1654
+ */
1655
+ waitInQueue?: () => boolean;
1640
1656
  /**
1641
1657
  * 按模型 id 覆盖 contextWindow(用户配置,每次请求实时读取)。
1642
1658
  *
@@ -1887,6 +1903,15 @@ interface Config {
1887
1903
  * 打开后卡片上会显示它的 pid,并给一个「结束」按钮。
1888
1904
  */
1889
1905
  keepAliveDaemon?: boolean;
1906
+ /**
1907
+ * 「排队时一直等到轮到」(issue #10)。缺省 = **关**。
1908
+ *
1909
+ * 打开后,上游明确回排队拒绝时插件不再直接报错,而是提前打开 SSE、每 20 秒发
1910
+ * 一个空帧保住连接(宿主的 90 秒空闲超时只认可解析事件),轮询排队位置直到
1911
+ * 轮到,最长等 15 分钟。代价:等待期间界面上已经开始「回复」,属于用户知情后
1912
+ * 主动选择的行为,所以不默认开。
1913
+ */
1914
+ queueWaitUntilReady?: boolean;
1890
1915
  }
1891
1916
  declare const Config: z<Config>;
1892
1917
  declare function apply(ctx: Context, rawConfig: Config): void;