@llblab/pi-codex-usage 0.3.5 → 0.4.1
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/AGENTS.md +2 -2
- package/CHANGELOG.md +23 -7
- package/README.md +4 -4
- package/banner.png +0 -0
- package/index.ts +20 -9
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
- Trigger: Updating quota polling or error handling.
|
|
9
9
|
- Action: Do not collapse the bar while a request is in flight; only show `n/a` or `error` after repeated failures or no usable quota.
|
|
10
10
|
|
|
11
|
-
- `Compact dual bar`: Encode the 5-hour and weekly quota windows in the
|
|
11
|
+
- `Compact dual bar`: Encode the 5-hour and weekly quota windows in the ten-character separated-sextant bar.
|
|
12
12
|
- Trigger: Changing statusline formatting.
|
|
13
|
-
- Action: Keep a fixed-width `
|
|
13
|
+
- Action: Keep a fixed-width `xxxxxxxxxx` bar where top sextants represent the 5-hour window and bottom sextants represent the weekly window, with 20 steps per window.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
3
|
+
## 0.4.1: Stable Startup Bar
|
|
4
|
+
|
|
5
|
+
- Fixed the initial empty statusline bar to use ten non-trimmed blank glyph cells through the same formatting path as the populated quota bar. Impact: the footer background stays at ten cells during startup before the first quota values arrive.
|
|
6
|
+
|
|
7
|
+
## 0.4.0
|
|
8
|
+
|
|
9
|
+
- Expanded the dual statusline bar to ten glyphs with 20 steps per quota window, moved its status key near the start of the footer status order, and draws the bar on the themed selected background. Impact: 5-hour and weekly limits now move in 5% increments for 40 total discrete points while empty cells no longer blend into the terminal background.
|
|
10
|
+
|
|
11
|
+
## 0.3.5
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
15
|
+
## 0.3.4
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
|
|
19
|
+
## Fork baseline
|
|
20
|
+
|
|
21
|
+
- 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.
|
|
22
|
+
- 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.
|
|
23
|
+
- Ignored additional returned buckets such as Spark-specific limits. Impact: the statusline only represents primary Codex 5-hour and weekly quota windows.
|
|
24
|
+
- Replaced textual percentages with a fixed-width separated-sextant bar. Impact: both 5-hour and weekly remaining quota are encoded in five statusline characters.
|
|
25
|
+
- Kept the last good bar during refresh and transient failures, with a short successful-redraw blink. Impact: the footer no longer shifts or collapses during polling.
|
package/README.md
CHANGED
|
@@ -15,12 +15,12 @@ This repository is a minimal fork of [`narumiruna/pi-extensions/extensions/pi-co
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
17
|
- Shows an empty statusline bar immediately, then refreshes every 30 seconds while the active Pi model uses `openai-codex`
|
|
18
|
-
- Statusline output stays compact, with the `codex` label accented and the
|
|
18
|
+
- Statusline output stays compact, with the `codex` label accented and the quota bar drawn on a themed background
|
|
19
19
|
- Additional returned buckets, including Spark-specific limits, are ignored
|
|
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 only when a
|
|
23
|
+
- Successful updates briefly redraw the bar only when a 5% 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
|
|
49
|
+
The ten-character bar encodes two twenty-step limits at once: 40 total bits of quota state in 10 terminal cells. Each step is 5%: 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
|
@@ -11,11 +11,12 @@ const CODEX_USAGE_URL = "https://chatgpt.com/backend-api/wham/usage";
|
|
|
11
11
|
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
12
12
|
const REFRESH_INTERVAL_MS = 30 * 1000;
|
|
13
13
|
const REDRAW_BLINK_MS = 150;
|
|
14
|
-
const STATUS_KEY = "codex-usage";
|
|
14
|
+
const STATUS_KEY = "aa-codex-usage";
|
|
15
15
|
const MAX_ERROR_BODY_CHARS = 600;
|
|
16
16
|
const STATUS_LABEL_TEXT = "codex";
|
|
17
|
+
const DUAL_BAR_WIDTH = 10;
|
|
17
18
|
const DUAL_BAR_CHARS = [
|
|
18
|
-
"
|
|
19
|
+
"⠀",
|
|
19
20
|
"▘",
|
|
20
21
|
"▝",
|
|
21
22
|
"▀",
|
|
@@ -688,7 +689,8 @@ export function formatCodexUsageStatusline(
|
|
|
688
689
|
ctx: ExtensionContext,
|
|
689
690
|
_model?: CodexUsageModel,
|
|
690
691
|
): string {
|
|
691
|
-
|
|
692
|
+
const bar = formatReportBar(report);
|
|
693
|
+
return bar ? formatStatuslineBarText(ctx, bar) : formatStatuslineText(ctx, "n/a");
|
|
692
694
|
}
|
|
693
695
|
|
|
694
696
|
function formatReportBar(report: CodexUsageReport): string | undefined {
|
|
@@ -702,8 +704,17 @@ function formatStatuslineText(ctx: ExtensionContext, value: string): string {
|
|
|
702
704
|
return `${label} ${ctx.ui.theme.fg("dim", value)}`;
|
|
703
705
|
}
|
|
704
706
|
|
|
707
|
+
function formatStatuslineBarText(ctx: ExtensionContext, bar: string): string {
|
|
708
|
+
const label = ctx.ui.theme.fg("accent", STATUS_LABEL_TEXT);
|
|
709
|
+
const value = ctx.ui.theme.bg(
|
|
710
|
+
"selectedBg",
|
|
711
|
+
ctx.ui.theme.fg("dim", bar),
|
|
712
|
+
);
|
|
713
|
+
return `${label} ${value}`;
|
|
714
|
+
}
|
|
715
|
+
|
|
705
716
|
function formatEmptyStatuslineBar(ctx: ExtensionContext): string {
|
|
706
|
-
return
|
|
717
|
+
return formatStatuslineBarText(ctx, DUAL_BAR_CHARS[0].repeat(DUAL_BAR_WIDTH));
|
|
707
718
|
}
|
|
708
719
|
|
|
709
720
|
function formatStatuslineProblem(
|
|
@@ -755,10 +766,10 @@ function formatDualLimitBar(
|
|
|
755
766
|
primary: NormalizedRateLimitWindow | undefined,
|
|
756
767
|
secondary: NormalizedRateLimitWindow | undefined,
|
|
757
768
|
): string {
|
|
758
|
-
const primaryParts =
|
|
759
|
-
const secondaryParts =
|
|
769
|
+
const primaryParts = filledTwentieths(primary);
|
|
770
|
+
const secondaryParts = filledTwentieths(secondary);
|
|
760
771
|
let value = "";
|
|
761
|
-
for (let index = 0; index <
|
|
772
|
+
for (let index = 0; index < DUAL_BAR_WIDTH; index++) {
|
|
762
773
|
const leftPart = index * 2 + 1;
|
|
763
774
|
const rightPart = leftPart + 1;
|
|
764
775
|
let mask = 0;
|
|
@@ -771,9 +782,9 @@ function formatDualLimitBar(
|
|
|
771
782
|
return value;
|
|
772
783
|
}
|
|
773
784
|
|
|
774
|
-
function
|
|
785
|
+
function filledTwentieths(window: NormalizedRateLimitWindow | undefined): number {
|
|
775
786
|
if (!window) return 0;
|
|
776
|
-
return Math.round(remainingPercent(window) /
|
|
787
|
+
return Math.round(remainingPercent(window) / 5);
|
|
777
788
|
}
|
|
778
789
|
|
|
779
790
|
function remainingPercent(window: NormalizedRateLimitWindow): number {
|