@ravshansbox/pi-statusline 1.3.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.ts +5 -18
  3. 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, cost and context usage
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 {
@@ -19,10 +18,8 @@ function sanitizeStatusText(text: string): string {
19
18
 
20
19
  function formatTokens(count: number): string {
21
20
  if (count < 1000) return count.toString();
22
- if (count < 10000) return `${(count / 1000).toFixed(1)}k`;
23
- if (count < 1000000) return `${Math.round(count / 1000)}k`;
24
- if (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;
25
- return `${Math.round(count / 1000000)}M`;
21
+ if (count < 999500) return `${Math.round(count / 1000)}k`;
22
+ return `${Math.round(count / 1000000)}m`;
26
23
  }
27
24
 
28
25
  function formatCwd(cwd: string, home: string | undefined): string {
@@ -34,14 +31,13 @@ function formatCwd(cwd: string, home: string | undefined): string {
34
31
  }
35
32
 
36
33
  function getUsage(ctx: ExtensionContext) {
37
- const totals = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0 };
34
+ const totals = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
38
35
  let latestCacheHitRate: number | undefined;
39
36
  const add = (u: Usage) => {
40
37
  totals.input += u.input;
41
38
  totals.output += u.output;
42
39
  totals.cacheRead += u.cacheRead;
43
40
  totals.cacheWrite += u.cacheWrite;
44
- totals.cost += u.cost.total;
45
41
  };
46
42
  for (const entry of ctx.sessionManager.getEntries()) {
47
43
  if (entry.type === 'usage') {
@@ -79,7 +75,7 @@ export default function (pi: ExtensionAPI) {
79
75
  const contextWindow = contextUsage?.contextWindow ?? model?.contextWindow ?? 0;
80
76
  const contextPercentValue = contextUsage?.percent ?? 0;
81
77
  const contextPercent =
82
- contextUsage?.percent != null ? contextPercentValue.toFixed(1) : '?';
78
+ contextUsage?.percent != null ? contextPercentValue.toFixed(0) : '?';
83
79
 
84
80
  let pwd = formatCwd(
85
81
  ctx.sessionManager.getCwd(),
@@ -96,16 +92,7 @@ export default function (pi: ExtensionAPI) {
96
92
  if (totals.cacheRead) statsParts.push(`R${formatTokens(totals.cacheRead)}`);
97
93
  if (totals.cacheWrite) statsParts.push(`W${formatTokens(totals.cacheWrite)}`);
98
94
  if ((totals.cacheRead > 0 || totals.cacheWrite > 0) && latestCacheHitRate !== undefined) {
99
- statsParts.push(`CH${latestCacheHitRate.toFixed(1)}%`);
100
- }
101
-
102
- const usingSubscription = model
103
- ? model.provider === 'kimi-coding' ||
104
- (ctx.modelRegistry.isUsingOAuth(model) &&
105
- ctx.modelRegistry.getProvider(model.provider)?.auth.oauth?.isSubscription === true)
106
- : false;
107
- if (totals.cost || usingSubscription) {
108
- statsParts.push(`$${totals.cost.toFixed(3)}${usingSubscription ? ' (sub)' : ''}`);
95
+ statsParts.push(`CH${latestCacheHitRate.toFixed(0)}%`);
109
96
  }
110
97
 
111
98
  const contextDisplay =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravshansbox/pi-statusline",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Statusline extension for pi",
5
5
  "license": "MIT",
6
6
  "type": "module",