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
+13
View File
@@ -419,6 +419,19 @@ are session metadata: no assistant/tool message is created and no queued prompt
is admitted or completed by a usage update. Subscriptions replay retained usage;
native readback refreshes it where supported.
`usage.account` is the account's subscription quota as the harness reported it,
absent when unknown:
`{"harness","source","plan","as_of","windows":[{"id","label","used_percent","resets_at"}],"unsupported"}`.
`used_percent` is 0–100 (it can exceed 100); `as_of` and `resets_at` are epoch
milliseconds. Claude Code fills it from its `rate_limit_event` stream lines
(5-hour and weekly windows; plan from the initialize `account`), shared by every
chat on the same account; API-key logins never report one. Codex reads
`account/rateLimits/read` once per connection (again when a chat opens after
five minutes) and merges `account/rateLimits/updated` notifications.
OpenCode has no quota API, so it sends `{"harness":"OpenCode","unsupported":true}`.
A usage frame with only `account` updates the quota and leaves token figures as
they were. No quota is estimated and no model call is made to obtain one.
The brokered OpenCode chat exposes the operator's own sessions, separate from the
sessions pipeline runs create. The protocol types are: