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:
@@ -6,9 +6,12 @@
|
||||
// `?chats=N` N chat sessions in the chat list, each opening a short
|
||||
// markdown transcript;
|
||||
// `?graph=1` run 7 carries its pinned graph (plan -> build);
|
||||
// `?quota=claude|opencode|limit` (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.
|
||||
// `?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%.
|
||||
// `?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
|
||||
@@ -179,7 +182,12 @@ List<JsonMap> perfChatFollowUps(JsonMap request) {
|
||||
{
|
||||
'id': 'five_hour',
|
||||
'label': '5-hour',
|
||||
'used_percent': quota == 'limit' ? 100 : 42,
|
||||
'used_percent': switch (quota) {
|
||||
'limit' => 100,
|
||||
'warn80' => 84,
|
||||
'warn95' => 96,
|
||||
_ => 42,
|
||||
},
|
||||
'resets_at': at(
|
||||
const Duration(hours: 2, minutes: 14, seconds: 30),
|
||||
),
|
||||
@@ -187,7 +195,11 @@ List<JsonMap> perfChatFollowUps(JsonMap request) {
|
||||
{
|
||||
'id': 'seven_day',
|
||||
'label': 'Weekly',
|
||||
'used_percent': 93,
|
||||
'used_percent': switch (quota) {
|
||||
'warn80' => 60,
|
||||
'warn95' => 88,
|
||||
_ => 93,
|
||||
},
|
||||
'resets_at': at(const Duration(days: 3, hours: 5)),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user