opencode-statboard 2.10.11 → 2.10.13
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 +1 -1
- package/server.js +6 -3
- package/tui-dashboard.js +10 -2
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1569,9 +1569,9 @@ async function startServer() {
|
|
|
1569
1569
|
await refresh();
|
|
1570
1570
|
await refreshModels();
|
|
1571
1571
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1572
|
+
// Ensure attribution bundle is ready before generating trends,
|
|
1573
|
+
// so the trend data uses the full attribution data, not EMPTY_ATTR.
|
|
1574
|
+
await waitForBundle(180000);
|
|
1575
1575
|
// Today's report eagerly (the common first view). Other periods build on
|
|
1576
1576
|
// demand in the background via refreshReport stale-while-revalidate.
|
|
1577
1577
|
for (const d of [1]) {
|
|
@@ -1586,6 +1586,9 @@ async function startServer() {
|
|
|
1586
1586
|
if (t) trendCache[String(d)] = t;
|
|
1587
1587
|
} catch (_) {}
|
|
1588
1588
|
}
|
|
1589
|
+
setInterval(refresh, REFRESH_MS);
|
|
1590
|
+
setInterval(refreshModels, 60000);
|
|
1591
|
+
setInterval(refreshAttrBundle, 60000);
|
|
1589
1592
|
// (Windows may kill process for excessive I/O on large DB files).
|
|
1590
1593
|
setTimeout(() => {
|
|
1591
1594
|
autoBackupIfDue().catch((_) => {});
|
package/tui-dashboard.js
CHANGED
|
@@ -555,13 +555,15 @@ class TUIServer {
|
|
|
555
555
|
|
|
556
556
|
const height = this.getContentHeight() - 4;
|
|
557
557
|
const width = this.getContentWidth();
|
|
558
|
-
const chartHeight = Math.max(1, Math.floor(height / 3) - 2);
|
|
558
|
+
const chartHeight = Math.max(1, Math.floor(height / 3) - 2);
|
|
559
559
|
|
|
560
560
|
// Helper: render one chart with its own max
|
|
561
561
|
const renderChart = (data, label, color, maxVal) => {
|
|
562
562
|
if (maxVal <= 0) return '{gray}(no data){/gray}\n';
|
|
563
563
|
let lines = [];
|
|
564
|
-
|
|
564
|
+
// Show current (today = last index) value next to label
|
|
565
|
+
const todayVal = data[data.length - 1] || 0;
|
|
566
|
+
lines.push('{bold}' + label + ': ' + this.formatNumber(todayVal) + ' (today){/bold}');
|
|
565
567
|
for (let row = chartHeight - 1; row >= 0; row--) {
|
|
566
568
|
let line = '';
|
|
567
569
|
const threshold = (row / chartHeight) * maxVal;
|
|
@@ -586,6 +588,7 @@ class TUIServer {
|
|
|
586
588
|
out += renderChart(output, t('output') + ' (green)', 'green', maxOut) + '\n';
|
|
587
589
|
out += renderChart(cost, t('cost') + ' (yellow)', 'yellow', maxCost) + '\n';
|
|
588
590
|
|
|
591
|
+
// X-axis: show first date, middle date, last date
|
|
589
592
|
let xAxis = '';
|
|
590
593
|
const labelStep = Math.max(1, Math.ceil(width / 20));
|
|
591
594
|
for (let i = 0; i < width; i++) {
|
|
@@ -598,6 +601,11 @@ class TUIServer {
|
|
|
598
601
|
}
|
|
599
602
|
out += '{gray}' + xAxis + '{/gray}\n';
|
|
600
603
|
|
|
604
|
+
// Add date range info
|
|
605
|
+
const firstDate = trend.dates ? trend.dates[0] : labels[0];
|
|
606
|
+
const lastDate = trend.dates ? trend.dates[trend.dates.length - 1] : labels[labels.length - 1];
|
|
607
|
+
out += '\n{gray}Range: ' + firstDate + ' \u2192 ' + lastDate + ' (' + labels.length + ' days){/gray}\n';
|
|
608
|
+
|
|
601
609
|
const lastIdx = labels.length - 1;
|
|
602
610
|
out += '\n{bold}' + t('today') + ':{/bold} Input: ' + this.formatNumber(input[lastIdx] || 0) + ' | Output: ' + this.formatNumber(output[lastIdx] || 0) + ' | Cost: ' + this.formatCost(cost[lastIdx] || 0);
|
|
603
611
|
|