Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
Index ¶
- type Hub
- func (h *Hub) BroadcastMessage(channelID int64, channelName string, channelType string, msg domain.Message, ...)
- func (h *Hub) BroadcastPresence(username string, online bool, state string)
- func (h *Hub) BroadcastToRole(role string, data []byte, store domain.Store)
- func (h *Hub) ClearState(username string)
- func (h *Hub) ClientCount() int
- func (h *Hub) GetState(username string) string
- func (h *Hub) Register(client *WSClient)
- func (h *Hub) SetState(username, state string)
- func (h *Hub) Unregister(client *WSClient)
- type PresenceHandler
- type PresenceNotifier
- type RESTHandler
- type Server
- type SharkfinMCP
- type WSClient
- type WSHandler
- type WebhookEvent
- type WebhookPayload
- type WebhookSubscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages connected WebSocket clients and broadcasts events.
func (*Hub) BroadcastMessage ¶
func (h *Hub) BroadcastMessage(channelID int64, channelName string, channelType string, msg domain.Message, mentions []string, threadID *int64, store domain.Store)
BroadcastMessage sends a message.new event to all connected members of a channel.
func (*Hub) BroadcastPresence ¶
BroadcastPresence sends a presence event to all connected clients.
func (*Hub) BroadcastToRole ¶ added in v0.1.0
BroadcastToRole sends a pre-encoded event to all connected clients whose identity has the given role.
func (*Hub) ClearState ¶ added in v0.1.0
ClearState removes the state entry for a user.
func (*Hub) ClientCount ¶
ClientCount returns the number of connected clients.
func (*Hub) Unregister ¶
Unregister removes a client from the hub.
type PresenceHandler ¶
type PresenceHandler struct {
// contains filtered or unexported fields
}
func NewPresenceHandler ¶
func NewPresenceHandler(pongTimeout time.Duration) *PresenceHandler
func (*PresenceHandler) IsOnline ¶ added in v0.6.0
func (h *PresenceHandler) IsOnline(username string) bool
func (*PresenceHandler) SendNotification ¶ added in v0.6.0
func (h *PresenceHandler) SendNotification(username string, data []byte) error
func (*PresenceHandler) ServeHTTP ¶
func (h *PresenceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type PresenceNotifier ¶ added in v0.4.0
type PresenceNotifier struct {
// contains filtered or unexported fields
}
func NewPresenceNotifier ¶ added in v0.4.0
func NewPresenceNotifier(bus domain.EventBus, presence *PresenceHandler, store domain.Store) *PresenceNotifier
func (*PresenceNotifier) Close ¶ added in v0.4.0
func (pn *PresenceNotifier) Close()
type RESTHandler ¶ added in v0.7.0
type RESTHandler struct {
// contains filtered or unexported fields
}
RESTHandler holds all REST endpoint handlers.
func NewRESTHandler ¶ added in v0.7.0
type SharkfinMCP ¶
type SharkfinMCP struct {
// contains filtered or unexported fields
}
SharkfinMCP wraps an mcp-go MCPServer with Sharkfin's business logic.
func NewSharkfinMCP ¶
func NewSharkfinMCP(store domain.Store, hub *Hub, presence *PresenceHandler, version string) *SharkfinMCP
NewSharkfinMCP creates the MCP server and registers all tools.
func (*SharkfinMCP) Server ¶
func (s *SharkfinMCP) Server() *server.MCPServer
Server returns the underlying mcp-go MCPServer.
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
WSClient represents a connected WebSocket client.
type WSHandler ¶
type WSHandler struct {
// contains filtered or unexported fields
}
WSHandler handles WebSocket connections for non-MCP clients.
func NewWSHandler ¶
func NewWSHandler(store domain.Store, hub *Hub, presence *PresenceHandler, pongTimeout time.Duration, version string) *WSHandler
NewWSHandler creates a new WebSocket handler.
type WebhookEvent ¶
type WebhookEvent struct {
ChannelID int64
ChannelName string
ChannelType string
From string
FromType string // identity type of sender
Body string
Metadata *string
MessageID int64
SentAt time.Time
Recipients []string // for legacy global webhook
}
WebhookEvent contains the data needed to fire webhooks for a message.
type WebhookPayload ¶
type WebhookPayload struct {
Event string `json:"event"`
ChannelID int64 `json:"channel_id"`
ChannelName string `json:"channel_name"`
ChannelType string `json:"channel_type"`
From string `json:"from"`
FromType string `json:"from_type"`
MessageID int64 `json:"message_id"`
Body string `json:"body"`
Metadata *string `json:"metadata"`
SentAt string `json:"sent_at"`
// Legacy fields — kept for global webhook_url backwards compatibility.
Recipient string `json:"recipient,omitempty"`
Channel string `json:"channel,omitempty"`
}
WebhookPayload is the JSON body POSTed to the webhook URL.
type WebhookSubscriber ¶ added in v0.4.0
type WebhookSubscriber struct {
// contains filtered or unexported fields
}
WebhookSubscriber listens for message events and fires webhooks.
func NewWebhookSubscriber ¶ added in v0.4.0
func NewWebhookSubscriber(bus domain.EventBus, store domain.Store) *WebhookSubscriber
NewWebhookSubscriber creates a subscriber that fires webhooks on new messages.
func (*WebhookSubscriber) Close ¶ added in v0.4.0
func (ws *WebhookSubscriber) Close()
Close stops the webhook subscriber.