@ravshansbox/pi-statusline 1.2.0 → 1.3.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 +3 -10
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
type ExtensionAPI,
|
|
4
|
-
type ExtensionContext,
|
|
5
|
-
SettingsManager,
|
|
6
|
-
} from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { type ExtensionAPI, type ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
7
3
|
import { truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
|
|
8
4
|
|
|
9
5
|
type Usage = {
|
|
@@ -71,8 +67,6 @@ function getUsage(ctx: ExtensionContext) {
|
|
|
71
67
|
export default function (pi: ExtensionAPI) {
|
|
72
68
|
pi.on('session_start', (_event, ctx) => {
|
|
73
69
|
if (ctx.mode !== 'tui') return;
|
|
74
|
-
const settings = SettingsManager.create(ctx.cwd);
|
|
75
|
-
|
|
76
70
|
ctx.ui.setFooter((tui, theme, footerData) => {
|
|
77
71
|
const unsub = footerData.onBranchChange(() => tui.requestRender());
|
|
78
72
|
return {
|
|
@@ -114,11 +108,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
114
108
|
statsParts.push(`$${totals.cost.toFixed(3)}${usingSubscription ? ' (sub)' : ''}`);
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
const autoIndicator = settings.getCompactionEnabled() ? ' (auto)' : '';
|
|
118
111
|
const contextDisplay =
|
|
119
112
|
contextPercent === '?'
|
|
120
|
-
? `?/${formatTokens(contextWindow)}
|
|
121
|
-
: `${contextPercent}%/${formatTokens(contextWindow)}
|
|
113
|
+
? `?/${formatTokens(contextWindow)}`
|
|
114
|
+
: `${contextPercent}%/${formatTokens(contextWindow)}`;
|
|
122
115
|
if (contextPercentValue > 90) statsParts.push(theme.fg('error', contextDisplay));
|
|
123
116
|
else if (contextPercentValue > 70) statsParts.push(theme.fg('warning', contextDisplay));
|
|
124
117
|
else statsParts.push(contextDisplay);
|