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
+31 -3
View File
@@ -9,9 +9,10 @@
// `?quota=claude|opencode|limit|warn80|warn95` (with `?chats=N`) pushes a
// usage frame with that harness's account quota after a chat
// subscribes; `limit` is Claude Code with its 5-hour window
// exhausted, `warn80` and `warn95` with it at 84% and 96%
// (the early warning) and the weekly window at 60% and 88%;
// otherwise the weekly window is at 93%.
// exhausted and the transcript ending on Claude Code's limit
// refusal, `warn80` and `warn95` with it at 84% and 96% (the
// send ring's warning tones) and the weekly window at 60% and
// 88%; otherwise the weekly window is at 93%.
// `?colors=1` (with `?chats=N`) names the chats, stars and colours some of
// them, and keeps colours picked with chat_color;
// `?activity=1` (with `?chats=N`) lists a running chat, one with
@@ -351,6 +352,20 @@ JsonMap? perfChatReply(JsonMap request) {
'chat_queued': _scheduledPrompt(request) != null,
if (_params['steered'] == '1') 'chat_steered': true,
};
case 'chat_unqueue':
// The fixture holds at most the one scheduled prompt: removing it
// leaves the queue empty.
final body = request['chat_unqueue'];
final unqueue = body is Map ? body : const {};
return {
'id': id,
'type': 'chat_unqueue',
'chat_queue': {
'session_id': unqueue['session_id'],
'prompts': const [],
'removed': unqueue['operation_id'],
},
};
case 'chat_shells':
return {
'id': id,
@@ -447,6 +462,19 @@ JsonMap? perfChatReply(JsonMap request) {
},
],
},
if (_params['quota'] == 'limit')
{
'id': 'perf-limit-refusal',
'role': 'assistant',
'parts': [
{
'type': 'text',
'text':
"You've hit your 5-hour limit · resets 5:20pm "
'(Europe/London) · out of usage credits',
},
],
},
],
'next_cursor': '',
'has_more': false,