@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.
- package/README.md +1 -1
- package/index.ts +4 -2
- 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%
|
|
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
|
|
110
|
-
if (
|
|
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
|
}
|