Show injected Claude input as agent reports and notices, not operator bubbles
Claude Code records subagent/peer reports, task notifications, reminders and skill bodies as user-role entries. Classify them server-side (history and live stream) by origin/isMeta/queued_command mode: reports become kind agent_report, task notifications kind notice, harness meta is hidden, and the mid-turn wrapper is unwrapped to the operator's text. The app draws a collapsed Agent report card and a one-line system notice on the agent's side.
This commit is contained in:
@@ -79,8 +79,11 @@ type chatMessage struct {
|
||||
role string
|
||||
client string
|
||||
operationID string
|
||||
order []string
|
||||
parts map[string]*chatPart
|
||||
// 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
|
||||
}
|
||||
|
||||
type chatTurn struct {
|
||||
@@ -232,6 +235,9 @@ func (h *chatHub) applyLocked(frame protocol.ChatEventFrame) {
|
||||
if message.operationID == "" && frame.Kind == protocol.ChatEventUser {
|
||||
message.operationID = frame.OperationID
|
||||
}
|
||||
if message.kind == "" && frame.MessageKind != "" && frame.Kind != protocol.ChatEventUser {
|
||||
message.kind = frame.MessageKind
|
||||
}
|
||||
switch frame.Kind {
|
||||
case protocol.ChatEventUser:
|
||||
if frame.Part == nil || frame.Part.ID == "" || frame.Part.Text == "" || turn.overflow {
|
||||
@@ -260,7 +266,7 @@ func (h *chatHub) applyLocked(frame protocol.ChatEventFrame) {
|
||||
}
|
||||
part, ok := message.parts[id]
|
||||
if !ok {
|
||||
part = &chatPart{part: protocol.ChatPart{Type: frame.Kind, ID: id}}
|
||||
part = &chatPart{part: protocol.ChatPart{Type: frame.Kind, ID: id, Name: frame.Part.Name}}
|
||||
message.order = append(message.order, id)
|
||||
message.parts[id] = part
|
||||
}
|
||||
@@ -553,6 +559,7 @@ func (h *chatHub) snapshot(sessionID string) []protocol.ChatMessage {
|
||||
}
|
||||
out.Client = message.client
|
||||
out.OperationID = message.operationID
|
||||
out.Kind = message.kind
|
||||
for _, partID := range message.order {
|
||||
if part, ok := message.parts[partID]; ok {
|
||||
piece := part.part
|
||||
|
||||
Reference in New Issue
Block a user