@reedchan/statusline 1.10.0 → 1.10.2
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 +2 -2
- package/README_CN.md +2 -2
- package/extensions/statusline/index.ts +4 -0
- package/extensions/statusline/render.ts +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@ English | [中文](README_CN.md)
|
|
|
7
7
|
Replaces pi's footer with a labelled two-row one. Every value carries a word, so nothing has to be
|
|
8
8
|
decoded from a symbol or remembered from a legend.
|
|
9
9
|
|
|
10
|
-
```
|
|
11
|
-
Context █████████▍░░░░░░░░░░ 47% 471k / 1.0M Input 194k · Output 89k | Cache hit 99.9% | Cost $0.
|
|
10
|
+
```text
|
|
11
|
+
Context █████████▍░░░░░░░░░░ 47% 471k / 1.0M Input 194k · Output 89k | Cache hit 99.9% | Cost $0.23 · Today $1.63
|
|
12
12
|
~/.pi (master) deepseek-flash · Effort high | TTFT 482ms · Avg TTFT 612ms | Last 729 tok/s · Avg 512 tok/s
|
|
13
13
|
LSP Active: typescript
|
|
14
14
|
```
|
package/README_CN.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
替换 pi 的 footer,改成带文字标签的两行。每个值都带一个词,不需要靠符号猜、也不需要记图例。
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
Context █████████▍░░░░░░░░░░ 47% 471k / 1.0M Input 194k · Output 89k | Cache hit 99.9% | Cost $0.
|
|
9
|
+
```text
|
|
10
|
+
Context █████████▍░░░░░░░░░░ 47% 471k / 1.0M Input 194k · Output 89k | Cache hit 99.9% | Cost $0.23 · Today $1.63
|
|
11
11
|
~/.pi (master) deepseek-flash · Effort high | TTFT 482ms · Avg TTFT 612ms | Last 729 tok/s · Avg 512 tok/s
|
|
12
12
|
LSP Active: typescript
|
|
13
13
|
```
|
|
@@ -706,6 +706,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
706
706
|
ttftCount += 1
|
|
707
707
|
persist(ctx.sessionManager.getSessionFile() ?? null)
|
|
708
708
|
publish((tokens / decodeMs) * 1000, output > 0, measured)
|
|
709
|
+
} else if (measured !== null && decodeMs > 0) {
|
|
710
|
+
// The frozen Last must be this message's whole-message rate, never the last live
|
|
711
|
+
// sliding-window sample: a buffered burst of chunks mid-stream reads triple.
|
|
712
|
+
publish((tokens / decodeMs) * 1000, output > 0, measured)
|
|
709
713
|
}
|
|
710
714
|
// Null it with the stream: a request that has produced its message is no longer in flight, and
|
|
711
715
|
// a stale anchor would let the live branch count against nothing until the next turn.
|
|
@@ -65,7 +65,9 @@ export function formatLatency(ms: number): string {
|
|
|
65
65
|
const clamped = Math.max(0, ms)
|
|
66
66
|
if (clamped < 1000) return `${Math.round(clamped)}ms`
|
|
67
67
|
const seconds = clamped / 1000
|
|
68
|
-
|
|
68
|
+
// Fixed one decimal under 10s: dropping the ".0" costs two columns, and the whole row would
|
|
69
|
+
// twitch every time a ticking count crossed an integer.
|
|
70
|
+
return `${seconds < 10 ? seconds.toFixed(1) : Math.round(seconds)}s`
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
/**
|
|
@@ -324,15 +326,15 @@ export function withCachedRates(
|
|
|
324
326
|
return `${JSON.stringify({ ...config, rates, fetchedAt }, null, 2)}\n`
|
|
325
327
|
}
|
|
326
328
|
|
|
327
|
-
/**
|
|
329
|
+
/** Two decimals, with padding zeros trimmed so `$0.30` renders as `$0.3`. */
|
|
328
330
|
/**
|
|
329
|
-
*
|
|
331
|
+
* Two decimals, with the padding zeros trimmed so `$0.30` renders as `$0.3`.
|
|
330
332
|
*
|
|
331
|
-
* All of them, not just one: a converted amount lands on `¥17.
|
|
332
|
-
* trailing zero would show up as `¥17.
|
|
333
|
+
* All of them, not just one: a converted amount lands on `¥17.80` often enough that a single
|
|
334
|
+
* trailing zero would show up as `¥17.8` beside `¥2.71` and read as a different precision.
|
|
333
335
|
*/
|
|
334
336
|
export function formatCost(cost: number, currency: Currency = USD): string {
|
|
335
|
-
return `${currency.symbol}${(cost * currency.perUsd).toFixed(
|
|
337
|
+
return `${currency.symbol}${(cost * currency.perUsd).toFixed(2).replace(/\.?0+$/, '')}`
|
|
336
338
|
}
|
|
337
339
|
|
|
338
340
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reedchan/statusline",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Replaces pi's footer with a labelled two-row status line: context pressure as a fixed-size meter, cache and cost, the model and effort level, and the latest turn's TTFT and decode throughput in tokens/second.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|