@reedchan/statusline 1.1.0 → 1.1.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.
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* stepStartTime; decodeMs = completedTime - firstTokenTime; tok/s = usage.output / (decodeMs / 1000)
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
import { readFile, stat } from 'node:fs/promises'
|
|
21
22
|
import { homedir } from 'node:os'
|
|
22
23
|
import { join } from 'node:path'
|
|
23
24
|
|
|
@@ -58,8 +59,19 @@ const CONFIG_PATH = join(homedir(), '.pi', 'agent', 'statusline.json')
|
|
|
58
59
|
* bug. Editing the file therefore takes effect on `/reload`.
|
|
59
60
|
*/
|
|
60
61
|
async function loadCurrency(notify: (message: string) => void): Promise<Currency> {
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
try {
|
|
63
|
+
await stat(CONFIG_PATH)
|
|
64
|
+
} catch {
|
|
65
|
+
// No config file is the normal case, and it means USD.
|
|
66
|
+
return USD
|
|
67
|
+
}
|
|
68
|
+
let text: string
|
|
69
|
+
try {
|
|
70
|
+
text = await readFile(CONFIG_PATH, 'utf8')
|
|
71
|
+
} catch {
|
|
72
|
+
notify('statusline.json exists but could not be read, showing USD')
|
|
73
|
+
return USD
|
|
74
|
+
}
|
|
63
75
|
const { currency, problem } = currencyFromConfig(text)
|
|
64
76
|
if (problem !== null) notify(problem)
|
|
65
77
|
return currency
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reedchan/statusline",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|