Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildNotification ¶
BuildNotification creates a lightweight JSON notification from a message.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler upgrades HTTP connections to WebSocket for local-mode agents.
func NewHandler ¶
func NewHandler(hub *Hub, store HandlerStore) *Handler
type HandlerStore ¶
type HandlerStore interface {
GetUserByAPIKey(ctx context.Context, apiKey string) (*identity.User, error)
GetAgentByEmail(ctx context.Context, email string) (*identity.AgentIdentity, error)
GetMessagesByAgent(ctx context.Context, agentID, status string, limit int, afterTime time.Time, afterID string) ([]identity.Message, error)
}
HandlerStore is the subset of identity.Store that the WS handler needs.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages WebSocket connections for local-mode agents. One connection per agent; new connections replace old ones.
func (*Hub) IsConnected ¶
IsConnected returns whether an agent has an active WebSocket connection.
func (*Hub) Register ¶
Register stores a connection for the given agent, returning any previous connection. The caller should close the old connection if non-nil.
type Notification ¶
type Notification struct {
MessageID string `json:"message_id"`
ConversationID string `json:"conversation_id,omitempty"`
From string `json:"from"`
To string `json:"to"`
Subject string `json:"subject"`
ReceivedAt time.Time `json:"received_at"`
}
Notification is the lightweight JSON payload sent over WebSocket when a new message arrives. It contains only metadata — full content is fetched via REST.