@jack-yang/opencode-tps-meter 1.0.1 → 1.1.0
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.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +3 -2
- package/tui.tsx +9 -18
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ English | [中文](./README.zh-CN.md)
|
|
|
4
4
|
|
|
5
5
|
A TUI plugin for [opencode](https://opencode.ai) that displays real-time LLM output speed metrics next to the session prompt.
|
|
6
6
|
|
|
7
|
-
   
|
|
7
|
+
[](https://www.npmjs.com/package/@jack-yang/opencode-tps-meter) [](https://www.npmjs.com/package/@jack-yang/opencode-tps-meter) [](https://github.com/yangwudong/opencode-tps-meter) 
|
|
8
8
|
|
|
9
9
|
## Display
|
|
10
10
|
|
package/README.zh-CN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
一个 [opencode](https://opencode.ai) 的 TUI 插件,在输入框旁边实时显示 LLM 输出速度指标。
|
|
6
6
|
|
|
7
|
-
   
|
|
7
|
+
[](https://www.npmjs.com/package/@jack-yang/opencode-tps-meter) [](https://www.npmjs.com/package/@jack-yang/opencode-tps-meter) [](https://github.com/yangwudong/opencode-tps-meter) 
|
|
8
8
|
|
|
9
9
|
## 显示效果
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@jack-yang/opencode-tps-meter",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "Live TPS/AVG/TTFT meter plugin for OpenCode TUI with color-coded speed tiers",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"overrides": {
|
|
54
|
-
"@babel/core": "^7.29.6"
|
|
54
|
+
"@babel/core": "^7.29.6",
|
|
55
|
+
"brace-expansion": "^5.0.8"
|
|
55
56
|
}
|
|
56
57
|
}
|
package/tui.tsx
CHANGED
|
@@ -190,9 +190,7 @@ function MeterDisplay(props: {
|
|
|
190
190
|
spinnerCells: () => { glyph: string; color: RGBA }[]
|
|
191
191
|
subscribe: (listener: Listener) => () => void
|
|
192
192
|
}) {
|
|
193
|
-
|
|
194
|
-
const spinRefs: (TextRenderable | undefined)[] = []
|
|
195
|
-
let sepRef: TextRenderable | undefined
|
|
193
|
+
let particleRef: TextRenderable | undefined
|
|
196
194
|
let tpsRef: TextRenderable | undefined
|
|
197
195
|
let avgRef: TextRenderable | undefined
|
|
198
196
|
let ttftRef: TextRenderable | undefined
|
|
@@ -208,18 +206,14 @@ function MeterDisplay(props: {
|
|
|
208
206
|
const avg = stats && stats.totalDurationMs > 0 ? stats.totalOutputTokens / (stats.totalDurationMs / 1000) : undefined
|
|
209
207
|
const ttft = props.tracker.liveTtftBySession[props.sessionID]
|
|
210
208
|
const thinkingNow = props.tracker.thinkingBySession[props.sessionID] === true && props.config.spinner.enabled
|
|
211
|
-
if (
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (cell) { ref.content = cell.glyph; ref.fg = cell.color }
|
|
209
|
+
if (particleRef) {
|
|
210
|
+
if (thinkingNow) {
|
|
211
|
+
const cells = props.spinnerCells()
|
|
212
|
+
particleRef.content = " " + cells.map((c) => c.glyph).join("")
|
|
213
|
+
particleRef.fg = cells[0]?.color ?? muted
|
|
214
|
+
} else {
|
|
215
|
+
particleRef.content = ""
|
|
219
216
|
}
|
|
220
|
-
} else {
|
|
221
|
-
if (sepRef) sepRef.content = ""
|
|
222
|
-
for (const ref of spinRefs) if (ref) ref.content = ""
|
|
223
217
|
}
|
|
224
218
|
if (tpsRef) {
|
|
225
219
|
tpsRef.content = live !== undefined ? formatTps(live) ?? "--" : "--"
|
|
@@ -247,10 +241,7 @@ function MeterDisplay(props: {
|
|
|
247
241
|
<text ref={(el: TextRenderable) => { avgRef = el; sync() }} fg={muted}>--</text>
|
|
248
242
|
<text fg={muted}> | TTFT </text>
|
|
249
243
|
<text ref={(el: TextRenderable) => { ttftRef = el; sync() }} fg={muted}>--</text>
|
|
250
|
-
<text ref={(el: TextRenderable) => {
|
|
251
|
-
{Array.from({ length: cellCount }).map((_, i) => (
|
|
252
|
-
<text ref={(el: TextRenderable) => { spinRefs[i] = el; sync() }} fg={muted}></text>
|
|
253
|
-
))}
|
|
244
|
+
<text ref={(el: TextRenderable) => { particleRef = el; sync() }} fg={muted}></text>
|
|
254
245
|
</box>
|
|
255
246
|
)
|
|
256
247
|
}
|