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
+3 -2
View File
@@ -123,10 +123,10 @@ func (s *chatToolService) runScheduleFollowup(ctx context.Context, sessionID, me
var token [8]byte
_, _ = rand.Read(token[:])
operationID := chatFollowupPrefix + hex.EncodeToString(token[:])
text := fmt.Sprintf("[Follow-up you scheduled at %s with schedule_followup] %s", now.UTC().Format(time.RFC3339), message)
text := fmt.Sprintf(chatFollowupTextPrefix+"%s with schedule_followup] %s", now.UTC().Format(time.RFC3339), message)
if run != nil {
operationID = fmt.Sprintf("%s%d-%s-%s", chatRunFollowupPrefix, run.ID, on, hex.EncodeToString(token[:]))
text = fmt.Sprintf("[Follow-up you scheduled at %s with schedule_followup, for when run %d %s; delivered at %s at the latest] %s",
text = fmt.Sprintf(chatFollowupTextPrefix+"%s with schedule_followup, for when run %d %s; delivered at %s at the latest] %s",
now.UTC().Format(time.RFC3339), run.ID, runFollowupCondition(on), sendAt.UTC().Format(time.RFC3339), message)
}
if err := s.hub.queueFollowup(ctx, s.broker, sessionID, operationID, text, sendAt); err != nil {
@@ -417,6 +417,7 @@ func (h *chatHub) queueFollowup(ctx context.Context, broker chatBroker, sessionI
Part: &protocol.ChatPart{Type: protocol.ChatPartText, ID: "usr", Text: text},
Client: chatFollowupClient,
OperationID: operationID,
Origin: protocol.ChatOriginFollowup,
}, "")
return nil
}