Chat info: account quota per harness (Claude rate_limit_event, Codex account/rateLimits, OpenCode unsupported)

Usage frames carry optional usage.account {harness, source, plan, as_of,
windows[{id,label,used_percent,resets_at}], unsupported}. Claude Code quota
comes from its rate_limit_event stream lines and the initialize account
(plan), shared across chats on the same account. Codex reads
account/rateLimits/read once per connection (re-read when a chat opens after
5 min) and merges account/rateLimits/updated. OpenCode exposes no quota API
and says so. The app's chat info sheet shows an Account usage section with a
progress bar and reset countdown per window, Material and Cupertino.
This commit is contained in:
2026-11-02 18:57:13 +00:00
parent 8a402c1114
commit 10049b8062
26 changed files with 1469 additions and 19 deletions
+11
View File
@@ -42,3 +42,14 @@ before `turn/start`. Files retain the existing attachment-store retention rules.
History keeps local file/image parts; native image parts use the stored basename
while a companion text input retains the original display name.
All wire tests use fake JSON-RPC servers, never the production control socket.
## Account rate limits
`account-rate-limits-read.json` (an `account/rateLimits/read` result) and
`account-rate-limits-updated.json` (an `account/rateLimits/updated`
notification) follow the schema generated by the installed codex-cli 0.164.0
(`codex app-server generate-ts`: `v2/GetAccountRateLimitsResponse.ts`,
`RateLimitSnapshot.ts`, `RateLimitWindow.ts`,
`AccountRateLimitsUpdatedNotification.ts`). Numbers are synthetic. `resetsAt`
is Unix seconds; `usedPercent` is 0-100. The update is sparse: null fields keep
the previously read values.
+19
View File
@@ -0,0 +1,19 @@
{
"ordinaryUsageAllowed": true,
"rateLimits": {
"limitId": "codex",
"limitName": null,
"normalModelSlug": null,
"primary": {"usedPercent": 37, "windowDurationMins": 300, "resetsAt": 1900000000},
"secondary": {"usedPercent": 12, "windowDurationMins": 10080, "resetsAt": 1900500000},
"credits": {"hasCredits": false, "unlimited": false, "balance": null},
"individualLimit": null,
"spendControlReached": null,
"planType": "plus",
"rateLimitReachedType": null
},
"rateLimitsByLimitId": null,
"rateLimitResetCredits": null,
"accountId": null,
"rateLimitUpsell": null
}
@@ -0,0 +1,17 @@
{
"method": "account/rateLimits/updated",
"params": {
"rateLimits": {
"limitId": "codex",
"limitName": null,
"normalModelSlug": null,
"primary": {"usedPercent": 41, "windowDurationMins": 300, "resetsAt": 1900000000},
"secondary": null,
"credits": null,
"individualLimit": null,
"spendControlReached": null,
"planType": null,
"rateLimitReachedType": null
}
}
}