@ravshansbox/pi-quota 0.2.0 → 0.3.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 +3 -3
- package/index.ts +1 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Anthropic and OpenAI Codex quota status extension for pi.
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pi install
|
|
8
|
+
pi install npm:@ravshansbox/pi-quota
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -15,8 +15,8 @@ Pi loads the extension from `./index.ts` and shows the remaining quota for the p
|
|
|
15
15
|
- Polls Anthropic and OpenAI Codex usage endpoints at every 10-minute wall-clock mark (`HH:00`, `HH:10`, `HH:20`, `HH:30`, `HH:40`, `HH:50`); polls immediately on session start, then aligns to the next mark
|
|
16
16
|
- 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
|
|
17
17
|
- The status shares the footer line with other extensions, so it uses no extra terminal row
|
|
18
|
-
- The text
|
|
19
|
-
- Available resets, when present, are appended as
|
|
18
|
+
- 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
|
|
19
|
+
- Available resets, when present, are appended as `· 2x 5h` (count, then time until the soonest expires)
|
|
20
20
|
- Both providers are still polled whenever their credentials exist, so quota is already fresh when the active model changes
|
|
21
21
|
- 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
|
|
22
22
|
- Appends poll and token-refresh errors to `~/.pi/agent/pi-quota.log`
|
package/index.ts
CHANGED
|
@@ -76,11 +76,6 @@ const MODEL_PROVIDER_NAMES: Record<QuotaState['provider'], string> = {
|
|
|
76
76
|
'openai-codex': 'openai',
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const QUOTA_LABELS: Record<QuotaState['provider'], string> = {
|
|
80
|
-
anthropic: 'Claude',
|
|
81
|
-
'openai-codex': 'Codex',
|
|
82
|
-
};
|
|
83
|
-
|
|
84
79
|
const REQUEST_TIMEOUT_MS = 30_000;
|
|
85
80
|
|
|
86
81
|
function nextMarkAfter(time: Date): Date {
|
|
@@ -211,7 +206,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
211
206
|
: '';
|
|
212
207
|
parts.push(`${state.resetsAvailable}x${expiryStr}`);
|
|
213
208
|
}
|
|
214
|
-
return parts.length > 0 ?
|
|
209
|
+
return parts.length > 0 ? parts.join(' · ') : undefined;
|
|
215
210
|
}
|
|
216
211
|
|
|
217
212
|
function updateStatus() {
|