Documentation
¶
Index ¶
- type AlertUsecases
- type ApiUsecases
- type ChatNotifierdeprecated
- type ChatResponder
- type ChatSession
- type ChatSessionID
- type ChatSource
- type Clients
- type CommandExecutor
- type EmbeddingClient
- type LLMClient
- type LLMSession
- type Option
- type PolicyClient
- type Repository
- type SlackClient
- type SlackEventUsecases
- type SlackInteractionUsecases
- type SlackThreadService
- type StorageClient
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertUsecases ¶
type ApiUsecases ¶ added in v0.1.0
type ApiUsecases interface {
// User related handlers
GetUserIcon(ctx context.Context, userID string) ([]byte, string, error)
GetUserProfile(ctx context.Context, userID string) (string, error)
// Ticket related handlers
GenerateTicketAlertsJSONL(ctx context.Context, ticketID types.TicketID) ([]byte, error)
}
type ChatNotifier
deprecated
added in
v0.1.0
type ChatNotifier interface {
// NotifyMessage sends a message to a chat room/channel
NotifyMessage(ctx context.Context, ticketID types.TicketID, message string) error
// NotifyTrace sends a trace message (debug/info level) to a chat room/channel
NotifyTrace(ctx context.Context, ticketID types.TicketID, message string) error
}
Deprecated: ChatNotifier is no longer used in the new design Use ChatResponder for targeted responses to specific chat sessions ChatNotifier provides an abstraction for chat notification services
type ChatResponder ¶ added in v0.1.0
type ChatResponder interface {
// SendMessage sends a message to the specific chat session
SendMessage(ctx context.Context, message string) error
// SendTrace sends a trace message to the specific chat session
SendTrace(ctx context.Context, message string) error
// GetSession returns the chat session information
GetSession() *ChatSession
}
ChatResponder provides response capabilities for a specific chat session Deprecated: Use msg.With to setup context-based message routing instead
type ChatSession ¶ added in v0.1.0
type ChatSession struct {
ID ChatSessionID
Source ChatSource
TicketID types.TicketID
UserID string
// For WebSocket: specific connection ID
// For Slack: thread information
Metadata map[string]interface{}
}
ChatSession represents a specific chat session context Deprecated: Use msg.With to setup context-based message routing
type ChatSessionID ¶ added in v0.1.0
type ChatSessionID string
ChatSessionID represents a unique chat session identifier
type ChatSource ¶ added in v0.1.0
type ChatSource string
ChatSource represents the type of chat source
const ( ChatSourceSlack ChatSource = "slack" ChatSourceWebSocket ChatSource = "websocket" )
type Clients ¶
type Clients struct {
// contains filtered or unexported fields
}
func NewClients ¶
func (*Clients) Repository ¶
func (c *Clients) Repository() Repository
func (*Clients) Storage ¶
func (c *Clients) Storage() StorageClient
type CommandExecutor ¶ added in v0.1.0
type CommandExecutor interface {
Execute(ctx context.Context, slackMsg *slack.Message, thread slack.Thread, command string) error
}
CommandExecutor defines the interface for executing Slack commands
type EmbeddingClient ¶
type LLMSession ¶
type Option ¶
type Option func(*Clients)
func WithLLMClient ¶
func WithRepository ¶
func WithRepository(repo Repository) Option
func WithStorageClient ¶
func WithStorageClient(storage StorageClient) Option
type PolicyClient ¶
type Repository ¶
type Repository interface {
GetTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
BatchGetTickets(ctx context.Context, ticketIDs []types.TicketID) ([]*ticket.Ticket, error)
PutTicket(ctx context.Context, ticket ticket.Ticket) error
BatchUpdateTicketsStatus(ctx context.Context, ticketIDs []types.TicketID, status types.TicketStatus) error
GetTicketByThread(ctx context.Context, thread slack.Thread) (*ticket.Ticket, error)
FindNearestTickets(ctx context.Context, embedding []float32, limit int) ([]*ticket.Ticket, error)
FindNearestTicketsWithSpan(ctx context.Context, embedding []float32, begin, end time.Time, limit int) ([]*ticket.Ticket, error)
GetTicketsByStatus(ctx context.Context, statuses []types.TicketStatus, offset, limit int) ([]*ticket.Ticket, error)
CountTicketsByStatus(ctx context.Context, statuses []types.TicketStatus) (int, error)
GetTicketsBySpan(ctx context.Context, begin, end time.Time) ([]*ticket.Ticket, error)
GetTicketsByStatusAndSpan(ctx context.Context, status types.TicketStatus, begin, end time.Time) ([]*ticket.Ticket, error)
// For comment management
PutTicketComment(ctx context.Context, comment ticket.Comment) error
GetTicketComments(ctx context.Context, ticketID types.TicketID) ([]ticket.Comment, error)
GetTicketCommentsPaginated(ctx context.Context, ticketID types.TicketID, offset, limit int) ([]ticket.Comment, error)
CountTicketComments(ctx context.Context, ticketID types.TicketID) (int, error)
GetTicketUnpromptedComments(ctx context.Context, ticketID types.TicketID) ([]ticket.Comment, error)
PutTicketCommentsPrompted(ctx context.Context, ticketID types.TicketID, commentIDs []types.CommentID) error
BindAlertsToTicket(ctx context.Context, alertIDs []types.AlertID, ticketID types.TicketID) error
UnbindAlertFromTicket(ctx context.Context, alertID types.AlertID) error
PutAlert(ctx context.Context, alert alert.Alert) error
BatchPutAlerts(ctx context.Context, alerts alert.Alerts) error
GetAlert(ctx context.Context, alertID types.AlertID) (*alert.Alert, error)
GetLatestAlertByThread(ctx context.Context, thread slack.Thread) (*alert.Alert, error)
SearchAlerts(ctx context.Context, path, op string, value any, limit int) (alert.Alerts, error)
GetAlertWithoutTicket(ctx context.Context, offset, limit int) (alert.Alerts, error)
CountAlertsWithoutTicket(ctx context.Context) (int, error)
GetAlertsBySpan(ctx context.Context, begin, end time.Time) (alert.Alerts, error)
BatchGetAlerts(ctx context.Context, alertIDs []types.AlertID) (alert.Alerts, error)
FindNearestAlerts(ctx context.Context, embedding []float32, limit int) (alert.Alerts, error)
GetLatestHistory(ctx context.Context, ticketID types.TicketID) (*ticket.History, error)
PutHistory(ctx context.Context, ticketID types.TicketID, history *ticket.History) error
// For list management
GetAlertList(ctx context.Context, listID types.AlertListID) (*alert.List, error)
PutAlertList(ctx context.Context, list *alert.List) error
GetAlertListByThread(ctx context.Context, thread slack.Thread) (*alert.List, error)
GetLatestAlertListInThread(ctx context.Context, thread slack.Thread) (*alert.List, error)
GetAlertListsInThread(ctx context.Context, thread slack.Thread) ([]*alert.List, error)
GetAlertWithoutEmbedding(ctx context.Context) (alert.Alerts, error)
GetAlertsWithInvalidEmbedding(ctx context.Context) (alert.Alerts, error)
GetTicketsWithInvalidEmbedding(ctx context.Context) ([]*ticket.Ticket, error)
// For authentication management
PutToken(ctx context.Context, token *auth.Token) error
GetToken(ctx context.Context, tokenID auth.TokenID) (*auth.Token, error)
DeleteToken(ctx context.Context, tokenID auth.TokenID) error
// For activity management
PutActivity(ctx context.Context, activity *activity.Activity) error
GetActivities(ctx context.Context, offset, limit int) ([]*activity.Activity, error)
CountActivities(ctx context.Context) (int, error)
// For tag management (legacy - deprecated, kept for external compatibility)
RemoveTagFromAllAlerts(ctx context.Context, name string) error
RemoveTagFromAllTickets(ctx context.Context, name string) error
// For new tag management (ID-based)
GetTagByID(ctx context.Context, tagID string) (*tag.Tag, error)
GetTagsByIDs(ctx context.Context, tagIDs []string) ([]*tag.Tag, error)
ListAllTags(ctx context.Context) ([]*tag.Tag, error)
CreateTagWithID(ctx context.Context, tag *tag.Tag) error
UpdateTag(ctx context.Context, tag *tag.Tag) error
DeleteTagByID(ctx context.Context, tagID string) error
RemoveTagIDFromAllAlerts(ctx context.Context, tagID string) error
RemoveTagIDFromAllTickets(ctx context.Context, tagID string) error
// For tag name lookup (compatibility)
GetTagByName(ctx context.Context, name string) (*tag.Tag, error)
IsTagNameExists(ctx context.Context, name string) (bool, error)
GetOrCreateTagByName(ctx context.Context, name, description, color, createdBy string) (*tag.Tag, error)
}
type SlackClient ¶
type SlackClient interface {
PostMessageContext(ctx context.Context, channelID string, options ...slackSDK.MsgOption) (string, string, error)
UpdateMessageContext(ctx context.Context, channelID, timestamp string, options ...slackSDK.MsgOption) (string, string, string, error)
AuthTest() (*slackSDK.AuthTestResponse, error)
GetTeamInfo() (*slackSDK.TeamInfo, error)
OpenView(triggerID string, view slackSDK.ModalViewRequest) (*slackSDK.ViewResponse, error)
UpdateView(view slackSDK.ModalViewRequest, externalID, hash, viewID string) (*slackSDK.ViewResponse, error)
UploadFileV2Context(ctx context.Context, params slackSDK.UploadFileV2Parameters) (*slackSDK.FileSummary, error)
GetUserInfo(userID string) (*slackSDK.User, error)
GetUsersInfo(users ...string) (*[]slackSDK.User, error)
GetConversationInfo(input *slackSDK.GetConversationInfoInput) (*slackSDK.Channel, error)
GetUserGroups(options ...slackSDK.GetUserGroupsOption) ([]slackSDK.UserGroup, error)
GetBotInfoContext(ctx context.Context, parameters slackSDK.GetBotInfoParameters) (*slackSDK.Bot, error)
}
type SlackEventUsecases ¶
type SlackInteractionUsecases ¶
type SlackInteractionUsecases interface {
// Slack interaction handlers
HandleSlackInteractionViewSubmission(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error
HandleSlackInteractionBlockActions(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value, triggerID string) error
HandleSalvageRefresh(ctx context.Context, user slack.User, metadata string, values slack.StateValue, viewID string) error
}
type SlackThreadService ¶
type SlackThreadService interface {
// Thread information
ChannelID() string
ThreadID() string
Entity() *slack.Thread
// Posting operations
PostAlert(ctx context.Context, alert *alert.Alert) error
PostComment(ctx context.Context, comment string) error
PostCommentWithMessageID(ctx context.Context, comment string) (string, error)
PostTicket(ctx context.Context, ticket *ticket.Ticket, alerts alert.Alerts) (string, error)
PostLinkToTicket(ctx context.Context, ticketURL, ticketTitle string) error
PostFinding(ctx context.Context, finding *ticket.Finding) error
// Update operations
UpdateAlert(ctx context.Context, alert alert.Alert) error
UpdateAlertList(ctx context.Context, list *alert.List, status string) error
// List operations
PostAlerts(ctx context.Context, alerts alert.Alerts) error
PostAlertList(ctx context.Context, list *alert.List) (string, error)
PostAlertLists(ctx context.Context, clusters []*alert.List) error
PostTicketList(ctx context.Context, tickets []*ticket.Ticket) error
// Interactive operations
Reply(ctx context.Context, message string)
NewStateFunc(ctx context.Context, message string) func(ctx context.Context, msg string)
NewUpdatableMessage(ctx context.Context, initialMessage string) func(ctx context.Context, newMsg string)
NewTraceMessage(ctx context.Context, initialMessage string) func(ctx context.Context, traceMsg string)
// File operations
AttachFile(ctx context.Context, title, fileName string, data []byte) error
}