@ogulcancelik/pi-minimal-footer 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/index.ts +15 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -41,6 +41,12 @@ Usage is fetched:
41
41
 
42
42
  The footer adapts to narrow terminals by stacking lines vertically instead of the single-line wide layout.
43
43
 
44
+ ## Known issues
45
+
46
+ ### Claude Max usage bar not showing
47
+
48
+ Anthropic's OAuth usage endpoint (`/api/oauth/usage`) has been returning persistent 429 (rate limit) errors since late March 2026, affecting all third-party tools that display Claude usage data (CodexBar, oh-my-claudecode, claude-pulse, etc.). This is an Anthropic-side issue — tracked in [claude-code#30930](https://github.com/anthropics/claude-code/issues/30930) and [claude-code#31021](https://github.com/anthropics/claude-code/issues/31021). The usage bar will start working again once Anthropic fixes the endpoint.
49
+
44
50
  ## Notes
45
51
 
46
52
  - Replaces the default pi footer entirely via `ctx.ui.setFooter()`
package/index.ts CHANGED
@@ -794,10 +794,11 @@ export default function (pi: ExtensionAPI) {
794
794
  tuiRef?.requestRender();
795
795
  }
796
796
 
797
- // Fetch fresh in background
797
+ // Fetch fresh in background — keep cached data on transient errors
798
798
  fetchUsageForProvider(provider)
799
799
  .then((u) => {
800
800
  if (!u || activeProvider !== provider) return;
801
+ if (u.windows.length === 0 && u.error && cached?.windows.length) return;
801
802
  usageCache.set(provider, u);
802
803
  latestUsage = u;
803
804
  tuiRef?.requestRender();
@@ -810,10 +811,13 @@ export default function (pi: ExtensionAPI) {
810
811
  if (refreshTimer) clearInterval(refreshTimer);
811
812
  refreshTimer = setInterval(() => {
812
813
  if (activeProvider) {
813
- fetchUsageForProvider(activeProvider)
814
+ const provider = activeProvider;
815
+ const cached = usageCache.get(provider);
816
+ fetchUsageForProvider(provider)
814
817
  .then((u) => {
815
- if (!u) return;
816
- usageCache.set(activeProvider!, u);
818
+ if (!u || activeProvider !== provider) return;
819
+ if (u.windows.length === 0 && u.error && cached?.windows.length) return;
820
+ usageCache.set(provider, u);
817
821
  latestUsage = u;
818
822
  tuiRef?.requestRender();
819
823
  })
@@ -835,8 +839,6 @@ export default function (pi: ExtensionAPI) {
835
839
  if (!ctx.hasUI) return;
836
840
 
837
841
  ctx.ui.setFooter((tui: any, theme: any, footerData: any) => {
838
- // Store tui reference for event handlers — must be set before any async
839
- // fetch completes so requestRender() works on first load.
840
842
  tuiRef = tui;
841
843
 
842
844
  const unsub = footerData.onBranchChange(() => {
@@ -844,6 +846,13 @@ export default function (pi: ExtensionAPI) {
844
846
  tui.requestRender();
845
847
  });
846
848
 
849
+ // Initial fetch inside factory — tui is guaranteed available here,
850
+ // so requestRender() will work when the async fetch completes.
851
+ if (ctx.model?.provider) {
852
+ fetchUsage(ctx.model.provider);
853
+ startRefreshTimer();
854
+ }
855
+
847
856
  return {
848
857
  dispose: () => {
849
858
  unsub();
@@ -919,11 +928,6 @@ export default function (pi: ExtensionAPI) {
919
928
  };
920
929
  });
921
930
 
922
- // Initial usage fetch — after setFooter so tuiRef is set
923
- if (ctx.model?.provider) {
924
- fetchUsage(ctx.model.provider);
925
- startRefreshTimer();
926
- }
927
931
  });
928
932
 
929
933
  // Refresh when model changes — fetch immediately, restart timer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogulcancelik/pi-minimal-footer",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Minimal footer for pi with context gauge and subscription usage bars",
5
5
  "type": "module",
6
6
  "keywords": [