dsh-codearts 1.4.1 → 1.4.2
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 +25 -0
- package/lib/{auth-C00dJphV.mjs → auth-CsAz93vO.mjs} +1 -1
- package/lib/bin.mjs +3 -3
- package/lib/client/index.js +100 -100
- package/lib/index.d.mts +7 -2
- package/lib/index.mjs +17 -8
- package/lib/{keeper-MHeAp_eV.mjs → keeper-DJLwIiR4.mjs} +82 -7
- package/lib/keeper-main.mjs +62 -12
- package/lib/{upstream-D1wYeXC7.mjs → upstream-BsoeSKrY.mjs} +16 -7
- package/lib/{version-DC5JRWls.mjs → version-DLMVdsWB.mjs} +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
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.2] - 2026-11-16
|
|
7
|
+
|
|
8
|
+
### 修复
|
|
9
|
+
|
|
10
|
+
- **更新安装不再被守护进程挡住**:守护进程以前借 DSH 本体的进程名运行
|
|
11
|
+
(`ELECTRON_RUN_AS_NODE`),而安装器在 `%TEMP%\ns*.tmp` 阶段按进程名查找
|
|
12
|
+
`DeepSeek Harness.exe`,看到它就静默中止 —— 表现是安装失败、应用不被拉回。
|
|
13
|
+
现在优先用 DSH 自带的 `node.exe` 启动,进程名不再冲突;万一只能借本体启动,
|
|
14
|
+
守护进程会盯着 `%TEMP%`,发现安装器就主动退出并写交接标记,更新装完应用重启后
|
|
15
|
+
自动重新拉起,保活开关保持原样(不会被误当成「你手动关了」)。
|
|
16
|
+
- **守护进程启动时误判「已有实例」**:状态文件里的旧 pid 被 Windows 复用给别的
|
|
17
|
+
进程时,以前只查 pid 还活着就直接退出,保活开关刚打开又被自动关掉。现在要求
|
|
18
|
+
心跳新鲜、且确实是守护进程才认。
|
|
19
|
+
- **上下文窗口把兜底值当成上游规格展示**(#9):backfill 之后
|
|
20
|
+
`contextWindowKnown` 恒为真,合成的 32768 也被当成上游真实窗口显示。现在
|
|
21
|
+
「展示是否可信」与「守卫用哪个数」分开:只有上游确实给了窗口(或用户显式覆盖)
|
|
22
|
+
才标记为已知,兜底值只参与守卫计算,不再对外展示。
|
|
23
|
+
|
|
24
|
+
### 调整
|
|
25
|
+
|
|
26
|
+
- 账号页「粘贴 Token 添加 / 添加账号」两个按钮改用 36px 中号(`md`),避免拉满
|
|
27
|
+
整行时显得过扁;行内的「置顶 / 重新登录 / 删除」等仍保持 28px 小号。
|
|
28
|
+
- 保活关闭时的提示不再断言「开关已关闭」:现在也可能是进程被结束、为更新让路或
|
|
29
|
+
启动失败,文案改为列出这几种可能。
|
|
30
|
+
|
|
6
31
|
## [1.4.1] - 2026-11-14
|
|
7
32
|
|
|
8
33
|
### 新增
|
|
@@ -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-BsoeSKrY.mjs").then((n) => n.j);
|
|
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 { l as fetchCallerIdentity, z as isBenefitModel } from "./upstream-
|
|
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-CsAz93vO.mjs";
|
|
3
|
+
import { l as fetchCallerIdentity, z as isBenefitModel } from "./upstream-BsoeSKrY.mjs";
|
|
4
|
+
import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DLMVdsWB.mjs";
|
|
5
5
|
import { existsSync, statSync } from "node:fs";
|
|
6
6
|
//#region src/bin.ts
|
|
7
7
|
/**
|
package/lib/client/index.js
CHANGED
|
@@ -155,112 +155,112 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
155
155
|
document.head.appendChild(tag);
|
|
156
156
|
}
|
|
157
157
|
var CodeArtsPluginCard_module_css_default = {
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"statCard": "xoziZG_statCard",
|
|
162
|
-
"accountRowActions": "xoziZG_accountRowActions",
|
|
163
|
-
"usageTipSep": "xoziZG_usageTipSep",
|
|
164
|
-
"modelTrack": "xoziZG_modelTrack",
|
|
165
|
-
"heatGrid": "xoziZG_heatGrid",
|
|
166
|
-
"heatHours": "xoziZG_heatHours",
|
|
167
|
-
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
168
|
-
"accountEntry": "xoziZG_accountEntry",
|
|
169
|
-
"body": "xoziZG_body",
|
|
170
|
-
"tabPanel": "xoziZG_tabPanel",
|
|
158
|
+
"usageTipName": "xoziZG_usageTipName",
|
|
159
|
+
"accountInfo": "xoziZG_accountInfo",
|
|
160
|
+
"modelSpec": "xoziZG_modelSpec",
|
|
171
161
|
"header": "xoziZG_header",
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
162
|
+
"sectionLabel": "xoziZG_sectionLabel",
|
|
163
|
+
"heatWeekday": "xoziZG_heatWeekday",
|
|
164
|
+
"balanceMeta": "xoziZG_balanceMeta",
|
|
165
|
+
"accountRow": "xoziZG_accountRow",
|
|
166
|
+
"statGrid": "xoziZG_statGrid",
|
|
167
|
+
"danger": "xoziZG_danger",
|
|
168
|
+
"accountHint": "xoziZG_accountHint",
|
|
169
|
+
"creditFooter": "xoziZG_creditFooter",
|
|
176
170
|
"creditLink": "xoziZG_creditLink",
|
|
177
|
-
"section": "xoziZG_section",
|
|
178
|
-
"accountName": "xoziZG_accountName",
|
|
179
171
|
"sectionHead": "xoziZG_sectionHead",
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
172
|
+
"bar": "xoziZG_bar",
|
|
173
|
+
"accountName": "xoziZG_accountName",
|
|
174
|
+
"usageTipSep": "xoziZG_usageTipSep",
|
|
175
|
+
"check": "xoziZG_check",
|
|
176
|
+
"balance": "xoziZG_balance",
|
|
177
|
+
"usageBar": "xoziZG_usageBar",
|
|
178
|
+
"choiceRow": "xoziZG_choiceRow",
|
|
179
|
+
"statCard": "xoziZG_statCard",
|
|
180
|
+
"heatAxis": "xoziZG_heatAxis",
|
|
181
|
+
"statSub": "xoziZG_statSub",
|
|
182
|
+
"accountToggle": "xoziZG_accountToggle",
|
|
183
|
+
"accountToggleLabel": "xoziZG_accountToggleLabel",
|
|
184
|
+
"modelFill": "xoziZG_modelFill",
|
|
185
|
+
"windowButton": "xoziZG_windowButton",
|
|
186
|
+
"heatLegend": "xoziZG_heatLegend",
|
|
187
|
+
"windowAnchor": "xoziZG_windowAnchor",
|
|
183
188
|
"desc": "xoziZG_desc",
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"modelName": "xoziZG_modelName",
|
|
187
|
-
"modelTokens": "xoziZG_modelTokens",
|
|
189
|
+
"balanceRow": "xoziZG_balanceRow",
|
|
190
|
+
"updated": "xoziZG_updated",
|
|
188
191
|
"creditRows": "xoziZG_creditRows",
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
194
|
-
"sectionLabel": "xoziZG_sectionLabel",
|
|
195
|
-
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
196
|
-
"windowInput": "xoziZG_windowInput",
|
|
197
|
-
"heatHourCell": "xoziZG_heatHourCell",
|
|
198
|
-
"windowHint": "xoziZG_windowHint",
|
|
199
|
-
"windowCaret": "xoziZG_windowCaret",
|
|
192
|
+
"modelRequests": "xoziZG_modelRequests",
|
|
193
|
+
"heatLegendChip": "xoziZG_heatLegendChip",
|
|
194
|
+
"skeleton": "xoziZG_skeleton",
|
|
195
|
+
"usageFill": "xoziZG_usageFill",
|
|
200
196
|
"statusLine": "xoziZG_statusLine",
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
197
|
+
"windowPopover": "xoziZG_windowPopover",
|
|
198
|
+
"creditRow": "xoziZG_creditRow",
|
|
199
|
+
"accountEntry": "xoziZG_accountEntry",
|
|
200
|
+
"modelName": "xoziZG_modelName",
|
|
201
|
+
"meta": "xoziZG_meta",
|
|
202
|
+
"expiryRow": "xoziZG_expiryRow",
|
|
203
|
+
"choices": "xoziZG_choices",
|
|
204
|
+
"balanceUnit": "xoziZG_balanceUnit",
|
|
205
205
|
"heatAxisSlot": "xoziZG_heatAxisSlot",
|
|
206
|
+
"heatCell": "xoziZG_heatCell",
|
|
207
|
+
"manualSummary": "xoziZG_manualSummary",
|
|
208
|
+
"accountCard": "xoziZG_accountCard",
|
|
209
|
+
"hint": "xoziZG_hint",
|
|
210
|
+
"heatHourCell": "xoziZG_heatHourCell",
|
|
211
|
+
"barFill": "xoziZG_barFill",
|
|
212
|
+
"modelChart": "xoziZG_modelChart",
|
|
213
|
+
"usageTip": "xoziZG_usageTip",
|
|
214
|
+
"modelTokens": "xoziZG_modelTokens",
|
|
206
215
|
"trendTip": "xoziZG_trendTip",
|
|
216
|
+
"skeletonRow": "xoziZG_skeletonRow",
|
|
217
|
+
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
218
|
+
"windowCaret": "xoziZG_windowCaret",
|
|
219
|
+
"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",
|
|
207
227
|
"windowButtonOpen": "xoziZG_windowButtonOpen",
|
|
208
|
-
"
|
|
228
|
+
"avatar": "xoziZG_avatar",
|
|
229
|
+
"error": "xoziZG_error",
|
|
209
230
|
"windowPopoverHead": "xoziZG_windowPopoverHead",
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
"
|
|
231
|
+
"windowPopoverRow": "xoziZG_windowPopoverRow",
|
|
232
|
+
"windowUnit": "xoziZG_windowUnit",
|
|
233
|
+
"creditBlock": "xoziZG_creditBlock",
|
|
234
|
+
"accountNameRow": "xoziZG_accountNameRow",
|
|
235
|
+
"windowHint": "xoziZG_windowHint",
|
|
215
236
|
"doctorList": "xoziZG_doctorList",
|
|
216
|
-
"
|
|
217
|
-
"accountInfo": "xoziZG_accountInfo",
|
|
218
|
-
"accountCard": "xoziZG_accountCard",
|
|
219
|
-
"meta": "xoziZG_meta",
|
|
220
|
-
"check": "xoziZG_check",
|
|
221
|
-
"accountRow": "xoziZG_accountRow",
|
|
222
|
-
"balanceRow": "xoziZG_balanceRow",
|
|
223
|
-
"creditRow": "xoziZG_creditRow",
|
|
224
|
-
"skeleton": "xoziZG_skeleton",
|
|
225
|
-
"tabs": "xoziZG_tabs",
|
|
226
|
-
"accountToggle": "xoziZG_accountToggle",
|
|
227
|
-
"field": "xoziZG_field",
|
|
228
|
-
"statSub": "xoziZG_statSub",
|
|
229
|
-
"windowButtonSet": "xoziZG_windowButtonSet",
|
|
230
|
-
"usageFill": "xoziZG_usageFill",
|
|
231
|
-
"hint": "xoziZG_hint",
|
|
232
|
-
"modelFill": "xoziZG_modelFill",
|
|
233
|
-
"modelChart": "xoziZG_modelChart",
|
|
237
|
+
"name": "xoziZG_name",
|
|
234
238
|
"creditHint": "xoziZG_creditHint",
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
"
|
|
239
|
-
"
|
|
239
|
+
"fieldLabel": "xoziZG_fieldLabel",
|
|
240
|
+
"windowPopoverValue": "xoziZG_windowPopoverValue",
|
|
241
|
+
"tabs": "xoziZG_tabs",
|
|
242
|
+
"claimAllRow": "xoziZG_claimAllRow",
|
|
243
|
+
"count": "xoziZG_count",
|
|
240
244
|
"statLabel": "xoziZG_statLabel",
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"accountHint": "xoziZG_accountHint",
|
|
244
|
-
"choiceRow": "xoziZG_choiceRow",
|
|
245
|
-
"modelRow": "xoziZG_modelRow",
|
|
246
|
-
"manualForm": "xoziZG_manualForm",
|
|
247
|
-
"doctorRow": "xoziZG_doctorRow",
|
|
245
|
+
"windowRange": "xoziZG_windowRange",
|
|
246
|
+
"windowInput": "xoziZG_windowInput",
|
|
248
247
|
"windowInputSet": "xoziZG_windowInputSet",
|
|
248
|
+
"tabPanel": "xoziZG_tabPanel",
|
|
249
|
+
"doctorName": "xoziZG_doctorName",
|
|
250
|
+
"modelShare": "xoziZG_modelShare",
|
|
251
|
+
"accountRowActions": "xoziZG_accountRowActions",
|
|
252
|
+
"skeletonBreath": "xoziZG_skeletonBreath",
|
|
253
|
+
"expiryLabel": "xoziZG_expiryLabel",
|
|
254
|
+
"manual": "xoziZG_manual",
|
|
255
|
+
"actions": "xoziZG_actions",
|
|
249
256
|
"card": "xoziZG_card",
|
|
250
|
-
"
|
|
251
|
-
"
|
|
252
|
-
"
|
|
253
|
-
"
|
|
257
|
+
"field": "xoziZG_field",
|
|
258
|
+
"modelRow": "xoziZG_modelRow",
|
|
259
|
+
"doctorRow": "xoziZG_doctorRow",
|
|
260
|
+
"area": "xoziZG_area",
|
|
261
|
+
"link": "xoziZG_link",
|
|
254
262
|
"usageTipRow": "xoziZG_usageTipRow",
|
|
255
|
-
"
|
|
256
|
-
"barFill": "xoziZG_barFill",
|
|
257
|
-
"balanceMeta": "xoziZG_balanceMeta",
|
|
258
|
-
"modelRequests": "xoziZG_modelRequests",
|
|
259
|
-
"balanceUnit": "xoziZG_balanceUnit",
|
|
260
|
-
"creditFooter": "xoziZG_creditFooter",
|
|
261
|
-
"windowUnit": "xoziZG_windowUnit",
|
|
262
|
-
"avatar": "xoziZG_avatar",
|
|
263
|
-
"windowAnchor": "xoziZG_windowAnchor"
|
|
263
|
+
"heatHours": "xoziZG_heatHours"
|
|
264
264
|
};
|
|
265
265
|
//#endregion
|
|
266
266
|
//#region src/client/CodeArtsPluginCard.tsx
|
|
@@ -1877,14 +1877,14 @@ function CodeArtsPluginCard({ t }) {
|
|
|
1877
1877
|
className: CodeArtsPluginCard_module_css_default.accountToolbar,
|
|
1878
1878
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1879
1879
|
variant: "outline",
|
|
1880
|
-
size: "
|
|
1880
|
+
size: "md",
|
|
1881
1881
|
"aria-expanded": manualOpen,
|
|
1882
1882
|
disabled: busy,
|
|
1883
1883
|
onClick: () => setManualOpen((open) => !open),
|
|
1884
1884
|
children: t("pasteTokenAdd")
|
|
1885
1885
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1886
1886
|
variant: "primary",
|
|
1887
|
-
size: "
|
|
1887
|
+
size: "md",
|
|
1888
1888
|
disabled: busy || loginPending,
|
|
1889
1889
|
onClick: () => void startOAuthLogin(),
|
|
1890
1890
|
children: loginPending ? t("signingIn") : t("addAccount")
|
|
@@ -3187,14 +3187,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
3187
3187
|
document.head.appendChild(tag);
|
|
3188
3188
|
}
|
|
3189
3189
|
var CodeArtsPanel_module_css_default = {
|
|
3190
|
-
"
|
|
3191
|
-
"
|
|
3190
|
+
"page": "Z66cgG_page",
|
|
3191
|
+
"body": "Z66cgG_body",
|
|
3192
3192
|
"back": "Z66cgG_back",
|
|
3193
|
-
"
|
|
3193
|
+
"icon": "Z66cgG_icon",
|
|
3194
|
+
"desc": "Z66cgG_desc",
|
|
3194
3195
|
"title": "Z66cgG_title",
|
|
3195
|
-
"
|
|
3196
|
-
"backCaret": "Z66cgG_backCaret"
|
|
3197
|
-
"body": "Z66cgG_body"
|
|
3196
|
+
"head": "Z66cgG_head",
|
|
3197
|
+
"backCaret": "Z66cgG_backCaret"
|
|
3198
3198
|
};
|
|
3199
3199
|
//#endregion
|
|
3200
3200
|
//#region src/client/CodeArtsPanel.tsx
|
|
@@ -3527,7 +3527,7 @@ const zh = {
|
|
|
3527
3527
|
displayKeeperToggle: "开启常驻保活进程(默认关闭)",
|
|
3528
3528
|
displayKeeperRunning: "后台进程运行中 · PID {pid} · 最近心跳 {time}",
|
|
3529
3529
|
displayKeeperStarting: "后台进程正在启动……稍等几秒刷新这一页。",
|
|
3530
|
-
displayKeeperDown: "
|
|
3530
|
+
displayKeeperDown: "后台进程没有在跑(可能被你结束、为更新让路或启动失败)。{message}",
|
|
3531
3531
|
displayKeeperStop: "结束进程",
|
|
3532
3532
|
displayKeeperStopping: "正在结束……",
|
|
3533
3533
|
displayKeeperStopped: "后台进程已结束,保活开关已同时关闭。",
|
|
@@ -3739,7 +3739,7 @@ const en = {
|
|
|
3739
3739
|
displayKeeperToggle: "Run the keep-alive background process (off by default)",
|
|
3740
3740
|
displayKeeperRunning: "Background process running · PID {pid} · last heartbeat {time}",
|
|
3741
3741
|
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)
|
|
3742
|
+
displayKeeperDown: "The background process is not running (stopped by you, stepped aside for an update, or it failed to start). {message}",
|
|
3743
3743
|
displayKeeperStop: "Stop process",
|
|
3744
3744
|
displayKeeperStopping: "Stopping…",
|
|
3745
3745
|
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`
|
|
791
|
+
* 这个 `contextWindow` 能不能当「上游真实规格」展示。
|
|
792
792
|
*
|
|
793
|
-
*
|
|
793
|
+
* 由各发现源在解析时置位(上游真给了字段、且 > 0),再一路带过合并与 `backfillParams`;
|
|
794
|
+
* 用户按模型覆盖、或进程内实测学到上界时,`fetchModels` 也会把它置位(那些值是我们
|
|
795
|
+
* 确认过的,可以展示)。
|
|
796
|
+
*
|
|
797
|
+
* 参数表补出来的值**永远不带**这个标记:`contextWindow` 同时是守卫输入,补一个保守值
|
|
798
|
+
* 让它保守拦截是对的;但把兜底值印成上游规格就是假数据(issue #9 的遗留项)。
|
|
794
799
|
*/
|
|
795
800
|
contextWindowKnown?: boolean;
|
|
796
801
|
/**
|
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 upstreamErrorMessage, B as markModelUnavailable, C as learnedContextWindowFor, D as prepareChatBody, E as pickDailyWelfareCampaign, F as creditRatioLabel, I as filterEnabledModels, L as forgetModelUnavailable, M as CodeArtsCatalog, N as FALLBACK_CODEARTS_MODELS, O as rateLimitFrame, P as clearBenefitBlocked, R as isBenefitBlocked, S as learnContextWindow, T as modelUnavailableReasonText, U as modelUnavailableReason, _ as isNotMultimodal, a as claimDailyWelfare, b as isTpmLimit, c as degradeTokenCeiling, d as fetchQueueStatus, f as fetchWelfareCampaigns, g as isModelNotAccessible, h as isIamTokenError, i as chatStream, k as signedGet, 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 maxTokensCeilingFor, x as isWelfareClaimedStatus, y as isQueueableRate, z as isBenefitModel } from "./upstream-
|
|
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-CsAz93vO.mjs";
|
|
2
|
+
import { A as upstreamErrorMessage, B as markModelUnavailable, C as learnedContextWindowFor, D as prepareChatBody, E as pickDailyWelfareCampaign, F as creditRatioLabel, I as filterEnabledModels, L as forgetModelUnavailable, M as CodeArtsCatalog, N as FALLBACK_CODEARTS_MODELS, O as rateLimitFrame, P as clearBenefitBlocked, R as isBenefitBlocked, S as learnContextWindow, T as modelUnavailableReasonText, U as modelUnavailableReason, _ as isNotMultimodal, a as claimDailyWelfare, b as isTpmLimit, c as degradeTokenCeiling, d as fetchQueueStatus, f as fetchWelfareCampaigns, g as isModelNotAccessible, h as isIamTokenError, i as chatStream, k as signedGet, 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 maxTokensCeilingFor, x as isWelfareClaimedStatus, y as isQueueableRate, z as isBenefitModel } from "./upstream-BsoeSKrY.mjs";
|
|
3
|
+
import { a as refreshCatalog, i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DLMVdsWB.mjs";
|
|
4
4
|
import { i as lazyApi, r as createProvider } from "./models-CgKCibpk.mjs";
|
|
5
|
-
import {
|
|
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";
|
|
7
7
|
import z from "@deepseek-ai/schemastery";
|
|
8
8
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
@@ -3114,12 +3114,14 @@ function apply(ctx, rawConfig) {
|
|
|
3114
3114
|
if (model.id.toLowerCase() !== lower) return model;
|
|
3115
3115
|
const target = window ?? model.contextWindowDiscovered ?? model.contextWindow;
|
|
3116
3116
|
const { contextWindowDiscovered, ...rest } = model;
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
contextWindow: target
|
|
3120
|
-
} : {
|
|
3117
|
+
const known = window === null ? model.contextWindowKnown : true;
|
|
3118
|
+
const patched = {
|
|
3121
3119
|
...rest,
|
|
3122
3120
|
contextWindow: target,
|
|
3121
|
+
...known === true ? { contextWindowKnown: true } : {}
|
|
3122
|
+
};
|
|
3123
|
+
return contextWindowDiscovered === void 0 || contextWindowDiscovered === target ? patched : {
|
|
3124
|
+
...patched,
|
|
3123
3125
|
contextWindowDiscovered
|
|
3124
3126
|
};
|
|
3125
3127
|
}));
|
|
@@ -3189,6 +3191,11 @@ function apply(ctx, rawConfig) {
|
|
|
3189
3191
|
...keeperLastError === void 0 ? {} : { error: keeperLastError },
|
|
3190
3192
|
logPath
|
|
3191
3193
|
};
|
|
3194
|
+
if (keeperHandoffRecent()) return {
|
|
3195
|
+
alive: false,
|
|
3196
|
+
error: "守护进程为更新安装让路,重启后会自动恢复",
|
|
3197
|
+
logPath
|
|
3198
|
+
};
|
|
3192
3199
|
try {
|
|
3193
3200
|
await setDock({ keepAliveDaemon: false });
|
|
3194
3201
|
} catch {}
|
|
@@ -3230,6 +3237,7 @@ function apply(ctx, rawConfig) {
|
|
|
3230
3237
|
keeperSpawnedAt = Date.now();
|
|
3231
3238
|
if (outcome.ok) {
|
|
3232
3239
|
keeperLastError = void 0;
|
|
3240
|
+
clearKeeperHandoff();
|
|
3233
3241
|
ctx.logger.debug(`dsh-codearts: credential keeper running (pid ${outcome.pid ?? "?"})`);
|
|
3234
3242
|
} else {
|
|
3235
3243
|
keeperLastError = outcome.reason ?? "spawn failed";
|
|
@@ -3252,6 +3260,7 @@ function apply(ctx, rawConfig) {
|
|
|
3252
3260
|
if (!keeperRunning() && Date.now() - keeperSpawnedAt >= KEEPER_START_GRACE_MS) {
|
|
3253
3261
|
keeperTimer = void 0;
|
|
3254
3262
|
keeperSpawnedAt = 0;
|
|
3263
|
+
if (keeperHandoffRecent()) return;
|
|
3255
3264
|
await setDock({ keepAliveDaemon: false }).catch(() => false);
|
|
3256
3265
|
return;
|
|
3257
3266
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
3
|
+
import { basename, dirname, join } from "node:path";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
//#region src/keeper.ts
|
|
@@ -18,9 +18,11 @@ import { fileURLToPath } from "node:url";
|
|
|
18
18
|
* ## 进程形态
|
|
19
19
|
*
|
|
20
20
|
* DSH Desktop 是 Electron,宿主 exe 可以直接当 Node 用:设置
|
|
21
|
-
* `ELECTRON_RUN_AS_NODE=1` 后启动它就是 node 24.21.0
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* `ELECTRON_RUN_AS_NODE=1` 后启动它就是 node 24.21.0(已实测)。但**优先用宿主自带的
|
|
22
|
+
* 真 node.exe**(`resources/runtime/<runtime>/dependencies/node/bin/node.exe`)—— 宿主 exe 的
|
|
23
|
+
* 进程名是 `DeepSeek Harness.exe`,会被更新安装器当成「应用还在跑」而挡住更新
|
|
24
|
+
* (见 `bundledNodeExecutable`)。两者都不依赖用户装没装 node,也不引入任何原生依赖。
|
|
25
|
+
* 启动后 `detached` + `unref` + `stdio:'ignore'`,DSH 退出它不跟着退出(同样已实测)。
|
|
24
26
|
*
|
|
25
27
|
* ## 谁有权续期(重要)
|
|
26
28
|
*
|
|
@@ -100,10 +102,42 @@ function keeperScriptPath() {
|
|
|
100
102
|
return fileURLToPath(new URL("./keeper-main.mjs", import.meta.url));
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
105
|
+
* 宿主自带的 node(`resources/runtime/<runtime>/dependencies/node/bin/node.exe`)。
|
|
106
|
+
*
|
|
107
|
+
* 为什么不直接用 `process.execPath`:那是宿主 exe,keeper 的进程名就成了
|
|
108
|
+
* `DeepSeek Harness.exe`。DSH 的更新安装器会枚举同名进程判断「应用是否已关闭」,
|
|
109
|
+
* 看到 keeper 就认为应用还在跑 —— 更新在十秒左右中止,而且安装器不会把应用拉回来
|
|
110
|
+
* (2026-11-16 实测:装 0.2.2-rc.3 时两次都是被这个挡住的)。
|
|
111
|
+
*
|
|
112
|
+
* 运行时目录名会随版本变(`primary-runtime` / `dsh-primary-runtime`),所以按目录枚举,
|
|
113
|
+
* 不把某一版的名字写死。拿不到就返回 undefined,由调用方退回宿主 exe。
|
|
114
|
+
*/
|
|
115
|
+
function bundledNodeExecutable() {
|
|
116
|
+
const name = process.platform === "win32" ? "node.exe" : "node";
|
|
117
|
+
const roots = [];
|
|
118
|
+
const resources = process.resourcesPath;
|
|
119
|
+
if (typeof resources === "string" && resources !== "") roots.push(resources);
|
|
120
|
+
roots.push(join(dirname(process.execPath), "resources"));
|
|
121
|
+
for (const root of roots) {
|
|
122
|
+
const runtime = join(root, "runtime");
|
|
123
|
+
let runtimes;
|
|
124
|
+
try {
|
|
125
|
+
runtimes = readdirSync(runtime);
|
|
126
|
+
} catch {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
for (const runtimeName of runtimes) {
|
|
130
|
+
const candidate = join(runtime, runtimeName, "dependencies", "node", "bin", name);
|
|
131
|
+
if (existsSync(candidate)) return candidate;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
103
136
|
* 拿 `ELECTRON_RUN_AS_NODE` 这条路启动 node 所需的 exe。
|
|
104
137
|
*
|
|
105
138
|
* 优先级:宿主自己给的 `DSH_DESKTOP_NODE_EXECUTABLE`(Desktop 注入,最准)→
|
|
106
|
-
*
|
|
139
|
+
* 宿主自带的 node.exe(见 `bundledNodeExecutable`,进程名不会撞 DSH)→
|
|
140
|
+
* `process.execPath`(Electron 自己或普通 node 都适用)。
|
|
107
141
|
*/
|
|
108
142
|
function nodeLauncher() {
|
|
109
143
|
const desktop = process.env.DSH_DESKTOP_NODE_EXECUTABLE;
|
|
@@ -114,6 +148,11 @@ function nodeLauncher() {
|
|
|
114
148
|
ELECTRON_RUN_AS_NODE: "1"
|
|
115
149
|
}
|
|
116
150
|
};
|
|
151
|
+
const bundled = bundledNodeExecutable();
|
|
152
|
+
if (bundled !== void 0) return {
|
|
153
|
+
command: bundled,
|
|
154
|
+
env: { ...process.env }
|
|
155
|
+
};
|
|
117
156
|
return {
|
|
118
157
|
command: process.execPath,
|
|
119
158
|
env: {
|
|
@@ -123,6 +162,42 @@ function nodeLauncher() {
|
|
|
123
162
|
};
|
|
124
163
|
}
|
|
125
164
|
/**
|
|
165
|
+
* 这是 DSH 更新安装器在 `%TEMP%` 里建的插件目录吗。
|
|
166
|
+
*
|
|
167
|
+
* 安装器(NSIS)一启动就把自己签名的 `window-frame.dll` 解到 `%TEMP%\ns*.tmp\`。
|
|
168
|
+
* 用「目录名 + 那个 dll」两条一起判,用户装别的软件留下同名目录也不会误伤。
|
|
169
|
+
*/
|
|
170
|
+
function isDshInstallerTempDir(path) {
|
|
171
|
+
if (!/^ns[\w.-]{2,}\.tmp$/i.test(basename(path))) return false;
|
|
172
|
+
return existsSync(join(path, "window-frame.dll"));
|
|
173
|
+
}
|
|
174
|
+
/** 「让路」标记:keeper 为更新安装器主动退出时写,插件据此不把开关关掉。 */
|
|
175
|
+
function keeperHandoffPath(home) {
|
|
176
|
+
return join(home ?? dshHome(), ".codearts-keeper.handoff");
|
|
177
|
+
}
|
|
178
|
+
function writeKeeperHandoff(reason, home) {
|
|
179
|
+
try {
|
|
180
|
+
writeFileSync(keeperHandoffPath(home), JSON.stringify({
|
|
181
|
+
at: Date.now(),
|
|
182
|
+
reason
|
|
183
|
+
}), { mode: 384 });
|
|
184
|
+
} catch {}
|
|
185
|
+
}
|
|
186
|
+
/** 最近发生过一次「为更新让路」的退出吗(默认 15 分钟内)。 */
|
|
187
|
+
function keeperHandoffRecent(home, maxAgeMs = 9e5) {
|
|
188
|
+
try {
|
|
189
|
+
const parsed = JSON.parse(readFileSync(keeperHandoffPath(home), "utf8"));
|
|
190
|
+
return typeof parsed.at === "number" && Date.now() - parsed.at <= maxAgeMs;
|
|
191
|
+
} catch {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function clearKeeperHandoff(home) {
|
|
196
|
+
try {
|
|
197
|
+
if (existsSync(keeperHandoffPath(home))) unlinkSync(keeperHandoffPath(home));
|
|
198
|
+
} catch {}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
126
201
|
* 起一个守护进程。已经在跑就返回现有的那个(幂等,不重复起)。
|
|
127
202
|
*
|
|
128
203
|
* `detached` + `unref` + `stdio:'ignore'` 三件套缺一不可:少了任何一个,DSH 退出时
|
|
@@ -212,4 +287,4 @@ function stopRequested(home) {
|
|
|
212
287
|
return existsSync(join(home ?? dshHome(), ".codearts-keeper.stop"));
|
|
213
288
|
}
|
|
214
289
|
//#endregion
|
|
215
|
-
export {
|
|
290
|
+
export { clearKeeperState as a, keeperLogPath as c, keeperStats as d, spawnKeeper as f, writeKeeperState as g, writeKeeperHandoff as h, clearKeeperHandoff as i, keeperScriptPath as l, stopRequested as m, KEEPER_STALE_MS as n, isDshInstallerTempDir as o, stopKeeper as p, KEEPER_TICK_MS as r, keeperHandoffRecent as s, KEEPER_HEARTBEAT_MS as t, keeperStatePath as u };
|
package/lib/keeper-main.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { d as OAuthTokenError, f as defaultLoginConfig, i as codeartsAccountsPath, l as readAccountDocument, p as refreshToken, u as writeJsonAtomic } from "./auth-
|
|
2
|
-
import { a as keeperLogPath,
|
|
3
|
-
import { appendFileSync, existsSync, unlinkSync } from "node:fs";
|
|
1
|
+
import { d as OAuthTokenError, f as defaultLoginConfig, i as codeartsAccountsPath, l as readAccountDocument, p as refreshToken, u as writeJsonAtomic } from "./auth-CsAz93vO.mjs";
|
|
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
|
+
import { appendFileSync, existsSync, unlinkSync, watch } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
4
5
|
//#region src/keeper-main.ts
|
|
5
6
|
/**
|
|
6
7
|
* dsh-codearts 凭证守护进程(独立入口,由 DSH 用 `ELECTRON_RUN_AS_NODE=1` 拉起)。
|
|
@@ -39,17 +40,16 @@ function log(message) {
|
|
|
39
40
|
*
|
|
40
41
|
* 从卡片连点两次、或同时开两个 DSH 窗口时,第二次 spawn 必须让路 —— 两个进程同时
|
|
41
42
|
* 刷 refresh_token 就是上面说的那个翻车场景。
|
|
43
|
+
*
|
|
44
|
+
* 判据用 `keeperStats`(心跳 + pid 都算),不能只看 pid:上一份 keeper 被强杀后
|
|
45
|
+
* 状态文件会留在盘上,而 Windows 很快就把那个 pid 发给别的进程 —— 只探 pid 会
|
|
46
|
+
* 把一个正常的新进程当成「已有 keeper」,于是每次启动都立刻退出(2026-11-16 实测)。
|
|
42
47
|
*/
|
|
43
48
|
function alreadyRunning() {
|
|
44
|
-
const
|
|
45
|
-
if (state === void 0) return void 0;
|
|
46
|
-
if (state.pid === process.pid) return void 0;
|
|
47
|
-
|
|
48
|
-
process.kill(state.pid, 0);
|
|
49
|
-
return state.pid;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
return error?.code === "EPERM" ? state.pid : void 0;
|
|
52
|
-
}
|
|
49
|
+
const stats = keeperStats(home);
|
|
50
|
+
if (!stats.alive || stats.state === void 0) return void 0;
|
|
51
|
+
if (stats.state.pid === process.pid) return void 0;
|
|
52
|
+
return stats.state.pid;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* 一轮续期:读文档 → 逐个续 → 写回。
|
|
@@ -144,6 +144,39 @@ async function tick(state) {
|
|
|
144
144
|
};
|
|
145
145
|
if (refreshed > 0 || needsLogin.length > 0) log(`pass done: checked=${checked} refreshed=${refreshed} needsLogin=${needsLogin.length}`);
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* 更新安装器一出现就通知调用方让路。
|
|
149
|
+
*
|
|
150
|
+
* 为什么需要:安装器启动后会枚举进程判断「应用是否已关闭」,keeper 只要还在跑就
|
|
151
|
+
* 可能被当成应用本身,更新在十秒左右中止、也不把应用拉回来(`keeper.ts` 的
|
|
152
|
+
* `bundledNodeExecutable` 注释里有完整现场)。换 node.exe 是主路,这里是双保险 —
|
|
153
|
+
* 安装器就算按安装路径匹配也挡不住。
|
|
154
|
+
*
|
|
155
|
+
* 实现上用 `fs.watch` 盯 `%TEMP%`(事件驱动,不轮询):只有新出现的 `ns*.tmp`
|
|
156
|
+
* 目录里真有安装器的 `window-frame.dll` 才算数,用户装别的软件不会误伤。
|
|
157
|
+
*/
|
|
158
|
+
function watchForUpdateInstaller(onSeen) {
|
|
159
|
+
if (process.platform !== "win32") return;
|
|
160
|
+
const root = process.env.TEMP ?? process.env.TMP;
|
|
161
|
+
if (root === void 0 || root === "") return;
|
|
162
|
+
const confirm = (name, attempt) => {
|
|
163
|
+
if (!name.toLowerCase().startsWith("ns")) return;
|
|
164
|
+
const dir = join(root, name);
|
|
165
|
+
if (isDshInstallerTempDir(dir)) {
|
|
166
|
+
onSeen();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (attempt < 2) setTimeout(() => confirm(name, attempt + 1), 500);
|
|
170
|
+
};
|
|
171
|
+
try {
|
|
172
|
+
watch(root, (_event, filename) => {
|
|
173
|
+
if (filename === null) return;
|
|
174
|
+
confirm(String(filename), 0);
|
|
175
|
+
});
|
|
176
|
+
} catch (error) {
|
|
177
|
+
log(`installer watch unavailable: ${error instanceof Error ? error.message : String(error)}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
147
180
|
async function main() {
|
|
148
181
|
const other = alreadyRunning();
|
|
149
182
|
if (other !== void 0) {
|
|
@@ -167,6 +200,23 @@ async function main() {
|
|
|
167
200
|
clearKeeperState(home);
|
|
168
201
|
process.exit(0);
|
|
169
202
|
};
|
|
203
|
+
clearKeeperHandoff(home);
|
|
204
|
+
/**
|
|
205
|
+
* 为更新安装让路。
|
|
206
|
+
*
|
|
207
|
+
* 和 `shutdown` 的区别只有一条:留一个「让路」标记。插件看到它会知道这是预期内
|
|
208
|
+
* 的退出,不把「常驻保活」开关关掉 —— 新版应用起来后开关还开着,keeper 会照常被
|
|
209
|
+
* 拉起,用户不会发现自己"被关了保活"。
|
|
210
|
+
*/
|
|
211
|
+
const stepAside = (reason) => {
|
|
212
|
+
if (stopped) return;
|
|
213
|
+
log(`keeper stepping aside: ${reason}`);
|
|
214
|
+
writeKeeperHandoff(reason, home);
|
|
215
|
+
clearKeeperState(home);
|
|
216
|
+
stopped = true;
|
|
217
|
+
process.exit(0);
|
|
218
|
+
};
|
|
219
|
+
watchForUpdateInstaller(() => stepAside("update installer detected"));
|
|
170
220
|
for (const signal of [
|
|
171
221
|
"SIGINT",
|
|
172
222
|
"SIGTERM",
|
|
@@ -334,10 +334,12 @@ function backfillParams(discovered, params = FALLBACK_CODEARTS_MODELS) {
|
|
|
334
334
|
for (const fallback of params) {
|
|
335
335
|
const current = byId.get(fallback.id.toLowerCase());
|
|
336
336
|
if (current === void 0) continue;
|
|
337
|
+
const keptWindow = current.contextWindow > 0;
|
|
337
338
|
byId.set(fallback.id.toLowerCase(), {
|
|
338
339
|
id: current.id,
|
|
339
340
|
name: current.name || fallback.name,
|
|
340
|
-
contextWindow:
|
|
341
|
+
contextWindow: keptWindow ? current.contextWindow : fallback.contextWindow,
|
|
342
|
+
...keptWindow && current.contextWindowKnown === true ? { contextWindowKnown: true } : {},
|
|
341
343
|
maxTokens: current.maxTokens > 0 ? current.maxTokens : fallback.maxTokens,
|
|
342
344
|
supportsImages: current.supportsImages || fallback.supportsImages,
|
|
343
345
|
...current.ratio === void 0 ? {} : { ratio: current.ratio },
|
|
@@ -1444,10 +1446,12 @@ async function fetchBuiltinModels(credential, signal) {
|
|
|
1444
1446
|
const id = firstString(model.model_id, model.model_name);
|
|
1445
1447
|
if (id === "") continue;
|
|
1446
1448
|
const ratio = creditRatioOf(model);
|
|
1449
|
+
const contextWindow = positive(model.context_window);
|
|
1447
1450
|
out.push({
|
|
1448
1451
|
id,
|
|
1449
1452
|
name: firstString(model.model_name, id),
|
|
1450
|
-
contextWindow
|
|
1453
|
+
contextWindow,
|
|
1454
|
+
...contextWindow > 0 ? { contextWindowKnown: true } : {},
|
|
1451
1455
|
maxTokens: positive(model.max_tokens),
|
|
1452
1456
|
supportsImages: model.supports_images === true,
|
|
1453
1457
|
...ratio === void 0 ? {} : { ratio }
|
|
@@ -1472,10 +1476,12 @@ async function fetchBenefitModels(credential, signal) {
|
|
|
1472
1476
|
const id = firstString(model.model_id, model.model_name);
|
|
1473
1477
|
if (id === "") continue;
|
|
1474
1478
|
const ratio = creditRatioOf(model);
|
|
1479
|
+
const contextWindow = positive(model.context_window);
|
|
1475
1480
|
out.push({
|
|
1476
1481
|
id,
|
|
1477
1482
|
name: firstString(model.model_name, id),
|
|
1478
|
-
contextWindow
|
|
1483
|
+
contextWindow,
|
|
1484
|
+
...contextWindow > 0 ? { contextWindowKnown: true } : {},
|
|
1479
1485
|
maxTokens: positive(model.max_tokens),
|
|
1480
1486
|
supportsImages: model.supports_images === true,
|
|
1481
1487
|
...ratio === void 0 ? {} : { ratio },
|
|
@@ -1519,10 +1525,12 @@ async function fetchAgentModels(credential, signal) {
|
|
|
1519
1525
|
const id = firstString(params.model_id, model.model_id, model.model_alias, model.model_name);
|
|
1520
1526
|
if (id === "") continue;
|
|
1521
1527
|
const ratio = creditRatioOf(model) ?? creditRatioOf(params);
|
|
1528
|
+
const contextWindow = positive(params.context_window);
|
|
1522
1529
|
out.push({
|
|
1523
1530
|
id,
|
|
1524
1531
|
name: firstString(model.model_name, model.model_alias, id),
|
|
1525
|
-
contextWindow
|
|
1532
|
+
contextWindow,
|
|
1533
|
+
...contextWindow > 0 ? { contextWindowKnown: true } : {},
|
|
1526
1534
|
maxTokens: positive(params.max_tokens),
|
|
1527
1535
|
supportsImages: model.supports_images === true,
|
|
1528
1536
|
...ratio === void 0 ? {} : { ratio }
|
|
@@ -1721,15 +1729,16 @@ async function fetchModels(credential, signal, contextWindowOverrides = {}) {
|
|
|
1721
1729
|
const thinking = variants.get(model.id.toLowerCase());
|
|
1722
1730
|
const override = contextWindowOverrideFor(contextWindowOverrides, model.id);
|
|
1723
1731
|
const learned = learnedContextWindowFor(model.id);
|
|
1724
|
-
const
|
|
1732
|
+
const upstreamKnown = model.contextWindowKnown === true;
|
|
1733
|
+
const discovered = model.contextWindow > 0 ? model.contextWindow : learned ?? UNKNOWN_CONTEXT_WINDOW;
|
|
1725
1734
|
const base = override ?? discovered;
|
|
1726
1735
|
const contextWindow = learned === void 0 ? base : Math.min(base, learned);
|
|
1727
1736
|
return {
|
|
1728
1737
|
...model,
|
|
1729
1738
|
...thinking === void 0 ? {} : { thinking },
|
|
1730
|
-
|
|
1739
|
+
...override !== void 0 || learned !== void 0 || upstreamKnown ? { contextWindowKnown: true } : {},
|
|
1731
1740
|
contextWindow,
|
|
1732
|
-
...contextWindow
|
|
1741
|
+
...upstreamKnown && contextWindow !== model.contextWindow ? { contextWindowDiscovered: model.contextWindow } : {},
|
|
1733
1742
|
maxTokens: Math.min(model.maxTokens > 0 ? model.maxTokens : UNKNOWN_MAX_TOKENS, maxTokensCeilingFor(model.id))
|
|
1734
1743
|
};
|
|
1735
1744
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as writeJsonAtomic } from "./auth-
|
|
2
|
-
import { H as modelDisplayName, V as mergeModelLists, W as setDiscoveredBenefitModels, u as fetchModels, z as isBenefitModel } from "./upstream-
|
|
1
|
+
import { u as writeJsonAtomic } from "./auth-CsAz93vO.mjs";
|
|
2
|
+
import { H as modelDisplayName, V as mergeModelLists, W as setDiscoveredBenefitModels, u as fetchModels, z as isBenefitModel } from "./upstream-BsoeSKrY.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.2";
|
|
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.2",
|
|
6
6
|
"packageManager": "pnpm@11.24.0",
|
|
7
7
|
"author": "elegant01",
|
|
8
8
|
"keywords": [
|