@eddyskywalker/dsh-chatgpt-subscription 1.0.1 → 1.1.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 (47) hide show
  1. package/lib/client.js +89 -8
  2. package/lib/client.js.map +1 -1
  3. package/lib/codemode.js +33 -5
  4. package/lib/index.js +461 -64
  5. package/lib/{preset-sync-DWOAwSyl.js → preset-sync-RBsYhDY3.js} +2 -1
  6. package/lib/{tool-result-pruner-ClgRVOph.js → tool-result-pruner-DsaDg_l1.js} +2 -1
  7. package/lib/tool-result-pruner.js +1 -1
  8. package/lib/types/client/features/progress-updates/settings-section.d.ts +2 -2
  9. package/lib/types/client/locales-ru/qoder.d.ts.map +1 -1
  10. package/lib/types/client/providers/qoder/QoderComposerQuota.d.ts.map +1 -1
  11. package/lib/types/client/providers/qoder/QoderSection.d.ts.map +1 -1
  12. package/lib/types/client/providers/qoder/locales.d.ts +7 -1
  13. package/lib/types/client/providers/qoder/locales.d.ts.map +1 -1
  14. package/lib/types/client/providers/qoder/styles.d.ts.map +1 -1
  15. package/lib/types/client/providers/qoder/useQoderSection.d.ts +15 -0
  16. package/lib/types/client/providers/qoder/useQoderSection.d.ts.map +1 -1
  17. package/lib/types/compat.d.ts +1 -1
  18. package/lib/types/entries/tool-result-pruner.d.ts.map +1 -1
  19. package/lib/types/host/providers/antigravity-acp/adapter.d.ts.map +1 -1
  20. package/lib/types/host/providers/qoder/account-affinity.d.ts +16 -0
  21. package/lib/types/host/providers/qoder/account-affinity.d.ts.map +1 -0
  22. package/lib/types/host/providers/qoder/account-pool.d.ts +4 -2
  23. package/lib/types/host/providers/qoder/account-pool.d.ts.map +1 -1
  24. package/lib/types/host/providers/qoder/adapter.d.ts +15 -0
  25. package/lib/types/host/providers/qoder/adapter.d.ts.map +1 -1
  26. package/lib/types/host/providers/qoder/cache-diagnostics.d.ts +20 -0
  27. package/lib/types/host/providers/qoder/cache-diagnostics.d.ts.map +1 -0
  28. package/lib/types/host/providers/qoder/cosy.d.ts +12 -5
  29. package/lib/types/host/providers/qoder/cosy.d.ts.map +1 -1
  30. package/lib/types/host/providers/qoder/mapper.d.ts +15 -0
  31. package/lib/types/host/providers/qoder/mapper.d.ts.map +1 -1
  32. package/lib/types/host/providers/qoder/model-catalog.d.ts +18 -0
  33. package/lib/types/host/providers/qoder/model-catalog.d.ts.map +1 -1
  34. package/lib/types/host/providers/qoder/queue-state.d.ts +8 -1
  35. package/lib/types/host/providers/qoder/queue-state.d.ts.map +1 -1
  36. package/lib/types/host/providers/qoder/traffic-guard.d.ts +13 -0
  37. package/lib/types/host/providers/qoder/traffic-guard.d.ts.map +1 -0
  38. package/lib/types/host/providers/qoder/types.d.ts +6 -6
  39. package/lib/types/host/providers/qoder/types.d.ts.map +1 -1
  40. package/lib/types/host/runtime/codemode/rules.d.ts.map +1 -1
  41. package/lib/types/host/runtime/codemode/transport.d.ts.map +1 -1
  42. package/lib/types/index.d.ts.map +1 -1
  43. package/lib/types/shared/advisor-contracts.d.ts +9 -2
  44. package/lib/types/shared/advisor-contracts.d.ts.map +1 -1
  45. package/lib/types/shared/qoder-contracts.d.ts +30 -1
  46. package/lib/types/shared/qoder-contracts.d.ts.map +1 -1
  47. package/package.json +2 -2
package/lib/client.js CHANGED
@@ -20511,6 +20511,9 @@ window.__ModuleLoader__.load({
20511
20511
  cacheMissedTokens: "未命中输入",
20512
20512
  cacheWriteTokens: "缓存写入",
20513
20513
  cacheRequests: "样本请求数",
20514
+ cacheRecentTitle: "最近请求",
20515
+ cacheRecentAccount: "账号",
20516
+ cacheRecentPrefix: "前缀",
20514
20517
  composerLabel: "剩余额度",
20515
20518
  quotaWindow: "额度窗口"
20516
20519
  };
@@ -20644,6 +20647,9 @@ window.__ModuleLoader__.load({
20644
20647
  cacheMissedTokens: "Uncached input",
20645
20648
  cacheWriteTokens: "Cache write",
20646
20649
  cacheRequests: "Sampled requests",
20650
+ cacheRecentTitle: "Recent requests",
20651
+ cacheRecentAccount: "Account",
20652
+ cacheRecentPrefix: "Prefix",
20647
20653
  composerLabel: "quota left",
20648
20654
  quotaWindow: "Limit window"
20649
20655
  }
@@ -20807,11 +20813,33 @@ window.__ModuleLoader__.load({
20807
20813
  const read = finiteNumber(carrier.cacheReadTokens);
20808
20814
  const missed = finiteNumber(carrier.missedInputTokens);
20809
20815
  if (read === null || missed === null) return null;
20816
+ const recent = [];
20817
+ if (Array.isArray(carrier.recent)) for (const item of carrier.recent) {
20818
+ if (typeof item !== "object" || item === null) continue;
20819
+ const row = item;
20820
+ const at = finiteNumber(row["at"]);
20821
+ const model = typeof row["model"] === "string" ? row["model"] : void 0;
20822
+ if (at === null || model === void 0) continue;
20823
+ recent.push({
20824
+ at,
20825
+ model,
20826
+ account: typeof row["account"] === "string" ? row["account"] : "-",
20827
+ session: typeof row["session"] === "string" ? row["session"] : "-",
20828
+ system: typeof row["system"] === "string" ? row["system"] : "-",
20829
+ tools: typeof row["tools"] === "string" ? row["tools"] : "-",
20830
+ messages: finiteNumber(row["messages"]) ?? 0,
20831
+ bodyChars: finiteNumber(row["bodyChars"]) ?? 0,
20832
+ inputTokens: finiteNumber(row["inputTokens"]) ?? 0,
20833
+ cacheReadTokens: finiteNumber(row["cacheReadTokens"]) ?? 0,
20834
+ cacheWriteTokens: finiteNumber(row["cacheWriteTokens"]) ?? 0
20835
+ });
20836
+ }
20810
20837
  return {
20811
20838
  cacheReadTokens: read,
20812
20839
  missedInputTokens: missed,
20813
20840
  cacheWriteTokens: finiteNumber(carrier.cacheWriteTokens) ?? 0,
20814
- requests: finiteNumber(carrier.requests)
20841
+ requests: finiteNumber(carrier.requests),
20842
+ recent
20815
20843
  };
20816
20844
  }
20817
20845
  /**
@@ -21714,6 +21742,46 @@ window.__ModuleLoader__.load({
21714
21742
  ]
21715
21743
  })
21716
21744
  }),
21745
+ cache !== null && (cache.recent ?? []).length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
21746
+ className: "dshq-cache-recent",
21747
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
21748
+ className: "dshq-cache-recent-title",
21749
+ children: t.cacheRecentTitle
21750
+ }), (cache.recent ?? []).slice(-6).reverse().map((row) => {
21751
+ const ratio = row.inputTokens > 0 ? row.cacheReadTokens / row.inputTokens : null;
21752
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
21753
+ className: "dshq-cache-recent-row",
21754
+ children: [
21755
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
21756
+ className: "dshq-cache-recent-model",
21757
+ children: row.model
21758
+ }),
21759
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
21760
+ className: "dshq-cache-recent-meta",
21761
+ children: [
21762
+ t.cacheRecentAccount,
21763
+ " ",
21764
+ row.account,
21765
+ " · ",
21766
+ t.cacheRecentPrefix,
21767
+ " ",
21768
+ row.system,
21769
+ "/",
21770
+ row.tools
21771
+ ]
21772
+ }),
21773
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
21774
+ className: "dshq-cache-recent-value",
21775
+ children: [
21776
+ ratio === null ? t.cacheHitRatioUnavailable : percentText(ratio),
21777
+ " · ",
21778
+ tokenText(row.cacheReadTokens)
21779
+ ]
21780
+ })
21781
+ ]
21782
+ }, row.at + "-" + row.account);
21783
+ })]
21784
+ }),
21717
21785
  moreNotes(t.moreNotes, [t.cacheDesc])
21718
21786
  ]
21719
21787
  }),
@@ -37581,6 +37649,9 @@ window.__ModuleLoader__.load({
37581
37649
  cacheMissedTokens: "Ввод без кеша",
37582
37650
  cacheWriteTokens: "Запись в кеш",
37583
37651
  cacheRequests: "Запросов в выборке",
37652
+ cacheRecentTitle: "Последние запросы",
37653
+ cacheRecentAccount: "Аккаунт",
37654
+ cacheRecentPrefix: "Префикс",
37584
37655
  composerLabel: "Остаток квоты",
37585
37656
  quotaWindow: "Окно лимита"
37586
37657
  };
@@ -41140,13 +41211,15 @@ window.__ModuleLoader__.load({
41140
41211
  * 没有快照、没有桶、或全部桶都没有总额时返回 null(见文件头)。
41141
41212
  */
41142
41213
  function selectBadgeFacts$1(status, lookup = (key) => zh$19[key]) {
41143
- const queuePosition = status?.queue?.position;
41144
- if (queuePosition !== void 0 && queuePosition > 0) {
41145
- const wait = status?.queue?.retryAfterSeconds;
41214
+ const queue = status?.queue;
41215
+ const queuePosition = queue?.position;
41216
+ if (queue !== null && queue !== void 0 && (queue.waiting === true || (queuePosition ?? 0) > 0)) {
41217
+ const wait = queue.retryAfterSeconds;
41146
41218
  const label = lookup("queuePosition");
41219
+ const detail = queue.waiting === true ? label : label + " " + queuePosition;
41147
41220
  return {
41148
- text: label + " " + queuePosition,
41149
- tooltip: "[" + lookup("title") + "] " + label + " " + queuePosition + (wait === void 0 ? "" : " · " + wait + "s"),
41221
+ text: detail,
41222
+ tooltip: "[" + lookup("title") + "] " + detail + (wait === void 0 ? "" : " · " + wait + "s"),
41150
41223
  level: "warning"
41151
41224
  };
41152
41225
  }
@@ -41238,6 +41311,14 @@ window.__ModuleLoader__.load({
41238
41311
  .dshq-fact>span:first-child{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.4}
41239
41312
  .dshq-fact>span:last-child{color:var(--dsw-alias-label-primary);font-size:12px;line-height:1.4}
41240
41313
 
41314
+ /* 最近请求:与额度桶同一条列表节奏,一行一次请求;哈希只用于对账,不泄露凭据。 */
41315
+ .dshq-cache-recent{border-top:0.5px solid var(--dsw-alias-border-l2);display:flex;flex-direction:column;gap:7px;margin-top:12px;padding-top:10px}
41316
+ .dshq-cache-recent-title{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600}
41317
+ .dshq-cache-recent-row{align-items:center;display:flex;flex-wrap:wrap;gap:5px 12px}
41318
+ .dshq-cache-recent-model{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600}
41319
+ .dshq-cache-recent-meta{color:var(--dsw-alias-label-tertiary);font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;overflow-wrap:anywhere}
41320
+ .dshq-cache-recent-value{color:var(--dsw-alias-label-secondary);font-size:11px;margin-left:auto}
41321
+
41241
41322
  /* 补充说明的折叠区:原句一个不少,只是默认收起。 */
41242
41323
  .dshq-details{border-top:0.5px solid var(--dsw-alias-border-l2);padding:10px 0 2px}
41243
41324
  .dshq-details>summary{color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;line-height:1.5;list-style:none;user-select:none}
@@ -71447,9 +71528,9 @@ window.__ModuleLoader__.load({
71447
71528
  },
71448
71529
  timeout: {
71449
71530
  min: 1e3,
71450
- max: 3e5,
71531
+ max: 54e4,
71451
71532
  step: 1,
71452
- fallback: 3e5
71533
+ fallback: 54e4
71453
71534
  },
71454
71535
  retries: {
71455
71536
  min: 0,