opencode-tui-stats 0.4.0 → 0.4.1

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/tracker.ts +1 -1
  3. package/tui.tsx +7 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "opencode-tui-stats",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "description": "OpenCode 1 TUI plugin that shows live TPS, average TPS, and average time to first token in the session prompt.",
6
6
  "type": "module",
7
7
  "exports": {
package/tracker.ts CHANGED
@@ -147,7 +147,7 @@ export function averageTtft(average: SessionAverage | undefined) {
147
147
  /** Cache hit percentage (e.g. `31%`) or `undefined` when nothing promptable has been seen. */
148
148
  export function cacheText(stats: { cacheRead: number; cachePrompt: number } | undefined) {
149
149
  if (!stats || stats.cachePrompt <= 0) return undefined
150
- return `${Math.round((stats.cacheRead / stats.cachePrompt) * 100)}%`
150
+ return `${((stats.cacheRead / stats.cachePrompt) * 100).toFixed(1)}%`
151
151
  }
152
152
 
153
153
  export function costText(stats: { cost: number; steps: number } | undefined) {
package/tui.tsx CHANGED
@@ -14,10 +14,10 @@ const DETAIL_INDENT = " "
14
14
  /** Fixed cells keep every label on the same column across rows without measuring the panel. */
15
15
  const RATE_CELL = 4
16
16
  const TTFT_CELL = 6
17
- const CACHE_CELL = 4
17
+ const CACHE_CELL = 6
18
18
 
19
- /** Split `provider/model` so the provider can be muted. Model ids may contain slashes, so only the
20
- * first slash separates the provider. When the model already starts with the provider name
19
+ /** Split `provider/model` so the provider can be de-emphasised. Model ids may contain slashes, so
20
+ * only the first slash separates the provider. When the model already starts with the provider name
21
21
  * (`deepseek/deepseek-flash`) the redundant prefix is dropped. */
22
22
  function splitLabel(label: string) {
23
23
  const slash = label.indexOf("/")
@@ -39,7 +39,7 @@ function ttftCell(value: string | undefined) {
39
39
  function cacheCell(value: string | undefined) {
40
40
  if (value === undefined) return "—".padStart(CACHE_CELL)
41
41
  const percent = value.endsWith("%") ? value.slice(0, -1) : value
42
- return `${percent.padStart(3)}%`
42
+ return `${percent.padStart(5)}%`
43
43
  }
44
44
 
45
45
  /** A single model row: fold marker + summary line, plus its detail lines when expanded. */
@@ -70,7 +70,9 @@ function ModelRowView(props: { api: TuiPluginApi; row: ModelRow; expanded: boole
70
70
  <span style={{ fg: theme().textMuted } as Record<string, unknown>}>{"↳ "}</span>
71
71
  </Show>
72
72
  <Show when={parts().provider}>
73
- <span style={{ fg: theme().textMuted } as Record<string, unknown>}>{parts().provider}</span>
73
+ {/* Dimmed foreground sits between the model name and muted metadata without borrowing
74
+ * a status colour, so the provider reads as its own tier even as themes change. */}
75
+ <span style={{ fg: theme().text, dim: true } as Record<string, unknown>}>{parts().provider}</span>
74
76
  </Show>
75
77
  <span style={{ fg: theme().text } as Record<string, unknown>}>{parts().model}</span>
76
78
  </text>