opencode-statboard 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-statboard",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Real-time dashboard for opencode token usage and cost statistics",
5
5
  "main": "server.js",
6
6
  "bin": {
package/public/index.html CHANGED
@@ -50,6 +50,7 @@
50
50
  .card .subs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
51
51
  .card .subs b { color: var(--text); font-weight: 600; }
52
52
  .subs .k-in { color: var(--in); } .subs .k-out { color: var(--out); }
53
+ .subs .k-incl { flex-basis: 100%; font-variant-numeric: tabular-nums; }
53
54
  .subs .k-reasoning { color: var(--tool); } .subs .k-cache { color: var(--cache); }
54
55
  .subs .warn { color: var(--warn); cursor: pointer; border-bottom: 1px dashed var(--warn); }
55
56
  .subs .warn:hover { color: #f0c674; }
@@ -163,6 +164,7 @@
163
164
  <div class="l" data-i18n="tokens">Tokens</div>
164
165
  <div class="v" id="hl-tokens">&#8212;</div>
165
166
  <div class="subs">
167
+ <span class="k-incl" id="hl-tokens-incl">&#8212;</span>
166
168
  <span class="k-in"><span data-i18n="tIn">in</span> <b id="hl-in">&#8212;</b></span>
167
169
  <span class="k-out"><span data-i18n="tOut">out</span> <b id="hl-out">&#8212;</b></span>
168
170
  <span class="k-reasoning"><span data-i18n="tReasoning">reasoning</span> <b id="hl-reasoning">&#8212;</b></span>
@@ -306,7 +308,7 @@ const STRINGS = {
306
308
  headline: 'HEADLINE', trend: 'TREND', breakdown: 'BREAKDOWN', toolUsage: 'TOOLS',
307
309
  pricingBasis: 'PRICING BASIS', rawText: 'RAW TEXT',
308
310
  rawHint: 'Plain-text statement, same numbers as the tables above.',
309
- tokens: 'Tokens (excl. cache re-reads)', tIn: 'in', tOut: 'out', tReasoning: 'reasoning', tCache: 'cache re-reads',
311
+ tokens: 'Tokens', tIn: 'in', tOut: 'out', tReasoning: 'reasoning', tCache: 'cache re-reads', tokensInclCache: 'incl. cache re-reads: {v}',
310
312
  totalCost: 'Total Cost', marketValue: 'Market Value', saved: 'Saved',
311
313
  costShare: 'actual paid', atCatalog: 'same usage at catalog list prices',
312
314
  savedOf: '{pct}% of market value',
@@ -352,7 +354,7 @@ const STRINGS = {
352
354
  headline: '重點指標', trend: '趨勢', breakdown: '明細', toolUsage: '工具',
353
355
  pricingBasis: '定價依據', rawText: '原始文字',
354
356
  rawHint: '純文字報表,數字與上方表格一致。',
355
- tokens: 'Tokens(不含快取重讀)', tIn: '輸入', tOut: '輸出', tReasoning: '推理', tCache: '快取重讀',
357
+ tokens: 'Tokens', tIn: '輸入', tOut: '輸出', tReasoning: '推理', tCache: '快取重讀', tokensInclCache: '含快取重讀:{v}',
356
358
  totalCost: '總費用', marketValue: '市價', saved: '已節省',
357
359
  costShare: '實際付費', atCatalog: '同等用量依牌價換算',
358
360
  savedOf: '占市價 {pct}%',
@@ -530,9 +532,11 @@ function renderReport(rep) {
530
532
  const o = (rep.stats && rep.stats.overview) || {};
531
533
  const cacheAll = (c.cacheRead || 0) + (c.cacheWrite || 0);
532
534
 
533
- // Cache reads are context RE-reads (the same prefix counted again on every
534
- // turn), so they must not inflate the headline token count.
535
- $('hl-tokens').textContent = fmt((c.input || 0) + (c.output || 0) + (c.reasoning || 0));
535
+ // Cache reads are context RE-reads (the same prefix counted again every turn),
536
+ // so the headline shows new tokens and the inclusive total sits below it.
537
+ const coreTok = (c.input || 0) + (c.output || 0) + (c.reasoning || 0);
538
+ $('hl-tokens').textContent = fmt(coreTok);
539
+ $('hl-tokens-incl').textContent = fmtLang('tokensInclCache', { v: fmt(coreTok + cacheAll) });
536
540
  $('hl-in').textContent = fmt(c.input);
537
541
  $('hl-out').textContent = fmt(c.output);
538
542
  $('hl-reasoning').textContent = fmt(c.reasoning);