@opengeni/codex 0.2.19-canary.4 → 0.2.20-canary.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/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/usage-normalize.d.ts +8 -0
- package/package.json +2 -2
- package/src/usage-normalize.ts +14 -0
|
@@ -59,3 +59,11 @@ export declare function buildCodexUsageWindowFromCache(usedPercent: number | nul
|
|
|
59
59
|
* @param rawPayload the parsed JSON body (or null when the body was unreadable)
|
|
60
60
|
*/
|
|
61
61
|
export declare function normalizeCodexUsage(httpStatus: number, rawPayload: unknown): CodexUsagePayload;
|
|
62
|
+
/**
|
|
63
|
+
* Whether one live /wham/usage response authoritatively contradicts an older
|
|
64
|
+
* quota refusal. `ok` proves the base allowance is open; every surfaced
|
|
65
|
+
* feature-specific window must also remain below exhaustion because the older
|
|
66
|
+
* model refusal may have belonged to one of those limits. Missing/no-data and
|
|
67
|
+
* malformed/error responses never repair cooldown state.
|
|
68
|
+
*/
|
|
69
|
+
export declare function codexUsageConfirmsQuotaAvailable(payload: CodexUsagePayload): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/codex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20-canary.0",
|
|
4
4
|
"description": "ChatGPT/Codex subscription auth + transport: device-code login, token refresh, and the Responses-backend fetch. Pure HTTP + transforms; no database dependency.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@opengeni/network": "^0.2.3-canary.
|
|
44
|
+
"@opengeni/network": "^0.2.3-canary.5",
|
|
45
45
|
"zod": "^4.2.1"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
package/src/usage-normalize.ts
CHANGED
|
@@ -296,3 +296,17 @@ export function normalizeCodexUsage(httpStatus: number, rawPayload: unknown): Co
|
|
|
296
296
|
...(credits ? { credits } : {}),
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Whether one live /wham/usage response authoritatively contradicts an older
|
|
302
|
+
* quota refusal. `ok` proves the base allowance is open; every surfaced
|
|
303
|
+
* feature-specific window must also remain below exhaustion because the older
|
|
304
|
+
* model refusal may have belonged to one of those limits. Missing/no-data and
|
|
305
|
+
* malformed/error responses never repair cooldown state.
|
|
306
|
+
*/
|
|
307
|
+
export function codexUsageConfirmsQuotaAvailable(payload: CodexUsagePayload): boolean {
|
|
308
|
+
if (payload.status !== "ok" || payload.limitReached) return false;
|
|
309
|
+
return !payload.additionalLimits?.some(
|
|
310
|
+
(limit) => (limit.fiveHour?.percent ?? 0) >= 100 || (limit.weekly?.percent ?? 0) >= 100,
|
|
311
|
+
);
|
|
312
|
+
}
|