Chat: warn before the harness account's usage limit runs out

A compact banner above the composer when any quota window of the chat's
harness account reaches 80% (error colours from 95%), naming the most
constrained window and a second one also at 80%+. Dismissing it holds per
harness+window until the next level (80/90/95) or a reset, across chats and
reloads; a newly crossed level is announced once with a root SnackBar. The
usage-limit banner wins. Fixture: quota=warn80|warn95.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 12:34:01 +00:00
parent 18807b8ac2
commit b6d06219cd
7 changed files with 956 additions and 9 deletions
@@ -51,6 +51,7 @@ import 'chat_composer_controller.dart';
import 'chat_escape_stop.dart';
import 'chat_delivery_indicator.dart';
import 'chat_usage_limit_banner.dart';
import 'chat_usage_warning_banner.dart';
import '../domain/chat_usage_limit.dart';
import 'chat_draft_store.dart';
import 'chat_effort_control.dart';
@@ -1254,10 +1255,17 @@ class _ChatThreadViewState extends State<ChatThreadView> {
pasteTarget: widget.pasteTarget,
ownsPasteWhenFocused: widget.ownsPasteWhenFocused,
runShell: _shellRuns.start,
limitBanner: (sendDraft) => ChatUsageLimitBanner(
thread: _controller,
composer: _composer,
sendDraft: sendDraft,
limitBanner: (sendDraft) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ChatUsageLimitBanner(
thread: _controller,
composer: _composer,
sendDraft: sendDraft,
),
ChatUsageWarningBanner(thread: _controller),
],
),
backgroundTasks: ChatBackgroundTasks(
key: ValueKey('chat-background-tasks-${widget.sessionId}'),