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
@@ -191,13 +191,15 @@ class ChatComposerController extends ChangeNotifier {
return _deliver(intent, clearDraft: true);
}
/// Asks the server to send [text] (text only) at [sendAt] epoch ms, as a
/// new message, leaving the draft alone: the usage-limit banner's re-send
/// of the operator's last message. Returns whether the server accepted it.
Future<bool> schedule(String text, int sendAt) async {
/// Asks the server to send [text] (text only) at [sendAt] epoch ms (0 sends
/// now), as a new message, leaving the draft alone: the usage-limit
/// banner's auto-continue and Try again. A given [operationId] makes the
/// send idempotent: the server keeps one prompt however many devices ask.
/// Returns whether the server accepted it.
Future<bool> schedule(String text, int sendAt, {String? operationId}) async {
final trimmed = text.trim();
if (_disposed || _sending || trimmed.isEmpty) return false;
final operationId = _nextOperationId();
operationId ??= _nextOperationId();
final intent = ChatComposerSend(
sessionId: sessionId,
text: trimmed,