Chat list: tool calls and notices never mark a chat New

Only visible assistant reply text, a pending form or an unresolved
permission request is unread. Tool results, user prompts, harness
notices/agent reports and blank deltas only drive the working state.
This commit is contained in:
2026-11-03 18:34:29 +00:00
parent fa6c0864db
commit c320dac131
4 changed files with 145 additions and 35 deletions
@@ -18,23 +18,20 @@ ChatSessionFrameEffect? chatSessionFrameEffect(JsonMap frame) {
if (event is! Map) return null;
id = event['session_id'] is String ? event['session_id'] as String : null;
final kind = event['kind'];
// A badge means content to read, not transport/activity churn: assistant
// text, another client's user message, a returned tool result, or a pending
// form. Reasoning, starts, steps, shells, compaction and usage are not unread.
// A badge means the agent said something to read or is waiting on the
// operator: visible assistant reply text or a pending form. Tool calls and
// their results, harness notices and agent reports (`message_kind`), the
// operator's own prompts from any device, reasoning, steps, shells,
// compaction and usage are turn activity, never unread.
if (kind == 'text') {
attention = '${event['delta'] ?? ''}'.isNotEmpty;
} else if (kind == 'user') {
attention = true;
attention =
'${event['delta'] ?? ''}'.trim().isNotEmpty &&
'${event['message_kind'] ?? ''}'.isEmpty;
} else if (kind == 'tool') {
final part = event['part'];
final state = part is Map ? part['state'] : null;
if (state is Map) {
final status = state['status'];
attention =
(status == 'completed' || status == 'error') &&
((state['content'] is List &&
(state['content'] as List).isNotEmpty) ||
state['error'] != null);
if (status == 'running' || status == 'streaming') running = true;
}
} else if (kind == 'form') {