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
@@ -129,6 +129,44 @@ void main() {
);
});
test('summary ends with extra usage when the account has it', () {
ChatUsageRing ring(ChatExtraUsage extra) => chatUsageRing(
ChatAccountUsage(
harness: 'Claude Code',
plan: 'max',
asOf: 0,
windows: [_window('five_hour', '5-hour', 42, null)],
unsupported: false,
extraUsage: extra,
),
_now,
)!;
const available = ChatExtraUsage(
status: 'allowed',
inUse: false,
disabledReason: '',
);
expect(
chatUsageRingSummary(ring(available), _now),
'5-hour 42% · Extra usage available',
);
const inUse = ChatExtraUsage(
status: 'allowed_warning',
inUse: true,
disabledReason: '',
);
expect(
chatUsageRingSummary(ring(inUse), _now),
'5-hour 42% · Using extra usage',
);
const off = ChatExtraUsage(
status: 'rejected',
inUse: false,
disabledReason: 'out_of_credits',
);
expect(chatUsageRingSummary(ring(off), _now), '5-hour 42%');
});
test('reset times: today, this week, further out', () {
expect(chatUsageRingResetTime(DateTime(2026, 11, 30, 8, 5), _now), '08:05');
expect(