Documentation
¶
Overview ¶
Package events provides an event bus implementation for internal application events. It supports publishing events and subscribing to specific event types.
Package events provides an event bus implementation for internal application events. It defines event types and structures for communication between components.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus interface {
Publish(event Event)
Subscribe(eventType EventType, handler HandlerFunc)
}
Bus provides a simple publish/subscribe mechanism for internal events.
type EventType ¶
type EventType string
EventType identifies the type of an event.
const ( // ServerAdded is the event type for when a new server is added ServerAdded EventType = "server.added" // ServerRemoved is the event type for when a server is removed ServerRemoved EventType = "server.removed" // ToolsUpdated indicates tools for a specific server were updated ToolsUpdated EventType = "tools.updated" // ServerStatusChanged indicates the connection status of a server has changed ServerStatusChanged EventType = "server.status.changed" // ToolsProcessedInDB indicates that the backend service has finished processing tools from an update event. ToolsProcessedInDB EventType = "tools.processed.db" // LocalToolsRefreshed indicates the agent's own exposed toolset was potentially updated. LocalToolsRefreshed EventType = "local.tools.refreshed" // ServerDataUpdated signals that backend data relevant to the UI has changed. ServerDataUpdated EventType = "server.data.updated" )
type HandlerFunc ¶
type HandlerFunc func(event Event)
HandlerFunc defines the function signature for event handlers.
type LocalToolsRefreshedEvent ¶
type LocalToolsRefreshedEvent struct {
// contains filtered or unexported fields
}
LocalToolsRefreshedEvent is published by the ConnectionManager after refreshMCPServerTools completes. It signals that the list of tools exposed by this agent's MCP server may have changed.
func NewLocalToolsRefreshedEvent ¶
func NewLocalToolsRefreshedEvent() *LocalToolsRefreshedEvent
NewLocalToolsRefreshedEvent creates a new LocalToolsRefreshedEvent.
type ServerAddedEvent ¶
ServerAddedEvent is published when a new MCP server is added.
func NewServerAddedEvent ¶
func NewServerAddedEvent(server models.MCPServer) *ServerAddedEvent
NewServerAddedEvent creates a new event for when a server is added
type ServerDataUpdatedEvent ¶
type ServerDataUpdatedEvent struct {
// contains filtered or unexported fields
}
ServerDataUpdatedEvent is published by the BackendService after any operation that changes data relevant to the UI (add, remove, status update, etc.).
func NewServerDataUpdatedEvent ¶
func NewServerDataUpdatedEvent() *ServerDataUpdatedEvent
NewServerDataUpdatedEvent creates a new ServerDataUpdatedEvent.
type ServerRemovedEvent ¶
type ServerRemovedEvent struct {
ServerID int64
ServerURL string // Include URL for potential listeners that don't have the ID cached
// contains filtered or unexported fields
}
ServerRemovedEvent is published when an MCP server is removed.
func NewServerRemovedEvent ¶
func NewServerRemovedEvent(serverID int64, serverURL string) *ServerRemovedEvent
NewServerRemovedEvent creates a new event for when a server is removed
type ServerStatusChangedEvent ¶
type ServerStatusChangedEvent struct {
ServerID int64
ServerURL string
NewState models.ConnectionState
LastError *string
// contains filtered or unexported fields
}
ServerStatusChangedEvent is published when an MCP server's connection status changes. This is typically triggered by the ConnectionManager detecting a change and updating the backend.
func NewServerStatusChangedEvent ¶
func NewServerStatusChangedEvent(serverID int64, serverURL string, newState models.ConnectionState, lastError *string) *ServerStatusChangedEvent
NewServerStatusChangedEvent creates a new event for server status changes.
type ToolsProcessedInDBEvent ¶
type ToolsProcessedInDBEvent struct {
ServerID int64
ServerURL string // Include URL as ID might not be known to all potential future listeners
// contains filtered or unexported fields
}
ToolsProcessedInDBEvent is published by the BackendService after it finishes processing tools from a ToolsUpdatedEvent. This signals the ConnectionManager that it's safe to update the internal MCP server's tool list.
func NewToolsProcessedInDBEvent ¶
func NewToolsProcessedInDBEvent(serverID int64, serverURL string) *ToolsProcessedInDBEvent
NewToolsProcessedInDBEvent creates a new ToolsProcessedInDBEvent.
type ToolsUpdatedEvent ¶
type ToolsUpdatedEvent struct {
ServerID int64
ServerURL string
FetchedCount int
Tools []models.Tool
// contains filtered or unexported fields
}
ToolsUpdatedEvent is published when the updater successfully fetches and processes tools for a server.
func NewToolsUpdatedEvent ¶
func NewToolsUpdatedEvent(serverID int64, serverURL string, tools []models.Tool) *ToolsUpdatedEvent
NewToolsUpdatedEvent creates a new event for when tools are updated for a server