chore(server): report background prompt failures via events
Christian Rocha
and
Charm Crush
created
Add a prompt failure event that can be delivered after the HTTP request
has already returned. Remote clients and subscribers now receive the
same failure message through the event stream.
Co-Authored-By: Charm Crush <crush@charm.land>
@@ -12,6 +12,9 @@ const (
// TypeReAuthenticate indicates the agent encountered an
// authentication error and the user needs to re-authenticate.
TypeReAuthenticate Type = "re_authenticate"
+ // TypeAgentError indicates the agent's turn terminated with an
+ // error. The error text is carried in Notification.Message.
+ TypeAgentError Type = "error"
)
// Notification represents a domain event published by the agent.
@@ -20,6 +23,9 @@ type Notification struct {
SessionTitle string
Type Type
ProviderID string
+ // Message carries the error text for TypeAgentError. Other
+ // notification types ignore it.
+ Message string
}
// RunComplete is the authoritative end-of-run signal for a session.