@bacnh85/pi-sub 0.1.2 → 0.1.3
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 +3 -3
- package/index.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Pi extension that shows subscription usage for the currently selected supported model provider.
|
|
4
4
|
|
|
5
|
-
V1 supports OpenAI Codex models by reading Pi's auth state from `~/.pi/agent/auth.json` (or `$PI_CODING_AGENT_DIR/auth.json`) and displays a
|
|
5
|
+
V1 supports OpenAI Codex models by reading Pi's auth state from `~/.pi/agent/auth.json` (or `$PI_CODING_AGENT_DIR/auth.json`) and displays a subscription footer status after Pi's built-in status/token usage line only while the active Pi model provider is `openai-codex`.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ pi -e ./extensions/pi-sub
|
|
|
26
26
|
|
|
27
27
|
## What it shows
|
|
28
28
|
|
|
29
|
-
The footer status includes:
|
|
29
|
+
The footer status appears after Pi's built-in status/token usage line and includes:
|
|
30
30
|
|
|
31
31
|
- active account email;
|
|
32
32
|
- subscription plan, such as `Plus`;
|
|
@@ -54,7 +54,7 @@ When Pi OpenAI Codex auth is available, `/sub` shows the active account usage:
|
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
56
|
ACCOUNT PLAN 5H USAGE WEEKLY USAGE LAST ACTIVITY
|
|
57
|
-
*
|
|
57
|
+
* user@example.com Plus 85% (18:12) 80% (08:00 on 2 Jul) Now
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
## Refresh behavior
|
package/index.ts
CHANGED
|
@@ -277,7 +277,7 @@ function maxPercent(account: SubscriptionAccountSnapshot | undefined): number {
|
|
|
277
277
|
|
|
278
278
|
function renderSubscriptionLine(ctx: ExtensionContext, state: State): void {
|
|
279
279
|
if (!state.adapter) {
|
|
280
|
-
ctx.ui.
|
|
280
|
+
ctx.ui.setStatus(STATUS_KEY, undefined);
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
283
|
const theme = ctx.ui.theme;
|
|
@@ -301,7 +301,7 @@ function renderSubscriptionLine(ctx: ExtensionContext, state: State): void {
|
|
|
301
301
|
line = pieces.join(" · ");
|
|
302
302
|
color = maxPercent(account) >= 90 ? "error" : maxPercent(account) >= 80 ? "warning" : "dim";
|
|
303
303
|
}
|
|
304
|
-
ctx.ui.
|
|
304
|
+
ctx.ui.setStatus(STATUS_KEY, theme.fg(color, line));
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
function startTimer(ctx: ExtensionContext, state: State): void {
|
|
@@ -413,7 +413,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
413
413
|
|
|
414
414
|
pi.on("session_shutdown", async (_event, ctx) => {
|
|
415
415
|
stopTimer(state);
|
|
416
|
-
ctx.ui.
|
|
416
|
+
ctx.ui.setStatus(STATUS_KEY, undefined);
|
|
417
417
|
});
|
|
418
418
|
|
|
419
419
|
pi.registerCommand("sub", {
|