@eddyskywalker/dsh-chatgpt-subscription 0.66.0 → 0.66.1

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/lib/client.js +137 -9
  3. package/lib/client.js.map +1 -1
  4. package/lib/index.js +682 -77
  5. package/lib/types/client/antigravity/styles.d.ts.map +1 -1
  6. package/lib/types/client/glm-coding-plan/styles.d.ts.map +1 -1
  7. package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -1
  8. package/lib/types/client/kimi-code/locales.d.ts +44 -2
  9. package/lib/types/client/kimi-code/locales.d.ts.map +1 -1
  10. package/lib/types/client/kimi-code/styles.d.ts.map +1 -1
  11. package/lib/types/client/locales-ru/kimi-code.d.ts.map +1 -1
  12. package/lib/types/client/workbuddy/styles.d.ts.map +1 -1
  13. package/lib/types/compat.d.ts +1 -1
  14. package/lib/types/host/cache-warmup/contracts.d.ts +1 -1
  15. package/lib/types/host/cache-warmup/contracts.d.ts.map +1 -1
  16. package/lib/types/host/cache-warmup/install.d.ts.map +1 -1
  17. package/lib/types/host/cache-warmup/projection.d.ts.map +1 -1
  18. package/lib/types/host/glm-coding-plan/adapter.d.ts +11 -0
  19. package/lib/types/host/glm-coding-plan/adapter.d.ts.map +1 -1
  20. package/lib/types/host/kimi-code/adapter.d.ts +4 -10
  21. package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
  22. package/lib/types/host/kimi-code/mapper.d.ts +11 -1
  23. package/lib/types/host/kimi-code/mapper.d.ts.map +1 -1
  24. package/lib/types/host/kimi-code/routes.d.ts.map +1 -1
  25. package/lib/types/host/kimi-code/session-cache-state.d.ts +19 -2
  26. package/lib/types/host/kimi-code/session-cache-state.d.ts.map +1 -1
  27. package/lib/types/host/kimi-code/tool-argument-guard.d.ts +36 -0
  28. package/lib/types/host/kimi-code/tool-argument-guard.d.ts.map +1 -0
  29. package/lib/types/host/kimi-code/tool-argument-recovery.d.ts +16 -0
  30. package/lib/types/host/kimi-code/tool-argument-recovery.d.ts.map +1 -0
  31. package/lib/types/index.d.ts.map +1 -1
  32. package/lib/types/shared/kimi-code-contracts.d.ts +63 -0
  33. package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -1
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.66.1 - 2026-11-09
6
+
7
+ - **[kimi-code / 号池] 瞬时失败保持账号亲和,只有明确的账号级限制才冷却换号**
8
+ - 普通 429 背压与上游引擎过载不再被当成本账号额度耗尽:重试沿用原账号,不冷却、不轮换;只有响应正文能够证明账号额度或账号限制时,才进入冷却并选择其他账号。流内错误与响应头错误共用同一套分类,避免换号破坏前缀缓存亲和。
9
+ - 持久化有界、非机密的最近请求诊断,卡片显示实际账号、是否切号、请求结果、输入/缓存读写/输出 token 及 reasoning 占比;高推理占比时明确提示成本主要来自推理,而不是缓存失效。
10
+
11
+ - **[kimi-code / 工具调用] 拦截失控参数流,并允许同一步在原账号引导恢复一次**
12
+ - 两种线上协议都在工具执行前拦截超过线路字节预算的参数,以及失控的重复键参数族;`ask_user_question`、大型程序与普通工具分别沿用适合其用途的限制,原始失控参数不会写入恢复提示。
13
+ - 第一次命中专用守卫错误后,在失败 attempt 之后追加最小合法 JSON 提示,由同一个 turn/step 立即重试,并钉住原账号以保留缓存;第二次仍失控则交还默认错误处理,不形成无限恢复循环。
14
+
15
+ - **[cache-warmup / 诊断] 扩大安全结果预览范围,区分前缀延续与新增输入**
16
+ - 有明确通过汇总且无失败证据的测试日志、严格识别根形状的 PTC 工具目录,以及超过当前预算且能可靠结构化的 grep/glob 结果可生成 preview;完整名称、错误集合与汇总按策略保留,完整原文仍通过 `ref://` 补读。混合证据、无法可靠解析或可能丢失关键事实的内容继续逐字保留。
17
+ - Kimi 缓存卡片新增「最近前缀延续」,分别展示最近请求缓存读、新增输入与按 256-token 对齐基线估算的保留比例;该指标仅用于诊断,不声明上游内部缓存契约。
18
+
19
+ - **[glm-coding-plan] 模型目录构建不再写账号池**
20
+ - 目录只需要区域信息,不再调用真实请求选号入口;按号池 revision 与指定账号缓存只读区域快照,避免一次模型选择器刷新被放大成重复 DPAPI 解密、凭据读取和 `lastUsedAt` 回写。未登录或读取失败时不缓存失败结果,登录后仍可重试。
21
+
22
+ - **[client] 修复设置枢纽主按钮悬停与登录行视觉层级**
23
+ - 共享 hover 洗色不再匹配 `.dsha-btn-primary`,避免「保存设置」「添加账号」等主按钮悬停时底色消失、白字落在近白背景上;Antigravity 与 Kimi 两份相同样式同步修复。
24
+ - 删除登录行对所有按钮的无差别 info 填充,保留「添加账号」主按钮与「设备码登录」「导入本地登录」次要按钮的视觉层级,布局规则不变。
25
+
26
+ - **验证**:完整类型检查通过;清洁构建后全量 Vitest 为 384 个文件通过 / 2 个跳过(6992 项通过 / 9 项跳过 / 0 失败);`npm pack --dry-run` 为 977 个文件、约 4.3 MB。按钮修复以 v0.66.0 与当前版本在相同 DOM、760×300 截图区域及浅色主题下完成 Before/After 复核。
27
+
5
28
  ## 0.66.0 - 2026-11-09
6
29
 
7
30
  - **[shared / cache] Kimi Code 的缓存与运行时优化沉淀为跨线路共享能力,并按上游证据启用**
package/lib/client.js CHANGED
@@ -5074,6 +5074,20 @@ window.__ModuleLoader__.load({
5074
5074
  cacheDrift: "最近前缀状态",
5075
5075
  cacheOpening: "开局继承",
5076
5076
  cacheOpeningValue: "{cached} / {tokens} tok({ratio})",
5077
+ cacheContinuation: "最近前缀延续",
5078
+ cacheContinuationValue: "{cached} / {expected} tok({ratio})· 新增 {fresh} tok",
5079
+ cacheLastRequest: "最近请求",
5080
+ cacheRequestSuccess: "成功",
5081
+ cacheRequestError: "失败",
5082
+ cacheRequestAborted: "已中止",
5083
+ cacheAccountChanged: "(已切号)",
5084
+ cacheLastInput: "本次输入",
5085
+ cacheLastInputValue: "新增 {fresh} · 缓存读 {cached} · 缓存写 {written}",
5086
+ cacheLastOutput: "本次输出",
5087
+ cacheLastReasoning: "其中 reasoning",
5088
+ cacheReasoningValue: "{tokens} tok(占输出 {ratio})",
5089
+ cacheReasoningCost: "本步成本主要来自推理,并非缓存失效。",
5090
+ metricNotReported: "未报告",
5077
5091
  cacheDriftFirst: "首个请求(缓存为空)",
5078
5092
  cacheDriftStable: "稳定(前缀未变)",
5079
5093
  cacheDriftSystemPrompt: "系统提示已变化(缓存失效)",
@@ -5247,6 +5261,20 @@ window.__ModuleLoader__.load({
5247
5261
  cacheDrift: "Last prefix state",
5248
5262
  cacheOpening: "Opening inheritance",
5249
5263
  cacheOpeningValue: "{cached} / {tokens} tok ({ratio})",
5264
+ cacheContinuation: "Latest prefix continuity",
5265
+ cacheContinuationValue: "{cached} / {expected} tok ({ratio}) · {fresh} fresh tok",
5266
+ cacheLastRequest: "Latest request",
5267
+ cacheRequestSuccess: "success",
5268
+ cacheRequestError: "error",
5269
+ cacheRequestAborted: "aborted",
5270
+ cacheAccountChanged: " (account changed)",
5271
+ cacheLastInput: "Input this request",
5272
+ cacheLastInputValue: "{fresh} fresh · {cached} cache read · {written} cache write",
5273
+ cacheLastOutput: "Output this request",
5274
+ cacheLastReasoning: "Reasoning included",
5275
+ cacheReasoningValue: "{tokens} tok ({ratio} of output)",
5276
+ cacheReasoningCost: "Reasoning, not a cache miss, drove this request cost.",
5277
+ metricNotReported: "not reported",
5250
5278
  cacheDriftFirst: "First request (cache cold)",
5251
5279
  cacheDriftStable: "Stable (prefix unchanged)",
5252
5280
  cacheDriftSystemPrompt: "System prompt changed (cache invalidated)",
@@ -5841,6 +5869,7 @@ window.__ModuleLoader__.load({
5841
5869
  * number this build cannot read at all falls back to "暂无".
5842
5870
  */
5843
5871
  function tokenCount(value, t) {
5872
+ if (value === null) return t.metricNotReported;
5844
5873
  return typeof value === "number" && Number.isFinite(value) ? value.toLocaleString() : t.unknownMetric;
5845
5874
  }
5846
5875
  /**
@@ -5870,6 +5899,64 @@ window.__ModuleLoader__.load({
5870
5899
  default: return String(cause);
5871
5900
  }
5872
5901
  }
5902
+ function KimiLatestRequestRows(input) {
5903
+ const { request, status, t } = input;
5904
+ const account = status.accounts?.find((entry) => entry.id === request.accountId)?.alias ?? request.accountId ?? t.unknownMetric;
5905
+ const outcome = request.outcome === "success" ? t.cacheRequestSuccess : request.outcome === "aborted" ? t.cacheRequestAborted : t.cacheRequestError;
5906
+ const usage = request.usage;
5907
+ const reasoning = usage?.reasoningTokens;
5908
+ const reasoningRatio = usage !== void 0 && reasoning !== null && reasoning !== void 0 && usage.outputTokens > 0 ? reasoning / usage.outputTokens : null;
5909
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5910
+ className: "dsha-row",
5911
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5912
+ className: "dsha-label",
5913
+ children: t.cacheLastRequest
5914
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5915
+ className: "dsha-value",
5916
+ children: [
5917
+ account,
5918
+ request.accountChanged ? t.cacheAccountChanged : "",
5919
+ " · ",
5920
+ outcome
5921
+ ]
5922
+ })]
5923
+ }), usage !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
5924
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5925
+ className: "dsha-row",
5926
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5927
+ className: "dsha-label",
5928
+ children: t.cacheLastInput
5929
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5930
+ className: "dsha-value",
5931
+ children: t.cacheLastInputValue.replace("{fresh}", tokenCount(usage.freshTokens, t)).replace("{cached}", tokenCount(usage.cacheReadTokens, t)).replace("{written}", tokenCount(usage.cacheWriteTokens, t))
5932
+ })]
5933
+ }),
5934
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5935
+ className: "dsha-row",
5936
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5937
+ className: "dsha-label",
5938
+ children: t.cacheLastOutput
5939
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5940
+ className: "dsha-value",
5941
+ children: tokenCount(usage.outputTokens, t)
5942
+ })]
5943
+ }),
5944
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5945
+ className: "dsha-row",
5946
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5947
+ className: "dsha-label",
5948
+ children: t.cacheLastReasoning
5949
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5950
+ className: "dsha-value",
5951
+ children: reasoning == null ? t.metricNotReported : reasoningRatio === null ? tokenCount(reasoning, t) : t.cacheReasoningValue.replace("{tokens}", tokenCount(reasoning, t)).replace("{ratio}", `${(reasoningRatio * 100).toFixed(1)}%`)
5952
+ })]
5953
+ }),
5954
+ reasoning != null && reasoning >= 1e3 && reasoningRatio !== null && reasoningRatio >= .5 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5955
+ className: "dsha-notice",
5956
+ children: t.cacheReasoningCost
5957
+ })
5958
+ ] })] });
5959
+ }
5873
5960
  function KimiCodeSection({ onModelChange, loadModelDirectory }) {
5874
5961
  const [status, setStatus] = (0, react.useState)(null);
5875
5962
  const [loading, setLoading] = (0, react.useState)(true);
@@ -6450,6 +6537,21 @@ window.__ModuleLoader__.load({
6450
6537
  children: t.cacheOpeningValue.replace("{cached}", status.cache.opening.cachedTokens.toLocaleString()).replace("{tokens}", status.cache.opening.promptTokens.toLocaleString()).replace("{ratio}", `${(status.cache.opening.hitRatio * 100).toFixed(1)}%`)
6451
6538
  })]
6452
6539
  }),
6540
+ status.cache.continuation !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6541
+ className: "dsha-row",
6542
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6543
+ className: "dsha-label",
6544
+ children: t.cacheContinuation
6545
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6546
+ className: "dsha-value",
6547
+ children: t.cacheContinuationValue.replace("{cached}", status.cache.continuation.cachedTokens.toLocaleString()).replace("{expected}", status.cache.continuation.expectedCachedTokens.toLocaleString()).replace("{fresh}", status.cache.continuation.freshTokens.toLocaleString()).replace("{ratio}", `${(status.cache.continuation.retentionRatio * 100).toFixed(1)}%`)
6548
+ })]
6549
+ }),
6550
+ status.cache.lastRequest !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KimiLatestRequestRows, {
6551
+ status,
6552
+ request: status.cache.lastRequest,
6553
+ t
6554
+ }),
6453
6555
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6454
6556
  className: "dsha-row",
6455
6557
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -22676,6 +22778,20 @@ window.__ModuleLoader__.load({
22676
22778
  cacheDrift: "Состояние последнего префикса",
22677
22779
  cacheOpening: "Наследование на старте",
22678
22780
  cacheOpeningValue: "{cached} / {tokens} ток. ({ratio})",
22781
+ cacheContinuation: "Непрерывность последнего префикса",
22782
+ cacheContinuationValue: "{cached} / {expected} ток. ({ratio}) · новых: {fresh} ток.",
22783
+ cacheLastRequest: "Последний запрос",
22784
+ cacheRequestSuccess: "успешно",
22785
+ cacheRequestError: "ошибка",
22786
+ cacheRequestAborted: "прервано",
22787
+ cacheAccountChanged: " (аккаунт сменился)",
22788
+ cacheLastInput: "Ввод запроса",
22789
+ cacheLastInputValue: "новых: {fresh} · чтение кеша: {cached} · запись кеша: {written}",
22790
+ cacheLastOutput: "Вывод запроса",
22791
+ cacheLastReasoning: "В том числе reasoning",
22792
+ cacheReasoningValue: "{tokens} ток. ({ratio} вывода)",
22793
+ cacheReasoningCost: "Стоимость этого шага обусловлена рассуждениями, а не промахом кеша.",
22794
+ metricNotReported: "не сообщено",
22679
22795
  cacheDriftFirst: "Первый запрос (кеш пуст)",
22680
22796
  cacheDriftStable: "Стабильно (префикс не менялся)",
22681
22797
  cacheDriftSystemPrompt: "Системный промпт изменился (кеш сброшен)",
@@ -23997,7 +24113,13 @@ window.__ModuleLoader__.load({
23997
24113
  .dsha-value{font-size:13px;min-width:0;overflow-wrap:anywhere;text-align:right;color:var(--dsw-alias-label-primary)}
23998
24114
  .dsha-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;padding-top:12px}
23999
24115
  .dsha-btn{background:var(--dsw-alias-bg-layer-2);border:0.5px solid var(--dsw-alias-border-l2);border-radius:999px;corner-shape:round;color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;font-size:13px;line-height:1;padding:8px 13px;white-space:nowrap}
24000
- .dsha-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}
24116
+ /* The hover tint belongs to the unfilled button only: it is a translucent wash
24117
+ over the neutral fill, and letting it match .dsha-btn-primary would paint the
24118
+ filled button with the wash while the label stayed white — the primary fill
24119
+ is (0,1,0) and this rule is (0,3,0), so nothing else could win it back. The
24120
+ exclusion is written into the selector, like the shared chip's
24121
+ :not([aria-pressed='true']), so a later filled variant cannot reintroduce it. */
24122
+ .dsha-btn:hover:not(:disabled):not(.dsha-btn-primary){background:var(--dsw-alias-interactive-bg-hover)}
24001
24123
  .dsha-btn:disabled{cursor:default;opacity:.5}
24002
24124
  .dsha-btn-primary{background:var(--dsw-alias-button-info-fill,#397ee8);border-color:transparent;color:var(--dsw-alias-button-info-label,#fff)}
24003
24125
  .dsha-btn-primary:hover:not(:disabled){opacity:.9}
@@ -24475,7 +24597,13 @@ window.__ModuleLoader__.load({
24475
24597
  .dsha-value{font-size:13px;min-width:0;overflow-wrap:anywhere;text-align:right;color:var(--dsw-alias-label-primary)}
24476
24598
  .dsha-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;padding-top:12px}
24477
24599
  .dsha-btn{background:var(--dsw-alias-bg-layer-2);border:0.5px solid var(--dsw-alias-border-l2);border-radius:999px;corner-shape:round;color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;font-size:13px;line-height:1;padding:8px 13px;white-space:nowrap}
24478
- .dsha-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}
24600
+ /* The hover tint belongs to the unfilled button only: it is a translucent wash
24601
+ over the neutral fill, and letting it match .dsha-btn-primary would paint the
24602
+ filled button with the wash while the label stayed white — the primary fill
24603
+ is (0,1,0) and this rule is (0,3,0), so nothing else could win it back. The
24604
+ exclusion is written into the selector, like the shared chip's
24605
+ :not([aria-pressed='true']), so a later filled variant cannot reintroduce it. */
24606
+ .dsha-btn:hover:not(:disabled):not(.dsha-btn-primary){background:var(--dsw-alias-interactive-bg-hover)}
24479
24607
  .dsha-btn:disabled{cursor:default;opacity:.5}
24480
24608
  .dsha-btn-primary{background:var(--dsw-alias-button-info-fill,#397ee8);border-color:transparent;color:var(--dsw-alias-button-info-label,#fff)}
24481
24609
  .dsha-btn-primary:hover:not(:disabled){opacity:.9}
@@ -25389,12 +25517,14 @@ window.__ModuleLoader__.load({
25389
25517
  .dshglm-model-meta{color:var(--dsw-alias-label-tertiary);font-size:11px;margin-left:5px}
25390
25518
  .dsha-badge.glm-adopted{background:color-mix(in srgb,var(--dsw-alias-button-info-fill,#397ee8) 16%,var(--dsw-alias-bg-layer-1));border-color:color-mix(in srgb,var(--dsw-alias-button-info-fill,#397ee8) 45%,var(--dsw-alias-border-l2));color:var(--dsw-alias-label-primary)}
25391
25519
 
25392
- /* 跨线路共享的登录入口按钮行:两区登录入口把多个「添加账号」按钮排进同一行,
25393
- 按钮沿用基础 .dsha-btn 的形状,只在这里统一换成信息色填充。原先是另一张卡片的
25394
- 样式表带出来的,那张卡片下线后这份声明移到这里,选择器与取值一字未改。 */
25520
+ /* 跨线路共享的登录入口按钮行:两区登录入口把多个按钮排进同一行,行本身只负责
25521
+ 换行与间距。按钮的主次由各自的 class 决定 —— 主按钮带 .dsha-btn-primary,取信息
25522
+ 色填充;次要入口(设备码登录、导入本地登录)保持中性外观,这样一行里才读得出
25523
+ 「主入口 + 另外两种进入方式」。这里原先统一涂成信息色,是为了绕开
25524
+ .dsha-btn:hover 盖掉主按钮填充的问题(见 antigravity / kimi-code 两张表里的
25525
+ :not(.dsha-btn-primary));通用 hover 修好后它只剩副作用:把 .dsha-btn 的次要
25526
+ 按钮也画成主按钮,故删除。 */
25395
25527
  .dsha-account-add-actions{display:flex;flex-wrap:wrap;gap:8px}
25396
- .dsha-account-add-actions .dsha-btn{background:var(--dsw-alias-button-info-fill,#397ee8);border-color:transparent;color:var(--dsw-alias-button-info-label,#fff)}
25397
- .dsha-account-add-actions .dsha-btn:hover:not(:disabled){opacity:.9;background:var(--dsw-alias-button-info-fill,#397ee8)}
25398
25528
  `, STYLE_ID$3);
25399
25529
  }
25400
25530
  //#endregion
@@ -56947,8 +57077,6 @@ window.__ModuleLoader__.load({
56947
57077
  installPluginStyle("workbuddy", `
56948
57078
  .dsh-wb-mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px}
56949
57079
  .dsha-account-add-actions{display:flex;flex-wrap:wrap;gap:8px}
56950
- .dsha-account-add-actions .dsha-btn{background:var(--dsw-alias-button-info-fill,#397ee8);border-color:transparent;color:var(--dsw-alias-button-info-label,#fff)}
56951
- .dsha-account-add-actions .dsha-btn:hover:not(:disabled){opacity:.9;background:var(--dsw-alias-button-info-fill,#397ee8)}
56952
57080
  /* The whole-pool state banner. It renders BEFORE the account list on purpose:
56953
57081
  a paused pool means nothing is routable, and a list of green account cards
56954
57082
  above that sentence reads as "available" whatever the banner says. */