opencode-statboard 2.10.15 → 2.10.16

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 (2) hide show
  1. package/package.json +1 -1
  2. package/tui-dashboard.js +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-statboard",
3
- "version": "2.10.15",
3
+ "version": "2.10.16",
4
4
  "description": "Real-time dashboard for opencode token usage and cost statistics",
5
5
  "main": "server.js",
6
6
  "bin": {
package/tui-dashboard.js CHANGED
@@ -604,7 +604,7 @@ class TUIServer {
604
604
 
605
605
  const height = this.getContentHeight() - 4;
606
606
  const width = this.getContentWidth();
607
- const chartHeight = Math.max(1, Math.floor(height / 3) - 2);
607
+ const chartHeight = Math.max(1, Math.floor(height / 5) - 2);
608
608
 
609
609
  // Helper: render one chart with its own max
610
610
  const renderChart = (data, label, color, maxVal) => {
@@ -629,13 +629,17 @@ class TUIServer {
629
629
 
630
630
  const maxIn = Math.max(...input, 1);
631
631
  const maxOut = Math.max(...output, 1);
632
+ const maxCache = Math.max(...cache, 1);
633
+ const maxTotal = Math.max(...labels.map((_, i) => (input[i] || 0) + (output[i] || 0) + (reasoning[i] || 0) + (cache[i] || 0)), 1);
632
634
  const maxCost = Math.max(...cost, 1);
633
635
 
634
636
  let out = '{center}{bold}\u2501\u2501\u2501 ' + t('trend') + ' \u2501\u2501\u2501{/bold}{/center}\n\n';
635
637
 
636
638
  out += renderChart(input, t('input') + ' (cyan)', 'cyan', maxIn) + '\n';
637
639
  out += renderChart(output, t('output') + ' (green)', 'green', maxOut) + '\n';
638
- out += renderChart(cost, t('cost') + ' (yellow)', 'yellow', maxCost) + '\n';
640
+ out += renderChart(cache, t('cacheRead') + ' (yellow)', 'yellow', maxCache) + '\n';
641
+ out += renderChart(labels.map((_, i) => (input[i] || 0) + (output[i] || 0) + (reasoning[i] || 0) + (cache[i] || 0)), t('total') + ' (magenta)', 'magenta', maxTotal) + '\n';
642
+ out += renderChart(cost, t('cost') + ' (red)', 'red', maxCost) + '\n';
639
643
 
640
644
  // X-axis: show first date, middle date, last date
641
645
  let xAxis = '';
@@ -656,7 +660,8 @@ class TUIServer {
656
660
  out += '\n{gray}Range: ' + firstDate + ' \u2192 ' + lastDate + ' (' + labels.length + ' days){/gray}\n';
657
661
 
658
662
  const lastIdx = labels.length - 1;
659
- out += '\n{bold}' + t('today') + ':{/bold} Input: ' + this.formatNumber(input[lastIdx] || 0) + ' | Output: ' + this.formatNumber(output[lastIdx] || 0) + ' | Cost: ' + this.formatCost(cost[lastIdx] || 0);
663
+ const totalTokens = (input[lastIdx] || 0) + (output[lastIdx] || 0) + (reasoning[lastIdx] || 0) + (cache[lastIdx] || 0);
664
+ out += '\n{bold}' + t('today') + ':{/bold} Input: ' + this.formatNumber(input[lastIdx] || 0) + ' | Output: ' + this.formatNumber(output[lastIdx] || 0) + ' | Cache: ' + this.formatNumber(cache[lastIdx] || 0) + ' | Total: ' + this.formatNumber(totalTokens) + ' | Cost: ' + this.formatCost(cost[lastIdx] || 0);
660
665
 
661
666
  return out;
662
667
  }