opencode-statboard 2.10.26 → 2.10.28

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 (3) hide show
  1. package/package.json +1 -1
  2. package/pricing.js +10 -0
  3. package/server.js +2 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-statboard",
3
- "version": "2.10.26",
3
+ "version": "2.10.28",
4
4
  "description": "Real-time dashboard for opencode token usage and cost statistics",
5
5
  "main": "server.js",
6
6
  "bin": {
package/pricing.js CHANGED
@@ -173,6 +173,13 @@ function orRefresh() {
173
173
  };
174
174
  run();
175
175
  }
176
+ // Free models whose paid twin is not on OpenRouter under the same name.
177
+ // The basis is the provider's own paid listing, so the estimate is honest and
178
+ // still disclosed as a proxy (kind 'openrouter').
179
+ const OR_MANUAL = {
180
+ 'baidu/ernie-5.5-flash-preview:free': 'baidu/ernie-light-dt-1.0-intl',
181
+ };
182
+
176
183
  function orEntry(provider, model) {
177
184
  const c = orLoad();
178
185
  if (!c.models) {
@@ -194,6 +201,9 @@ function orEntry(provider, model) {
194
201
  const hits = Object.keys(c.models).filter((id) => id.split('/').pop() === last);
195
202
  if (hits.length === 1) return { ...c.models[hits[0]], id: hits[0] };
196
203
  }
204
+ // Manual paid twin (same provider, different name).
205
+ const manual = OR_MANUAL[`${provider}/${model}`] || OR_MANUAL[model];
206
+ if (manual && c.models[manual]) return { ...c.models[manual], id: manual };
197
207
  return null;
198
208
  }
199
209
 
package/server.js CHANGED
@@ -1584,6 +1584,7 @@ async function startServer() {
1584
1584
 
1585
1585
  (async () => {
1586
1586
  try {
1587
+ await startServer();
1587
1588
  // Serve the persisted bundle + tool counts IMMEDIATELY. Nothing on this
1588
1589
  // path touches the live DB, so the first request answers in milliseconds
1589
1590
  // instead of waiting out a 3-29s scan.
@@ -1616,17 +1617,12 @@ async function startServer() {
1616
1617
  if (r && r.stats && r.stats.ok) reportCache[String(d)] = r;
1617
1618
  } catch (_) {}
1618
1619
  }
1619
- for (const d of [7, 30, 90]) {
1620
+ for (const d of [1, 7, 30, 90]) {
1620
1621
  try {
1621
1622
  const t = await generateTrend(d);
1622
1623
  if (t) trendCache[String(d)] = t;
1623
1624
  } catch (_) {}
1624
1625
  }
1625
- // Open the port only once there is real data to paint. Listening first made
1626
- // the browser paint an empty "updating" shell and then swap in numbers,
1627
- // which is exactly what a 16s LCP looks like. With a cache present this is
1628
- // ~1s after launch; on a cold machine the wait is the scan itself.
1629
- await startServer();
1630
1626
  setInterval(refresh, REFRESH_MS);
1631
1627
  setInterval(refreshModels, 60000);
1632
1628
  setInterval(refreshAttrBundle, 60000);