@laoyuehanni/dsh-token-usage 0.4.12 → 0.4.14

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 (108) hide show
  1. package/README.md +19 -9
  2. package/README.zh.md +19 -9
  3. package/lib/aux-request.d.ts +4 -0
  4. package/lib/aux-request.d.ts.map +1 -1
  5. package/lib/aux-request.js +1 -0
  6. package/lib/aux-request.js.map +1 -1
  7. package/lib/client/DashboardCards.d.ts +18 -10
  8. package/lib/client/DashboardCards.d.ts.map +1 -1
  9. package/lib/client/DashboardCards.js +14 -8
  10. package/lib/client/DashboardCards.js.map +1 -1
  11. package/lib/client/QuotaButton.d.ts +3 -1
  12. package/lib/client/QuotaButton.d.ts.map +1 -1
  13. package/lib/client/QuotaButton.js +23 -9
  14. package/lib/client/QuotaButton.js.map +1 -1
  15. package/lib/client/RequestPool.d.ts.map +1 -1
  16. package/lib/client/RequestPool.js +111 -32
  17. package/lib/client/RequestPool.js.map +1 -1
  18. package/lib/client/StatCard.d.ts +8 -10
  19. package/lib/client/StatCard.d.ts.map +1 -1
  20. package/lib/client/StatCard.js +10 -13
  21. package/lib/client/StatCard.js.map +1 -1
  22. package/lib/client/TokenUsageSection.d.ts.map +1 -1
  23. package/lib/client/TokenUsageSection.js +25 -14
  24. package/lib/client/TokenUsageSection.js.map +1 -1
  25. package/lib/client/UsageRows.d.ts +19 -11
  26. package/lib/client/UsageRows.d.ts.map +1 -1
  27. package/lib/client/UsageRows.js +59 -16
  28. package/lib/client/UsageRows.js.map +1 -1
  29. package/lib/client/UsageView.js +2 -2
  30. package/lib/client/UsageView.js.map +1 -1
  31. package/lib/client/format.d.ts +5 -0
  32. package/lib/client/format.d.ts.map +1 -1
  33. package/lib/client/format.js +5 -0
  34. package/lib/client/format.js.map +1 -1
  35. package/lib/client/locales.d.ts +17 -2
  36. package/lib/client/locales.d.ts.map +1 -1
  37. package/lib/client/locales.js +34 -4
  38. package/lib/client/locales.js.map +1 -1
  39. package/lib/client/quota-format.d.ts +55 -1
  40. package/lib/client/quota-format.d.ts.map +1 -1
  41. package/lib/client/quota-format.js +99 -0
  42. package/lib/client/quota-format.js.map +1 -1
  43. package/lib/client.js +426 -141
  44. package/lib/client.js.map +1 -1
  45. package/lib/compaction-attribution.d.ts +72 -0
  46. package/lib/compaction-attribution.d.ts.map +1 -0
  47. package/lib/compaction-attribution.js +82 -0
  48. package/lib/compaction-attribution.js.map +1 -0
  49. package/lib/field-completion.d.ts +46 -0
  50. package/lib/field-completion.d.ts.map +1 -0
  51. package/lib/field-completion.js +71 -0
  52. package/lib/field-completion.js.map +1 -0
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +145 -15
  55. package/lib/index.js.map +1 -1
  56. package/lib/migrate.d.ts +2 -1
  57. package/lib/migrate.d.ts.map +1 -1
  58. package/lib/migrate.js +13 -1
  59. package/lib/migrate.js.map +1 -1
  60. package/lib/provider-label.d.ts +20 -0
  61. package/lib/provider-label.d.ts.map +1 -0
  62. package/lib/provider-label.js +21 -0
  63. package/lib/provider-label.js.map +1 -0
  64. package/lib/provider-names.d.ts +60 -0
  65. package/lib/provider-names.d.ts.map +1 -0
  66. package/lib/provider-names.js +156 -0
  67. package/lib/provider-names.js.map +1 -0
  68. package/lib/quota/adapters/magpie.d.ts.map +1 -1
  69. package/lib/quota/adapters/magpie.js +25 -0
  70. package/lib/quota/adapters/magpie.js.map +1 -1
  71. package/lib/request-observe.d.ts +16 -1
  72. package/lib/request-observe.d.ts.map +1 -1
  73. package/lib/request-observe.js +82 -1
  74. package/lib/request-observe.js.map +1 -1
  75. package/lib/rollup.d.ts +10 -4
  76. package/lib/rollup.d.ts.map +1 -1
  77. package/lib/rollup.js +21 -4
  78. package/lib/rollup.js.map +1 -1
  79. package/lib/session-request-details.d.ts +2 -1
  80. package/lib/session-request-details.d.ts.map +1 -1
  81. package/lib/session-request-details.js +8 -0
  82. package/lib/session-request-details.js.map +1 -1
  83. package/lib/stats-route.d.ts +4 -0
  84. package/lib/stats-route.d.ts.map +1 -1
  85. package/lib/stats-route.js +14 -1
  86. package/lib/stats-route.js.map +1 -1
  87. package/lib/stats.d.ts.map +1 -1
  88. package/lib/stats.js +86 -19
  89. package/lib/stats.js.map +1 -1
  90. package/lib/sync-state.d.ts +43 -0
  91. package/lib/sync-state.d.ts.map +1 -1
  92. package/lib/sync-state.js +106 -0
  93. package/lib/sync-state.js.map +1 -1
  94. package/lib/sync.d.ts.map +1 -1
  95. package/lib/sync.js +26 -5
  96. package/lib/sync.js.map +1 -1
  97. package/lib/usage-log.d.ts +31 -0
  98. package/lib/usage-log.d.ts.map +1 -1
  99. package/lib/usage-log.js +172 -8
  100. package/lib/usage-log.js.map +1 -1
  101. package/lib/usage-record.d.ts +33 -8
  102. package/lib/usage-record.d.ts.map +1 -1
  103. package/lib/usage-record.js +79 -12
  104. package/lib/usage-record.js.map +1 -1
  105. package/lib/wire.d.ts +85 -1
  106. package/lib/wire.d.ts.map +1 -1
  107. package/lib/wire.js.map +1 -1
  108. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -547,6 +547,20 @@ window.__ModuleLoader__.load({
547
547
  }
548
548
  return points;
549
549
  }
550
+ // src/provider-label.ts
551
+ /**
552
+ * Label for a route key. The name registry wins; a missing or empty entry
553
+ * falls back to the key itself, so a route the registry never saw still
554
+ * displays. A route without a name is not an error — the registry is a
555
+ * convenience, the route key is the identity.
556
+ * @param id - the route key.
557
+ * @param names - the name registry, when the caller has one.
558
+ * @returns the display name, or the route key itself.
559
+ */
560
+ function providerLabel(id, names) {
561
+ const name = names?.[id];
562
+ return name !== void 0 && name !== "" ? name : id;
563
+ }
550
564
  // src/client/format.ts
551
565
  /** Known `LlmFailure.code`s that have a `fail.*` locale label. An unknown
552
566
  * future code is not in this map and the tooltip renders it verbatim. */
@@ -2678,6 +2692,84 @@ window.__ModuleLoader__.load({
2678
2692
  return pick;
2679
2693
  }
2680
2694
  /**
2695
+ * Pool the windows of a payload: windows that NAME the same quota POOL
2696
+ * and spend the same tier (an `other` window pools only with its own
2697
+ * name) collapse into one level — their budgets are interchangeable
2698
+ * (a gateway's several keys of one vendor family), so the pool's mean
2699
+ * remaining share is the level the traffic actually feels.
2700
+ *
2701
+ * Two boundaries keep the collapse honest:
2702
+ *
2703
+ * - A window WITHOUT a pool stands alone. Single-source payloads name
2704
+ * no pool, and a lone window pools with nothing — the mean of one
2705
+ * window is that window.
2706
+ * - BALANCE windows never pool. Amounts are not shares: summing two
2707
+ * purses of different currencies (or averaging them) states nothing
2708
+ * true about either, so every balance keeps its own row.
2709
+ *
2710
+ * The order of first appearance is preserved, so the trigger still reads
2711
+ * the first (finest) level of the payload.
2712
+ */
2713
+ function poolQuotaWindows(windows) {
2714
+ const groups = /* @__PURE__ */ new Map();
2715
+ windows.forEach((window, index) => {
2716
+ const key = window.pool === void 0 ? `solo:${String(index)}` : `${window.pool}|${window.tier}|${window.name ?? ""}`;
2717
+ const group = groups.get(key);
2718
+ if (group === void 0) groups.set(key, [window]);
2719
+ else group.push(window);
2720
+ });
2721
+ const pooled = [];
2722
+ for (const group of groups.values()) {
2723
+ const ratios = group.map((window) => quotaRemainingPercent(window)).filter((value) => value !== void 0);
2724
+ if (group.length === 1 || group[0]?.tier === "balance" || ratios.length === 0) {
2725
+ for (const window of group) {
2726
+ const remaining = quotaRemainingPercent(window);
2727
+ pooled.push({
2728
+ ...window,
2729
+ peerCount: 1,
2730
+ exhaustedPeerCount: remaining !== void 0 && remaining < REMAIN_RED ? 1 : 0
2731
+ });
2732
+ }
2733
+ continue;
2734
+ }
2735
+ const mean = ratios.reduce((sum, value) => sum + value, 0) / ratios.length;
2736
+ const exhausted = ratios.filter((value) => value < REMAIN_RED).length;
2737
+ const first = group[0];
2738
+ pooled.push({
2739
+ tier: first.tier,
2740
+ remainingPercent: mean,
2741
+ ...first.name !== void 0 ? { name: first.name } : {},
2742
+ ...first.pool !== void 0 ? { pool: first.pool } : {},
2743
+ peerCount: group.length,
2744
+ exhaustedPeerCount: exhausted
2745
+ });
2746
+ }
2747
+ return pooled;
2748
+ }
2749
+ /**
2750
+ * The severity of a POOLED window — the traffic light of a pool, not of
2751
+ * a single meter:
2752
+ *
2753
+ * - red only when EVERY window of the pool is exhausted (the pool has
2754
+ * nothing left to route to);
2755
+ * - yellow when the pool is low (mean at or below the yellow line) or
2756
+ * when SOME window is exhausted while others still have room (one
2757
+ * account died, the pool still serves);
2758
+ * - green otherwise.
2759
+ *
2760
+ * A lone window keeps the plain per-window band, so single-source
2761
+ * providers read exactly as before.
2762
+ */
2763
+ function quotaPoolSeverityOf(window) {
2764
+ if (window.peerCount <= 1) return quotaSeverityOf(window);
2765
+ const remaining = quotaRemainingPercent(window);
2766
+ if (remaining === void 0) return quotaSeverityOf(window);
2767
+ if (window.exhaustedPeerCount >= window.peerCount) return "exhausted";
2768
+ if (window.exhaustedPeerCount > 0) return "warn";
2769
+ if (remaining <= REMAIN_YELLOW) return "warn";
2770
+ return "ok";
2771
+ }
2772
+ /**
2681
2773
  * Fill share of the trigger ring, 0–1. Ratio windows map the remaining
2682
2774
  * percent; a funded balance without a total paints a full ring (the color
2683
2775
  * stays neutral — amounts tint only at ≤ 0); empty / overdrawn / missing
@@ -2771,7 +2863,9 @@ window.__ModuleLoader__.load({
2771
2863
  * Input-bar quota button (browser half): a 28×28 round trigger registered
2772
2864
  * into the `conversation.input.right` slot (it renders left of the model
2773
2865
  * chip — the host's fixed tool-row order). The glyph is a remaining-share
2774
- * ring (ContextMeter family) colored by the finest window. Clicking opens a
2866
+ * ring (ContextMeter family) colored by the finest window's POOL level —
2867
+ * a gateway's several keys of one vendor share one budget, so the ring
2868
+ * reads that pool's mean share and its availability. Clicking opens a
2775
2869
  * width-tiered popup (amount-only 200px / one progress bar 232px / two
2776
2870
  * bars 320px) centered on the button with the current provider's quota
2777
2871
  * windows: progress columns (5 小时 / 每周) for coding-plan providers, an
@@ -2929,15 +3023,19 @@ window.__ModuleLoader__.load({
2929
3023
  measurePanelLeft
2930
3024
  ]);
2931
3025
  if (!visible || payload === null) return null;
2932
- const finest = finestQuotaWindow(payload.status === "ok" ? payload.windows : []);
2933
- const severity = finest === void 0 ? "ok" : quotaSeverityOf(finest);
3026
+ const finest = finestQuotaWindow(poolQuotaWindows(payload.status === "ok" ? payload.windows : []));
3027
+ const severity = finest === void 0 ? "ok" : quotaPoolSeverityOf(finest);
2934
3028
  const triggerClass = [QuotaButton_module_css_default.trigger];
2935
3029
  if (severity === "warn") triggerClass.push(QuotaButton_module_css_default["icon-warn"]);
2936
3030
  else if (severity === "exhausted") triggerClass.push(QuotaButton_module_css_default["icon-exhausted"]);
2937
3031
  else if (finest !== void 0 && quotaRemainingPercent(finest) !== void 0) triggerClass.push(QuotaButton_module_css_default["icon-ok"]);
2938
3032
  const triggerClassName = triggerClass.join(" ").trim();
2939
3033
  const figure = quotaTriggerFigure(finest);
2940
- const triggerTip = figure === void 0 ? t("quota.trigger") : t("quota.triggerSummary", {
3034
+ const triggerTip = figure === void 0 ? t("quota.trigger") : finest !== void 0 && finest.peerCount > 1 ? t("quota.triggerSummaryPooled", {
3035
+ name: payload.providerName ?? payload.provider,
3036
+ figure,
3037
+ count: finest.peerCount
3038
+ }) : t("quota.triggerSummary", {
2941
3039
  name: payload.providerName ?? payload.provider,
2942
3040
  figure
2943
3041
  });
@@ -4081,7 +4179,7 @@ window.__ModuleLoader__.load({
4081
4179
  });
4082
4180
  }
4083
4181
  // \0dsh-css:/home/runner/work/dsh-token-usage/dsh-token-usage/src/client/UsageRows.module.css.mjs
4084
- const css$10 = ".qYVDeG_rows{flex-direction:column;min-height:120px;max-height:400px;padding-right:2px;display:flex;overflow-y:auto;container-type:inline-size}.qYVDeG_rows::-webkit-scrollbar{width:8px}.qYVDeG_rows::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.qYVDeG_rows.qYVDeG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.qYVDeG_rows::-webkit-scrollbar-track{background:0 0}.qYVDeG_row{border-bottom:1px solid var(--dsw-alias-border-l1);align-items:center;gap:12px;padding:4px 0;display:flex}.qYVDeG_row:last-child{border-bottom:none}.qYVDeG_rowName{width:138px;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:none;font-size:12px;font-weight:400;overflow:hidden}.qYVDeG_nameLine{align-items:baseline;gap:4px;width:100%;min-width:0;display:flex}.qYVDeG_nameGrow{flex:1;width:auto}.qYVDeG_nameText{text-overflow:ellipsis;white-space:nowrap;min-width:0;font:inherit;color:inherit;text-align:left;background:0 0;border:none;border-bottom:1.5px dashed #0000;padding:0;font-size:12px;overflow:hidden}.qYVDeG_jumpable{cursor:pointer;border-bottom-color:var(--dsw-alias-label-secondary);color:var(--dsw-alias-label-primary);text-decoration:none}.qYVDeG_jumpable:hover{border-bottom-color:var(--dsw-alias-label-primary)}.qYVDeG_badge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:10px}.qYVDeG_track{background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent);border-radius:2px;flex:1;min-width:0;height:3px;overflow:hidden}.qYVDeG_fill{background:color-mix(in srgb, var(--dsw-alias-label-primary) 55%, transparent);border-radius:2px;height:100%;display:block}.qYVDeG_rowNums{text-align:right;width:118px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:12px}.qYVDeG_rowCost{text-align:right;font-variant-numeric:tabular-nums;width:64px;color:var(--dsw-alias-label-primary);flex:none;font-size:12px;font-weight:600}.qYVDeG_srow .qYVDeG_rowCost{width:auto}.qYVDeG_perfToggle{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border-radius:8px;align-items:center;gap:5px;padding:3px 10px;font-family:inherit;font-size:12px;font-weight:500;display:inline-flex}.qYVDeG_perfToggle:hover{color:var(--dsw-alias-label-primary)}.qYVDeG_perfToggle:focus-visible{outline:2px solid var(--dsw-alias-border-l1);outline-offset:1px}.qYVDeG_perfGauge{font-size:11px;line-height:1}.qYVDeG_perfOn{background:color-mix(in srgb, var(--dsw-alias-label-primary) 10%, transparent);color:var(--dsw-alias-label-primary);border-color:#0000;font-weight:600}.qYVDeG_perfNums{text-align:right;width:260px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:12px}.qYVDeG_perfNums b{color:var(--dsw-alias-label-primary);font-weight:600}.qYVDeG_perfDim,.qYVDeG_perfDim b{color:var(--dsw-alias-label-tertiary);font-weight:400}.qYVDeG_srow{cursor:default;display:block}.qYVDeG_srow .qYVDeG_rowName{flex:1;width:auto}.qYVDeG_rowTop{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.qYVDeG_rowSub{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:11px;overflow:hidden}.qYVDeG_empty{color:var(--dsw-alias-label-tertiary);text-align:center;padding:16px 0;font-size:12px}.qYVDeG_segmented{border:1px solid var(--dsw-alias-border-l1);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.qYVDeG_segBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;padding:3px 10px;font-family:inherit;font-size:12px;font-weight:500}.qYVDeG_segBtn:hover{color:var(--dsw-alias-label-primary)}.qYVDeG_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 10%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.qYVDeG_controlCompact .qYVDeG_segBtn{padding:2px 7px;font-size:10px}.qYVDeG_controlCompact{border-radius:6px;padding:1px}.qYVDeG_perfCompact{border-radius:6px;padding:3px 7px;font-size:10px}@container (width<=440px){.qYVDeG_row:not(.qYVDeG_srow){grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;display:grid}.qYVDeG_row:not(.qYVDeG_srow)>.qYVDeG_rowName{grid-column:1/-1;width:auto}.qYVDeG_track{display:none}.qYVDeG_rowNums{text-align:left;width:auto}.qYVDeG_perfNums{text-align:left;white-space:normal;overflow-wrap:anywhere;grid-column:1/-1;width:auto}.qYVDeG_rowTop{grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;display:grid}.qYVDeG_rowTop>.qYVDeG_rowName{grid-column:1/-1}}";
4182
+ const css$10 = ".qYVDeG_rows{flex-direction:column;min-height:120px;max-height:400px;padding-right:2px;display:flex;overflow-y:auto;container-type:inline-size}.qYVDeG_rows::-webkit-scrollbar{width:8px}.qYVDeG_rows::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.qYVDeG_rows.qYVDeG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.qYVDeG_rows::-webkit-scrollbar-track{background:0 0}.qYVDeG_row{border-bottom:1px solid var(--dsw-alias-border-l1);align-items:center;gap:12px;padding:4px 0;display:flex}.qYVDeG_row:last-child{border-bottom:none}.qYVDeG_rowName{width:138px;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:none;font-size:12px;font-weight:400;overflow:hidden}.qYVDeG_nameLine{align-items:baseline;gap:4px;width:100%;min-width:0;display:flex}.qYVDeG_nameGrow{flex:1;width:auto}.qYVDeG_nameDim{color:var(--dsw-alias-label-secondary)}.qYVDeG_hintWrap{min-width:0;display:inline-flex}.qYVDeG_hintWrap [role=tooltip]{white-space:pre-wrap;overflow-wrap:anywhere;width:max-content;min-width:0;max-width:min(360px,100vw - 24px);font-size:12px;font-weight:400;line-height:1.4}.qYVDeG_nameHint{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:help;border-radius:4px;flex:none;align-items:center;padding:2px 5px;font-size:10px;line-height:1;display:inline-flex}.qYVDeG_nameText{text-overflow:ellipsis;white-space:nowrap;min-width:0;font:inherit;color:inherit;text-align:left;background:0 0;border:none;border-bottom:1.5px dashed #0000;padding:0;font-size:12px;overflow:hidden}.qYVDeG_jumpable{cursor:pointer;border-bottom-color:var(--dsw-alias-label-secondary);color:var(--dsw-alias-label-primary);text-decoration:none}.qYVDeG_jumpable:hover{border-bottom-color:var(--dsw-alias-label-primary)}.qYVDeG_badge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:10px}.qYVDeG_track{background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent);border-radius:2px;flex:1;min-width:0;height:3px;overflow:hidden}.qYVDeG_fill{background:color-mix(in srgb, var(--dsw-alias-label-primary) 55%, transparent);border-radius:2px;height:100%;display:block}.qYVDeG_rowNums{text-align:right;width:118px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:12px}.qYVDeG_rowCost{text-align:right;font-variant-numeric:tabular-nums;width:64px;color:var(--dsw-alias-label-primary);flex:none;font-size:12px;font-weight:600}.qYVDeG_srow .qYVDeG_rowCost{width:auto}.qYVDeG_perfToggle{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border-radius:8px;align-items:center;gap:5px;padding:3px 10px;font-family:inherit;font-size:12px;font-weight:500;display:inline-flex}.qYVDeG_perfToggle:hover{color:var(--dsw-alias-label-primary)}.qYVDeG_perfToggle:focus-visible{outline:2px solid var(--dsw-alias-border-l1);outline-offset:1px}.qYVDeG_perfGauge{font-size:11px;line-height:1}.qYVDeG_perfOn{background:color-mix(in srgb, var(--dsw-alias-label-primary) 10%, transparent);color:var(--dsw-alias-label-primary);border-color:#0000;font-weight:600}.qYVDeG_perfNums{text-align:right;width:260px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:12px}.qYVDeG_perfNums b{color:var(--dsw-alias-label-primary);font-weight:600}.qYVDeG_perfDim,.qYVDeG_perfDim b{color:var(--dsw-alias-label-tertiary);font-weight:400}.qYVDeG_srow{cursor:default;display:block}.qYVDeG_srow .qYVDeG_rowName{flex:1;width:auto}.qYVDeG_rowTop{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.qYVDeG_rowSub{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:11px;overflow:hidden}.qYVDeG_empty{color:var(--dsw-alias-label-tertiary);text-align:center;padding:16px 0;font-size:12px}.qYVDeG_segmented{border:1px solid var(--dsw-alias-border-l1);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.qYVDeG_segBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;padding:3px 10px;font-family:inherit;font-size:12px;font-weight:500}.qYVDeG_segBtn:hover{color:var(--dsw-alias-label-primary)}.qYVDeG_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 10%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.qYVDeG_controlCompact .qYVDeG_segBtn{padding:2px 7px;font-size:10px}.qYVDeG_controlCompact{border-radius:6px;padding:1px}.qYVDeG_perfCompact{border-radius:6px;padding:3px 7px;font-size:10px}@container (width<=440px){.qYVDeG_row:not(.qYVDeG_srow){grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;display:grid}.qYVDeG_row:not(.qYVDeG_srow)>.qYVDeG_rowName{grid-column:1/-1;width:auto}.qYVDeG_track{display:none}.qYVDeG_rowNums{text-align:left;width:auto}.qYVDeG_perfNums{text-align:left;white-space:normal;overflow-wrap:anywhere;grid-column:1/-1;width:auto}.qYVDeG_rowTop{grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;display:grid}.qYVDeG_rowTop>.qYVDeG_rowName{grid-column:1/-1}}";
4085
4183
  const tagId$10 = "@laoyuehanni/dsh-token-usage/UsageRows.module.css";
4086
4184
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$10) + "]") === null) {
4087
4185
  const tag = document.createElement("style");
@@ -4095,8 +4193,11 @@ window.__ModuleLoader__.load({
4095
4193
  "controlCompact": "qYVDeG_controlCompact",
4096
4194
  "empty": "qYVDeG_empty",
4097
4195
  "fill": "qYVDeG_fill",
4196
+ "hintWrap": "qYVDeG_hintWrap",
4098
4197
  "jumpable": "qYVDeG_jumpable",
4198
+ "nameDim": "qYVDeG_nameDim",
4099
4199
  "nameGrow": "qYVDeG_nameGrow",
4200
+ "nameHint": "qYVDeG_nameHint",
4100
4201
  "nameLine": "qYVDeG_nameLine",
4101
4202
  "nameText": "qYVDeG_nameText",
4102
4203
  "perfCompact": "qYVDeG_perfCompact",
@@ -4314,14 +4415,16 @@ window.__ModuleLoader__.load({
4314
4415
  }
4315
4416
  // src/client/UsageRows.tsx
4316
4417
  /**
4317
- * The dashboards' flat row lists (browser half): one component, three
4318
- * shapes — `project` (directory-tail folds), `model` (the priced rows) and
4319
- * `session` (two-line rows). All three read the same single-line grammar
4320
- * of the v3 demo: name | relative bar (projects/models only) | total
4321
- * tokens · cache share | cost; sessions swap the bar for a second identity
4322
- * line (directory · activity) under the same figures cells, all three
4323
- * lists rendering one figures style everywhere (no hover affordance — a
4324
- * former four-bucket popup read as clutter and went).
4418
+ * The dashboards' flat row lists (browser half): one component, four
4419
+ * shapes — `project` (directory-tail folds), `model` (the priced rows),
4420
+ * `session` (two-line rows) and `provider` (the per-route rows with the
4421
+ * unattributed remainder sunk to the bottom). All four read the same
4422
+ * single-line grammar of the v3 demo: name | relative bar (projects /
4423
+ * models / providers only) | total tokens · cache share | cost; sessions
4424
+ * swap the bar for a second identity line (directory · activity) under the
4425
+ * same figures cells, all four lists rendering one figures style everywhere
4426
+ * (no hover affordance — a former four-bucket popup read as clutter and
4427
+ * went).
4325
4428
  *
4326
4429
  * The relative bar scales to
4327
4430
  * the active sort's own measure — tokens while sorted by tokens, billed cost
@@ -4413,6 +4516,20 @@ window.__ModuleLoader__.load({
4413
4516
  function shortIdOf(sessionId) {
4414
4517
  return sessionId.length > 8 ? `${sessionId.slice(0, 8)}…` : sessionId;
4415
4518
  }
4519
+ /** The unattributed row's hover tooltip: an intro line, then the known
4520
+ * reasons a record can carry no route key as a numbered list, each line
4521
+ * indented by two spaces (the bubble renders `pre`, so the indent shows).
4522
+ * The list is the full closed set — deleted logs, pre-field history, and
4523
+ * bypass calls the host never gives a route key — so the reader sees this
4524
+ * row is expected, not a bug. */
4525
+ function unattributedTooltip(t) {
4526
+ const causes = [
4527
+ t("byProvider.cause.deletedLog"),
4528
+ t("byProvider.cause.preField"),
4529
+ t("byProvider.cause.bypass")
4530
+ ];
4531
+ return [t("byProvider.cause.intro"), ...causes.map((cause, index) => ` ${index + 1}. ${cause}`)].join("\n");
4532
+ }
4416
4533
  /** Relative last-active label (「3 小时前」): minutes inside the first hour,
4417
4534
  * hours inside the first day, days beyond. */
4418
4535
  function relativeTimeOf(time, t) {
@@ -4426,7 +4543,7 @@ window.__ModuleLoader__.load({
4426
4543
  * Render one flat row list. The list is the height-capped scroll container
4427
4544
  * (scrollbar appears while scrolling, fades 800ms after it stops).
4428
4545
  */
4429
- function UsageRows({ kind, projectRows, modelRows, sessionRows, sort, perfView, pricing, costState, view, t, sessionListed, onSessionOpen, onToggleModel, onModelName }) {
4546
+ function UsageRows({ kind, projectRows, modelRows, sessionRows, providerRows, providerNames, sort, perfView, pricing, costState, view, t, sessionListed, onSessionOpen, onToggleModel, onModelName }) {
4430
4547
  const ctrlHeld = useCtrlHeld();
4431
4548
  const scrollRef = (0, react.useRef)(null);
4432
4549
  const scrollTimer = (0, react.useRef)(void 0);
@@ -4444,7 +4561,7 @@ window.__ModuleLoader__.load({
4444
4561
  const perfMode = perfView === true && kind === "model";
4445
4562
  const active = sort ?? (kind === "session" ? "cost" : "tokens");
4446
4563
  const rows = (0, react.useMemo)(() => {
4447
- const base = kind === "project" ? projectRows : kind === "model" ? modelRows : sessionRows;
4564
+ const base = kind === "project" ? projectRows : kind === "model" ? modelRows : kind === "session" ? sessionRows : providerRows;
4448
4565
  if (base === void 0) return [];
4449
4566
  if (kind === "session") {
4450
4567
  if (active === "cost") return base;
@@ -4454,6 +4571,10 @@ window.__ModuleLoader__.load({
4454
4571
  if (active === "tokens") return base;
4455
4572
  return [...base].sort((left, right) => right.cost - left.cost || (left.name < right.name ? -1 : 1));
4456
4573
  }
4574
+ if (kind === "provider") {
4575
+ const unattributedLast = (row) => row.provider === "" ? 1 : 0;
4576
+ return [...base].sort((left, right) => unattributedLast(left) - unattributedLast(right) || (active === "cost" ? right.cost - left.cost : totalTokens$1(right.totals) - totalTokens$1(left.totals)) || (left.provider < right.provider ? -1 : 1));
4577
+ }
4457
4578
  const models = [...base];
4458
4579
  if (perfMode) {
4459
4580
  const ranked = (row) => row.perf !== void 0 && row.perf.samples >= 5;
@@ -4471,10 +4592,11 @@ window.__ModuleLoader__.load({
4471
4592
  projectRows,
4472
4593
  modelRows,
4473
4594
  sessionRows,
4595
+ providerRows,
4474
4596
  active,
4475
4597
  perfMode
4476
4598
  ]);
4477
- const barValueOf = (row) => perfMode ? "perf" in row && row.perf !== void 0 && row.perf.samples >= 5 ? row.perf.tokensPerSec : 0 : active === "cost" ? row.cost : totalTokens$1(row.totals);
4599
+ const barValueOf = (row) => perfMode ? "perf" in row && row.perf !== void 0 && row.perf.samples >= 5 ? row.perf.tokensPerSec : 0 : kind === "provider" && row.provider === "" ? 0 : active === "cost" ? row.cost : totalTokens$1(row.totals);
4478
4600
  const barMax = (0, react.useMemo)(() => {
4479
4601
  let max = 0;
4480
4602
  for (const row of rows) {
@@ -4544,7 +4666,7 @@ window.__ModuleLoader__.load({
4544
4666
  ]
4545
4667
  });
4546
4668
  };
4547
- const ariaLabel = kind === "project" ? t("byProject.title") : kind === "model" ? t("byModel.title") : t("bySession.title");
4669
+ const ariaLabel = kind === "project" ? t("byProject.title") : kind === "model" ? t("byModel.title") : kind === "session" ? t("bySession.title") : t("byProvider.title");
4548
4670
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4549
4671
  className: UsageRows_module_css_default["rows"],
4550
4672
  ref: scrollRef,
@@ -4641,6 +4763,56 @@ window.__ModuleLoader__.load({
4641
4763
  ]
4642
4764
  }, model.model);
4643
4765
  }
4766
+ if (kind === "provider") {
4767
+ const provider = row;
4768
+ const unattributed = provider.provider === "";
4769
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4770
+ className: UsageRows_module_css_default["row"],
4771
+ role: "listitem",
4772
+ children: [
4773
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4774
+ className: unattributed ? `${UsageRows_module_css_default["rowName"]} ${UsageRows_module_css_default["nameDim"]}` : UsageRows_module_css_default["rowName"],
4775
+ title: unattributed ? void 0 : provider.provider,
4776
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4777
+ className: UsageRows_module_css_default["nameLine"],
4778
+ children: unattributed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4779
+ className: UsageRows_module_css_default["hintWrap"],
4780
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4781
+ label: unattributedTooltip(t),
4782
+ side: "bottom",
4783
+ delayMs: 100,
4784
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4785
+ className: UsageRows_module_css_default["nameText"],
4786
+ "aria-label": t("byProvider.unattributed"),
4787
+ tabIndex: 0,
4788
+ children: [t("byProvider.unattributed"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4789
+ className: UsageRows_module_css_default["nameHint"],
4790
+ "aria-hidden": true,
4791
+ children: "?"
4792
+ })]
4793
+ })
4794
+ })
4795
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4796
+ className: UsageRows_module_css_default["nameText"],
4797
+ children: providerLabel(provider.provider, providerNames)
4798
+ })
4799
+ })
4800
+ }),
4801
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4802
+ className: UsageRows_module_css_default["track"],
4803
+ children: barMax > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4804
+ className: UsageRows_module_css_default["fill"],
4805
+ style: { width: `${barValueOf(provider) / barMax * 100}%` }
4806
+ }) : null
4807
+ }),
4808
+ numsCell(provider.totals),
4809
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4810
+ className: UsageRows_module_css_default["rowCost"],
4811
+ children: costText(provider.cost)
4812
+ })
4813
+ ]
4814
+ }, unattributed ? "\0" : provider.provider);
4815
+ }
4644
4816
  const session = row;
4645
4817
  const jump = ctrlHeld && sessionListed !== void 0 && onSessionOpen !== void 0 && sessionListed(session.sessionId);
4646
4818
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -4709,9 +4881,9 @@ window.__ModuleLoader__.load({
4709
4881
  "panelTitle": "dNNuRW_panelTitle"
4710
4882
  };
4711
4883
  // src/client/DashboardCards.tsx
4712
- /** The three cards' fixed sort options: projects and models pick between
4713
- * token size and billed cost; sessions add last activity. The models'
4714
- * performance view is a separate head toggle, not a sort pick. */
4884
+ /** The cards' fixed sort options: projects, models and providers pick
4885
+ * between token size and billed cost; sessions add last activity. The
4886
+ * models' performance view is a separate head toggle, not a sort pick. */
4715
4887
  const SORT_PROJECT = ["tokens", "cost"];
4716
4888
  const SORT_SESSION = [
4717
4889
  "tokens",
@@ -4719,12 +4891,14 @@ window.__ModuleLoader__.load({
4719
4891
  "recent"
4720
4892
  ];
4721
4893
  const SORT_MODEL = ["tokens", "cost"];
4894
+ const SORT_PROVIDER = ["tokens", "cost"];
4722
4895
  /**
4723
- * Render the four-card dashboard: projects | sessions on the first row,
4724
- * models | runtime overhead on the second. The lists cap their own height
4725
- * and scroll inside the cards.
4896
+ * Render the dashboard: projects | sessions on the first row, models |
4897
+ * providers on the second, runtime overhead on the last. The lists cap
4898
+ * their own height and scroll inside the cards.
4726
4899
  */
4727
- function DashboardCards({ projectRows, modelRows, sessionRows, projectSort, onProjectSortChange, modelSort, onModelSortChange, modelPerfView, onModelPerfToggle, sessionSort, onSessionSortChange, aux, pricing, costState, view, t, sessionListed, onSessionOpen, onToggleModel, onModelName, overheadCardRef, overheadFlash }) {
4900
+ function DashboardCards({ projectRows, modelRows, sessionRows, projectSort, onProjectSortChange, modelSort, onModelSortChange, modelPerfView, onModelPerfToggle, providerRows, providerNames, providerSort, onProviderSortChange, sessionSort, onSessionSortChange, aux, pricing, costState, view, t, sessionListed, onSessionOpen, onToggleModel, onModelName, overheadCardRef, overheadFlash }) {
4901
+ const namedProviderCount = providerRows.filter((row) => row.provider !== "").length;
4728
4902
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4729
4903
  className: DashboardCards_module_css_default["grid2"],
4730
4904
  children: [
@@ -4826,6 +5000,33 @@ window.__ModuleLoader__.load({
4826
5000
  onModelName
4827
5001
  })]
4828
5002
  }),
5003
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5004
+ className: DashboardCards_module_css_default["panel"],
5005
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5006
+ className: DashboardCards_module_css_default["panelHead"],
5007
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5008
+ className: DashboardCards_module_css_default["panelTitle"],
5009
+ children: [t("board.providers"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5010
+ className: DashboardCards_module_css_default["panelCount"],
5011
+ children: providerSort === "cost" ? t("board.byCost", { count: namedProviderCount.toLocaleString() }) : t("board.byTokens", { count: namedProviderCount.toLocaleString() })
5012
+ })]
5013
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowSortControl, {
5014
+ value: providerSort,
5015
+ options: SORT_PROVIDER,
5016
+ onChange: onProviderSortChange,
5017
+ ariaLabel: t("board.providers"),
5018
+ t
5019
+ })]
5020
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageRows, {
5021
+ kind: "provider",
5022
+ providerRows,
5023
+ providerNames,
5024
+ sort: providerSort,
5025
+ costState,
5026
+ view,
5027
+ t
5028
+ })]
5029
+ }),
4829
5030
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4830
5031
  ref: overheadCardRef,
4831
5032
  className: overheadFlash ? `${DashboardCards_module_css_default["panel"]} ${DashboardCards_module_css_default["flash"]}` : DashboardCards_module_css_default["panel"],
@@ -4849,7 +5050,7 @@ window.__ModuleLoader__.load({
4849
5050
  });
4850
5051
  }
4851
5052
  // \0dsh-css:/home/runner/work/dsh-token-usage/dsh-token-usage/src/client/StatCard.module.css.mjs
4852
- const css$7 = "._9vrbFa_card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;flex-direction:column;gap:2px;min-width:0;padding:10px 12px;display:flex}._9vrbFa_cardLg{gap:4px;padding:12px 14px}._9vrbFa_cardLg ._9vrbFa_cardLabel{font-size:12px}._9vrbFa_cardLg ._9vrbFa_cardValue{font-size:20px;line-height:26px}._9vrbFa_cardSm{border-radius:7px;gap:3px;padding:8px 9px}._9vrbFa_cardSm ._9vrbFa_cardLabel{font-size:10px;line-height:14px}._9vrbFa_cardSm ._9vrbFa_cardValue{flex-wrap:nowrap;gap:4px;font-size:16px;line-height:22px}._9vrbFa_cardSm ._9vrbFa_cardLabelRow{gap:4px}._9vrbFa_cardSm ._9vrbFa_cardLabelRow ._9vrbFa_pillNeutral{padding-inline:4px;font-size:9px;line-height:12px}._9vrbFa_cardSm ._9vrbFa_failBare{font-size:10px}._9vrbFa_cardLabelRow{align-items:center;gap:6px;min-width:0;display:flex}._9vrbFa_cardLabelRow>._9vrbFa_cardLabel{flex:0 auto;min-width:0}._9vrbFa_cardLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}._9vrbFa_cardValue{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);flex-wrap:wrap;align-items:baseline;gap:4px 8px;min-width:0;font-size:18px;font-weight:600;display:flex}._9vrbFa_cardValueMain{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}._9vrbFa_pillWrap{flex-shrink:0;display:inline-flex}._9vrbFa_pillWrap [role=tooltip]{white-space:pre;width:max-content;min-width:max-content;max-width:none;font-size:12px;font-weight:400;line-height:1.4}._9vrbFa_split{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;column-gap:4px;width:100%;display:grid}._9vrbFa_splitOk{text-align:right;min-width:0}._9vrbFa_splitSep{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))}._9vrbFa_splitFailHead{text-align:left;min-width:0}._9vrbFa_splitFail{text-align:left;min-width:0;color:var(--dsw-alias-state-error-primary);display:block}._9vrbFa_split>._9vrbFa_pillWrap{justify-self:stretch;min-width:0;display:block}._9vrbFa_pill,._9vrbFa_pillNeutral{font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;flex-shrink:0;padding:1px 7px;font-size:12px;font-weight:400;line-height:1.4}._9vrbFa_pill{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent)}._9vrbFa_pillNeutral{color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-secondary) 10%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-label-secondary) 26%, transparent);cursor:pointer;font-family:inherit}._9vrbFa_pillNeutral:hover{background:color-mix(in srgb, var(--dsw-alias-label-secondary) 16%, transparent)}._9vrbFa_cardLabelRow ._9vrbFa_pill,._9vrbFa_cardLabelRow ._9vrbFa_pillNeutral{padding:0 6px;font-size:10px;line-height:13px}._9vrbFa_cardLabelRow~._9vrbFa_cardValue{flex-wrap:nowrap;gap:6px}._9vrbFa_failBare{font-variant-numeric:tabular-nums;color:var(--dsw-alias-state-error-primary);white-space:nowrap;font-size:11px;font-weight:400}";
5053
+ const css$7 = "._9vrbFa_card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;flex-direction:column;gap:2px;min-width:0;padding:10px 12px;display:flex}._9vrbFa_cardLg{gap:4px;padding:12px 14px}._9vrbFa_cardLg ._9vrbFa_cardLabel{font-size:12px}._9vrbFa_cardLg ._9vrbFa_cardValue{font-size:20px;line-height:26px}._9vrbFa_cardSm{border-radius:7px;gap:3px;padding:8px 9px}._9vrbFa_cardSm ._9vrbFa_cardLabel{font-size:10px;line-height:14px}._9vrbFa_cardSm ._9vrbFa_cardValue{flex-wrap:nowrap;gap:4px;font-size:16px;line-height:22px}._9vrbFa_cardSm ._9vrbFa_cardLabelRow{gap:4px}._9vrbFa_cardSm ._9vrbFa_cardLabelRow ._9vrbFa_pillNeutral{padding-inline:4px;font-size:9px;line-height:12px}._9vrbFa_cardSm ._9vrbFa_failBare{font-size:10px}._9vrbFa_cardLabelRow{align-items:center;gap:6px;min-width:0;display:flex}._9vrbFa_cardLabelRow>._9vrbFa_cardLabel{flex:0 auto;min-width:0}._9vrbFa_cardLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}._9vrbFa_cardValue{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);flex-wrap:wrap;align-items:baseline;gap:4px 8px;min-width:0;font-size:18px;font-weight:600;display:flex}._9vrbFa_cardValueMain{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}._9vrbFa_pillWrap{flex-shrink:0;display:inline-flex}._9vrbFa_pillWrap [role=tooltip]{white-space:pre;width:max-content;min-width:max-content;max-width:none;font-size:12px;font-weight:400;line-height:1.4}._9vrbFa_splitSep{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));padding:0 1px}._9vrbFa_splitFail{color:var(--dsw-alias-state-error-primary)}._9vrbFa_failWrap{display:inline}._9vrbFa_pill,._9vrbFa_pillNeutral{font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;flex-shrink:0;padding:1px 7px;font-size:12px;font-weight:400;line-height:1.4}._9vrbFa_pill{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent)}._9vrbFa_pillNeutral{color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-secondary) 10%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-label-secondary) 26%, transparent);cursor:pointer;font-family:inherit}._9vrbFa_pillNeutral:hover{background:color-mix(in srgb, var(--dsw-alias-label-secondary) 16%, transparent)}._9vrbFa_cardLabelRow ._9vrbFa_pill,._9vrbFa_cardLabelRow ._9vrbFa_pillNeutral{padding:0 6px;font-size:10px;line-height:13px}._9vrbFa_cardLabelRow~._9vrbFa_cardValue{flex-wrap:nowrap;gap:6px}._9vrbFa_failBare{font-variant-numeric:tabular-nums;color:var(--dsw-alias-state-error-primary);white-space:nowrap;font-size:11px;font-weight:400}";
4853
5054
  const tagId$7 = "@laoyuehanni/dsh-token-usage/StatCard.module.css";
4854
5055
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
4855
5056
  const tag = document.createElement("style");
@@ -4867,13 +5068,11 @@ window.__ModuleLoader__.load({
4867
5068
  "cardValue": "_9vrbFa_cardValue",
4868
5069
  "cardValueMain": "_9vrbFa_cardValueMain",
4869
5070
  "failBare": "_9vrbFa_failBare",
5071
+ "failWrap": "_9vrbFa_failWrap",
4870
5072
  "pill": "_9vrbFa_pill",
4871
5073
  "pillNeutral": "_9vrbFa_pillNeutral",
4872
5074
  "pillWrap": "_9vrbFa_pillWrap",
4873
- "split": "_9vrbFa_split",
4874
5075
  "splitFail": "_9vrbFa_splitFail",
4875
- "splitFailHead": "_9vrbFa_splitFailHead",
4876
- "splitOk": "_9vrbFa_splitOk",
4877
5076
  "splitSep": "_9vrbFa_splitSep"
4878
5077
  };
4879
5078
  // src/client/StatCard.tsx
@@ -4980,69 +5179,40 @@ window.__ModuleLoader__.load({
4980
5179
  })
4981
5180
  });
4982
5181
  }
4983
- /** Column header for the per-model success/fail split: same 3-track
4984
- * grid as {@link RequestsCell} so the slash sits on the column midline. */
4985
- function RequestsSplitHead({ t }) {
4986
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4987
- className: StatCard_module_css_default["split"],
4988
- children: [
4989
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4990
- className: StatCard_module_css_default["splitOk"],
4991
- children: t("stat.ok")
4992
- }),
4993
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4994
- className: StatCard_module_css_default["splitSep"],
4995
- "aria-hidden": true,
4996
- children: "/"
4997
- }),
4998
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4999
- className: StatCard_module_css_default["splitFailHead"],
5000
- children: t("stat.fail")
5001
- })
5002
- ]
5003
- });
5004
- }
5005
- /** One table cell: successful count, and when failures > 0 a slash on
5006
- * the column midline plus the failure count in the error color.
5007
- * Zero failures print only A (same left track, so the figure still
5008
- * lines up with rows that have a B). Hovering B lists the per-code
5009
- * breakdown. */
5182
+ /** One table cell: the successful count, and when failures > 0 the
5183
+ * failure count after a slash, in the error color and hoverable for the
5184
+ * per-code breakdown.
5185
+ *
5186
+ * The column is ONE plain column: the figures are plain inline text, so
5187
+ * the head above them inherits the same alignment and the two share one
5188
+ * edge — no tracks, no grid, no placeholder. Zero failures print only
5189
+ * the successful count (no slash, no `0`). */
5010
5190
  function RequestsCell({ requests, failures, failuresByCode, t }) {
5011
5191
  const ok = requests.toLocaleString();
5012
- const okFigure = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5013
- className: StatCard_module_css_default["splitOk"],
5014
- children: ok
5015
- });
5016
- if (failures === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5017
- className: StatCard_module_css_default["split"],
5018
- children: okFigure
5019
- });
5192
+ if (failures === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: ok });
5020
5193
  const fail = failures.toLocaleString();
5021
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5022
- className: StatCard_module_css_default["split"],
5023
- children: [
5024
- okFigure,
5025
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5026
- className: StatCard_module_css_default["splitSep"],
5027
- "aria-hidden": true,
5028
- children: "/"
5029
- }),
5030
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5031
- className: StatCard_module_css_default["pillWrap"],
5032
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
5033
- label: failuresTooltip(failuresByCode, t),
5034
- side: "bottom",
5035
- delayMs: 200,
5036
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5037
- className: StatCard_module_css_default["splitFail"],
5038
- tabIndex: 0,
5039
- "aria-label": t("stat.failuresPill", { count: fail }),
5040
- children: fail
5041
- })
5194
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
5195
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: ok }),
5196
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5197
+ className: StatCard_module_css_default["splitSep"],
5198
+ "aria-hidden": true,
5199
+ children: "/"
5200
+ }),
5201
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5202
+ className: StatCard_module_css_default["failWrap"],
5203
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
5204
+ label: failuresTooltip(failuresByCode, t),
5205
+ side: "bottom",
5206
+ delayMs: 200,
5207
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5208
+ className: StatCard_module_css_default["splitFail"],
5209
+ tabIndex: 0,
5210
+ "aria-label": t("stat.failuresPill", { count: fail }),
5211
+ children: fail
5042
5212
  })
5043
5213
  })
5044
- ]
5045
- });
5214
+ })
5215
+ ] });
5046
5216
  }
5047
5217
  // src/client/trend-chart/axis.ts
5048
5218
  /**
@@ -6665,7 +6835,7 @@ window.__ModuleLoader__.load({
6665
6835
  });
6666
6836
  }
6667
6837
  // \0dsh-css:/home/runner/work/dsh-token-usage/dsh-token-usage/src/client/TokenUsageSection.module.css.mjs
6668
- const css$2 = "._1fNFvW_section{flex-direction:column;gap:16px;width:100%;min-width:0;display:flex;container-type:inline-size}._1fNFvW_pageVariant ._1fNFvW_title{font-size:20px;font-weight:500;line-height:28px}._1fNFvW_head{justify-content:space-between;align-items:center;gap:12px;display:flex}._1fNFvW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:600}._1fNFvW_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}._1fNFvW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}._1fNFvW_sortRow{justify-content:flex-end;align-items:center;gap:6px;margin-left:auto;display:flex}._1fNFvW_sortHidden{visibility:hidden}._1fNFvW_detailPanel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:9px;min-width:0}._1fNFvW_detailToolbar{border-bottom:1px solid var(--dsw-alias-border-l1);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;padding:10px 12px;display:flex}._1fNFvW_detailBody{min-width:0;padding:2px 12px 6px}._1fNFvW_segmented{align-items:stretch;gap:2px;padding:0;display:inline-flex}._1fNFvW_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 8px;font-size:11px;font-weight:500}._1fNFvW_segBtn:hover:not(._1fNFvW_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}._1fNFvW_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}._1fNFvW_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}._1fNFvW_empty{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}._1fNFvW_button{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:13px;line-height:20px}._1fNFvW_button:hover{background:var(--dsw-interactive-bg-hover)}._1fNFvW_filters{flex-wrap:nowrap;align-items:center;gap:8px;display:flex}._1fNFvW_pricingLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;margin-left:auto;padding:4px 8px;font-size:13px;line-height:20px}._1fNFvW_pricingLink:hover{background:var(--dsw-interactive-bg-hover)}@container (width<=480px){._1fNFvW_filters{flex-wrap:wrap}}";
6838
+ const css$2 = "._1fNFvW_section{flex-direction:column;gap:16px;width:100%;min-width:0;display:flex;container-type:inline-size}._1fNFvW_pageVariant ._1fNFvW_title{font-size:20px;font-weight:500;line-height:28px}._1fNFvW_head{justify-content:space-between;align-items:center;gap:12px;display:flex}._1fNFvW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:600}._1fNFvW_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}._1fNFvW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}._1fNFvW_sortRow{justify-content:flex-end;align-items:center;gap:6px;margin-left:auto;display:flex}._1fNFvW_sortHidden{visibility:hidden}._1fNFvW_detailPanel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:9px;min-width:0}._1fNFvW_detailToolbar{border-bottom:1px solid var(--dsw-alias-border-l1);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;padding:10px 12px;display:flex}._1fNFvW_detailBody{min-width:0;padding:2px 12px 6px}._1fNFvW_segmented{flex-wrap:wrap;align-items:stretch;gap:2px;padding:0;display:inline-flex}._1fNFvW_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 8px;font-size:11px;font-weight:500}._1fNFvW_segBtn:hover:not(._1fNFvW_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}._1fNFvW_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}._1fNFvW_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}._1fNFvW_empty{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}._1fNFvW_button{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:13px;line-height:20px}._1fNFvW_button:hover{background:var(--dsw-interactive-bg-hover)}._1fNFvW_filters{flex-wrap:nowrap;align-items:center;gap:8px;display:flex}._1fNFvW_pricingLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;margin-left:auto;padding:4px 8px;font-size:13px;line-height:20px}._1fNFvW_pricingLink:hover{background:var(--dsw-interactive-bg-hover)}@container (width<=480px){._1fNFvW_filters{flex-wrap:wrap}}";
6669
6839
  const tagId$2 = "@laoyuehanni/dsh-token-usage/TokenUsageSection.module.css";
6670
6840
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
6671
6841
  const tag = document.createElement("style");
@@ -6710,15 +6880,28 @@ window.__ModuleLoader__.load({
6710
6880
  *
6711
6881
  * @module token-usage/client/TokenUsageSection
6712
6882
  */
6713
- /** The three tabs' fixed sort options: projects and models pick between
6714
- * token size and billed cost; sessions add last activity. */
6883
+ /** The detail tabs' fixed sort options: projects, models and providers pick
6884
+ * between token size and billed cost; sessions add last activity. */
6715
6885
  const PROJECT_SORT = ["tokens", "cost"];
6716
6886
  const MODEL_SORT = ["tokens", "cost"];
6887
+ const PROVIDER_SORT = ["tokens", "cost"];
6717
6888
  const SESSION_SORT = [
6718
6889
  "tokens",
6719
6890
  "cost",
6720
6891
  "recent"
6721
6892
  ];
6893
+ /** The detail switch's tab labels, one per mode. */
6894
+ const DETAIL_MODES = [
6895
+ "project",
6896
+ "model",
6897
+ "session",
6898
+ "provider",
6899
+ "aux"
6900
+ ];
6901
+ /** One detail mode's label key. */
6902
+ function detailLabelOf(mode) {
6903
+ return mode === "project" ? "byProject.title" : mode === "model" ? "byModel.title" : mode === "session" ? "bySession.title" : mode === "provider" ? "byProvider.title" : "aux.tab";
6904
+ }
6722
6905
  /** Fetch the summary for one query string; the caller owns the failure
6723
6906
  * presentation. The AbortSignal wires into the request so a filter change
6724
6907
  * cancels the in-flight fetch instead of letting its response overwrite
@@ -6891,6 +7074,7 @@ window.__ModuleLoader__.load({
6891
7074
  const [projectSort, setProjectSort] = (0, react.useState)("tokens");
6892
7075
  const [modelSort, setModelSort] = (0, react.useState)("tokens");
6893
7076
  const [modelPerfView, setModelPerfView] = (0, react.useState)(false);
7077
+ const [providerSort, setProviderSort] = (0, react.useState)("tokens");
6894
7078
  const [sessionSort, setSessionSort] = (0, react.useState)("cost");
6895
7079
  const handleToggleModel = (0, react.useCallback)((model) => {
6896
7080
  setFilters((previous) => ({
@@ -7065,6 +7249,10 @@ window.__ModuleLoader__.load({
7065
7249
  onModelSortChange: setModelSort,
7066
7250
  modelPerfView,
7067
7251
  onModelPerfToggle: setModelPerfView,
7252
+ providerRows: state.value.byProvider ?? [],
7253
+ providerNames: state.value.providerNames,
7254
+ providerSort,
7255
+ onProviderSortChange: setProviderSort,
7068
7256
  sessionSort,
7069
7257
  onSessionSortChange: setSessionSort,
7070
7258
  aux: state.value.aux,
@@ -7088,17 +7276,12 @@ window.__ModuleLoader__.load({
7088
7276
  className: TokenUsageSection_module_css_default["segmented"],
7089
7277
  role: "group",
7090
7278
  "aria-label": t("detail.switch.label"),
7091
- children: [
7092
- "project",
7093
- "model",
7094
- "session",
7095
- "aux"
7096
- ].map((mode) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7279
+ children: DETAIL_MODES.map((mode) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7097
7280
  type: "button",
7098
7281
  className: detailMode === mode ? `${TokenUsageSection_module_css_default["segBtn"]} ${TokenUsageSection_module_css_default["segActive"]}` : TokenUsageSection_module_css_default["segBtn"],
7099
7282
  "aria-pressed": detailMode === mode,
7100
7283
  onClick: () => setDetailMode(mode),
7101
- children: t(mode === "project" ? "byProject.title" : mode === "model" ? "byModel.title" : mode === "session" ? "bySession.title" : "aux.tab")
7284
+ children: t(detailLabelOf(mode))
7102
7285
  }, mode))
7103
7286
  }), detailMode !== "aux" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7104
7287
  className: TokenUsageSection_module_css_default["sortRow"],
@@ -7106,10 +7289,10 @@ window.__ModuleLoader__.load({
7106
7289
  className: detailMode === "model" && modelPerfView ? TokenUsageSection_module_css_default["sortHidden"] : void 0,
7107
7290
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowSortControl, {
7108
7291
  compact: true,
7109
- value: detailMode === "project" ? projectSort : detailMode === "model" ? modelSort : sessionSort,
7110
- options: detailMode === "project" ? PROJECT_SORT : detailMode === "model" ? MODEL_SORT : SESSION_SORT,
7111
- onChange: detailMode === "project" ? setProjectSort : detailMode === "model" ? setModelSort : setSessionSort,
7112
- ariaLabel: t(detailMode === "project" ? "byProject.title" : detailMode === "model" ? "byModel.title" : "bySession.title"),
7292
+ value: detailMode === "project" ? projectSort : detailMode === "model" ? modelSort : detailMode === "provider" ? providerSort : sessionSort,
7293
+ options: detailMode === "project" ? PROJECT_SORT : detailMode === "model" ? MODEL_SORT : detailMode === "provider" ? PROVIDER_SORT : SESSION_SORT,
7294
+ onChange: detailMode === "project" ? setProjectSort : detailMode === "model" ? setModelSort : detailMode === "provider" ? setProviderSort : setSessionSort,
7295
+ ariaLabel: t(detailLabelOf(detailMode)),
7113
7296
  t
7114
7297
  })
7115
7298
  }), detailMode === "model" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PerfToggle, {
@@ -7131,7 +7314,9 @@ window.__ModuleLoader__.load({
7131
7314
  projectRows,
7132
7315
  modelRows: state.value.byModel,
7133
7316
  sessionRows: state.value.sessionRows ?? [],
7134
- sort: detailMode === "project" ? projectSort : detailMode === "model" ? modelSort : sessionSort,
7317
+ providerRows: state.value.byProvider ?? [],
7318
+ providerNames: state.value.providerNames,
7319
+ sort: detailMode === "project" ? projectSort : detailMode === "model" ? modelSort : detailMode === "provider" ? providerSort : sessionSort,
7135
7320
  perfView: detailMode === "model" && modelPerfView,
7136
7321
  pricing: state.value.pricing,
7137
7322
  costState: state.value.costState,
@@ -7207,7 +7392,7 @@ window.__ModuleLoader__.load({
7207
7392
  });
7208
7393
  }
7209
7394
  // \0dsh-css:/home/runner/work/dsh-token-usage/dsh-token-usage/src/client/UsageView.module.css.mjs
7210
- const css = ".PR9kTG_root{color:var(--dsw-alias-label-primary);box-sizing:border-box;width:100%;padding:12px calc(var(--dsh-composer-side-clearance,16px) + 16px);padding-bottom:calc(var(--dsh-composer-height,152px) + 16px);flex-direction:column;gap:12px;max-width:1400px;height:100%;min-height:0;margin:0 auto;display:flex;overflow-y:auto;container:PR9kTG_usage/inline-size}.PR9kTG_root>*{flex-shrink:0}.PR9kTG_head{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:12px;display:flex}.PR9kTG_headRight{align-items:center;gap:10px;display:flex}.PR9kTG_back{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;padding:3px 10px;font-size:12px}.PR9kTG_back:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.PR9kTG_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.PR9kTG_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:12px;font-weight:500}.PR9kTG_segBtn:hover:not(.PR9kTG_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}.PR9kTG_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.PR9kTG_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.PR9kTG_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.PR9kTG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.PR9kTG_empty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0 0;font-size:13px}.PR9kTG_button{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;align-self:flex-start;padding:3px 10px;font-size:12px}.PR9kTG_warning{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-label-secondary));margin:0;font-size:12px}.PR9kTG_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px}.PR9kTG_cards{grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;display:grid}.PR9kTG_tokenStrip{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:18px;padding:6px 2px 0;font-size:12px;display:flex}.PR9kTG_tokenStrip b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}.PR9kTG_mid{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start;gap:24px;display:grid}.PR9kTG_chartCol,.PR9kTG_modelCol,.PR9kTG_subagents{flex-direction:column;gap:6px;min-width:0;display:flex}.PR9kTG_subagentsHead,.PR9kTG_chartHead{align-items:center;gap:8px;display:flex}.PR9kTG_subtitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;font-weight:600}.PR9kTG_tableWrap{overflow-x:auto}.PR9kTG_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:480px;font-size:12px}.PR9kTG_table th,.PR9kTG_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.PR9kTG_table tbody tr{transition:background-color .12s}.PR9kTG_table tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}.PR9kTG_table th{border-bottom:1.5px solid var(--dsw-alias-border-l2);font-weight:600}.PR9kTG_costCol{font-weight:600}.PR9kTG_zeroDim{color:var(--dsw-alias-label-tertiary);opacity:.55}.PR9kTG_table th:first-child,.PR9kTG_table td:first-child,.PR9kTG_modelHead{text-align:left}.PR9kTG_modelCell{font-variant-numeric:normal;text-overflow:ellipsis;max-width:180px;overflow:hidden}.PR9kTG_modelIdentity{align-items:center;gap:4px;max-width:180px;display:inline-flex}.PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_childLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;text-align:left;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:none;max-width:220px;padding:0;font-size:12px;overflow:hidden}.PR9kTG_childLink:hover{text-decoration:underline}.PR9kTG_nestedBadge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:6px;font-size:11px}.PR9kTG_poolSection{flex-direction:column;gap:6px;min-width:0;margin-top:4px;display:flex}.PR9kTG_poolHead{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:8px 12px;display:flex}.PR9kTG_poolContext{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px}.PR9kTG_poolEmpty{color:var(--dsw-alias-label-secondary);padding:12px 0;font-size:12px}.PR9kTG_latestPanel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:9px;min-width:0;padding:14px 16px}.PR9kTG_requestIdentity{flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;display:flex}.PR9kTG_poolBadge{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:5px;flex:none;padding:1px 7px;font-size:11px}.PR9kTG_poolState{white-space:nowrap;font-size:11px}.PR9kTG_requestIdentity .PR9kTG_poolState{align-items:center;gap:5px;display:inline-flex}.PR9kTG_statusDot{background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}.PR9kTG_latestPanel .PR9kTG_modelName{font-size:13px;font-weight:500}.PR9kTG_stateDone{color:var(--dsw-alias-state-success-primary,#16a34a)}.PR9kTG_stateFailed{color:var(--dsw-alias-state-error-primary,#dc2626)}.PR9kTG_statePending{color:light-dark(#b45309,#d9ac64)}.PR9kTG_stateStreaming{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary))}.PR9kTG_modelInline{white-space:nowrap;align-items:center;gap:6px;min-width:0;max-width:100%;display:inline-flex}.PR9kTG_cacheLoss{color:light-dark(#b45309,#d9ac64);white-space:nowrap;background:light-dark(#fff1d8,#352b1d);border-radius:4px;flex:none;align-items:center;gap:4px;padding:2px 6px;font-size:11px;display:inline-flex}.PR9kTG_cacheLoss svg{flex:none;width:12px;height:12px}.PR9kTG_auxKind{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:4px;flex:none;padding:2px 5px;font-size:10px}.PR9kTG_requestMetrics{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;padding:13px 0;display:grid}.PR9kTG_metricValue{letter-spacing:-.25px;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:23px;font-weight:500}.PR9kTG_metricUnit{color:var(--dsw-alias-label-tertiary);letter-spacing:0;margin-left:4px;font-size:11px}.PR9kTG_metricLabel{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:11px}.PR9kTG_requestFooter{border-top:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);flex-wrap:wrap;justify-content:space-between;gap:8px 18px;padding-top:8px;font-size:11px;display:flex}.PR9kTG_requestBuckets{flex-wrap:wrap;gap:8px 15px;display:flex}.PR9kTG_requestFooter b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.PR9kTG_poolNotice{color:light-dark(#b45309,#d9ac64);margin:4px 0 0;font-size:11px}.PR9kTG_poolNoticeError{color:var(--dsw-alias-state-error-primary)}.PR9kTG_poolNoticeNeutral{color:var(--dsw-alias-label-tertiary)}.PR9kTG_poolTableWrap{overscroll-behavior:contain;max-height:196px;overflow:auto}.PR9kTG_poolTableWrap::-webkit-scrollbar{width:8px;height:8px}.PR9kTG_poolTableWrap::-webkit-scrollbar-track,.PR9kTG_poolTableWrap::-webkit-scrollbar-corner{background:0 0}.PR9kTG_poolTableWrap::-webkit-scrollbar-button{display:none}.PR9kTG_poolTableWrap::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.PR9kTG_poolTableWrap.PR9kTG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.PR9kTG_poolTableWrap:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:2px}.PR9kTG_poolTable{table-layout:fixed;border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;font-size:11px}.PR9kTG_poolTable th,.PR9kTG_poolTable td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:8px 6px;overflow:hidden}.PR9kTG_poolTable th{z-index:1;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-secondary);border-bottom:1.5px solid var(--dsw-alias-border-l2);padding:6px;font-weight:400;position:sticky;top:0}.PR9kTG_poolTable th:nth-child(-n+4),.PR9kTG_poolTable td:nth-child(-n+4){text-align:left}.PR9kTG_poolOrigin,.PR9kTG_poolTime{color:var(--dsw-alias-label-secondary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:200px}.PR9kTG_poolModel .PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_poolModelHead{text-align:left}.PR9kTG_poolTable tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}@media (prefers-reduced-motion:no-preference){.PR9kTG_latestPanel{animation:.25s ease-out PR9kTG_pool-arrive}@keyframes PR9kTG_pool-arrive{0%{opacity:.4}to{opacity:1}}}@container PR9kTG_usage (width<=900px){.PR9kTG_requestMetrics{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_poolTableWrap{max-height:230px}}@container PR9kTG_usage (width<=480px){.PR9kTG_poolTableWrap{max-height:240px}.PR9kTG_poolTable thead{display:none}.PR9kTG_poolTable,.PR9kTG_poolTable tbody{min-width:0;display:block}.PR9kTG_poolTable tbody tr{border-bottom:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 9px;padding:9px 0;display:grid}.PR9kTG_poolTable td{border-bottom:none;text-align:left!important;padding:0!important}.PR9kTG_poolTable td:nth-child(4){grid-column:1/-1}.PR9kTG_poolTable td:before{content:attr(data-label) \" \";color:var(--dsw-alias-label-tertiary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:100%}.PR9kTG_metricValue{font-size:21px}}@container PR9kTG_usage (width<=900px){.PR9kTG_cards{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_mid{grid-template-columns:1fr}}@media (width<=600px){.PR9kTG_root{padding-left:12px;padding-right:12px}}";
7395
+ const css = ".PR9kTG_root{color:var(--dsw-alias-label-primary);box-sizing:border-box;width:100%;padding:12px calc(var(--dsh-composer-side-clearance,16px) + 16px);padding-bottom:calc(var(--dsh-composer-height,152px) + 16px);flex-direction:column;gap:12px;max-width:1400px;height:100%;min-height:0;margin:0 auto;display:flex;overflow-y:auto;container:PR9kTG_usage/inline-size}.PR9kTG_root>*{flex-shrink:0}.PR9kTG_head{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:12px;display:flex}.PR9kTG_headRight{align-items:center;gap:10px;display:flex}.PR9kTG_back{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;padding:3px 10px;font-size:12px}.PR9kTG_back:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.PR9kTG_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.PR9kTG_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:12px;font-weight:500}.PR9kTG_segBtn:hover:not(.PR9kTG_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}.PR9kTG_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.PR9kTG_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.PR9kTG_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.PR9kTG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.PR9kTG_empty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0 0;font-size:13px}.PR9kTG_button{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;align-self:flex-start;padding:3px 10px;font-size:12px}.PR9kTG_warning{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-label-secondary));margin:0;font-size:12px}.PR9kTG_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px}.PR9kTG_cards{grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;display:grid}.PR9kTG_tokenStrip{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:18px;padding:6px 2px 0;font-size:12px;display:flex}.PR9kTG_tokenStrip b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}.PR9kTG_mid{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start;gap:24px;display:grid}.PR9kTG_chartCol,.PR9kTG_modelCol,.PR9kTG_subagents{flex-direction:column;gap:6px;min-width:0;display:flex}.PR9kTG_subagentsHead,.PR9kTG_chartHead{align-items:center;gap:8px;display:flex}.PR9kTG_subtitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;font-weight:600}.PR9kTG_tableWrap{overflow-x:auto}.PR9kTG_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:480px;font-size:12px}.PR9kTG_table th,.PR9kTG_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.PR9kTG_table tbody tr{transition:background-color .12s}.PR9kTG_table tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}.PR9kTG_table th{border-bottom:1.5px solid var(--dsw-alias-border-l2);font-weight:600}.PR9kTG_costCol{font-weight:600}.PR9kTG_zeroDim{color:var(--dsw-alias-label-tertiary);opacity:.55}.PR9kTG_table th:first-child,.PR9kTG_table td:first-child,.PR9kTG_modelHead{text-align:left}.PR9kTG_modelCell{font-variant-numeric:normal;text-overflow:ellipsis;max-width:180px;overflow:hidden}.PR9kTG_modelIdentity{align-items:center;gap:4px;max-width:180px;display:inline-flex}.PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_childLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;text-align:left;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:none;max-width:220px;padding:0;font-size:12px;overflow:hidden}.PR9kTG_childLink:hover{text-decoration:underline}.PR9kTG_nestedBadge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:6px;font-size:11px}.PR9kTG_poolSection{flex-direction:column;gap:6px;min-width:0;margin-top:4px;display:flex}.PR9kTG_poolHead{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:8px 12px;display:flex}.PR9kTG_poolContext{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px}.PR9kTG_poolEmpty{color:var(--dsw-alias-label-secondary);padding:12px 0;font-size:12px}.PR9kTG_latestPanel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:9px;min-width:0;padding:14px 16px}.PR9kTG_requestIdentity{flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;display:flex}.PR9kTG_poolBadge{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:5px;flex:none;padding:1px 7px;font-size:11px}.PR9kTG_poolState{white-space:nowrap;font-size:11px}.PR9kTG_requestIdentity .PR9kTG_poolState{align-items:center;gap:5px;display:inline-flex}.PR9kTG_statusDot{background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}.PR9kTG_latestPanel .PR9kTG_modelName{font-size:13px;font-weight:500}.PR9kTG_stateDone{color:var(--dsw-alias-state-success-primary,#16a34a)}.PR9kTG_stateFailed{color:var(--dsw-alias-state-error-primary,#dc2626)}.PR9kTG_statePending{color:light-dark(#b45309,#d9ac64)}.PR9kTG_stateStreaming{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary))}.PR9kTG_modelInline{white-space:nowrap;align-items:center;gap:6px;min-width:0;max-width:100%;display:inline-flex}.PR9kTG_cacheLoss{color:light-dark(#b45309,#d9ac64);white-space:nowrap;background:light-dark(#fff1d8,#352b1d);border-radius:4px;flex:none;align-items:center;gap:4px;padding:2px 6px;font-size:11px;display:inline-flex}.PR9kTG_cacheLoss svg{flex:none;width:12px;height:12px}.PR9kTG_auxKind{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:4px;flex:none;padding:2px 5px;font-size:10px}.PR9kTG_requestMetrics{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;padding:13px 0;display:grid}.PR9kTG_metricValue{letter-spacing:-.25px;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:23px;font-weight:500}.PR9kTG_metricUnit{color:var(--dsw-alias-label-tertiary);letter-spacing:0;margin-left:4px;font-size:11px}.PR9kTG_metricLabel{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:11px}.PR9kTG_requestFooter{border-top:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);flex-wrap:nowrap;justify-content:space-between;align-items:baseline;gap:8px 18px;padding-top:8px;font-size:11px;display:flex}.PR9kTG_requestBuckets{flex-wrap:wrap;flex:none;gap:8px 15px;display:flex}.PR9kTG_requestNote{white-space:nowrap;text-overflow:ellipsis;color:light-dark(#b45309,#d9ac64);flex:0 auto;min-width:0;margin:0;font-size:11px;overflow:hidden}.PR9kTG_requestNoteError{color:var(--dsw-alias-state-error-primary)}.PR9kTG_requestNoteNeutral{color:var(--dsw-alias-label-tertiary)}.PR9kTG_requestFooter b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.PR9kTG_poolNotice{color:light-dark(#b45309,#d9ac64);margin:4px 0 0;font-size:11px}.PR9kTG_poolTableWrap{overscroll-behavior:contain;max-height:196px;overflow:auto}.PR9kTG_poolTableWrap::-webkit-scrollbar{width:8px;height:8px}.PR9kTG_poolTableWrap::-webkit-scrollbar-track,.PR9kTG_poolTableWrap::-webkit-scrollbar-corner{background:0 0}.PR9kTG_poolTableWrap::-webkit-scrollbar-button{display:none}.PR9kTG_poolTableWrap::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.PR9kTG_poolTableWrap.PR9kTG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.PR9kTG_poolTableWrap:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:2px}.PR9kTG_poolTable{table-layout:fixed;border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;font-size:11px}.PR9kTG_poolTable th,.PR9kTG_poolTable td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:8px 6px;overflow:hidden}.PR9kTG_poolTable th{z-index:1;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-secondary);border-bottom:1.5px solid var(--dsw-alias-border-l2);padding:6px;font-weight:400;position:sticky;top:0}.PR9kTG_poolTable th:nth-child(-n+4),.PR9kTG_poolTable td:nth-child(-n+4){text-align:left}.PR9kTG_poolOrigin,.PR9kTG_poolTime{color:var(--dsw-alias-label-secondary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:200px}.PR9kTG_poolModel .PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_poolModelHead{text-align:left}.PR9kTG_poolTable tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}@media (prefers-reduced-motion:no-preference){.PR9kTG_latestPanel{animation:.25s ease-out PR9kTG_pool-arrive}@keyframes PR9kTG_pool-arrive{0%{opacity:.4}to{opacity:1}}}@container PR9kTG_usage (width<=900px){.PR9kTG_requestMetrics{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_poolTableWrap{max-height:230px}}@container PR9kTG_usage (width<=480px){.PR9kTG_poolTableWrap{max-height:240px}.PR9kTG_poolTable thead{display:none}.PR9kTG_poolTable,.PR9kTG_poolTable tbody{min-width:0;display:block}.PR9kTG_poolTable tbody tr{border-bottom:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 9px;padding:9px 0;display:grid}.PR9kTG_poolTable td{border-bottom:none;text-align:left!important;padding:0!important}.PR9kTG_poolTable td:nth-child(4){grid-column:1/-1}.PR9kTG_poolTable td:before{content:attr(data-label) \" \";color:var(--dsw-alias-label-tertiary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:100%}.PR9kTG_metricValue{font-size:21px}}@container PR9kTG_usage (width<=900px){.PR9kTG_cards{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_mid{grid-template-columns:1fr}}@media (width<=600px){.PR9kTG_root{padding-left:12px;padding-right:12px}}";
7211
7396
  const tagId = "@laoyuehanni/dsh-token-usage/UsageView.module.css";
7212
7397
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
7213
7398
  const tag = document.createElement("style");
@@ -7252,8 +7437,6 @@ window.__ModuleLoader__.load({
7252
7437
  "poolModel": "PR9kTG_poolModel",
7253
7438
  "poolModelHead": "PR9kTG_poolModelHead",
7254
7439
  "poolNotice": "PR9kTG_poolNotice",
7255
- "poolNoticeError": "PR9kTG_poolNoticeError",
7256
- "poolNoticeNeutral": "PR9kTG_poolNoticeNeutral",
7257
7440
  "poolOrigin": "PR9kTG_poolOrigin",
7258
7441
  "poolSection": "PR9kTG_poolSection",
7259
7442
  "poolState": "PR9kTG_poolState",
@@ -7264,6 +7447,9 @@ window.__ModuleLoader__.load({
7264
7447
  "requestFooter": "PR9kTG_requestFooter",
7265
7448
  "requestIdentity": "PR9kTG_requestIdentity",
7266
7449
  "requestMetrics": "PR9kTG_requestMetrics",
7450
+ "requestNote": "PR9kTG_requestNote",
7451
+ "requestNoteError": "PR9kTG_requestNoteError",
7452
+ "requestNoteNeutral": "PR9kTG_requestNoteNeutral",
7267
7453
  "root": "PR9kTG_root",
7268
7454
  "scrolling": "PR9kTG_scrolling",
7269
7455
  "segActive": "PR9kTG_segActive",
@@ -7322,22 +7508,39 @@ window.__ModuleLoader__.load({
7322
7508
  }
7323
7509
  /** The hit cell's tooltip: the low-hit explanation (with the raw-precision
7324
7510
  * note when rounding would hide a sub-threshold rate) or the exclusion
7325
- * reason. Unknown figures explain their unknown instead of going silent. */
7326
- function hitTooltipOf(cache, t) {
7327
- if (cache.rate === void 0) return cache.reason !== void 0 ? t(`pool.excluded.${cache.reason}`) : "";
7328
- const display = formatRequestRate(cache.rate);
7329
- if (cache.band === "loss") {
7330
- const lines = [t("pool.cache.tooltip", { rate: display })];
7331
- if (Number.parseFloat(display) >= 50) lines.push(t("pool.cache.roundedDown", { rate: formatRequestRateExact(cache.rate) }));
7332
- return lines.join("\n");
7511
+ * reason. Unknown figures explain their unknown instead of going silent.
7512
+ * The compaction attribution (when the row carries one) rides the same
7513
+ * tooltip as its closing section — real-world feedback dropped the standalone
7514
+ * badge as redundant next to the 缓存过低 marker, and the causal chain reads
7515
+ * exactly where the rate is questioned. The wording says the prefix WAS
7516
+ * rewritten and cache behaviour MAY be affected — never that compaction
7517
+ * caused a cache loss, because a high-hit row can carry the same attribution
7518
+ * (the miss severity depends on the earliest rewritten position, which the
7519
+ * plugin cannot see). */
7520
+ function hitTooltipOf(cache, t, attribution) {
7521
+ const lines = [];
7522
+ if (cache.rate === void 0) {
7523
+ if (cache.reason !== void 0) lines.push(t(`pool.excluded.${cache.reason}`));
7524
+ } else {
7525
+ const display = formatRequestRate(cache.rate);
7526
+ if (cache.band === "loss") {
7527
+ lines.push(t("pool.cache.tooltip", { rate: display }));
7528
+ if (Number.parseFloat(display) >= 50) lines.push(t("pool.cache.roundedDown", { rate: formatRequestRateExact(cache.rate) }));
7529
+ } else if (cache.reason !== void 0) lines.push(t(`pool.excluded.${cache.reason}`));
7333
7530
  }
7334
- if (cache.reason !== void 0) return t(`pool.excluded.${cache.reason}`);
7335
- return "";
7531
+ if (attribution !== void 0) {
7532
+ lines.push(t("pool.attribution.prefix"));
7533
+ for (const item of attribution) lines.push(item.kind === "prune" ? t("pool.attribution.prune", {
7534
+ count: String(item.count),
7535
+ tokens: formatTokens(item.shadowedTokenCount)
7536
+ }) : t("pool.attribution.summary", { tokens: formatTokens(item.shadowedTokenCount) }));
7537
+ }
7538
+ return lines.join("\n");
7336
7539
  }
7337
7540
  /** The hit cell keeps request precision, shared numeric colours, and its explanation. */
7338
- function HitCell({ cache, t }) {
7541
+ function HitCell({ cache, attribution, t }) {
7339
7542
  const text = formatRequestRate(cache.rate);
7340
- const tooltip = hitTooltipOf(cache, t);
7543
+ const tooltip = hitTooltipOf(cache, t, attribution);
7341
7544
  const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7342
7545
  className: hitClassOf(cache),
7343
7546
  children: text
@@ -7389,7 +7592,7 @@ window.__ModuleLoader__.load({
7389
7592
  children: kindLabel
7390
7593
  }),
7391
7594
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
7392
- label: hitTooltipOf(cache, t),
7595
+ label: hitTooltipOf(cache, t, detail.compactionAttribution),
7393
7596
  side: "top",
7394
7597
  delayMs: 100,
7395
7598
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
@@ -7448,16 +7651,9 @@ window.__ModuleLoader__.load({
7448
7651
  children: suffix
7449
7652
  })] });
7450
7653
  }
7451
- /** The in-flight notice line under the latest panel, plus the priced /
7452
- * untimed notes the state matrix requires. */
7453
- function noticeOf(detail, t) {
7454
- switch (detail.state) {
7455
- case "waiting": return t("pool.note.waiting");
7456
- case "streaming": return t("pool.note.streaming");
7457
- case "cancelled": return t("pool.note.cancelled");
7458
- case "interrupted": return t("pool.note.interrupted");
7459
- case "failed": return t("pool.note.failed", { code: detail.failureCode ?? "" });
7460
- }
7654
+ /** 已结算请求自身的诊断说明:辅助请求不重复解释(紧凑标记已经说明),
7655
+ * 缓存排除与计时/用量/定价的缺口各自说明自己。 */
7656
+ function diagnosticOf(detail, t) {
7461
7657
  if (detail.kind === "aux") return "";
7462
7658
  if (detail.pricingStatus === "unpriced") return t("pool.note.unpriced");
7463
7659
  if (detail.inputTokens === void 0 || detail.outputTokens === void 0) return t("pool.note.noUsage");
@@ -7465,6 +7661,57 @@ window.__ModuleLoader__.load({
7465
7661
  if (detail.cache.band === "excluded" || detail.cache.band === "unknown") return detail.cache.reason !== void 0 ? t(`pool.excluded.${detail.cache.reason}`) : "";
7466
7662
  return "";
7467
7663
  }
7664
+ /** The panel's notice: the conversation's state first (waiting for a tool
7665
+ * result / this turn is done / retrying after a failure), then the request's
7666
+ * own lifecycle, then the settled request's diagnostic. A lower-priority
7667
+ * fact never disappears — it moves into the tooltip instead, so both stay
7668
+ * reachable. */
7669
+ function noticeOf(detail, conversation, t) {
7670
+ const one = (text, tone) => ({
7671
+ text,
7672
+ full: text,
7673
+ tone
7674
+ });
7675
+ const own = (() => {
7676
+ switch (detail.state) {
7677
+ case "waiting": return one(t("pool.note.waiting"), "pending");
7678
+ case "streaming": return one(t("pool.note.streaming"), "pending");
7679
+ case "cancelled": return one(t("pool.note.cancelled"), "pending");
7680
+ case "interrupted": return one(t("pool.note.interrupted"), "pending");
7681
+ case "failed": return one(t("pool.note.failed", { code: detail.failureCode ?? "" }), "error");
7682
+ default: return;
7683
+ }
7684
+ })();
7685
+ const diagnostic = detail.state === "completed" ? diagnosticOf(detail, t) : "";
7686
+ const conversationNotice = (text, tone, rest) => ({
7687
+ text,
7688
+ full: [
7689
+ text,
7690
+ rest,
7691
+ own?.text ?? "",
7692
+ diagnostic
7693
+ ].filter((part) => part !== "").join(" · "),
7694
+ tone
7695
+ });
7696
+ if (conversation?.state === "retrying") {
7697
+ const retry = conversation.retry;
7698
+ const count = String(retry?.count ?? 1);
7699
+ return conversationNotice(retry !== void 0 && retry.max > 0 ? t("pool.note.retrying", {
7700
+ count,
7701
+ max: String(retry.max)
7702
+ }) : t("pool.note.retryingAlways", { count }), "pending", retry === void 0 ? "" : t("pool.note.retryWait", {
7703
+ seconds: String(Math.max(1, Math.round(retry.delayMs / 1e3))),
7704
+ code: retry.code ?? "—"
7705
+ }));
7706
+ }
7707
+ if (conversation?.state === "awaiting-tool") return conversationNotice(t("pool.note.awaitingTool"), "pending", "");
7708
+ if (conversation?.state === "turn-complete") return conversationNotice(t("pool.note.turnComplete"), "neutral", "");
7709
+ if (own !== void 0) return diagnostic === "" ? own : {
7710
+ ...own,
7711
+ full: `${own.full} · ${diagnostic}`
7712
+ };
7713
+ return diagnostic === "" ? void 0 : one(diagnostic, "neutral");
7714
+ }
7468
7715
  /** Fixed-layout column floors in px, in table order (origin, state, time,
7469
7716
  * model, cache hit, input, output, cache read, first token, latency, speed,
7470
7717
  * cost): each is the smallest width that column's content ever needs, so
@@ -7525,6 +7772,7 @@ window.__ModuleLoader__.load({
7525
7772
  "data-label": t("pool.col.hit"),
7526
7773
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HitCell, {
7527
7774
  cache: detail.cache,
7775
+ attribution: detail.compactionAttribution,
7528
7776
  t
7529
7777
  })
7530
7778
  }),
@@ -7613,7 +7861,8 @@ window.__ModuleLoader__.load({
7613
7861
  const inFlight = latest.state === "waiting" || latest.state === "streaming";
7614
7862
  const origin = latest.sessionId === focusId;
7615
7863
  const time = latest.orderBasis === "record" ? latest.recordTime ?? latest.orderAt : latest.startedAt ?? latest.orderAt;
7616
- const notice = noticeOf(latest, t);
7864
+ const notice = noticeOf(latest, details.conversation, t);
7865
+ const noteClass = `${UsageView_module_css_default["requestNote"]} ${notice?.tone === "error" ? UsageView_module_css_default["requestNoteError"] ?? "" : notice?.tone === "neutral" ? UsageView_module_css_default["requestNoteNeutral"] ?? "" : ""}`;
7617
7866
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7618
7867
  className: UsageView_module_css_default["latestPanel"],
7619
7868
  children: [
@@ -7652,6 +7901,7 @@ window.__ModuleLoader__.load({
7652
7901
  className: UsageView_module_css_default["metricValue"],
7653
7902
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HitCell, {
7654
7903
  cache: latest.cache,
7904
+ attribution: latest.compactionAttribution,
7655
7905
  t
7656
7906
  })
7657
7907
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -7723,14 +7973,19 @@ window.__ModuleLoader__.load({
7723
7973
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: tokenTextOf(latest.cacheWriteTokens) })
7724
7974
  ] })
7725
7975
  ]
7726
- }), (staleAt !== void 0 || latest.state !== "completed") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7976
+ }), notice !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
7977
+ label: notice.full,
7978
+ side: "top",
7979
+ delayMs: 100,
7980
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7981
+ className: noteClass,
7982
+ tabIndex: 0,
7983
+ children: notice.text
7984
+ })
7985
+ }) : staleAt !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7727
7986
  className: UsageView_module_css_default["poolContext"],
7728
- children: staleAt !== void 0 ? t("pool.asOf", { time: formatTimeOfDay(staleAt) }) : t(inFlight ? "pool.pending" : "pool.ended")
7729
- })]
7730
- }),
7731
- notice !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7732
- className: `${UsageView_module_css_default["poolNotice"]} ${latest.state === "failed" ? UsageView_module_css_default["poolNoticeError"] : latest.state === "completed" ? UsageView_module_css_default["poolNoticeNeutral"] : ""}`,
7733
- children: notice
7987
+ children: t("pool.asOf", { time: formatTimeOfDay(staleAt) })
7988
+ }) : null]
7734
7989
  })
7735
7990
  ]
7736
7991
  });
@@ -8193,8 +8448,8 @@ window.__ModuleLoader__.load({
8193
8448
  children: t("filter.model")
8194
8449
  }),
8195
8450
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
8196
- "aria-label": t("stat.successFail"),
8197
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestsSplitHead, { t })
8451
+ title: t("stat.successFail"),
8452
+ children: t("stat.requestColumn")
8198
8453
  }),
8199
8454
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("stat.input") }),
8200
8455
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("stat.output") }),
@@ -8433,9 +8688,8 @@ window.__ModuleLoader__.load({
8433
8688
  "calendar.weekday.5": "六",
8434
8689
  "calendar.weekday.6": "日",
8435
8690
  "stat.requests": "请求数",
8691
+ "stat.requestColumn": "请求",
8436
8692
  "stat.successFail": "成功/失败",
8437
- "stat.ok": "成功",
8438
- "stat.fail": "失败",
8439
8693
  "stat.failuresPill": "失败 {count}",
8440
8694
  "fail.RATE_LIMIT": "限流",
8441
8695
  "fail.SERVER": "服务异常",
@@ -8470,6 +8724,12 @@ window.__ModuleLoader__.load({
8470
8724
  "perf.lowSamples": "样本不足",
8471
8725
  "perf.requestCount": "{count} 次",
8472
8726
  "byModel.title": "按模型",
8727
+ "byProvider.title": "按供应商",
8728
+ "byProvider.unattributed": "缺失供应商",
8729
+ "byProvider.cause.intro": "可能是:",
8730
+ "byProvider.cause.deletedLog": "会话日志已删除的历史会话",
8731
+ "byProvider.cause.preField": "路由键字段加入前的旧会话",
8732
+ "byProvider.cause.bypass": "不带路由键的运行开销",
8473
8733
  "bySession.title": "按会话",
8474
8734
  "byProject.title": "按项目",
8475
8735
  "aux.tab": "运行开销",
@@ -8488,6 +8748,7 @@ window.__ModuleLoader__.load({
8488
8748
  "board.projects": "项目",
8489
8749
  "board.sessions": "会话",
8490
8750
  "board.models": "模型",
8751
+ "board.providers": "供应商",
8491
8752
  "board.byTokens": "{count} 个 · 按总 token",
8492
8753
  "board.byCost": "{count} 个 · 按费用",
8493
8754
  "board.bySpeed": "{count} 个 · 按输出速度",
@@ -8632,6 +8893,9 @@ window.__ModuleLoader__.load({
8632
8893
  "pool.kind.session-title": "标题",
8633
8894
  "pool.kind.translation": "翻译",
8634
8895
  "pool.kind.other": "辅助",
8896
+ "pool.attribution.prefix": "此请求发出前,宿主的压缩操作改写了上下文前缀,缓存表现可能受影响:",
8897
+ "pool.attribution.prune": "工具结果剪枝改写了请求前缀({count} 条,剪除消息的影子 token 合计 {tokens})",
8898
+ "pool.attribution.summary": "LLM 摘要替换了会话历史(影子 token {tokens})",
8635
8899
  "pool.state.waiting": "等待首 token",
8636
8900
  "pool.state.streaming": "生成中",
8637
8901
  "pool.state.completed": "已完成",
@@ -8673,6 +8937,11 @@ window.__ModuleLoader__.load({
8673
8937
  "pool.excluded.invalid-data": "缓存计数缺失或矛盾,无法计算命中率",
8674
8938
  "pool.note.waiting": "首 token 尚未到达;暂不计算输出速度",
8675
8939
  "pool.note.streaming": "生成中 · 服务商未提供实时 token 计数,速度待结束后结算",
8940
+ "pool.note.awaitingTool": "等待tool结果",
8941
+ "pool.note.turnComplete": "本轮对话已完成",
8942
+ "pool.note.retrying": "请求失败,正在重试({count}/{max})",
8943
+ "pool.note.retryingAlways": "请求失败,正在重试(第 {count} 次)",
8944
+ "pool.note.retryWait": "{seconds} 秒后重试 · 失败码 {code}",
8676
8945
  "pool.note.cancelled": "请求被取消 · 已交付的部分用量按记录展示,不估算缺失数据",
8677
8946
  "pool.note.interrupted": "连接中断 · 无法确认请求的结束状态",
8678
8947
  "pool.note.unpriced": "模型未定价 · 保留 token、缓存与性能,费用显示 —",
@@ -8694,6 +8963,7 @@ window.__ModuleLoader__.load({
8694
8963
  "panel.unpricedNote": "仅计 token",
8695
8964
  "quota.trigger": "供应商配额",
8696
8965
  "quota.triggerSummary": "{name} · {figure}",
8966
+ "quota.triggerSummaryPooled": "{name} · {figure}({count} 个额度均值)",
8697
8967
  "quota.panel": "供应商配额面板",
8698
8968
  "quota.tier.fiveHour": "5 小时",
8699
8969
  "quota.tier.weekly": "每周",
@@ -8784,9 +9054,8 @@ window.__ModuleLoader__.load({
8784
9054
  "calendar.weekday.5": "Sa",
8785
9055
  "calendar.weekday.6": "Su",
8786
9056
  "stat.requests": "Requests",
9057
+ "stat.requestColumn": "Requests",
8787
9058
  "stat.successFail": "OK/Fail",
8788
- "stat.ok": "OK",
8789
- "stat.fail": "Fail",
8790
9059
  "stat.failuresPill": "Failed {count}",
8791
9060
  "fail.RATE_LIMIT": "Rate limited",
8792
9061
  "fail.SERVER": "Server error",
@@ -8821,6 +9090,12 @@ window.__ModuleLoader__.load({
8821
9090
  "perf.lowSamples": "Low samples",
8822
9091
  "perf.requestCount": "{count} reqs",
8823
9092
  "byModel.title": "By model",
9093
+ "byProvider.title": "By provider",
9094
+ "byProvider.unattributed": "Missing provider",
9095
+ "byProvider.cause.intro": "Could be:",
9096
+ "byProvider.cause.deletedLog": "History sessions whose logs were deleted",
9097
+ "byProvider.cause.preField": "Sessions older than the route-key field",
9098
+ "byProvider.cause.bypass": "Bypass calls that carry no route key",
8824
9099
  "bySession.title": "By session",
8825
9100
  "byProject.title": "By project",
8826
9101
  "aux.tab": "Runtime overhead",
@@ -8839,6 +9114,7 @@ window.__ModuleLoader__.load({
8839
9114
  "board.projects": "Projects",
8840
9115
  "board.sessions": "Sessions",
8841
9116
  "board.models": "Models",
9117
+ "board.providers": "Providers",
8842
9118
  "board.byTokens": "{count} · by tokens",
8843
9119
  "board.byCost": "{count} · by cost",
8844
9120
  "board.bySpeed": "{count} · by speed",
@@ -8983,6 +9259,9 @@ window.__ModuleLoader__.load({
8983
9259
  "pool.kind.session-title": "Title",
8984
9260
  "pool.kind.translation": "Translation",
8985
9261
  "pool.kind.other": "Auxiliary",
9262
+ "pool.attribution.prefix": "Before this request, host compaction rewrote the context prefix; cache behaviour may be affected:",
9263
+ "pool.attribution.prune": "Tool-result pruning rewrote the request prefix ({count} event(s), shadow tokens of pruned messages {tokens})",
9264
+ "pool.attribution.summary": "An LLM summary replaced the conversation history (shadow tokens {tokens})",
8986
9265
  "pool.state.waiting": "Waiting for first token",
8987
9266
  "pool.state.streaming": "Generating",
8988
9267
  "pool.state.completed": "Completed",
@@ -9024,6 +9303,11 @@ window.__ModuleLoader__.load({
9024
9303
  "pool.excluded.invalid-data": "Cache counts missing or contradictory; no hit rate computed",
9025
9304
  "pool.note.waiting": "First token not arrived; output speed not computed",
9026
9305
  "pool.note.streaming": "Generating · the provider reports no live token counts; speed settles after completion",
9306
+ "pool.note.awaitingTool": "Waiting for tool result",
9307
+ "pool.note.turnComplete": "This turn is complete",
9308
+ "pool.note.retrying": "Request failed, retrying ({count}/{max})",
9309
+ "pool.note.retryingAlways": "Request failed, retrying (attempt {count})",
9310
+ "pool.note.retryWait": "next attempt in {seconds}s · failure {code}",
9027
9311
  "pool.note.cancelled": "Cancelled · delivered partial usage shown as recorded, nothing estimated",
9028
9312
  "pool.note.interrupted": "Connection lost · the request's final state cannot be confirmed",
9029
9313
  "pool.note.unpriced": "Model unpriced · tokens, cache and timing kept, cost shows —",
@@ -9045,6 +9329,7 @@ window.__ModuleLoader__.load({
9045
9329
  "panel.unpricedNote": "tokens only",
9046
9330
  "quota.trigger": "Provider quota",
9047
9331
  "quota.triggerSummary": "{name} · {figure}",
9332
+ "quota.triggerSummaryPooled": "{name} · {figure} (mean of {count} quota meters)",
9048
9333
  "quota.panel": "Provider quota panel",
9049
9334
  "quota.tier.fiveHour": "5-hour",
9050
9335
  "quota.tier.weekly": "Weekly",