Chat: draw agent follow-ups and automatic continues apart from the operator

The server now names a user turn's origin (followup, auto_continue,
auto_switch, scheduled) on chat messages, user frames and queued prompts,
from the prompt's operation id while it holds the prompt and from its own
text prefixes in history read later. Origin is a new field, so older
clients keep treating these as ordinary user turns.

The app draws an agent follow-up, auto-continue and account-switch prompt
as a quiet outlined card on the agent's side with an icon, label and the
schedule facts from the preamble; the operator's own scheduled message
keeps its bubble with a small Scheduled mark. Find searches the drawn text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 15:40:34 +00:00
parent 608b6b8edb
commit 9a6363b80e
22 changed files with 946 additions and 26 deletions
@@ -11,7 +11,7 @@ class ChatServerQueue {
List<JsonMap> _prompts = const [];
/// The queued prompts, each `{operation_id, message_id, native_message_id,
/// text, client, attachments}` as the server sent it.
/// text, client, attachments, send_at, origin}` as the server sent it.
List<JsonMap> get prompts => _prompts;
bool get isEmpty => _prompts.isEmpty;
@@ -45,6 +45,7 @@ class ChatServerQueue {
'operation_id': operation,
'native_message_id': prompt['native_message_id'] ?? '',
'client': prompt['client'],
'origin': ?prompt['origin'],
'parts': [
{'type': 'text', 'text': '${prompt['text'] ?? ''}'},
for (final attachment in prompt['attachments'] as List? ?? const [])
@@ -1919,6 +1919,7 @@ class _ChatThreadViewState extends State<ChatThreadView> with ChatFindHost {
() => ChatMessageView(
row: row,
speechScope: widget.sessionId,
scheduleShown: sendAt != null,
// The same reader id as the reply's Read aloud button, so the spoken
// word is highlighted in this reply's text.
textBuilder: (context, text) => ChatMarkdownView(
@@ -1983,6 +1984,7 @@ class _ChatThreadViewState extends State<ChatThreadView> with ChatFindHost {
row: {'kind': 'user', 'key': message['id'], 'message': message},
textBuilder: chatMarkdownText,
images: _images,
scheduleShown: true,
footer: [
ChatDeliveryIndicator(
state: ChatDelivery.queued,
@@ -2005,6 +2007,7 @@ class _ChatThreadViewState extends State<ChatThreadView> with ChatFindHost {
},
textBuilder: chatMarkdownText,
images: _images,
scheduleShown: true,
footer: [
ChatDeliveryIndicator(
state: ChatDelivery.failed,