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:
@@ -124,9 +124,11 @@ type chatMessage struct {
|
||||
operationID string
|
||||
// kind is the ChatMessage.Kind of harness-injected content (an agent
|
||||
// report or a notice); empty for an ordinary turn.
|
||||
kind string
|
||||
order []string
|
||||
parts map[string]*chatPart
|
||||
kind string
|
||||
// origin is the ChatMessage.Origin of a user turn.
|
||||
origin string
|
||||
order []string
|
||||
parts map[string]*chatPart
|
||||
}
|
||||
|
||||
type chatTurn struct {
|
||||
@@ -302,6 +304,9 @@ func (h *chatHub) applyLocked(frame protocol.ChatEventFrame) {
|
||||
if message.operationID == "" && frame.Kind == protocol.ChatEventUser {
|
||||
message.operationID = frame.OperationID
|
||||
}
|
||||
if message.origin == "" && frame.Kind == protocol.ChatEventUser {
|
||||
message.origin = frame.Origin
|
||||
}
|
||||
if message.kind == "" && frame.MessageKind != "" && frame.Kind != protocol.ChatEventUser {
|
||||
message.kind = frame.MessageKind
|
||||
}
|
||||
@@ -635,6 +640,7 @@ func (h *chatHub) snapshot(sessionID string) []protocol.ChatMessage {
|
||||
out.Client = message.client
|
||||
out.OperationID = message.operationID
|
||||
out.Kind = message.kind
|
||||
out.Origin = message.origin
|
||||
for _, partID := range message.order {
|
||||
if part, ok := message.parts[partID]; ok {
|
||||
piece := part.part
|
||||
@@ -674,6 +680,9 @@ func (h *chatHub) reconcileHistory(sessionID string, messages []protocol.ChatMes
|
||||
if out[i].Client == "" {
|
||||
out[i].Client = live.client
|
||||
}
|
||||
if out[i].Origin == "" {
|
||||
out[i].Origin = live.origin
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user