@narumitw/pi-usage 0.31.0 → 0.34.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 +2 -6
- package/package.json +1 -1
- package/src/format.ts +10 -8
- package/src/usage.ts +0 -4
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
- Keeps the compact statusline scoped to the current provider and runtime account.
|
|
17
17
|
- Isolates its five-minute in-memory cache by provider and a process-salted credential fingerprint.
|
|
18
18
|
- Resolves credentials through Pi and never reads Pi, account-extension, Codex CLI, or provider auth files.
|
|
19
|
-
- Retains `/codex-status` as a temporary argument-free compatibility alias.
|
|
20
19
|
|
|
21
20
|
## 📦 Install
|
|
22
21
|
|
|
@@ -57,8 +56,6 @@ Close
|
|
|
57
56
|
|
|
58
57
|
There are intentionally no `/usage --refresh`, `/usage <provider>`, or `/usage --all` argument paths. Cross-provider traffic requires an explicit interactive choice.
|
|
59
58
|
|
|
60
|
-
`/codex-status` opens the same menu during the migration period. Its former flags are not supported by `pi-usage`.
|
|
61
|
-
|
|
62
59
|
## 📋 Provider semantics
|
|
63
60
|
|
|
64
61
|
### OpenAI Codex
|
|
@@ -102,12 +99,11 @@ pi remove npm:@narumitw/pi-codex-usage
|
|
|
102
99
|
pi install npm:@narumitw/pi-usage
|
|
103
100
|
```
|
|
104
101
|
|
|
105
|
-
|
|
102
|
+
Remove the deprecated package rather than loading both usage extensions together.
|
|
106
103
|
|
|
107
104
|
Behavior changes:
|
|
108
105
|
|
|
109
|
-
- Use `/usage` as the
|
|
110
|
-
- `/codex-status` is an argument-free compatibility alias.
|
|
106
|
+
- Use `/usage` as the only entry point; `/codex-status` is no longer registered.
|
|
111
107
|
- Refresh and cross-provider operations are menu actions rather than flags.
|
|
112
108
|
- Codex CLI fallback is removed to preserve active-runtime-account correctness.
|
|
113
109
|
- The status key changes from `codex-usage` to `usage`.
|
package/package.json
CHANGED
package/src/format.ts
CHANGED
|
@@ -174,11 +174,13 @@ function normalizedModelKeys(model: UsageModel): Set<string> {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
function normalizeKey(value: string | undefined): string | undefined {
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
const separated = value?.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
178
|
+
if (!separated) return undefined;
|
|
179
|
+
let start = 0;
|
|
180
|
+
let end = separated.length;
|
|
181
|
+
while (separated[start] === "-") start += 1;
|
|
182
|
+
while (end > start && separated[end - 1] === "-") end -= 1;
|
|
183
|
+
return separated.slice(start, end) || undefined;
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
function normalizedKeyHasToken(key: string, token: string): boolean {
|
|
@@ -192,9 +194,9 @@ function normalizedKeyHasToken(key: string, token: string): boolean {
|
|
|
192
194
|
|
|
193
195
|
function compactLimitLabel(label: string): string {
|
|
194
196
|
const normalized = label.replace(/[_-]+/g, " ").trim();
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
const codex = /\bcodex\s/iu.exec(normalized);
|
|
198
|
+
const suffix = codex ? normalized.slice(codex.index + codex[0].length).trim() : "";
|
|
199
|
+
return (suffix || normalized).toLowerCase().replace(/\s+/g, " ");
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
function formatPercentBucket(bucket: UsageBucket): string {
|
package/src/usage.ts
CHANGED
|
@@ -606,10 +606,6 @@ export default function usageExtension(pi: ExtensionAPI) {
|
|
|
606
606
|
description: "Show usage for the current runtime account",
|
|
607
607
|
handler: commandHandler,
|
|
608
608
|
});
|
|
609
|
-
pi.registerCommand("codex-status", {
|
|
610
|
-
description: "Open /usage (temporary compatibility alias)",
|
|
611
|
-
handler: commandHandler,
|
|
612
|
-
});
|
|
613
609
|
|
|
614
610
|
pi.on("session_start", (_event, ctx) => {
|
|
615
611
|
sessionActive = true;
|