opencode-tui-stats 0.4.1 → 0.4.3

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/README.en.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # opencode-tui-stats
2
2
 
3
- A TUI plugin for OpenCode 1.x (v1) that shows a single line — `TPS | AVG | TTFT` — on the right side of the session prompt.
3
+ A TUI plugin for OpenCode 1.x (v1), mounted at the bottom of the right sidebar (slot `sidebar_footer`), with the panel title `Model-Performance · observed`. Each model occupies one row that can be collapsed/expanded by mouse click.
4
4
 
5
5
  ## Demo
6
6
 
@@ -18,11 +18,25 @@ This command writes the plugin into opencode's TUI config. You can also install
18
18
 
19
19
  - opencode ≥ 1.3.14
20
20
 
21
+ ## Collapsing & subagents
22
+
23
+ - Each model occupies one row that can be collapsed/expanded by mouse click (`▼`/`▶`); rows are collapsed by default, and the most recently used model starts expanded.
24
+ - Collapsed: `▶ [↳ ]provider/model` (redundant same-provider prefix omitted; provider dimmed, model name bright).
25
+ - Expanded:
26
+ - `AVG …t/s · TPS …t/s` (TPS shown only when a value exists; the final value is kept and dimmed after generation ends)
27
+ - `TTFT …s · CACHE …%`
28
+ - `$…` (cost on its own line)
29
+ - Models from subagents (sub-sessions) are merged into the same panel; rows originating from a subagent are prefixed with `↳`, and the same model (parent/child) is merged and summed.
30
+ - Panel footer: `Session CACHE …%` (aggregated across the whole session + subagent tree, 1 decimal place); `retries` is shown only when >0.
31
+
21
32
  ## Metrics
22
33
 
23
- - `TPS`: live generation rate within the most recent ~5-second streaming window (tokens/sec); shows `-` when the session is idle or data is stale.
34
+ - `TPS`: generation rate within the most recent ~5-second streaming window (tokens/sec); the final value is frozen and dimmed after the stream stops.
24
35
  - `AVG`: average generation rate of completed messages in this session (tokens/sec).
25
- - `TTFT`: average time to first token of completed messages in this session (seconds).
36
+ - `TTFT`: average time to first token (seconds, approximate, includes queue/retry wait).
37
+ - `CACHE`: prompt cache hit rate = `cache.read / (input + cache.read + cache.write)`, 1 decimal place.
38
+ - `COST`: cumulative session cost (aggregated per model/session).
39
+ - `RETRY`: retry count, derived from the attempt reported by the provider.
26
40
 
27
41
  ## License
28
42
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # opencode-tui-stats
2
2
 
3
- OpenCode 1.x(v1)的 TUI 插件,在会话提示区右侧显示一行 `TPS | AVG | TTFT`。
3
+ OpenCode 1.x(v1)的 TUI 插件,安装在右侧栏底部(slot `sidebar_footer`),面板标题为 `Model-Performance · observed`。每个模型占一行,鼠标点击可折叠/展开。
4
4
 
5
5
  ## 演示
6
6
 
@@ -18,11 +18,25 @@ opencode plugin opencode-tui-stats --global
18
18
 
19
19
  - opencode ≥ 1.3.14
20
20
 
21
+ ## 折叠与子会话
22
+
23
+ - 每个模型占一行,鼠标点击可折叠/展开(`▼`/`▶`);默认折叠,最近使用的模型默认展开。
24
+ - 折叠态:`▶ [↳ ]provider/model`(同 provider 前缀省略;provider 暗色、模型名亮色)。
25
+ - 展开态:
26
+ - `AVG …t/s · TPS …t/s`(TPS 仅在有值时显示;生成结束后保留最后值并变暗)
27
+ - `TTFT …s · CACHE …%`
28
+ - `$…`(成本单独一行)
29
+ - 子会话(子 agent)的模型会并入同一面板,来自子会话的行前缀 `↳`;同一模型(父/子)合并求和。
30
+ - 面板底部:`Session CACHE …%`(整个会话 + 子会话树聚合,1 位小数);`retries` 仅在 >0 时显示。
31
+
21
32
  ## 指标说明
22
33
 
23
- - `TPS`:最近约 5 秒流式窗口内的实时生成速度(token/秒);会话空闲或数据过期时显示 `-`。
34
+ - `TPS`:最近约 5 秒流式窗口内的生成速度(token/秒);停止后冻结最后值并变暗。
24
35
  - `AVG`:本会话已完成消息的平均生成速度(token/秒)。
25
- - `TTFT`:本会话已完成消息的平均首字延迟(秒)。
36
+ - `TTFT`:平均首字延迟(秒,近似值,包含排队/重试等待)。
37
+ - `CACHE`:提示词缓存命中率 = `cache.read / (input + cache.read + cache.write)`,1 位小数。
38
+ - `COST`:会话累计成本(按模型/会话聚合)。
39
+ - `RETRY`:按 provider 上报的 attempt 统计的重试次数。
26
40
 
27
41
  ## License
28
42
 
package/assets/demo.gif CHANGED
Binary file