Chat usage limit: Claude Code-style banner with auto-continue; drop the approaching-limit banner

- The usage-limit banner now reads 'Out of usage credits' (or the refusal's
  own 'You've hit your 5-hour limit'), 'Auto-resuming at <time>', an
  'Auto-continue when limits reset' checkbox and Try again, keeping the
  account switcher's 'Switch to <account>'.
- Auto-continue (a shared, persisted preference, on by default) hands the
  server a durable scheduled prompt (send_at = reset + 1 min) with an
  idempotent auto-continue-<refusal id> operation id: the refused operator
  message again, or 'continue' when the refused turn had already worked.
  Unchecking unqueues it; Try again unqueues it and sends now.
- Remove the approaching-limit banner, its SnackBar announcements and their
  marks; the send-button usage ring replaces them.
- Claude Code's rate_limit_event overage fields (overageStatus,
  isUsingOverage/overageInUse, overageDisabledReason, overageResetsAt) reach
  clients as usage.account.extra_usage; the ring tooltip and the banner say
  'Extra usage available' or 'Using extra usage'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 16:13:33 +00:00
parent 7a259d8f60
commit 293474ac3c
22 changed files with 905 additions and 1254 deletions
+21
View File
@@ -804,6 +804,23 @@ type ChatAccountUsage struct {
// account even with no windows yet, and a usage-limit refusal the chat
// received before it no longer applies.
SwitchedAt int64 `json:"switched_at,omitempty"`
// ExtraUsage is the account's extra usage (Claude Code's "overage": paid
// usage credits past the subscription limits) as the harness last
// reported it; nil when it never said.
ExtraUsage *ChatExtraUsage `json:"extra_usage,omitempty"`
}
// ChatExtraUsage is Claude Code's overage state from rate_limit_event:
// Status is its overageStatus ("allowed", "allowed_warning" or "rejected"),
// InUse whether requests are drawing on extra usage now, and DisabledReason
// its overageDisabledReason (e.g. "out_of_credits", "org_level_disabled",
// "overage_not_provisioned") when it is off. ResetsAt is when the extra usage
// period resets (epoch milliseconds), 0 if unknown.
type ChatExtraUsage struct {
Status string `json:"status,omitempty"`
InUse bool `json:"in_use,omitempty"`
DisabledReason string `json:"disabled_reason,omitempty"`
ResetsAt int64 `json:"resets_at,omitempty"`
}
// ChatQuotaWindow is one rolling quota window. UsedPercent is 0-100 (it can
@@ -823,6 +840,10 @@ func (a *ChatAccountUsage) Clone() *ChatAccountUsage {
}
copy := *a
copy.Windows = append([]ChatQuotaWindow(nil), a.Windows...)
if a.ExtraUsage != nil {
extra := *a.ExtraUsage
copy.ExtraUsage = &extra
}
return &copy
}