@@ -2,6 +2,7 @@ package server
4 "encoding/json"
4 "encoding/json"
@@ -85,13 +86,18 @@ func wrapEvent(ev any) *pubsub.Payload {
85 Payload: fileToProto(e.Payload),
86 Payload: fileToProto(e.Payload),
87 case pubsub.Event[notify.Notification]:
88 case pubsub.Event[notify.Notification]:
89+ payload := proto.AgentEvent{
90+ SessionID: e.Payload.SessionID,
91+ SessionTitle: e.Payload.SessionTitle,
92+ Type: proto.AgentEventType(e.Payload.Type),
94+ if e.Payload.Type == notify.TypeAgentError {
95+ payload.Type = proto.AgentEventTypeError
96+ payload.Error = errors.New(e.Payload.Message)
88 return envelope(pubsub.PayloadTypeAgentEvent, pubsub.Event[proto.AgentEvent]{
98 return envelope(pubsub.PayloadTypeAgentEvent, pubsub.Event[proto.AgentEvent]{
89− Type: e.Type,
99+ Type: e.Type,
90− Payload: proto.AgentEvent{
100+ Payload: payload,
91− SessionID: e.Payload.SessionID,
92− SessionTitle: e.Payload.SessionTitle,
93− Type: proto.AgentEventType(e.Payload.Type),
96 case pubsub.Event[notify.RunComplete]:
102 case pubsub.Event[notify.RunComplete]:
97 return envelope(pubsub.PayloadTypeRunComplete, pubsub.Event[proto.RunComplete]{
103 return envelope(pubsub.PayloadTypeRunComplete, pubsub.Event[proto.RunComplete]{