dsh-codearts 1.2.7 → 1.2.9

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,32 @@
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.2.9] - 2026-11-06
7
+
8
+ ### 变更
9
+
10
+ - **热力图的悬停提示统一成明细卡**:日历格子和逐小时格子原来只有浏览器原生
11
+ `title`(一个灰底小文字框),下面再挂一行同内容的小字;现在和「按账号 / 按模型」
12
+ 的用量条共用同一张悬停卡 —— 标题、分隔线、输入 / 输出 / 思考 / 缓存 / 请求 /
13
+ 命中率,数字精确到个位。卡片贴着指针画(格子只有 36px 宽,锚在格子上会横穿整张
14
+ 卡片),靠近视口右/下边界时自动翻到另一侧。底部那行改成固定的操作提示,不再复述
15
+ 明细。
16
+
17
+ ## [1.2.8] - 2026-11-05
18
+
19
+ ### 变更
20
+
21
+ - **用量页的柱状图改成当月日历热力图**:7 列是周一到周日,从 1 号铺到最后一天,
22
+ 格子里的数字是「几号」,底色深浅是那天的 token 量分 5 档。绿阶取自 agent-acta
23
+ 的活跃热力图(`#ddf4e7` → `#16a34a`),不再拿主题灰做档位 —— 灰阶在深色卡片上
24
+ 根本分不出档。没用量但属于本月的格子留浅底,本月未来的日子只留压暗的日期数字,
25
+ 今天用加粗 + 底部一条同色短线标出来(不画边框:浅色主题下内描边会被读成一圈黑边)。
26
+ 图例「少 ▢▢▢▢▢ 多」在日历正上方(不在日历和明细行之间),色块和格子同源。
27
+ 悬停任意一格,底部那行显示当天的输入 / 缓存 / 命中率 / 请求数,和 `title` 一致。
28
+ - **逐小时也改成一格一格的**:今天 24 格一行,同一套绿阶,轴每 6 格标一个钟点。
29
+ - **趋势窗口从 7 天扩到 35 天**:`usage.recentDays` 由 7 格变 35 格(刚好覆盖任意一个
30
+ 自然月);旧宿主只给 7 格时照常画,月历里没数据的日子会退成压暗的日期。
31
+
6
32
  ## [1.2.7] - 2026-11-05
7
33
 
8
34
  ### 变更
package/lib/bin.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { R as isBenefitModel, V as CodeArtsAccountStore, W as codeartsAccountsPath, d as fetchCallerIdentity, n as codeartsUsagePath, r as discoverModels, t as CodeArtsUsageTracker } from "./usage-4B0o-CQN.mjs";
2
+ import { R as isBenefitModel, V as CodeArtsAccountStore, W as codeartsAccountsPath, d as fetchCallerIdentity, n as codeartsUsagePath, r as discoverModels, t as CodeArtsUsageTracker } from "./usage-B2LNsUuR.mjs";
3
3
  import { existsSync, statSync } from "node:fs";
4
4
  //#region src/version.ts
5
- const CODEARTS_VERSION = "1.2.7";
5
+ const CODEARTS_VERSION = "1.2.9";
6
6
  //#endregion
7
7
  //#region src/bin.ts
8
8
  /**
@@ -89,6 +89,11 @@ interface CodeArtsSettingsKey {
89
89
  usageTrendHint: string;
90
90
  /** 逐小时是本次新增口径,启用前的小时不回填。 */
91
91
  usageTrendHourEmpty: string;
92
+ /** 热力图顶上的星期行(周一…周日,空格分隔,前端 split(' ') 成 7 列)。 */
93
+ usageHeatWeekdays: string;
94
+ /** 热力图档位图例的两端:少 ▢▢▢▢▢ 多。 */
95
+ usageHeatLess: string;
96
+ usageHeatMore: string;
92
97
  usageRequests: string;
93
98
  usageByAccount: string;
94
99
  usageRequestCount: string;
@@ -62,7 +62,7 @@ function subscribeSidebarPanelWanted(listener) {
62
62
  }
63
63
  //#endregion
64
64
  //#region \0dsh-css:/home/runner/work/dsh-codearts/dsh-codearts/src/client/CodeArtsPluginCard.module.css.mjs
65
- const css$1 = ".xoziZG_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-settings-card-fill);max-width:720px}.xoziZG_header{align-items:flex-start;gap:12px;padding:14px 16px;display:flex}.xoziZG_headText{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.xoziZG_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:22px}.xoziZG_desc{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px}.xoziZG_statusLine{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-size:14px;font-weight:500;line-height:22px;display:inline-flex}.xoziZG_meta{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px;line-height:18px}.xoziZG_body{border-top:.5px solid var(--dsw-alias-border-l2);margin:0 16px;padding:4px 0 16px}.xoziZG_tabs{margin-top:12px}.xoziZG_tabPanel{padding-top:2px}.xoziZG_accountToolbar{gap:8px;margin-top:12px;display:flex}.xoziZG_accountToolbar>*{flex:1}.xoziZG_manualForm{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);margin-top:12px;padding:12px}.xoziZG_accountCard{flex-direction:column;gap:10px;margin-top:12px;display:flex}.xoziZG_accountEntry{border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-2)}.xoziZG_accountRow{align-items:center;gap:10px;padding:12px;display:flex}.xoziZG_claimAllRow{border-top:.5px solid var(--dsw-alias-border-l2);justify-content:flex-end;padding:10px 12px 0;display:flex}.xoziZG_avatar{background:var(--dsw-alias-bg-layer-3);width:32px;height:32px;color:var(--dsw-alias-label-primary);border-radius:50%;flex:none;justify-content:center;align-items:center;font-size:14px;font-weight:600;display:inline-flex}.xoziZG_accountInfo{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.xoziZG_accountNameRow{align-items:center;gap:6px;min-width:0;display:flex}.xoziZG_accountName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;line-height:20px;overflow:hidden}.xoziZG_accountRowActions{flex:none;gap:6px;display:flex}.xoziZG_accountHint{color:var(--dsw-alias-label-tertiary);margin:0;padding:0 12px 12px;font-size:12px;line-height:18px}.xoziZG_creditBlock{border-top:.5px solid var(--dsw-alias-border-l2);padding:12px}.xoziZG_balanceRow{flex-wrap:wrap;align-items:baseline;gap:6px;display:flex}.xoziZG_balance{color:var(--dsw-alias-label-primary);letter-spacing:-.02em;font-variant-numeric:tabular-nums;font-size:28px;font-weight:600;line-height:34px}.xoziZG_balanceUnit{color:var(--dsw-alias-label-secondary);font-size:12px}.xoziZG_balanceMeta{color:var(--dsw-alias-label-tertiary);margin-left:2px;font-size:12px}.xoziZG_updated{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:auto;font-size:12px}.xoziZG_creditRows{flex-direction:column;gap:4px;margin-top:8px;display:flex}.xoziZG_creditRow{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;justify-content:space-between;align-items:baseline;gap:12px;font-size:12px;line-height:18px;display:flex}.xoziZG_usageBar{background:var(--dsw-alias-border-l2);border-radius:2px;height:4px;margin-top:4px;display:block;overflow:hidden}.xoziZG_usageFill{background:var(--dsw-alias-brand-primary);border-radius:2px;height:100%;transition:width .2s;display:block}.xoziZG_expiryRow{margin-top:2px}.xoziZG_expiryLabel{color:var(--dsw-alias-state-warn-label)}.xoziZG_bar{background:var(--dsw-alias-bg-layer-3);border-radius:2px;height:4px;margin-top:6px;display:block;overflow:hidden}.xoziZG_barFill{background:var(--dsw-alias-state-warn-primary);border-radius:2px;height:100%;display:block}.xoziZG_creditLink{margin-top:8px;display:inline-block}.xoziZG_creditFooter{border-top:.5px solid var(--dsw-alias-border-l2);justify-content:space-between;align-items:center;gap:8px;margin-top:12px;padding-top:10px;display:flex}.xoziZG_creditHint{color:var(--dsw-alias-label-tertiary);margin:8px 0 0;font-size:12px;line-height:18px}.xoziZG_section{margin-top:16px}.xoziZG_sectionHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.xoziZG_sectionLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:500}.xoziZG_count{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:12px}.xoziZG_hint{color:var(--dsw-alias-label-secondary);margin:8px 0 0;font-size:13px;line-height:20px}.xoziZG_error{color:var(--dsw-alias-state-error-primary);margin:10px 0 0;font-size:13px;line-height:20px}.xoziZG_actions{flex-wrap:wrap;align-items:center;gap:8px;margin-top:12px;display:flex}.xoziZG_danger{color:var(--dsw-alias-state-error-primary)}.xoziZG_link{appearance:none;color:var(--dsw-alias-brand-text);font:inherit;text-align:left;word-break:break-all;cursor:pointer;background:0 0;border:none;padding:0;font-size:12px}.xoziZG_link:hover{text-decoration:underline}.xoziZG_choices{flex-direction:column;gap:2px;margin-top:8px;display:flex}.xoziZG_choiceRow{border-radius:var(--dsw-radius-sm);align-items:center;gap:8px;margin:0 -6px;padding:5px 6px;display:flex}.xoziZG_choiceRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.xoziZG_statGrid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 14px;display:grid}.xoziZG_statCard{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);flex-direction:column;gap:1px;padding:8px 10px;display:flex}.xoziZG_statLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.xoziZG_statValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:15px;line-height:20px}.xoziZG_statSub{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.xoziZG_modelChart{flex-direction:column;gap:2px;margin-top:8px;display:flex}.xoziZG_modelRow{font-variant-numeric:tabular-nums;border-radius:6px;grid-template-columns:minmax(0,1.2fr) minmax(48px,1fr) 56px 52px 64px;align-items:center;gap:8px;padding:4px 0;display:grid;position:relative}.xoziZG_modelRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.xoziZG_usageTip{z-index:5;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);min-width:180px;max-width:260px;color:var(--dsw-alias-label-secondary);text-align:left;font-variant-numeric:tabular-nums;pointer-events:none;padding:8px 10px;font-size:12px;line-height:1.9;position:absolute;bottom:calc(100% + 6px);right:0;box-shadow:0 10px 28px #00000073}.xoziZG_usageTipName{max-width:240px;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.xoziZG_usageTipSep{background:var(--dsw-alias-border-l2);height:1px;margin:4px 0}.xoziZG_usageTipRow{justify-content:space-between;gap:24px;display:flex}.xoziZG_usageTipRow span:last-child{color:var(--dsw-alias-label-primary);font-weight:600}.xoziZG_modelName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.xoziZG_modelTrack{background:var(--dsw-alias-border-l2);border-radius:4px;height:8px;display:block;overflow:hidden}.xoziZG_modelFill{background:var(--dsw-alias-brand-primary);border-radius:4px;height:100%;transition:width .16s;display:block}.xoziZG_modelTokens,.xoziZG_modelShare,.xoziZG_modelRequests{color:var(--dsw-alias-label-secondary);text-align:right;white-space:nowrap;font-size:11px;line-height:16px}.xoziZG_modelRequests{color:var(--dsw-alias-label-tertiary)}.xoziZG_trendBars{align-items:flex-end;gap:3px;height:44px;margin:8px 0 2px;display:flex}.xoziZG_trendSlot{flex-direction:column;flex:1;justify-content:flex-end;min-width:0;height:100%;display:flex}.xoziZG_trendBar{background:var(--dsw-alias-brand-primary);border-radius:2px 2px 0 0;min-height:2px;transition:height .16s,background .16s}.xoziZG_trendBar[data-tone=mid]{background:var(--dsw-alias-state-warn-label)}.xoziZG_trendBar[data-tone=low]{background:var(--dsw-alias-state-error-primary,var(--dsw-alias-state-warn-label))}.xoziZG_trendBar[data-tone=empty]{background:var(--dsw-alias-border-l2)}.xoziZG_trendAxis{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;gap:3px;font-size:10px;line-height:14px;display:flex}.xoziZG_trendAxisSlot{text-align:center;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.xoziZG_trendTip{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;margin:2px 0 0;font-size:11px;line-height:16px}.xoziZG_check{flex:1;min-width:0}.xoziZG_check>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.xoziZG_manual{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);margin-top:12px;padding:0 12px}.xoziZG_manual[open]{padding-bottom:12px}.xoziZG_manualSummary{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:6px;padding:9px 0;font-size:13px;list-style:none;display:flex}.xoziZG_manualSummary::-webkit-details-marker{display:none}.xoziZG_field{flex-direction:column;gap:5px;margin-top:10px;display:flex}.xoziZG_fieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px}.xoziZG_area{box-sizing:border-box;resize:vertical;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:20px}.xoziZG_area::placeholder{color:var(--dsw-alias-label-dimmed)}.xoziZG_area:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}.xoziZG_skeleton{flex-direction:column;gap:10px;padding:4px 0;display:flex}.xoziZG_skeletonRow{border-radius:var(--dsw-radius-sm,4px);background:var(--dsw-alias-border-l2);height:12px;animation:1.4s ease-in-out infinite xoziZG_skeletonBreath}.xoziZG_skeletonRow:nth-child(2){width:72%}.xoziZG_skeletonRow:nth-child(3){width:46%}@keyframes xoziZG_skeletonBreath{0%,to{opacity:.45}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.xoziZG_skeletonRow{animation:none}}";
65
+ const css$1 = ".xoziZG_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-settings-card-fill);max-width:720px}.xoziZG_header{align-items:flex-start;gap:12px;padding:14px 16px;display:flex}.xoziZG_headText{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.xoziZG_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:22px}.xoziZG_desc{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px}.xoziZG_statusLine{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-size:14px;font-weight:500;line-height:22px;display:inline-flex}.xoziZG_meta{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px;line-height:18px}.xoziZG_body{border-top:.5px solid var(--dsw-alias-border-l2);margin:0 16px;padding:4px 0 16px}.xoziZG_tabs{margin-top:12px}.xoziZG_tabPanel{padding-top:2px}.xoziZG_accountToolbar{gap:8px;margin-top:12px;display:flex}.xoziZG_accountToolbar>*{flex:1}.xoziZG_manualForm{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);margin-top:12px;padding:12px}.xoziZG_accountCard{flex-direction:column;gap:10px;margin-top:12px;display:flex}.xoziZG_accountEntry{border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-2)}.xoziZG_accountRow{align-items:center;gap:10px;padding:12px;display:flex}.xoziZG_claimAllRow{border-top:.5px solid var(--dsw-alias-border-l2);justify-content:flex-end;padding:10px 12px 0;display:flex}.xoziZG_avatar{background:var(--dsw-alias-bg-layer-3);width:32px;height:32px;color:var(--dsw-alias-label-primary);border-radius:50%;flex:none;justify-content:center;align-items:center;font-size:14px;font-weight:600;display:inline-flex}.xoziZG_accountInfo{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.xoziZG_accountNameRow{align-items:center;gap:6px;min-width:0;display:flex}.xoziZG_accountName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;line-height:20px;overflow:hidden}.xoziZG_accountRowActions{flex:none;gap:6px;display:flex}.xoziZG_accountHint{color:var(--dsw-alias-label-tertiary);margin:0;padding:0 12px 12px;font-size:12px;line-height:18px}.xoziZG_creditBlock{border-top:.5px solid var(--dsw-alias-border-l2);padding:12px}.xoziZG_balanceRow{flex-wrap:wrap;align-items:baseline;gap:6px;display:flex}.xoziZG_balance{color:var(--dsw-alias-label-primary);letter-spacing:-.02em;font-variant-numeric:tabular-nums;font-size:28px;font-weight:600;line-height:34px}.xoziZG_balanceUnit{color:var(--dsw-alias-label-secondary);font-size:12px}.xoziZG_balanceMeta{color:var(--dsw-alias-label-tertiary);margin-left:2px;font-size:12px}.xoziZG_updated{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:auto;font-size:12px}.xoziZG_creditRows{flex-direction:column;gap:4px;margin-top:8px;display:flex}.xoziZG_creditRow{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;justify-content:space-between;align-items:baseline;gap:12px;font-size:12px;line-height:18px;display:flex}.xoziZG_usageBar{background:var(--dsw-alias-border-l2);border-radius:2px;height:4px;margin-top:4px;display:block;overflow:hidden}.xoziZG_usageFill{background:var(--dsw-alias-brand-primary);border-radius:2px;height:100%;transition:width .2s;display:block}.xoziZG_expiryRow{margin-top:2px}.xoziZG_expiryLabel{color:var(--dsw-alias-state-warn-label)}.xoziZG_bar{background:var(--dsw-alias-bg-layer-3);border-radius:2px;height:4px;margin-top:6px;display:block;overflow:hidden}.xoziZG_barFill{background:var(--dsw-alias-state-warn-primary);border-radius:2px;height:100%;display:block}.xoziZG_creditLink{margin-top:8px;display:inline-block}.xoziZG_creditFooter{border-top:.5px solid var(--dsw-alias-border-l2);justify-content:space-between;align-items:center;gap:8px;margin-top:12px;padding-top:10px;display:flex}.xoziZG_creditHint{color:var(--dsw-alias-label-tertiary);margin:8px 0 0;font-size:12px;line-height:18px}.xoziZG_section{margin-top:16px}.xoziZG_sectionHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.xoziZG_sectionLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:500}.xoziZG_count{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:12px}.xoziZG_hint{color:var(--dsw-alias-label-secondary);margin:8px 0 0;font-size:13px;line-height:20px}.xoziZG_error{color:var(--dsw-alias-state-error-primary);margin:10px 0 0;font-size:13px;line-height:20px}.xoziZG_actions{flex-wrap:wrap;align-items:center;gap:8px;margin-top:12px;display:flex}.xoziZG_danger{color:var(--dsw-alias-state-error-primary)}.xoziZG_link{appearance:none;color:var(--dsw-alias-brand-text);font:inherit;text-align:left;word-break:break-all;cursor:pointer;background:0 0;border:none;padding:0;font-size:12px}.xoziZG_link:hover{text-decoration:underline}.xoziZG_choices{flex-direction:column;gap:2px;margin-top:8px;display:flex}.xoziZG_choiceRow{border-radius:var(--dsw-radius-sm);align-items:center;gap:8px;margin:0 -6px;padding:5px 6px;display:flex}.xoziZG_choiceRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.xoziZG_statGrid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 14px;display:grid}.xoziZG_statCard{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);flex-direction:column;gap:1px;padding:8px 10px;display:flex}.xoziZG_statLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.xoziZG_statValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:15px;line-height:20px}.xoziZG_statSub{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.xoziZG_modelChart{flex-direction:column;gap:2px;margin-top:8px;display:flex}.xoziZG_modelRow{font-variant-numeric:tabular-nums;border-radius:6px;grid-template-columns:minmax(0,1.2fr) minmax(48px,1fr) 56px 52px 64px;align-items:center;gap:8px;padding:4px 0;display:grid;position:relative}.xoziZG_modelRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.xoziZG_usageTip{z-index:5;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);min-width:180px;max-width:260px;color:var(--dsw-alias-label-secondary);text-align:left;font-variant-numeric:tabular-nums;pointer-events:none;padding:8px 10px;font-size:12px;line-height:1.9;position:absolute;bottom:calc(100% + 6px);right:0;box-shadow:0 10px 28px #00000073}.xoziZG_usageTip[data-float=true]{z-index:40;position:fixed;bottom:auto;right:auto}.xoziZG_usageTipName{max-width:240px;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.xoziZG_usageTipSep{background:var(--dsw-alias-border-l2);height:1px;margin:4px 0}.xoziZG_usageTipRow{justify-content:space-between;gap:24px;display:flex}.xoziZG_usageTipRow span:last-child{color:var(--dsw-alias-label-primary);font-weight:600}.xoziZG_modelName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.xoziZG_modelTrack{background:var(--dsw-alias-border-l2);border-radius:4px;height:8px;display:block;overflow:hidden}.xoziZG_modelFill{background:var(--dsw-alias-brand-primary);border-radius:4px;height:100%;transition:width .16s;display:block}.xoziZG_modelTokens,.xoziZG_modelShare,.xoziZG_modelRequests{color:var(--dsw-alias-label-secondary);text-align:right;white-space:nowrap;font-size:11px;line-height:16px}.xoziZG_modelRequests{color:var(--dsw-alias-label-tertiary)}.xoziZG_heatGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;margin:8px 0 2px;display:grid}.xoziZG_heatWeekday{color:var(--dsw-alias-label-tertiary);text-align:center;font-size:10px;line-height:14px}.xoziZG_heatCell{background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent);height:36px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;border:0;border-radius:8px;outline:0;justify-content:center;align-items:center;font-size:12px;transition:background .12s ease-out;display:flex}.xoziZG_heatCell[data-tone=empty]{color:var(--dsw-alias-label-tertiary)}.xoziZG_heatCell[data-tone=pad]{background:0 0}.xoziZG_heatCell[data-tone=out]{color:var(--dsw-alias-label-tertiary);opacity:.45;background:0 0}.xoziZG_heatCell[data-tone=lv1]{color:#0f1115;background:#ddf4e7}.xoziZG_heatCell[data-tone=lv2]{color:#0f1115;background:#b3e8cc}.xoziZG_heatCell[data-tone=lv3]{color:#0f1115;background:#7dd8ac}.xoziZG_heatCell[data-tone=lv4]{color:#fff;background:#40c584}.xoziZG_heatCell[data-tone=lv5]{color:#fff;background:#16a34a}.xoziZG_heatCell[data-today=true]{font-weight:700;box-shadow:inset 0 -2px}.xoziZG_heatHours{grid-template-columns:repeat(24,minmax(0,1fr));gap:3px;margin:8px 0 0;display:grid}.xoziZG_heatHourCell{background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent);border-radius:4px;height:26px;transition:background .12s ease-out}.xoziZG_heatHourCell[data-tone=lv1]{background:#ddf4e7}.xoziZG_heatHourCell[data-tone=lv2]{background:#b3e8cc}.xoziZG_heatHourCell[data-tone=lv3]{background:#7dd8ac}.xoziZG_heatHourCell[data-tone=lv4]{background:#40c584}.xoziZG_heatHourCell[data-tone=lv5]{background:#16a34a}.xoziZG_heatAxis{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;grid-template-columns:repeat(24,minmax(0,1fr));gap:3px;font-size:10px;line-height:14px;display:grid}.xoziZG_heatAxisSlot{text-align:center;white-space:nowrap;overflow:hidden}.xoziZG_heatLegend{color:var(--dsw-alias-label-tertiary);justify-content:flex-start;align-items:center;gap:3px;margin:0 0 6px;font-size:10px;display:flex}.xoziZG_heatLegendChip{border-radius:3px;width:10px;height:10px}.xoziZG_heatLegendChip[data-tone=lv1]{background:#ddf4e7}.xoziZG_heatLegendChip[data-tone=lv2]{background:#b3e8cc}.xoziZG_heatLegendChip[data-tone=lv3]{background:#7dd8ac}.xoziZG_heatLegendChip[data-tone=lv4]{background:#40c584}.xoziZG_heatLegendChip[data-tone=lv5]{background:#16a34a}.xoziZG_trendTip{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;margin:2px 0 0;font-size:11px;line-height:16px}.xoziZG_check{flex:1;min-width:0}.xoziZG_check>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.xoziZG_manual{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);margin-top:12px;padding:0 12px}.xoziZG_manual[open]{padding-bottom:12px}.xoziZG_manualSummary{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:6px;padding:9px 0;font-size:13px;list-style:none;display:flex}.xoziZG_manualSummary::-webkit-details-marker{display:none}.xoziZG_field{flex-direction:column;gap:5px;margin-top:10px;display:flex}.xoziZG_fieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px}.xoziZG_area{box-sizing:border-box;resize:vertical;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:20px}.xoziZG_area::placeholder{color:var(--dsw-alias-label-dimmed)}.xoziZG_area:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}.xoziZG_skeleton{flex-direction:column;gap:10px;padding:4px 0;display:flex}.xoziZG_skeletonRow{border-radius:var(--dsw-radius-sm,4px);background:var(--dsw-alias-border-l2);height:12px;animation:1.4s ease-in-out infinite xoziZG_skeletonBreath}.xoziZG_skeletonRow:nth-child(2){width:72%}.xoziZG_skeletonRow:nth-child(3){width:46%}@keyframes xoziZG_skeletonBreath{0%,to{opacity:.45}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.xoziZG_skeletonRow{animation:none}}";
66
66
  const tagId$1 = "dsh-codearts/CodeArtsPluginCard.module.css";
67
67
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
68
68
  const tag = document.createElement("style");
@@ -72,88 +72,92 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
72
72
  document.head.appendChild(tag);
73
73
  }
74
74
  var CodeArtsPluginCard_module_css_default = {
75
- "section": "xoziZG_section",
75
+ "statValue": "xoziZG_statValue",
76
+ "statSub": "xoziZG_statSub",
77
+ "check": "xoziZG_check",
78
+ "body": "xoziZG_body",
79
+ "barFill": "xoziZG_barFill",
80
+ "statCard": "xoziZG_statCard",
81
+ "heatWeekday": "xoziZG_heatWeekday",
76
82
  "creditBlock": "xoziZG_creditBlock",
77
- "balance": "xoziZG_balance",
78
- "usageTipSep": "xoziZG_usageTipSep",
79
- "trendAxisSlot": "xoziZG_trendAxisSlot",
80
- "skeletonRow": "xoziZG_skeletonRow",
81
- "updated": "xoziZG_updated",
83
+ "accountCard": "xoziZG_accountCard",
84
+ "card": "xoziZG_card",
85
+ "sectionLabel": "xoziZG_sectionLabel",
86
+ "error": "xoziZG_error",
82
87
  "desc": "xoziZG_desc",
83
- "creditHint": "xoziZG_creditHint",
84
- "modelChart": "xoziZG_modelChart",
85
- "creditRow": "xoziZG_creditRow",
88
+ "accountRowActions": "xoziZG_accountRowActions",
89
+ "modelRow": "xoziZG_modelRow",
90
+ "balanceUnit": "xoziZG_balanceUnit",
91
+ "balance": "xoziZG_balance",
92
+ "usageTipRow": "xoziZG_usageTipRow",
86
93
  "bar": "xoziZG_bar",
87
- "statusLine": "xoziZG_statusLine",
88
- "trendAxis": "xoziZG_trendAxis",
89
- "modelShare": "xoziZG_modelShare",
90
- "statSub": "xoziZG_statSub",
91
- "tabs": "xoziZG_tabs",
92
94
  "accountRow": "xoziZG_accountRow",
93
- "choices": "xoziZG_choices",
94
- "usageTip": "xoziZG_usageTip",
95
- "balanceUnit": "xoziZG_balanceUnit",
96
- "accountNameRow": "xoziZG_accountNameRow",
97
- "accountRowActions": "xoziZG_accountRowActions",
98
- "creditRows": "xoziZG_creditRows",
95
+ "heatHourCell": "xoziZG_heatHourCell",
96
+ "header": "xoziZG_header",
97
+ "meta": "xoziZG_meta",
98
+ "tabs": "xoziZG_tabs",
99
+ "modelChart": "xoziZG_modelChart",
99
100
  "usageTipName": "xoziZG_usageTipName",
100
- "creditFooter": "xoziZG_creditFooter",
101
- "error": "xoziZG_error",
101
+ "accountName": "xoziZG_accountName",
102
+ "heatCell": "xoziZG_heatCell",
103
+ "heatLegend": "xoziZG_heatLegend",
104
+ "section": "xoziZG_section",
102
105
  "modelFill": "xoziZG_modelFill",
103
- "expiryLabel": "xoziZG_expiryLabel",
104
- "manualSummary": "xoziZG_manualSummary",
105
- "expiryRow": "xoziZG_expiryRow",
106
- "check": "xoziZG_check",
107
- "link": "xoziZG_link",
108
- "sectionLabel": "xoziZG_sectionLabel",
109
- "area": "xoziZG_area",
110
- "skeleton": "xoziZG_skeleton",
111
- "trendBars": "xoziZG_trendBars",
112
- "field": "xoziZG_field",
113
- "modelName": "xoziZG_modelName",
114
- "usageTipRow": "xoziZG_usageTipRow",
115
- "card": "xoziZG_card",
116
- "meta": "xoziZG_meta",
106
+ "accountNameRow": "xoziZG_accountNameRow",
117
107
  "claimAllRow": "xoziZG_claimAllRow",
118
- "sectionHead": "xoziZG_sectionHead",
119
- "usageFill": "xoziZG_usageFill",
120
- "modelRequests": "xoziZG_modelRequests",
121
- "trendTip": "xoziZG_trendTip",
122
- "fieldLabel": "xoziZG_fieldLabel",
123
- "statGrid": "xoziZG_statGrid",
124
- "skeletonBreath": "xoziZG_skeletonBreath",
125
- "modelTokens": "xoziZG_modelTokens",
126
- "trendBar": "xoziZG_trendBar",
127
- "tabPanel": "xoziZG_tabPanel",
128
108
  "creditLink": "xoziZG_creditLink",
129
- "name": "xoziZG_name",
130
- "accountHint": "xoziZG_accountHint",
131
109
  "choiceRow": "xoziZG_choiceRow",
132
- "modelTrack": "xoziZG_modelTrack",
133
- "accountToolbar": "xoziZG_accountToolbar",
134
- "accountCard": "xoziZG_accountCard",
135
- "accountEntry": "xoziZG_accountEntry",
136
- "danger": "xoziZG_danger",
137
- "trendSlot": "xoziZG_trendSlot",
138
- "headText": "xoziZG_headText",
139
- "count": "xoziZG_count",
110
+ "updated": "xoziZG_updated",
111
+ "statGrid": "xoziZG_statGrid",
112
+ "field": "xoziZG_field",
113
+ "creditRows": "xoziZG_creditRows",
114
+ "modelRequests": "xoziZG_modelRequests",
140
115
  "manual": "xoziZG_manual",
141
- "accountName": "xoziZG_accountName",
142
- "balanceRow": "xoziZG_balanceRow",
143
- "avatar": "xoziZG_avatar",
116
+ "skeletonRow": "xoziZG_skeletonRow",
117
+ "expiryRow": "xoziZG_expiryRow",
144
118
  "manualForm": "xoziZG_manualForm",
119
+ "name": "xoziZG_name",
120
+ "usageTip": "xoziZG_usageTip",
121
+ "avatar": "xoziZG_avatar",
122
+ "heatAxisSlot": "xoziZG_heatAxisSlot",
123
+ "modelTokens": "xoziZG_modelTokens",
124
+ "expiryLabel": "xoziZG_expiryLabel",
125
+ "heatHours": "xoziZG_heatHours",
126
+ "heatLegendChip": "xoziZG_heatLegendChip",
127
+ "heatGrid": "xoziZG_heatGrid",
128
+ "accountEntry": "xoziZG_accountEntry",
129
+ "modelName": "xoziZG_modelName",
130
+ "heatAxis": "xoziZG_heatAxis",
131
+ "fieldLabel": "xoziZG_fieldLabel",
145
132
  "hint": "xoziZG_hint",
146
- "statValue": "xoziZG_statValue",
147
- "header": "xoziZG_header",
133
+ "creditRow": "xoziZG_creditRow",
134
+ "creditFooter": "xoziZG_creditFooter",
135
+ "creditHint": "xoziZG_creditHint",
136
+ "manualSummary": "xoziZG_manualSummary",
137
+ "skeleton": "xoziZG_skeleton",
138
+ "headText": "xoziZG_headText",
139
+ "usageTipSep": "xoziZG_usageTipSep",
148
140
  "accountInfo": "xoziZG_accountInfo",
149
- "statLabel": "xoziZG_statLabel",
150
- "modelRow": "xoziZG_modelRow",
151
- "body": "xoziZG_body",
141
+ "link": "xoziZG_link",
152
142
  "balanceMeta": "xoziZG_balanceMeta",
153
- "barFill": "xoziZG_barFill",
143
+ "danger": "xoziZG_danger",
144
+ "trendTip": "xoziZG_trendTip",
145
+ "skeletonBreath": "xoziZG_skeletonBreath",
146
+ "count": "xoziZG_count",
147
+ "modelShare": "xoziZG_modelShare",
148
+ "statusLine": "xoziZG_statusLine",
149
+ "usageFill": "xoziZG_usageFill",
150
+ "usageBar": "xoziZG_usageBar",
151
+ "choices": "xoziZG_choices",
152
+ "balanceRow": "xoziZG_balanceRow",
154
153
  "actions": "xoziZG_actions",
155
- "statCard": "xoziZG_statCard",
156
- "usageBar": "xoziZG_usageBar"
154
+ "modelTrack": "xoziZG_modelTrack",
155
+ "accountHint": "xoziZG_accountHint",
156
+ "tabPanel": "xoziZG_tabPanel",
157
+ "accountToolbar": "xoziZG_accountToolbar",
158
+ "sectionHead": "xoziZG_sectionHead",
159
+ "area": "xoziZG_area",
160
+ "statLabel": "xoziZG_statLabel"
157
161
  };
158
162
  //#endregion
159
163
  //#region src/client/CodeArtsPluginCard.tsx
@@ -440,6 +444,62 @@ function hitPercentOf(totals) {
440
444
  return Math.min(100, Math.round(cached / totals.promptTokens * 100));
441
445
  }
442
446
  /**
447
+ * 悬停明细卡的正文:标题(账号 / 模型 / 日期 / 钟点)+ 输入 / 输出 / 思考 / 缓存 /
448
+ * 请求 / 命中率。用量条和热力图格子共用这一份,改文案或加字段只需动这里。
449
+ */
450
+ function UsageTipBody({ label, totals, t }) {
451
+ const cached = totals.cachedTokens;
452
+ const pct = hitPercentOf(totals);
453
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
454
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
455
+ className: CodeArtsPluginCard_module_css_default.usageTipName,
456
+ children: label
457
+ }),
458
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: CodeArtsPluginCard_module_css_default.usageTipSep }),
459
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
460
+ className: CodeArtsPluginCard_module_css_default.usageTipRow,
461
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipInput") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: exactCount(totals.promptTokens) })]
462
+ }),
463
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
464
+ className: CodeArtsPluginCard_module_css_default.usageTipRow,
465
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipOutput") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: exactCount(totals.completionTokens) })]
466
+ }),
467
+ (totals.reasoningTokens ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
468
+ className: CodeArtsPluginCard_module_css_default.usageTipRow,
469
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipReasoning") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: exactCount(totals.reasoningTokens ?? 0) })]
470
+ }),
471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
472
+ className: CodeArtsPluginCard_module_css_default.usageTipRow,
473
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipCached") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: cached === void 0 ? t("usageTipNoCache") : exactCount(cached) })]
474
+ }),
475
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: CodeArtsPluginCard_module_css_default.usageTipSep }),
476
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
477
+ className: CodeArtsPluginCard_module_css_default.usageTipRow,
478
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipRequests") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageRequestCount", { n: formatCount(totals.requests) }) })]
479
+ }),
480
+ pct !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
481
+ className: CodeArtsPluginCard_module_css_default.usageTipRow,
482
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipHit") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [pct, "%"] })]
483
+ })
484
+ ] });
485
+ }
486
+ /**
487
+ * 悬停卡贴着指针画:热力图格子只有 36px 宽,卡片锚在格子上会横穿整张卡片,
488
+ * 所以和 agent-acta 一样用 fixed + 指针坐标,靠近右下边界时翻到另一侧。
489
+ */
490
+ function tipPointStyle(point) {
491
+ const width = 230;
492
+ const height = 190;
493
+ const viewWidth = typeof window === "undefined" ? 0 : window.innerWidth;
494
+ const viewHeight = typeof window === "undefined" ? 0 : window.innerHeight;
495
+ const left = viewWidth > 0 && point.x + 16 + width > viewWidth ? point.x - 16 - width : point.x + 16;
496
+ const top = viewHeight > 0 && point.y + 16 + height > viewHeight ? point.y - 16 - height : point.y + 16;
497
+ return {
498
+ left: Math.max(8, left),
499
+ top: Math.max(8, top)
500
+ };
501
+ }
502
+ /**
443
503
  * 横向条形列表:名称 / 条 / token / 占比 / 请求数。
444
504
  *
445
505
  * 条长按「占组内总量的比例」画(不是按最大值归一化),所以几条加起来就是全部。
@@ -459,8 +519,6 @@ function UsageBars({ rows, t }) {
459
519
  const value = valueOf(row);
460
520
  const share = sum > 0 ? value / sum * 100 : 0;
461
521
  const totals = row.totals;
462
- const cached = totals.cachedTokens;
463
- const pct = hitPercentOf(totals);
464
522
  const detail = [t("usageRequests", { n: formatCount(totals.requests) }), t("usageTokens", {
465
523
  prompt: formatTokens$1(totals.promptTokens),
466
524
  completion: formatTokens$1(totals.completionTokens)
@@ -494,104 +552,181 @@ function UsageBars({ rows, t }) {
494
552
  className: CodeArtsPluginCard_module_css_default.modelRequests,
495
553
  children: t("usageRequestCount", { n: formatCount(totals.requests) })
496
554
  }),
497
- hovered === row.id && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
555
+ hovered === row.id && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
498
556
  className: CodeArtsPluginCard_module_css_default.usageTip,
499
557
  role: "tooltip",
500
- children: [
501
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
502
- className: CodeArtsPluginCard_module_css_default.usageTipName,
503
- children: row.label
504
- }),
505
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: CodeArtsPluginCard_module_css_default.usageTipSep }),
506
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
507
- className: CodeArtsPluginCard_module_css_default.usageTipRow,
508
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipInput") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: exactCount(totals.promptTokens) })]
509
- }),
510
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
511
- className: CodeArtsPluginCard_module_css_default.usageTipRow,
512
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipOutput") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: exactCount(totals.completionTokens) })]
513
- }),
514
- (totals.reasoningTokens ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
515
- className: CodeArtsPluginCard_module_css_default.usageTipRow,
516
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipReasoning") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: exactCount(totals.reasoningTokens ?? 0) })]
517
- }),
518
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
519
- className: CodeArtsPluginCard_module_css_default.usageTipRow,
520
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipCached") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: cached === void 0 ? t("usageTipNoCache") : exactCount(cached) })]
521
- }),
522
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: CodeArtsPluginCard_module_css_default.usageTipSep }),
523
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
524
- className: CodeArtsPluginCard_module_css_default.usageTipRow,
525
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipRequests") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageRequestCount", { n: formatCount(totals.requests) }) })]
526
- }),
527
- pct !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
528
- className: CodeArtsPluginCard_module_css_default.usageTipRow,
529
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageTipHit") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [pct, "%"] })]
530
- })
531
- ]
558
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageTipBody, {
559
+ label: row.label,
560
+ totals,
561
+ t
562
+ })
532
563
  })
533
564
  ]
534
565
  }, row.id);
535
566
  })
536
567
  });
537
568
  }
569
+ /** 一格 token 量在整组里的深浅档:0 是空格,其余按相对最大值分 5 档。 */
570
+ function toneOf(volume, max) {
571
+ if (volume <= 0 || max <= 0) return "empty";
572
+ const ratio = volume / max;
573
+ if (ratio < .15) return "lv1";
574
+ if (ratio < .35) return "lv2";
575
+ if (ratio < .6) return "lv3";
576
+ if (ratio < .85) return "lv4";
577
+ return "lv5";
578
+ }
579
+ /** 「YYYY-MM-DD」是本地日历日,不能丢给 `new Date(string)`(会被当成 UTC)。返回周一=0…周日=6。 */
580
+ function weekdayOf(date) {
581
+ const [year, month, day] = date.split("-").map(Number);
582
+ return (new Date(year, month - 1, day).getDay() + 6) % 7;
583
+ }
538
584
  /**
539
- * 趋势柱:近 7 天按天、今天按小时。
540
- *
541
- * 两张图共用一套柱子,但编码不同,因为要看的问题不同:
542
- * - `hit`:柱高就是命中率,颜色分档 —— 命中率一掉就能看见,这是诊断「系统提示词
543
- * 前缀变了 / 上下文突然变长」最直接的信号;
544
- * - `volume`:柱高按组内最大值归一化 —— 只用来看「什么时候在跑」,绝对值看悬停。
585
+ * 当月的每日热力图:7 列是周一到周日,格子里的数字是「几号」,底色深浅是那天的 token 量。
545
586
  *
546
- * 悬停柱子时下面那行换成该格明细,移开回到提示语。轴标签只画整数倍格,24 格全画会挤成一片。
587
+ * 画整月而不是「最近 N 天」:日历是熟人界面,缺的格子一眼就知道是「还没到」还是「没用量」;
588
+ * 颜色用 agent-acta 那套绿阶。精确数字(输入 / 缓存 / 命中率 / 条数)全放进悬停提示。
547
589
  */
548
- function UsageTrend({ points, mode, axisEvery, hint, t }) {
590
+ function UsageHeat({ days, t }) {
549
591
  const [hovered, setHovered] = (0, react.useState)(null);
550
- const max = points.reduce((peak, point) => Math.max(peak, point.totals.totalTokens), 0);
551
- const shown = hovered === null ? void 0 : points[hovered];
592
+ /** 指针离开格子就清掉,卡片跟着指针停在那一次进入的位置。 */
593
+ const [point, setPoint] = (0, react.useState)(null);
594
+ const last = days.at(-1);
595
+ const month = last?.date.slice(0, 7) ?? "";
596
+ const inMonth = days.filter((day) => day.date.startsWith(month));
597
+ const max = inMonth.reduce((peak, day) => Math.max(peak, day.totals.totalTokens), 0);
598
+ const [year, monthNo] = month.split("-").map(Number);
599
+ const span = month === "" ? [] : Array.from({ length: new Date(year, monthNo, 0).getDate() }, (_, index) => {
600
+ const day = index + 1;
601
+ const date = `${month}-${String(day).padStart(2, "0")}`;
602
+ return {
603
+ date,
604
+ day,
605
+ totals: inMonth.find((entry) => entry.date === date)?.totals,
606
+ future: last !== void 0 && date > last.date
607
+ };
608
+ });
609
+ const offset = month === "" ? 0 : weekdayOf(`${month}-01`);
610
+ const shown = span.find((entry) => entry.date === hovered);
552
611
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
553
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
554
- className: CodeArtsPluginCard_module_css_default.trendBars,
555
- children: points.map((point, index) => {
556
- const pct = hitPercentOf(point.totals);
557
- const share = mode === "hit" ? pct === void 0 ? 0 : Math.max(pct, 2) : max === 0 ? 0 : point.totals.totalTokens / max * 100;
558
- const tone = mode === "hit" ? pct === void 0 ? "empty" : pct >= 80 ? "ok" : pct >= 50 ? "mid" : "low" : point.totals.totalTokens === 0 ? "empty" : "ok";
559
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
560
- className: CodeArtsPluginCard_module_css_default.trendSlot,
561
- title: `${point.label} · ${trendDetail(point.totals, t)}`,
562
- onMouseEnter: () => setHovered(index),
563
- onMouseLeave: () => setHovered(null),
564
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
565
- className: CodeArtsPluginCard_module_css_default.trendBar,
612
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
613
+ className: CodeArtsPluginCard_module_css_default.heatLegend,
614
+ children: [
615
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageHeatLess") }),
616
+ [
617
+ "lv1",
618
+ "lv2",
619
+ "lv3",
620
+ "lv4",
621
+ "lv5"
622
+ ].map((tone) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
623
+ className: CodeArtsPluginCard_module_css_default.heatLegendChip,
624
+ "data-tone": tone
625
+ }, tone)),
626
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usageHeatMore") })
627
+ ]
628
+ }),
629
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
630
+ className: CodeArtsPluginCard_module_css_default.heatGrid,
631
+ children: [
632
+ t("usageHeatWeekdays").split(" ").map((label) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
633
+ className: CodeArtsPluginCard_module_css_default.heatWeekday,
634
+ children: label
635
+ }, label)),
636
+ Array.from({ length: offset }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
637
+ className: CodeArtsPluginCard_module_css_default.heatCell,
638
+ "data-tone": "pad"
639
+ }, `pad-${String(index)}`)),
640
+ span.map((entry) => {
641
+ const tone = entry.future ? "out" : entry.totals === void 0 ? "empty" : toneOf(entry.totals.totalTokens, max);
642
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
643
+ className: CodeArtsPluginCard_module_css_default.heatCell,
566
644
  "data-tone": tone,
567
- style: { height: `${share}%` }
568
- })
569
- }, point.key);
645
+ "data-today": entry.date === last?.date ? "true" : void 0,
646
+ onMouseEnter: entry.totals === void 0 ? void 0 : (event) => {
647
+ setHovered(entry.date);
648
+ setPoint({
649
+ x: event.clientX,
650
+ y: event.clientY
651
+ });
652
+ },
653
+ onMouseLeave: entry.totals === void 0 ? void 0 : () => {
654
+ setHovered(null);
655
+ },
656
+ children: entry.day
657
+ }, entry.date);
658
+ })
659
+ ]
660
+ }),
661
+ shown?.totals !== void 0 && point !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
662
+ className: CodeArtsPluginCard_module_css_default.usageTip,
663
+ "data-float": "true",
664
+ role: "tooltip",
665
+ style: tipPointStyle(point),
666
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageTipBody, {
667
+ label: shown.date,
668
+ totals: shown.totals,
669
+ t
570
670
  })
571
671
  }),
672
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
673
+ className: CodeArtsPluginCard_module_css_default.trendTip,
674
+ children: t("usageTrendHint")
675
+ })
676
+ ] });
677
+ }
678
+ /**
679
+ * 今天逐小时:一行 24 格,深浅同样是相对最大值的档位,轴标签每 6 格画一个。
680
+ *
681
+ * 只在有真实小时桶时画 —— 功能上线前的小时没有回填,全画成空格会被误读成「跑了但没用量」。
682
+ */
683
+ function UsageHours({ hours, t }) {
684
+ const [hovered, setHovered] = (0, react.useState)(null);
685
+ const [point, setPoint] = (0, react.useState)(null);
686
+ const max = hours.reduce((peak, hour) => Math.max(peak, hour.totals.totalTokens), 0);
687
+ const shown = hovered === null ? void 0 : hours.find((entry) => entry.hour === hovered);
688
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
689
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
690
+ className: CodeArtsPluginCard_module_css_default.heatHours,
691
+ children: hours.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
692
+ className: CodeArtsPluginCard_module_css_default.heatHourCell,
693
+ "data-tone": toneOf(entry.totals.totalTokens, max),
694
+ onMouseEnter: (event) => {
695
+ setHovered(entry.hour);
696
+ setPoint({
697
+ x: event.clientX,
698
+ y: event.clientY
699
+ });
700
+ },
701
+ onMouseLeave: () => {
702
+ setHovered(null);
703
+ }
704
+ }, entry.hour))
705
+ }),
572
706
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
573
- className: CodeArtsPluginCard_module_css_default.trendAxis,
574
- children: points.map((point, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
575
- className: CodeArtsPluginCard_module_css_default.trendAxisSlot,
576
- children: index % axisEvery === 0 ? point.label : ""
577
- }, point.key))
707
+ className: CodeArtsPluginCard_module_css_default.heatAxis,
708
+ children: hours.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
709
+ className: CodeArtsPluginCard_module_css_default.heatAxisSlot,
710
+ children: entry.hour % 6 === 0 ? entry.hour : ""
711
+ }, entry.hour))
712
+ }),
713
+ shown !== void 0 && point !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
714
+ className: CodeArtsPluginCard_module_css_default.usageTip,
715
+ "data-float": "true",
716
+ role: "tooltip",
717
+ style: tipPointStyle(point),
718
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageTipBody, {
719
+ label: `${String(shown.hour).padStart(2, "0")}:00`,
720
+ totals: shown.totals,
721
+ t
722
+ })
578
723
  }),
579
724
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
580
725
  className: CodeArtsPluginCard_module_css_default.trendTip,
581
- children: shown === void 0 ? hint : `${shown.label} · ${trendDetail(shown.totals, t)}`
726
+ children: t("usageTrendHint")
582
727
  })
583
728
  ] });
584
729
  }
585
- /** 一格趋势的明细文案:输入 / 缓存 / 命中率 / 请求数(输出与思考在明细卡里看)。 */
586
- function trendDetail(totals, t) {
587
- const pct = hitPercentOf(totals);
588
- return [
589
- t("usageStatIn", { n: formatTokens$1(totals.promptTokens) }),
590
- `${t("usageTipCached")} ${formatTokens$1(totals.cachedTokens ?? 0)}`,
591
- `${t("usageTipHit")} ${pct === void 0 ? "—" : `${pct}%`}`,
592
- t("usageRequestCount", { n: formatCount(totals.requests) })
593
- ].join(" · ");
594
- }
595
730
  /**
596
731
  * 用量区块。
597
732
  *
@@ -685,29 +820,15 @@ function UsageSection({ usage, accounts, t }) {
685
820
  (usage.recentDays ?? []).length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
686
821
  className: CodeArtsPluginCard_module_css_default.hint,
687
822
  children: t("usageTrendWeek")
688
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageTrend, {
689
- mode: "hit",
690
- axisEvery: 1,
691
- hint: t("usageTrendHint"),
692
- points: (usage.recentDays ?? []).map((day) => ({
693
- key: day.date,
694
- label: day.date.slice(5),
695
- totals: day.totals
696
- })),
823
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageHeat, {
824
+ days: usage.recentDays ?? [],
697
825
  t
698
826
  })] }),
699
827
  (usage.todayByHour ?? []).length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
700
828
  className: CodeArtsPluginCard_module_css_default.hint,
701
829
  children: t("usageTrendHour")
702
- }), (usage.todayByHour ?? []).some((entry) => entry.totals.requests > 0) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageTrend, {
703
- mode: "volume",
704
- axisEvery: 6,
705
- hint: t("usageTrendHint"),
706
- points: (usage.todayByHour ?? []).map((entry) => ({
707
- key: String(entry.hour),
708
- label: String(entry.hour),
709
- totals: entry.totals
710
- })),
830
+ }), (usage.todayByHour ?? []).some((entry) => entry.totals.requests > 0) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageHours, {
831
+ hours: usage.todayByHour ?? [],
711
832
  t
712
833
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
713
834
  className: CodeArtsPluginCard_module_css_default.trendTip,
@@ -2290,14 +2411,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
2290
2411
  document.head.appendChild(tag);
2291
2412
  }
2292
2413
  var CodeArtsPanel_module_css_default = {
2414
+ "head": "Z66cgG_head",
2415
+ "desc": "Z66cgG_desc",
2293
2416
  "icon": "Z66cgG_icon",
2294
2417
  "page": "Z66cgG_page",
2418
+ "backCaret": "Z66cgG_backCaret",
2295
2419
  "body": "Z66cgG_body",
2296
2420
  "back": "Z66cgG_back",
2297
- "backCaret": "Z66cgG_backCaret",
2298
- "title": "Z66cgG_title",
2299
- "head": "Z66cgG_head",
2300
- "desc": "Z66cgG_desc"
2421
+ "title": "Z66cgG_title"
2301
2422
  };
2302
2423
  //#endregion
2303
2424
  //#region src/client/CodeArtsPanel.tsx
@@ -2450,10 +2571,13 @@ const zh = {
2450
2571
  usageStatHit: "缓存命中",
2451
2572
  usageStatRequests: "今日请求",
2452
2573
  usageRequests: "{n} 次请求",
2453
- usageTrendWeek: "近 7 天 · 缓存命中率",
2574
+ usageTrendWeek: "本月 · 每日 token",
2454
2575
  usageTrendHour: "今天 · 逐小时 token",
2455
- usageTrendHint: "悬停柱子看那一格明细",
2576
+ usageTrendHint: "悬停格子看那一格明细",
2456
2577
  usageTrendHourEmpty: "今天还没有逐小时数据(启用前的小时不回填)",
2578
+ usageHeatWeekdays: "一 二 三 四 五 六 日",
2579
+ usageHeatLess: "少",
2580
+ usageHeatMore: "多",
2457
2581
  usageByAccount: "今日按账号",
2458
2582
  usageRequestCount: "{n} 条",
2459
2583
  usageTokens: "输入 {prompt} · 输出 {completion}",
@@ -2597,10 +2721,13 @@ const en = {
2597
2721
  usageStatHit: "Cache hit",
2598
2722
  usageStatRequests: "Today requests",
2599
2723
  usageRequests: "{n} request(s)",
2600
- usageTrendWeek: "Last 7 days · cache hit rate",
2724
+ usageTrendWeek: "This month · tokens per day",
2601
2725
  usageTrendHour: "Today · tokens by hour",
2602
- usageTrendHint: "Hover a bar for that slot",
2726
+ usageTrendHint: "Hover a cell for that day",
2603
2727
  usageTrendHourEmpty: "No hourly data yet today (hours before this feature are not backfilled)",
2728
+ usageHeatWeekdays: "Mo Tu We Th Fr Sa Su",
2729
+ usageHeatLess: "Less",
2730
+ usageHeatMore: "More",
2604
2731
  usageByAccount: "Today by account",
2605
2732
  usageRequestCount: "{n} reqs",
2606
2733
  usageTokens: "in {prompt} · out {completion}",
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as upstreamErrorMessage, B as modelUnavailableReason, C as isWelfareClaimedStatus, D as prepareChatBody, E as pickDailyWelfareCampaign, F as filterEnabledModels, G as codeartsAuthPath, H as CodeArtsCredentialStore, I as forgetModelUnavailable, K as startLogin, L as isBenefitBlocked, M as FALLBACK_CODEARTS_MODELS, N as clearBenefitBlocked, O as rateLimitFrame, P as creditRatioLabel, R as isBenefitModel, S as isTpmLimit, T as modelUnavailableReasonText, U as MANUAL_ACCOUNT_ID, V as CodeArtsAccountStore, W as codeartsAccountsPath, _ as isIamTokenError, a as SNAP_HOST, b as isParamInvalidFrame, c as claimDailyWelfare, d as fetchCallerIdentity, f as fetchModels, g as isConcurrencyCap, h as firstFrameError, i as refreshCatalog, j as CodeArtsCatalog, k as signedGet, l as clearQueueStatus, m as fetchWelfareCampaigns, n as codeartsUsagePath, o as canonicalModel, p as fetchQueueStatus, r as discoverModels, s as chatStream, t as CodeArtsUsageTracker, u as degradeTokenCeiling, v as isModelNotAccessible, w as maxTokensCeilingFor, x as isQueueableRate, y as isNotMultimodal, z as markModelUnavailable } from "./usage-4B0o-CQN.mjs";
1
+ import { A as upstreamErrorMessage, B as modelUnavailableReason, C as isWelfareClaimedStatus, D as prepareChatBody, E as pickDailyWelfareCampaign, F as filterEnabledModels, G as codeartsAuthPath, H as CodeArtsCredentialStore, I as forgetModelUnavailable, K as startLogin, L as isBenefitBlocked, M as FALLBACK_CODEARTS_MODELS, N as clearBenefitBlocked, O as rateLimitFrame, P as creditRatioLabel, R as isBenefitModel, S as isTpmLimit, T as modelUnavailableReasonText, U as MANUAL_ACCOUNT_ID, V as CodeArtsAccountStore, W as codeartsAccountsPath, _ as isIamTokenError, a as SNAP_HOST, b as isParamInvalidFrame, c as claimDailyWelfare, d as fetchCallerIdentity, f as fetchModels, g as isConcurrencyCap, h as firstFrameError, i as refreshCatalog, j as CodeArtsCatalog, k as signedGet, l as clearQueueStatus, m as fetchWelfareCampaigns, n as codeartsUsagePath, o as canonicalModel, p as fetchQueueStatus, r as discoverModels, s as chatStream, t as CodeArtsUsageTracker, u as degradeTokenCeiling, v as isModelNotAccessible, w as maxTokensCeilingFor, x as isQueueableRate, y as isNotMultimodal, z as markModelUnavailable } from "./usage-B2LNsUuR.mjs";
2
2
  import { i as lazyApi, r as createProvider } from "./models-CgKCibpk.mjs";
3
3
  import z from "@deepseek-ai/schemastery";
4
4
  import { randomBytes, timingSafeEqual } from "node:crypto";
@@ -2996,7 +2996,7 @@ var CodeArtsUsageTracker = class {
2996
2996
  /** 最近 TREND_DAYS 天的每日合计(按日期升序,缺账目的日子补 0)。 */
2997
2997
  recentDaysOf(at) {
2998
2998
  const out = [];
2999
- for (let back = 6; back >= 0; back -= 1) {
2999
+ for (let back = 34; back >= 0; back -= 1) {
3000
3000
  const date = localDateKey(at - back * 864e5);
3001
3001
  const day = this.days.get(date);
3002
3002
  out.push({
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.2.7",
5
+ "version": "1.2.9",
6
6
  "packageManager": "pnpm@11.24.0",
7
7
  "author": "elegant01",
8
8
  "keywords": [