@narumitw/pi-codex-usage 0.4.3 → 0.6.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/package.json +2 -2
- package/src/codex-usage.ts +5 -5
package/README.md
CHANGED
|
@@ -66,11 +66,11 @@ information on rate limits and credits
|
|
|
66
66
|
When the selected Pi model provider is `openai-codex`, `pi-codex-usage` refreshes a compact statusline item automatically:
|
|
67
67
|
|
|
68
68
|
```text
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
codex 59% 5h 61% wk
|
|
70
|
+
codex spark 100% 5h 100% wk
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
The statusline value uses the cached usage snapshot and refreshes every five minutes while the current model remains `openai-codex`.
|
|
73
|
+
`@narumitw/pi-statusline` adds the default `📊` icon unless configured otherwise. The statusline value uses the cached usage snapshot and refreshes every five minutes while the current model remains `openai-codex`.
|
|
74
74
|
When the selected model has its own returned usage bucket, such as `gpt-5.3-codex-spark`, the statusline switches to that bucket instead of the default `codex` bucket.
|
|
75
75
|
Switching away from an OpenAI Codex model clears the item.
|
|
76
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-codex-usage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Pi extension that shows Codex ChatGPT subscription usage without requiring Codex CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "2.4.14",
|
|
33
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
33
|
+
"@earendil-works/pi-coding-agent": "0.79.8",
|
|
34
34
|
"@types/node": "25.6.0",
|
|
35
35
|
"typescript": "6.0.3"
|
|
36
36
|
},
|
package/src/codex-usage.ts
CHANGED
|
@@ -242,12 +242,12 @@ export default function codexUsage(pi: ExtensionAPI) {
|
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
if (!setStatuslineValue(ctx, "
|
|
245
|
+
if (!setStatuslineValue(ctx, "checking")) return;
|
|
246
246
|
const result = await queryUsage(ctx, { timeoutMs: DEFAULT_TIMEOUT_MS });
|
|
247
247
|
if (!sessionActive || requestId !== statuslineRequestId) return;
|
|
248
248
|
|
|
249
249
|
if (!result.ok) {
|
|
250
|
-
if (setStatuslineValue(ctx, "
|
|
250
|
+
if (setStatuslineValue(ctx, "usage error")) {
|
|
251
251
|
scheduleStatuslineRefresh(ctx, selectedModel);
|
|
252
252
|
}
|
|
253
253
|
return;
|
|
@@ -287,7 +287,7 @@ export default function codexUsage(pi: ExtensionAPI) {
|
|
|
287
287
|
|
|
288
288
|
let keepStatusline = false;
|
|
289
289
|
const statuslineStarted =
|
|
290
|
-
options.value.statusline && setStatuslineValue(ctx, "
|
|
290
|
+
options.value.statusline && setStatuslineValue(ctx, "checking");
|
|
291
291
|
try {
|
|
292
292
|
const result = await queryUsage(ctx, options.value);
|
|
293
293
|
if (!result.ok) {
|
|
@@ -891,9 +891,9 @@ export function formatCodexUsageStatusline(
|
|
|
891
891
|
model?: CodexUsageModel,
|
|
892
892
|
): string {
|
|
893
893
|
const snapshot = selectSnapshotForModel(report, model);
|
|
894
|
-
if (!snapshot) return "
|
|
894
|
+
if (!snapshot) return "usage unavailable";
|
|
895
895
|
|
|
896
|
-
const parts = [
|
|
896
|
+
const parts = [formatStatuslinePrefix(snapshot)];
|
|
897
897
|
if (snapshot.primary) parts.push(`${formatRemainingPercent(snapshot.primary)} 5h`);
|
|
898
898
|
if (snapshot.secondary) parts.push(`${formatRemainingPercent(snapshot.secondary)} wk`);
|
|
899
899
|
if (parts.length === 1 && snapshot.credits) parts.push(formatCredits(snapshot.credits));
|