@opengeni/codex 0.2.19 → 0.2.20

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.
@@ -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.19",
3
+ "version": "0.2.20",
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": {
@@ -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
+ }