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
+7 -1
View File
@@ -58,9 +58,15 @@ func TestScheduleFollowupQueuesWithoutBlockingTheOperator(t *testing.T) {
t.Fatalf("a fourth pending follow-up must be refused: %v", result)
}
writeChat(t, server.ctx, conn, protocol.Message{Type: protocol.ChatUnqueue, ID: "rm", ChatUnqueue: &protocol.ChatUnqueueRequest{SessionID: "ses_1", OperationID: rows[0].OperationID}})
if removed := readUntil(t, server.ctx, conn, protocol.ChatUnqueue); removed.ChatQueue == nil || removed.ChatQueue.Removed != rows[0].OperationID || len(removed.ChatQueue.Prompts) != 2 {
removed := readUntil(t, server.ctx, conn, protocol.ChatUnqueue)
if removed.ChatQueue == nil || removed.ChatQueue.Removed != rows[0].OperationID || len(removed.ChatQueue.Prompts) != 2 {
t.Fatalf("the operator removes a follow-up: %+v", removed.ChatQueue)
}
for _, prompt := range removed.ChatQueue.Prompts {
if prompt.Origin != protocol.ChatOriginFollowup {
t.Fatalf("a queued follow-up is marked as the agent's: %+v", prompt)
}
}
if n := broker.promptCount(); n != 1 {
t.Fatalf("no follow-up is delivered before its time: %v", broker.promptTexts())
}