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
+2 -1
View File
@@ -236,7 +236,7 @@ func joinChatDeltas(last, next protocol.Message) (protocol.Message, bool) {
func plainChatDelta(f *protocol.ChatEventFrame) bool {
return (f.Kind == protocol.ChatEventText || f.Kind == protocol.ChatEventReasoning) && f.Delta != "" && f.Part != nil &&
f.Part.Text == "" && f.Step == nil && f.Usage == nil && f.Shell == nil && f.Form == nil && f.Compaction == nil &&
len(f.Attachments) == 0 && f.Client == "" && f.OperationID == ""
len(f.Attachments) == 0 && f.Client == "" && f.OperationID == "" && f.Origin == ""
}
// utf16Len is the length of s in UTF-16 code units, the unit a Dart client
@@ -1227,6 +1227,7 @@ func (h *chatHub) publishDelivery(room *chatRoom, p *chatQueuedPrompt) {
Attachments: p.parts,
Client: p.client,
OperationID: p.operationID,
Origin: chatPromptOrigin(p.operationID, !p.sendAt.IsZero()),
}
h.mu.Lock()
turn := h.turnLocked(room.sessionID)