opencode-statboard 2.10.17 → 2.10.18

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 +23 -1
  3. package/fix-dup.py +0 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-statboard",
3
- "version": "2.10.17",
3
+ "version": "2.10.18",
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
@@ -93,7 +93,29 @@ function priceFor(provider, model) {
93
93
  }
94
94
  // Any provider, cheapest nonzero listing for the same base name. Cheapest
95
95
  // keeps the estimate conservative (it understates savings, never inflates).
96
- for (const b of bases) {
96
+ // Also try the full model name (with provider prefix) as a base, since cache keys may include provider prefix.
97
+ const allBases = [...bases];
98
+ if (model !== bases[0] && !allBases.includes(model)) allBases.push(model); // full model name (may include provider prefix)
99
+ // Also try provider/model as a base (for cases where model name doesn't include provider prefix but cache key does)
100
+ const providerModel = `${provider}/${model}`;
101
+ if (!allBases.includes(providerModel)) allBases.push(providerModel);
102
+ // Also try openrouter/ + model (common case where sub-providers like reflection are under openrouter)
103
+ const openrouterModel = `openrouter/${model}`;
104
+ if (!allBases.includes(openrouterModel)) allBases.push(openrouterModel);
105
+ // Also try openrouter/provider/model (for cases where cache has openrouter/subprovider/model)
106
+ const openrouterProviderModel = `openrouter/${provider}/${model}`;
107
+ if (!allBases.includes(openrouterProviderModel)) allBases.push(openrouterProviderModel);
108
+ // Also try openrouter + common sub-providers (reflection, nvidia, etc.) for openrouter models without sub-provider prefix
109
+ if (provider === 'openrouter' && !model.includes('/')) {
110
+ const subProviders = ['reflection', 'nvidia', 'google', 'anthropic', 'meta', 'mistral', 'cohere', 'mistralai'];
111
+ for (const sub of subProviders) {
112
+ const subModel = `${sub}/${model}`;
113
+ if (!allBases.includes(subModel)) allBases.push(subModel);
114
+ const openrouterSubModel = `openrouter/${sub}/${model}`;
115
+ if (!allBases.includes(openrouterSubModel)) allBases.push(openrouterSubModel);
116
+ }
117
+ }
118
+ for (const b of allBases) {
97
119
  let best = null;
98
120
  for (const pid of Object.keys(data).sort()) {
99
121
  const e = entry(data, pid, b);
package/fix-dup.py DELETED
@@ -1,28 +0,0 @@
1
- c = open('tui-dashboard.js', encoding='utf-8').read()
2
-
3
- # Find the two renderChart declarations
4
- first = c.find(' const renderChart = (data, label, color, maxVal) => {')
5
- second = c.find(' const renderChart = (data, label, color, maxVal) => {', first + 1)
6
-
7
- # Show context around first
8
- print("First renderChart at line:", c[:first].count('\n') + 1)
9
- print("Second renderChart at line:", c[:second].count('\n') + 1)
10
-
11
- # The first renderChart ends at the semicolon + blank line before "const maxInOut"
12
- # Find the line after the first closing of renderChart function
13
- # The pattern: " return lines.join('\\n');\n };" appears twice
14
- marker = " return lines.join('\\n');\n };"
15
- first_marker = c.find(marker, first)
16
- second_marker = c.find(marker, first_marker + 1)
17
-
18
- print("First marker at line:", c[:first_marker].count('\n') + 1)
19
-
20
- # Remove everything from first renderChart to second renderChart (inclusive of first)
21
- # We want to keep from first renderChart line to the line before second renderChart
22
- old_block = c[first:first_marker + len(marker)]
23
- print("Block to remove length:", len(old_block))
24
- print("Block preview:", old_block[:200])
25
-
26
- # Check what's between
27
- between_preview = c[first_marker + len(marker):second][:200]
28
- print("Between:", repr(between_preview))