@llblab/pi-codex-usage 0.3.4 โ 0.3.5
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/CHANGELOG.md +1 -0
- package/README.md +3 -3
- package/banner.png +0 -0
- package/index.ts +28 -26
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
- `0.3.5` Refined the compact statusline bar with quadrant glyphs, darker bar coloring, and blink-on-segment-change behavior. Impact: Codex quota changes are easier to notice while routine refreshes stay visually stable.
|
|
3
4
|
- `0.3.4` Added package banner metadata and README hero image. Impact: Pi/package listings can show the Codex Usage banner while npm packages include the image asset.
|
|
4
5
|
- `Fork baseline` Imported `extensions/pi-codex-usage` from `narumiruna/pi-extensions` as a standalone `@llblab/pi-codex-usage` package. Impact: the extension can be installed and maintained independently.
|
|
5
6
|
- `Minimal statusline` Removed command-driven report output and narrowed the extension to a zero-configuration statusline widget. Impact: runtime behavior is automatic while `openai-codex` is active.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ This repository is a minimal fork of [`narumiruna/pi-extensions/extensions/pi-co
|
|
|
20
20
|
- Pi OpenAI Codex provider auth is used first
|
|
21
21
|
- Codex CLI app-server remains available as a fallback
|
|
22
22
|
- Missing auth, subscription, plan, or quota windows are shown as `n/a`, not as an error
|
|
23
|
-
- Successful updates briefly redraw the bar
|
|
23
|
+
- Successful updates briefly redraw the bar only when a ten-step segment changes
|
|
24
24
|
- Network/provider failures keep the last good bar briefly, then show `error`
|
|
25
25
|
- No commands or configuration are required
|
|
26
26
|
|
|
@@ -43,10 +43,10 @@ pi install git:github.com/llblab/pi-codex-usage
|
|
|
43
43
|
Normal usage:
|
|
44
44
|
|
|
45
45
|
```text
|
|
46
|
-
codex
|
|
46
|
+
codex โโโโโ
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
The five-character bar encodes two ten-step limits at once: the top
|
|
49
|
+
The five-character bar encodes two ten-step limits at once: the top quadrants are the 5-hour limit, and the bottom quadrants are the weekly limit.
|
|
50
50
|
|
|
51
51
|
Unavailable because Codex auth or subscription quota is not available:
|
|
52
52
|
|
package/banner.png
CHANGED
|
Binary file
|
package/index.ts
CHANGED
|
@@ -16,21 +16,21 @@ const MAX_ERROR_BODY_CHARS = 600;
|
|
|
16
16
|
const STATUS_LABEL_TEXT = "codex";
|
|
17
17
|
const DUAL_BAR_CHARS = [
|
|
18
18
|
" ",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
19
|
+
"โ",
|
|
20
|
+
"โ",
|
|
21
|
+
"โ",
|
|
22
|
+
"โ",
|
|
23
|
+
"โ",
|
|
24
|
+
"โ",
|
|
25
|
+
"โ",
|
|
26
|
+
"โ",
|
|
27
|
+
"โ",
|
|
28
|
+
"โ",
|
|
29
|
+
"โ",
|
|
30
|
+
"โ",
|
|
31
|
+
"โ",
|
|
32
|
+
"โ",
|
|
33
|
+
"โ",
|
|
34
34
|
];
|
|
35
35
|
|
|
36
36
|
type UsageSource = "pi-auth" | "codex-app-server";
|
|
@@ -222,11 +222,15 @@ export default function codexUsage(pi: ExtensionAPI) {
|
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
const previousReport = cache?.report;
|
|
226
|
+
const blink = previousReport
|
|
227
|
+
? formatReportBar(previousReport) !== formatReportBar(result.report)
|
|
228
|
+
: false;
|
|
225
229
|
failedRefreshes = 0;
|
|
226
230
|
cache = { createdAt: Date.now(), report: result.report };
|
|
227
231
|
setUsageStatusline(ctx, result.report, {
|
|
228
232
|
autoRefresh: true,
|
|
229
|
-
blink
|
|
233
|
+
blink,
|
|
230
234
|
model,
|
|
231
235
|
});
|
|
232
236
|
};
|
|
@@ -684,24 +688,22 @@ export function formatCodexUsageStatusline(
|
|
|
684
688
|
ctx: ExtensionContext,
|
|
685
689
|
_model?: CodexUsageModel,
|
|
686
690
|
): string {
|
|
687
|
-
|
|
688
|
-
|
|
691
|
+
return formatStatuslineText(ctx, formatReportBar(report) ?? "n/a");
|
|
692
|
+
}
|
|
689
693
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return
|
|
693
|
-
|
|
694
|
-
`[${formatDualLimitBar(snapshot.primary, snapshot.secondary)}]`,
|
|
695
|
-
);
|
|
694
|
+
function formatReportBar(report: CodexUsageReport): string | undefined {
|
|
695
|
+
const snapshot = selectPrimaryCodexSnapshot(report);
|
|
696
|
+
if (!snapshot || (!snapshot.primary && !snapshot.secondary)) return undefined;
|
|
697
|
+
return formatDualLimitBar(snapshot.primary, snapshot.secondary);
|
|
696
698
|
}
|
|
697
699
|
|
|
698
700
|
function formatStatuslineText(ctx: ExtensionContext, value: string): string {
|
|
699
701
|
const label = ctx.ui.theme.fg("accent", STATUS_LABEL_TEXT);
|
|
700
|
-
return `${label} ${ctx.ui.theme.fg("
|
|
702
|
+
return `${label} ${ctx.ui.theme.fg("dim", value)}`;
|
|
701
703
|
}
|
|
702
704
|
|
|
703
705
|
function formatEmptyStatuslineBar(ctx: ExtensionContext): string {
|
|
704
|
-
return formatStatuslineText(ctx, "
|
|
706
|
+
return formatStatuslineText(ctx, "\u00a0\u00a0\u00a0\u00a0\u00a0");
|
|
705
707
|
}
|
|
706
708
|
|
|
707
709
|
function formatStatuslineProblem(
|