@ravshansbox/pi-statusline 1.4.0 → 1.5.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/index.ts +1 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Add `-l` to install it in project settings.
|
|
|
15
15
|
Pi loads the extension from `./index.ts`. It replaces the built-in footer with a statusline that shows:
|
|
16
16
|
|
|
17
17
|
- the working directory, git branch and session name
|
|
18
|
-
- token usage, cache hit rate
|
|
18
|
+
- token usage, cache hit rate and context usage
|
|
19
19
|
- the provider, model and thinking level
|
|
20
20
|
- statuses set by other extensions
|
|
21
21
|
|
package/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ type Usage = {
|
|
|
7
7
|
output: number;
|
|
8
8
|
cacheRead: number;
|
|
9
9
|
cacheWrite: number;
|
|
10
|
-
cost: { total: number };
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
function sanitizeStatusText(text: string): string {
|
|
@@ -32,14 +31,13 @@ function formatCwd(cwd: string, home: string | undefined): string {
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
function getUsage(ctx: ExtensionContext) {
|
|
35
|
-
const totals = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0
|
|
34
|
+
const totals = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
36
35
|
let latestCacheHitRate: number | undefined;
|
|
37
36
|
const add = (u: Usage) => {
|
|
38
37
|
totals.input += u.input;
|
|
39
38
|
totals.output += u.output;
|
|
40
39
|
totals.cacheRead += u.cacheRead;
|
|
41
40
|
totals.cacheWrite += u.cacheWrite;
|
|
42
|
-
totals.cost += u.cost.total;
|
|
43
41
|
};
|
|
44
42
|
for (const entry of ctx.sessionManager.getEntries()) {
|
|
45
43
|
if (entry.type === 'usage') {
|
|
@@ -97,15 +95,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
97
95
|
statsParts.push(`CH${latestCacheHitRate.toFixed(0)}%`);
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
const usingSubscription = model
|
|
101
|
-
? model.provider === 'kimi-coding' ||
|
|
102
|
-
(ctx.modelRegistry.isUsingOAuth(model) &&
|
|
103
|
-
ctx.modelRegistry.getProvider(model.provider)?.auth.oauth?.isSubscription === true)
|
|
104
|
-
: false;
|
|
105
|
-
if (totals.cost || usingSubscription) {
|
|
106
|
-
statsParts.push(`$${totals.cost.toFixed(2)}${usingSubscription ? ' (sub)' : ''}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
98
|
const contextDisplay =
|
|
110
99
|
contextPercent === '?'
|
|
111
100
|
? `?/${formatTokens(contextWindow)}`
|