@ravshansbox/pi-quota 0.8.1 → 0.9.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.ts +4 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ Pi loads the extension from `./index.ts` and shows the remaining quota for the p
17
17
  - Calls the Anthropic usage endpoint once on session start, then reads the Anthropic quota from the rate limit headers of each Anthropic response
18
18
  - Polls the OpenAI Codex usage endpoint on session start, then at every 10-minute wall-clock mark (`HH:00`, `HH:10`, `HH:20`, `HH:30`, `HH:40`, `HH:50`)
19
19
  - Shows a footer status for the provider backing the **active model**, and only when quota data for that provider has been polled; switching models re-renders it immediately
20
- - The text stays compact, e.g. `93% 1h29m · 67% 3d13h`, where the 5-hour window comes first and the 7-day window second, and each window shows its remaining percentage followed by time until reset
20
+ - The text stays compact, e.g. `93% 1h29m · 67% 4d`, where the 5-hour window comes first and the 7-day window second, and each window shows its remaining percentage followed by time until reset
21
21
  - Available resets, when present, are appended as `· 2x 5h` (count, then time until the soonest expires)
22
22
  - Both providers are checked on session start whenever their credentials exist, so quota is already known when the active model changes
23
23
  - Refreshes Anthropic and OpenAI Codex OAuth access tokens from `~/.pi/agent/auth.json` when needed, writes updated credentials back (re-reading the file first to avoid clobbering concurrent updates), and notifies on the first successful refresh per provider each session
package/index.ts CHANGED
@@ -106,8 +106,10 @@ function formatResetTime(reset: Date): string {
106
106
  const hours = Math.floor((diff % 86400000) / 3600000);
107
107
  const minutes = Math.floor((diff % 3600000) / 60000);
108
108
 
109
- if (days > 0) return `${days}d${hours}h`;
110
- if (hours > 0) return `${hours}h${minutes}m`;
109
+ if (days === 1) return `${days}d${hours}h`;
110
+ if (days > 1) return `${Math.round(diff / 86400000)}d`;
111
+ if (hours === 1) return `${hours}h${minutes}m`;
112
+ if (hours > 1) return `${Math.round(diff / 3600000)}h`;
111
113
  if (minutes > 0) return `${minutes}m`;
112
114
  return 'now';
113
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravshansbox/pi-quota",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Anthropic and OpenAI Codex quota status extension for pi",
5
5
  "license": "MIT",
6
6
  "type": "module",