mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-10-22 08:16:18 +00:00
Replace the WinHTTP client with a ureq agent that keeps the same Client/Response surface: status errors come back as responses, gzip, 60 s connect / 30 s receive / 120 s total timeouts, rustls with the platform verifier and a per-request User-Agent override. Environment proxies come from ureq. On Windows, when none is set, the static Internet Settings proxy is read from HKCU and parsed by a pure core module (per-scheme ProxyServer, ProxyOverride globs and <local>); bypassed hosts go through a direct agent. PAC/WPAD is not evaluated. The usage providers and credential sources compile again on every platform. Refresh keeps the Windows candidates and CREATE_NO_WINDOW; Unix spawns claude/codex from PATH plus the usual per-user install directories and reaps the child on a detached thread. An empty CODEX_HOME now counts as unset and a float expiresAt is truncated instead of ignored. Fixture tests cover the OAuth usage body, rate-limit headers (including a 429 over loopback), the ChatGPT envelope, ISO 8601 edge cases, credential JSON and proxy strings. An ignored live_poll test polls the real providers.
21 lines
439 B
JSON
21 lines
439 B
JSON
{
|
|
"plan_type": "plus",
|
|
"rate_limit": {
|
|
"allowed": true,
|
|
"limit_reached": false,
|
|
"primary_window": {
|
|
"used_percent": 12,
|
|
"limit_window_seconds": 18000,
|
|
"reset_after_seconds": 3600,
|
|
"reset_at": 1761040800
|
|
},
|
|
"secondary_window": {
|
|
"used_percent": 104.5,
|
|
"limit_window_seconds": 604800,
|
|
"reset_after_seconds": 86400,
|
|
"reset_at": 1761508800
|
|
}
|
|
},
|
|
"credits": null
|
|
}
|