@ravshansbox/pi-statusline 1.3.0 → 1.4.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/index.ts +5 -7
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -19,10 +19,8 @@ function sanitizeStatusText(text: string): string {
|
|
|
19
19
|
|
|
20
20
|
function formatTokens(count: number): string {
|
|
21
21
|
if (count < 1000) return count.toString();
|
|
22
|
-
if (count <
|
|
23
|
-
|
|
24
|
-
if (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;
|
|
25
|
-
return `${Math.round(count / 1000000)}M`;
|
|
22
|
+
if (count < 999500) return `${Math.round(count / 1000)}k`;
|
|
23
|
+
return `${Math.round(count / 1000000)}m`;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
function formatCwd(cwd: string, home: string | undefined): string {
|
|
@@ -79,7 +77,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
79
77
|
const contextWindow = contextUsage?.contextWindow ?? model?.contextWindow ?? 0;
|
|
80
78
|
const contextPercentValue = contextUsage?.percent ?? 0;
|
|
81
79
|
const contextPercent =
|
|
82
|
-
contextUsage?.percent != null ? contextPercentValue.toFixed(
|
|
80
|
+
contextUsage?.percent != null ? contextPercentValue.toFixed(0) : '?';
|
|
83
81
|
|
|
84
82
|
let pwd = formatCwd(
|
|
85
83
|
ctx.sessionManager.getCwd(),
|
|
@@ -96,7 +94,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
96
94
|
if (totals.cacheRead) statsParts.push(`R${formatTokens(totals.cacheRead)}`);
|
|
97
95
|
if (totals.cacheWrite) statsParts.push(`W${formatTokens(totals.cacheWrite)}`);
|
|
98
96
|
if ((totals.cacheRead > 0 || totals.cacheWrite > 0) && latestCacheHitRate !== undefined) {
|
|
99
|
-
statsParts.push(`CH${latestCacheHitRate.toFixed(
|
|
97
|
+
statsParts.push(`CH${latestCacheHitRate.toFixed(0)}%`);
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
const usingSubscription = model
|
|
@@ -105,7 +103,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
105
103
|
ctx.modelRegistry.getProvider(model.provider)?.auth.oauth?.isSubscription === true)
|
|
106
104
|
: false;
|
|
107
105
|
if (totals.cost || usingSubscription) {
|
|
108
|
-
statsParts.push(`$${totals.cost.toFixed(
|
|
106
|
+
statsParts.push(`$${totals.cost.toFixed(2)}${usingSubscription ? ' (sub)' : ''}`);
|
|
109
107
|
}
|
|
110
108
|
|
|
111
109
|
const contextDisplay =
|