Documentation
¶
Index ¶
- Variables
- type AlertMock
- type AlertPipelineResult
- type AuthUseCase
- func (uc *AuthUseCase) GetAuthURL(state string) string
- func (uc *AuthUseCase) HandleCallback(ctx context.Context, code string) (*auth.Token, error)
- func (uc *AuthUseCase) IsNoAuthn() bool
- func (uc *AuthUseCase) Logout(ctx context.Context, tokenID auth.TokenID) error
- func (uc *AuthUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
- type AuthUseCaseInterface
- type ChatTurnEvent
- type DiagnosisUsecases
- type NoAuthnUseCase
- func (uc *NoAuthnUseCase) GetAuthURL(state string) string
- func (uc *NoAuthnUseCase) HandleCallback(ctx context.Context, code string) (*auth.Token, error)
- func (uc *NoAuthnUseCase) IsNoAuthn() bool
- func (uc *NoAuthnUseCase) Logout(ctx context.Context, tokenID auth.TokenID) error
- func (uc *NoAuthnUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
- type OpenIDConfiguration
- type Option
- func WithActionLimit(actionLimit int) Option
- func WithChatUseCase(chatUseCase interfaces.ChatUseCase) Option
- func WithCircuitBreaker(service *cbService.Service) Option
- func WithEmbeddingClient(embeddingClient interfaces.EmbeddingClient) Option
- func WithFindingLimit(findingLimit int) Option
- func WithFrontendURL(frontendURL string) Option
- func WithKnowledgeService(svc *svcknowledge.Service) Option
- func WithLLMClient(llmClient gollem.LLMClient) Option
- func WithNoAuthorization(noAuthorization bool) Option
- func WithPolicyClient(policyClient interfaces.PolicyClient) Option
- func WithPromptService(promptService interfaces.PromptService) Option
- func WithRepository(repository interfaces.Repository) Option
- func WithSlackService(slackService *slackService.Service) Option
- func WithStorageClient(storageClient interfaces.StorageClient) Option
- func WithStoragePrefix(storagePrefix string) Option
- func WithStrictAlert(strict bool) Option
- func WithTagService(tagService *tag.Service) Option
- func WithTimeSpan(timeSpan time.Duration) Option
- func WithTools(tools []interfaces.ToolSet) Option
- func WithTraceRepository(repo trace.Repository) Option
- func WithUserSystemPrompt(prompt string) Option
- type SlackEventMock
- func (mock *SlackEventMock) HandleSlackAppMention(ctx context.Context, slackMsg slack.Message) error
- func (mock *SlackEventMock) HandleSlackAppMentionCalls() []struct{ ... }
- func (mock *SlackEventMock) HandleSlackMessage(ctx context.Context, slackMsg slack.Message) error
- func (mock *SlackEventMock) HandleSlackMessageCalls() []struct{ ... }
- type SlackIDToken
- type SlackInteractionMock
- func (mock *SlackInteractionMock) HandleSlackInteractionBlockActions(ctx context.Context, user slack.User, slackThread slack.Thread, ...) error
- func (mock *SlackInteractionMock) HandleSlackInteractionBlockActionsCalls() []struct{ ... }
- func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmission(ctx context.Context, user slack.User, callbackID slack.CallbackID, ...) error
- func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmissionCalls() []struct{ ... }
- type SlackTokenResponse
- type TagUseCase
- func (u *TagUseCase) CreateTag(ctx context.Context, name string) (*tagmodel.Tag, error)
- func (u *TagUseCase) DeleteTag(ctx context.Context, name string) error
- func (u *TagUseCase) DeleteTagByID(ctx context.Context, tagID string) error
- func (u *TagUseCase) GetAvailableColorNames() ([]string, error)
- func (u *TagUseCase) GetAvailableColors() ([]string, error)
- func (u *TagUseCase) ListTags(ctx context.Context) ([]*tagmodel.Tag, error)
- func (u *TagUseCase) UpdateAlertTags(ctx context.Context, alertID types.AlertID, tags []string) (*alert.Alert, error)
- func (u *TagUseCase) UpdateAlertTagsByID(ctx context.Context, alertID types.AlertID, tagIDs []string) (*alert.Alert, error)
- func (u *TagUseCase) UpdateTag(ctx context.Context, tagID string, name, color, description string) (*tagmodel.Tag, error)
- func (u *TagUseCase) UpdateTicketTags(ctx context.Context, ticketID types.TicketID, tags []string) (*ticket.Ticket, error)
- func (u *TagUseCase) UpdateTicketTagsByID(ctx context.Context, ticketID types.TicketID, tagIDs []string) (*ticket.Ticket, error)
- type TicketCreationOptions
- type TicketUpdateFunction
- type UseCases
- func (uc *UseCases) ArchiveAllResolvedTickets(ctx context.Context) (int, error)
- func (uc *UseCases) ArchiveTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
- func (uc *UseCases) ArchiveTickets(ctx context.Context, ticketIDs []types.TicketID) ([]*ticket.Ticket, error)
- func (u *UseCases) BatchCountDiagnosisIssues(ctx context.Context, ids []types.DiagnosisID) (map[types.DiagnosisID]diagnosismodel.IssueCounts, error)
- func (uc *UseCases) BindAlertsToTicket(ctx context.Context, ticketID types.TicketID, alertIDs []types.AlertID) error
- func (x *UseCases) ChatFromCLI(ctx context.Context, t *ticket.Ticket, message string, sess *sessModel.Session) error
- func (x *UseCases) ChatFromSlack(ctx context.Context, slackMsg *slack.Message, mentionMessage string) error
- func (x *UseCases) ChatFromWebSocket(ctx context.Context, ticketID types.TicketID, message string, ...) error
- func (u *UseCases) CountDiagnosisIssues(ctx context.Context, id types.DiagnosisID) (diagnosismodel.IssueCounts, error)
- func (uc *UseCases) CreateManualTicket(ctx context.Context, title, description string, user *slack.User) (*ticket.Ticket, error)
- func (uc *UseCases) CreateManualTicketWithTest(ctx context.Context, title, description string, user *slack.User, isTest bool) (*ticket.Ticket, error)
- func (uc *UseCases) CreateTicketFromAlerts(ctx context.Context, alertIDs []types.AlertID, user *slack.User, ...) (*ticket.Ticket, error)
- func (uc *UseCases) CreateTicketFromConversation(ctx context.Context, thread slack.Thread, user *slack.User, userContext string) (*ticket.Ticket, error)
- func (uc *UseCases) DeclineAlerts(ctx context.Context, alertIDs []types.AlertID) ([]*alert.Alert, error)
- func (uc *UseCases) DiscardQueuedAlerts(ctx context.Context, ids []types.QueuedAlertID) error
- func (uc *UseCases) DiscardQueuedAlertsByFilter(ctx context.Context, keyword *string) (int, error)
- func (x *UseCases) EnsureCLISession(ctx context.Context, ticketID types.TicketID, userID types.UserID) (*sessModel.Session, error)
- func (x *UseCases) EnsureWebSession(ctx context.Context, ticketID types.TicketID, userID types.UserID) (*sessModel.Session, error)
- func (uc *UseCases) EscalateNotice(ctx context.Context, noticeID types.NoticeID) (*alert.Alert, error)
- func (u *UseCases) FixDiagnosis(ctx context.Context, id types.DiagnosisID) (*diagnosismodel.Diagnosis, error)
- func (u *UseCases) GenerateTicketAlertsJSONL(ctx context.Context, ticketID types.TicketID) ([]byte, error)
- func (u *UseCases) GetDiagnoses(ctx context.Context, offset, limit int) ([]*diagnosismodel.Diagnosis, int, error)
- func (u *UseCases) GetDiagnosis(ctx context.Context, id types.DiagnosisID) (*diagnosismodel.Diagnosis, error)
- func (u *UseCases) GetDiagnosisIssues(ctx context.Context, id types.DiagnosisID, offset, limit int, ...) ([]*diagnosismodel.Issue, int, error)
- func (uc *UseCases) GetSimilarTicketsForAlert(ctx context.Context, alertID types.AlertID, threshold float64, ...) ([]*ticket.Ticket, int, error)
- func (u *UseCases) GetTagService() *tag.Service
- func (uc *UseCases) GetUnboundAlertsFiltered(ctx context.Context, threshold *float64, keyword *string, ...) ([]*alert.Alert, int, error)
- func (u *UseCases) GetUserIcon(ctx context.Context, userID string) ([]byte, string, error)
- func (u *UseCases) GetUserProfile(ctx context.Context, userID string) (string, error)
- func (uc *UseCases) HandleAlert(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error)
- func (uc *UseCases) HandleHITLAction(ctx context.Context, slackUser slack.User, requestID types.HITLRequestID, ...) error
- func (uc *UseCases) HandleSalvageRefresh(ctx context.Context, user slack.User, metadata string, values slack.StateValue, ...) error
- func (uc *UseCases) HandleSlackAppMention(ctx context.Context, slackMsg slack.Message) error
- func (uc *UseCases) HandleSlackInteractionBlockActions(ctx context.Context, slackUser slack.User, slackThread slack.Thread, ...) error
- func (uc *UseCases) HandleSlackInteractionViewSubmission(ctx context.Context, slackUser slack.User, callbackID slack.CallbackID, ...) error
- func (uc *UseCases) HandleSlackMessage(ctx context.Context, slackMsg slack.Message) error
- func (u *UseCases) IsSlackEnabled() bool
- func (uc *UseCases) ProcessAlertPipeline(ctx context.Context, schema types.AlertSchema, alertData any, ...) ([]*AlertPipelineResult, error)
- func (uc *UseCases) Refine(ctx context.Context) error
- func (uc *UseCases) ReopenTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
- func (uc *UseCases) ReprocessQueuedAlert(ctx context.Context, queuedAlertID types.QueuedAlertID) (*alert.ReprocessJob, error)
- func (uc *UseCases) ReprocessQueuedAlertsByFilter(ctx context.Context, keyword *string) (*alert.ReprocessBatchJob, error)
- func (uc *UseCases) ResolveTicket(ctx context.Context, ticketID types.TicketID, conclusion types.AlertConclusion, ...) (*ticket.Ticket, error)
- func (u *UseCases) RunDiagnosis(ctx context.Context) (*diagnosismodel.Diagnosis, error)
- func (uc *UseCases) UnarchiveTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
- func (uc *UseCases) UpdateTicket(ctx context.Context, ticketID types.TicketID, title, description string, ...) (*ticket.Ticket, error)
- func (uc *UseCases) UpdateTicketConclusion(ctx context.Context, ticketID types.TicketID, conclusion types.AlertConclusion, ...) (*ticket.Ticket, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrSlackServiceNotConfigured = goerr.New("slack service not configured")
)
Functions ¶
This section is empty.
Types ¶
type AlertMock ¶
type AlertMock struct {
// HandleAlertWithAuthFunc mocks the HandleAlertWithAuth method.
HandleAlertWithAuthFunc func(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error)
// contains filtered or unexported fields
}
AlertMock is a mock implementation of Alert.
func TestSomethingThatUsesAlert(t *testing.T) {
// make and configure a mocked Alert
mockedAlert := &AlertMock{
HandleAlertWithAuthFunc: func(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error) {
panic("mock out the HandleAlertWithAuth method")
},
}
// use mockedAlert in code that requires Alert
// and then make assertions.
}
func (*AlertMock) HandleAlertWithAuth ¶
func (mock *AlertMock) HandleAlertWithAuth(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error)
HandleAlertWithAuth calls HandleAlertWithAuthFunc.
func (*AlertMock) HandleAlertWithAuthCalls ¶
func (mock *AlertMock) HandleAlertWithAuthCalls() []struct { Ctx context.Context Schema types.AlertSchema AlertData any }
HandleAlertWithAuthCalls gets all the calls that were made to HandleAlertWithAuth. Check the length with:
len(mockedAlert.HandleAlertWithAuthCalls())
type AlertPipelineResult ¶ added in v0.5.0
type AlertPipelineResult struct {
Alert *alert.Alert
EnrichResult policy.EnrichResults
TriageResult *policy.TriagePolicyResult
}
AlertPipelineResult represents the result of processing a single alert through the pipeline
type AuthUseCase ¶
type AuthUseCase struct {
// contains filtered or unexported fields
}
func NewAuthUseCase ¶
func NewAuthUseCase(repo interfaces.Repository, slackSvc *slack.Service, clientID, clientSecret, callbackURL string) *AuthUseCase
func (*AuthUseCase) GetAuthURL ¶
func (uc *AuthUseCase) GetAuthURL(state string) string
GetAuthURL returns the URL for Slack OAuth
func (*AuthUseCase) HandleCallback ¶
HandleCallback processes the OAuth callback
func (*AuthUseCase) IsNoAuthn ¶ added in v0.1.0
func (uc *AuthUseCase) IsNoAuthn() bool
IsNoAuthn returns false for regular AuthUseCase
func (*AuthUseCase) ValidateToken ¶
func (uc *AuthUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
ValidateToken validates the token and returns user info
type AuthUseCaseInterface ¶
type AuthUseCaseInterface interface {
GetAuthURL(state string) string
HandleCallback(ctx context.Context, code string) (*auth.Token, error)
ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
Logout(ctx context.Context, tokenID auth.TokenID) error
IsNoAuthn() bool // Added to identify NoAuthnUseCase
}
AuthUseCaseInterface defines the interface for authentication use cases
type ChatTurnEvent ¶ added in v0.16.0
type ChatTurnEvent struct {
Kind string
Turn *sessModel.Turn
Message *sessModel.Message
HITLRequest *hitlModel.Request
// HITLMessageID binds a HITL prompt to the progress message that
// hosts it, so the frontend can render approval UI in-place rather
// than as a floating banner.
HITLMessageID string
}
ChatTurnEvent describes a lifecycle event produced by a Web chat invocation so the WebSocket handler can publish envelope-format updates to the bound client. Emitted for "turn_started", "session_message_added", "session_message_updated", "turn_ended", "hitl_request_pending", and "hitl_request_resolved"; the payload field set depends on the event kind.
type DiagnosisUsecases ¶ added in v0.13.0
type DiagnosisUsecases interface {
RunDiagnosis(ctx context.Context) (*diagnosismodel.Diagnosis, error)
FixDiagnosis(ctx context.Context, id types.DiagnosisID) (*diagnosismodel.Diagnosis, error)
GetDiagnoses(ctx context.Context, offset, limit int) ([]*diagnosismodel.Diagnosis, int, error)
GetDiagnosis(ctx context.Context, id types.DiagnosisID) (*diagnosismodel.Diagnosis, error)
GetDiagnosisIssues(ctx context.Context, id types.DiagnosisID, offset, limit int, status *diagnosismodel.IssueStatus, ruleID *diagnosismodel.RuleID) ([]*diagnosismodel.Issue, int, error)
CountDiagnosisIssues(ctx context.Context, id types.DiagnosisID) (diagnosismodel.IssueCounts, error)
BatchCountDiagnosisIssues(ctx context.Context, ids []types.DiagnosisID) (map[types.DiagnosisID]diagnosismodel.IssueCounts, error)
}
DiagnosisUsecases defines the interface for diagnosis-related use cases used by the API layer.
type NoAuthnUseCase ¶ added in v0.1.0
type NoAuthnUseCase struct {
// contains filtered or unexported fields
}
NoAuthnUseCase provides a mock authentication that always returns an anonymous user
func NewNoAuthnUseCase ¶ added in v0.1.0
func NewNoAuthnUseCase(repo interfaces.Repository) *NoAuthnUseCase
NewNoAuthnUseCase creates a new NoAuthnUseCase instance
func (*NoAuthnUseCase) GetAuthURL ¶ added in v0.1.0
func (uc *NoAuthnUseCase) GetAuthURL(state string) string
GetAuthURL returns a dummy URL (should not be called in no-auth mode)
func (*NoAuthnUseCase) HandleCallback ¶ added in v0.1.0
HandleCallback handles OAuth callback (should not be called in no-auth mode)
func (*NoAuthnUseCase) IsNoAuthn ¶ added in v0.1.0
func (uc *NoAuthnUseCase) IsNoAuthn() bool
IsNoAuthn returns true for NoAuthnUseCase
func (*NoAuthnUseCase) ValidateToken ¶ added in v0.1.0
func (uc *NoAuthnUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
ValidateToken always returns an anonymous user token
type OpenIDConfiguration ¶
type OpenIDConfiguration struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint"`
JWKSURI string `json:"jwks_uri"`
ScopesSupported []string `json:"scopes_supported"`
ResponseTypesSupported []string `json:"response_types_supported"`
ResponseModesSupported []string `json:"response_modes_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
ClaimsSupported []string `json:"claims_supported"`
ClaimsParameterSupported bool `json:"claims_parameter_supported"`
RequestParameterSupported bool `json:"request_parameter_supported"`
RequestURIParameterSupported bool `json:"request_uri_parameter_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
}
OpenIDConfiguration represents Slack's OpenID Connect configuration
type Option ¶
type Option func(*UseCases)
func WithActionLimit ¶
func WithChatUseCase ¶ added in v0.12.0
func WithChatUseCase(chatUseCase interfaces.ChatUseCase) Option
WithChatUseCase sets a custom ChatUseCase implementation, overriding the default PlanExecChat.
func WithCircuitBreaker ¶ added in v0.14.0
func WithEmbeddingClient ¶
func WithEmbeddingClient(embeddingClient interfaces.EmbeddingClient) Option
func WithFindingLimit ¶
func WithFrontendURL ¶ added in v0.8.0
func WithKnowledgeService ¶ added in v0.14.0
func WithKnowledgeService(svc *svcknowledge.Service) Option
func WithLLMClient ¶
func WithNoAuthorization ¶ added in v0.7.0
func WithPolicyClient ¶
func WithPolicyClient(policyClient interfaces.PolicyClient) Option
func WithPromptService ¶ added in v0.4.0
func WithPromptService(promptService interfaces.PromptService) Option
func WithRepository ¶
func WithRepository(repository interfaces.Repository) Option
func WithSlackService ¶
func WithSlackService(slackService *slackService.Service) Option
func WithStorageClient ¶
func WithStorageClient(storageClient interfaces.StorageClient) Option
func WithStoragePrefix ¶
func WithStrictAlert ¶ added in v0.1.0
func WithTagService ¶ added in v0.2.0
func WithTimeSpan ¶
WithTimeSpan is used to set the time span for fetching alerts to search similar alerts
func WithTools ¶
func WithTools(tools []interfaces.ToolSet) Option
func WithTraceRepository ¶ added in v0.9.0
func WithTraceRepository(repo trace.Repository) Option
func WithUserSystemPrompt ¶ added in v0.12.0
type SlackEventMock ¶
type SlackEventMock struct {
// HandleSlackAppMentionFunc mocks the HandleSlackAppMention method.
HandleSlackAppMentionFunc func(ctx context.Context, slackMsg slack.Message) error
// HandleSlackMessageFunc mocks the HandleSlackMessage method.
HandleSlackMessageFunc func(ctx context.Context, slackMsg slack.Message) error
// contains filtered or unexported fields
}
SlackEventMock is a mock implementation of SlackEvent.
func TestSomethingThatUsesSlackEvent(t *testing.T) {
// make and configure a mocked SlackEvent
mockedSlackEvent := &SlackEventMock{
HandleSlackAppMentionFunc: func(ctx context.Context, slackMsg slack.Message) error {
panic("mock out the HandleSlackAppMention method")
},
HandleSlackMessageFunc: func(ctx context.Context, slackMsg slack.Message) error {
panic("mock out the HandleSlackMessage method")
},
}
// use mockedSlackEvent in code that requires SlackEvent
// and then make assertions.
}
func (*SlackEventMock) HandleSlackAppMention ¶
func (mock *SlackEventMock) HandleSlackAppMention(ctx context.Context, slackMsg slack.Message) error
HandleSlackAppMention calls HandleSlackAppMentionFunc.
func (*SlackEventMock) HandleSlackAppMentionCalls ¶
func (mock *SlackEventMock) HandleSlackAppMentionCalls() []struct { Ctx context.Context SlackMsg slack.Message }
HandleSlackAppMentionCalls gets all the calls that were made to HandleSlackAppMention. Check the length with:
len(mockedSlackEvent.HandleSlackAppMentionCalls())
func (*SlackEventMock) HandleSlackMessage ¶
HandleSlackMessage calls HandleSlackMessageFunc.
func (*SlackEventMock) HandleSlackMessageCalls ¶
func (mock *SlackEventMock) HandleSlackMessageCalls() []struct { Ctx context.Context SlackMsg slack.Message }
HandleSlackMessageCalls gets all the calls that were made to HandleSlackMessage. Check the length with:
len(mockedSlackEvent.HandleSlackMessageCalls())
type SlackIDToken ¶
type SlackIDToken struct {
Sub string `json:"sub"`
Email string `json:"email"`
Name string `json:"name"`
}
SlackIDToken represents the decoded ID token from Slack
type SlackInteractionMock ¶
type SlackInteractionMock struct {
// HandleSlackInteractionBlockActionsFunc mocks the HandleSlackInteractionBlockActions method.
HandleSlackInteractionBlockActionsFunc func(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value string, triggerID string) error
// HandleSlackInteractionViewSubmissionFunc mocks the HandleSlackInteractionViewSubmission method.
HandleSlackInteractionViewSubmissionFunc func(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error
// contains filtered or unexported fields
}
SlackInteractionMock is a mock implementation of SlackInteraction.
func TestSomethingThatUsesSlackInteraction(t *testing.T) {
// make and configure a mocked SlackInteraction
mockedSlackInteraction := &SlackInteractionMock{
HandleSlackInteractionBlockActionsFunc: func(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value string, triggerID string) error {
panic("mock out the HandleSlackInteractionBlockActions method")
},
HandleSlackInteractionViewSubmissionFunc: func(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error {
panic("mock out the HandleSlackInteractionViewSubmission method")
},
}
// use mockedSlackInteraction in code that requires SlackInteraction
// and then make assertions.
}
func (*SlackInteractionMock) HandleSlackInteractionBlockActions ¶
func (mock *SlackInteractionMock) HandleSlackInteractionBlockActions(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value string, triggerID string) error
HandleSlackInteractionBlockActions calls HandleSlackInteractionBlockActionsFunc.
func (*SlackInteractionMock) HandleSlackInteractionBlockActionsCalls ¶
func (mock *SlackInteractionMock) HandleSlackInteractionBlockActionsCalls() []struct { Ctx context.Context User slack.User SlackThread slack.Thread ActionID slack.ActionID Value string TriggerID string }
HandleSlackInteractionBlockActionsCalls gets all the calls that were made to HandleSlackInteractionBlockActions. Check the length with:
len(mockedSlackInteraction.HandleSlackInteractionBlockActionsCalls())
func (*SlackInteractionMock) HandleSlackInteractionViewSubmission ¶
func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmission(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error
HandleSlackInteractionViewSubmission calls HandleSlackInteractionViewSubmissionFunc.
func (*SlackInteractionMock) HandleSlackInteractionViewSubmissionCalls ¶
func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmissionCalls() []struct { Ctx context.Context User slack.User CallbackID slack.CallbackID Metadata string Values slack.StateValue }
HandleSlackInteractionViewSubmissionCalls gets all the calls that were made to HandleSlackInteractionViewSubmission. Check the length with:
len(mockedSlackInteraction.HandleSlackInteractionViewSubmissionCalls())
type SlackTokenResponse ¶
type SlackTokenResponse struct {
OK bool `json:"ok"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
BotUserID string `json:"bot_user_id"`
AppID string `json:"app_id"`
Team struct {
Name string `json:"name"`
ID string `json:"id"`
} `json:"team"`
Enterprise interface{} `json:"enterprise"`
AuthedUser struct {
ID string `json:"id"`
Scope string `json:"scope"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
} `json:"authed_user"`
IDToken string `json:"id_token"`
Error string `json:"error"`
}
SlackTokenResponse represents the response from Slack token exchange
type TagUseCase ¶ added in v0.2.0
type TagUseCase struct {
// contains filtered or unexported fields
}
TagUseCase provides tag management use cases
func NewTagUseCase ¶ added in v0.2.0
func NewTagUseCase(tagService *tag.Service) *TagUseCase
NewTagUseCase creates a new tag use case
func (*TagUseCase) DeleteTag ¶ added in v0.2.0
func (u *TagUseCase) DeleteTag(ctx context.Context, name string) error
DeleteTag deletes a tag by name (deprecated, use DeleteTagByID)
func (*TagUseCase) DeleteTagByID ¶ added in v0.2.0
func (u *TagUseCase) DeleteTagByID(ctx context.Context, tagID string) error
DeleteTagByID deletes a tag by ID
func (*TagUseCase) GetAvailableColorNames ¶ added in v0.2.0
func (u *TagUseCase) GetAvailableColorNames() ([]string, error)
GetAvailableColorNames returns user-friendly color names for tags
func (*TagUseCase) GetAvailableColors ¶ added in v0.2.0
func (u *TagUseCase) GetAvailableColors() ([]string, error)
GetAvailableColors returns available color options for tags (Tailwind classes)
func (*TagUseCase) UpdateAlertTags ¶ added in v0.2.0
func (u *TagUseCase) UpdateAlertTags(ctx context.Context, alertID types.AlertID, tags []string) (*alert.Alert, error)
UpdateAlertTags updates tags for an alert (legacy name-based method)
func (*TagUseCase) UpdateAlertTagsByID ¶ added in v0.2.0
func (u *TagUseCase) UpdateAlertTagsByID(ctx context.Context, alertID types.AlertID, tagIDs []string) (*alert.Alert, error)
UpdateAlertTagsByID updates tags for an alert using tag IDs directly
func (*TagUseCase) UpdateTag ¶ added in v0.2.0
func (u *TagUseCase) UpdateTag(ctx context.Context, tagID string, name, color, description string) (*tagmodel.Tag, error)
UpdateTag updates tag metadata (name, color, description)
type TicketCreationOptions ¶
type TicketCreationOptions struct {
AlertIDs []types.AlertID
SlackThread *slack.Thread
Assignee *slack.User
Title string
Description string
TitleSource types.Source // Source of title
DescriptionSource types.Source // Source of description
FillMetadata bool // Whether to use LLM to fill metadata
IsTest bool // Whether this is a test ticket
ValidateAlerts bool // Whether to validate alerts exist and are unbound
UpdateAlerts bool // Whether to update alerts with ticket ID
AutoInheritFromAlert bool // Whether to auto-inherit metadata from single alert
}
TicketCreationOptions contains options for ticket creation
type TicketUpdateFunction ¶
TicketUpdateFunction defines a function that updates a ticket
type UseCases ¶
type UseCases struct {
// use cases
ChatUC interfaces.ChatUseCase
TagUC *TagUseCase
// contains filtered or unexported fields
}
func (*UseCases) ArchiveAllResolvedTickets ¶ added in v0.15.1
ArchiveAllResolvedTickets fetches all resolved tickets from the repository and archives them. Returns the number of archived tickets.
func (*UseCases) ArchiveTicket ¶ added in v0.10.0
func (uc *UseCases) ArchiveTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
ArchiveTicket archives a resolved ticket. Requires the ticket to be in resolved state.
func (*UseCases) ArchiveTickets ¶ added in v0.10.0
func (uc *UseCases) ArchiveTickets(ctx context.Context, ticketIDs []types.TicketID) ([]*ticket.Ticket, error)
ArchiveTickets archives multiple resolved tickets efficiently using a batch read followed by individual writes and concurrent Slack syncs.
func (*UseCases) BatchCountDiagnosisIssues ¶ added in v0.13.0
func (u *UseCases) BatchCountDiagnosisIssues(ctx context.Context, ids []types.DiagnosisID) (map[types.DiagnosisID]diagnosismodel.IssueCounts, error)
BatchCountDiagnosisIssues returns issue counts for multiple diagnoses in one call.
func (*UseCases) BindAlertsToTicket ¶ added in v0.1.0
func (uc *UseCases) BindAlertsToTicket(ctx context.Context, ticketID types.TicketID, alertIDs []types.AlertID) error
BindAlertsToTicket binds multiple alerts to a ticket and updates Slack display
func (*UseCases) ChatFromCLI ¶ added in v0.13.0
func (x *UseCases) ChatFromCLI(ctx context.Context, t *ticket.Ticket, message string, sess *sessModel.Session) error
ChatFromCLI processes a chat message from the CLI inside an already- established CLI Session. The CLI main is responsible for the Session lifetime: non-interactive mode calls EnsureCLISession+ChatFromCLI once, interactive mode reuses the Session across inputs so every Turn shares working memory. Pass sess==nil only in tests or the degenerate ticketless path.
func (*UseCases) ChatFromSlack ¶ added in v0.13.0
func (x *UseCases) ChatFromSlack(ctx context.Context, slackMsg *slack.Message, mentionMessage string) error
ChatFromSlack processes a chat message from a Slack app mention.
chat-session-redesign Phase 2 wrapping: before delegating to ChatUC.Execute, the Slack Session is resolved (or created with a deterministic ID so repeated mentions on the same thread reuse it), the Session activity lock is acquired so simultaneous mentions are serialized, and a Turn is recorded for the mention. The existing Execute code path is retained; it still creates its internal "session.Session" (legacy) for backwards compatibility with aster/bluebell, and Phase 3+ will unify the two.
If the Session lock is already held when a new mention arrives, the function posts a short "please wait" context block to the thread and returns without starting a second AI run.
func (*UseCases) ChatFromWebSocket ¶ added in v0.13.0
func (x *UseCases) ChatFromWebSocket(ctx context.Context, ticketID types.TicketID, message string, sess *sessModel.Session, onEvent func(ChatTurnEvent)) error
ChatFromWebSocket processes a single user message inside an already- established Web Session. Each invocation creates a fresh Turn, stamps the user message with the resulting TurnID, runs the agent, and closes the Turn — guaranteeing that every WS message appears in the conversation timeline with a stable TurnID rather than as orphaned nil-TurnID rows. `onEvent` is invoked for each lifecycle event so the WebSocket handler can fan the Envelope out to the bound client; pass nil to disable.
func (*UseCases) CountDiagnosisIssues ¶ added in v0.13.0
func (u *UseCases) CountDiagnosisIssues(ctx context.Context, id types.DiagnosisID) (diagnosismodel.IssueCounts, error)
CountDiagnosisIssues returns issue counts for a diagnosis using a single repository call.
func (*UseCases) CreateManualTicket ¶
func (uc *UseCases) CreateManualTicket(ctx context.Context, title, description string, user *slack.User) (*ticket.Ticket, error)
CreateManualTicket creates a ticket manually without associated alerts
func (*UseCases) CreateManualTicketWithTest ¶
func (uc *UseCases) CreateManualTicketWithTest(ctx context.Context, title, description string, user *slack.User, isTest bool) (*ticket.Ticket, error)
CreateManualTicketWithTest creates a ticket manually without associated alerts with test flag
func (*UseCases) CreateTicketFromAlerts ¶ added in v0.1.0
func (uc *UseCases) CreateTicketFromAlerts(ctx context.Context, alertIDs []types.AlertID, user *slack.User, slackThread *slack.Thread) (*ticket.Ticket, error)
CreateTicketFromAlerts creates a ticket from one or more alerts (used by both Slack and Web UI)
func (*UseCases) CreateTicketFromConversation ¶ added in v0.5.0
func (uc *UseCases) CreateTicketFromConversation( ctx context.Context, thread slack.Thread, user *slack.User, userContext string, ) (*ticket.Ticket, error)
CreateTicketFromConversation creates a ticket from Slack conversation history
func (*UseCases) DeclineAlerts ¶ added in v0.11.0
func (uc *UseCases) DeclineAlerts(ctx context.Context, alertIDs []types.AlertID) ([]*alert.Alert, error)
DeclineAlerts declines multiple alerts by updating their status to declined.
func (*UseCases) DiscardQueuedAlerts ¶ added in v0.14.0
DiscardQueuedAlerts removes queued alerts without processing.
func (*UseCases) DiscardQueuedAlertsByFilter ¶ added in v0.14.0
DiscardQueuedAlertsByFilter removes all queued alerts matching the keyword filter.
func (*UseCases) EnsureCLISession ¶ added in v0.16.0
func (x *UseCases) EnsureCLISession(ctx context.Context, ticketID types.TicketID, userID types.UserID) (*sessModel.Session, error)
EnsureCLISession is the CLI-side counterpart to EnsureWebSession. The CLI main creates one Session per launch (non-interactive: one Turn; interactive: many Turns under the same Session).
func (*UseCases) EnsureWebSession ¶ added in v0.16.0
func (x *UseCases) EnsureWebSession(ctx context.Context, ticketID types.TicketID, userID types.UserID) (*sessModel.Session, error)
EnsureWebSession creates a Session scoped to the current WebSocket connection. Callers (controller/websocket.Handler) invoke this once when the client connects and pass the returned Session back into ChatFromWebSocket for every subsequent user message, so the whole connection shares one Session and one gollem working-memory slot.
func (*UseCases) EscalateNotice ¶ added in v0.4.0
func (uc *UseCases) EscalateNotice(ctx context.Context, noticeID types.NoticeID) (*alert.Alert, error)
EscalateNotice escalates a notice to a full alert
func (*UseCases) FixDiagnosis ¶ added in v0.13.0
func (u *UseCases) FixDiagnosis(ctx context.Context, id types.DiagnosisID) (*diagnosismodel.Diagnosis, error)
FixDiagnosis executes Fix for all pending issues in the given diagnosis. It updates each issue's status and the diagnosis overall status.
func (*UseCases) GenerateTicketAlertsJSONL ¶ added in v0.1.0
func (u *UseCases) GenerateTicketAlertsJSONL(ctx context.Context, ticketID types.TicketID) ([]byte, error)
GenerateTicketAlertsJSONL generates JSONL data for alerts associated with a ticket
func (*UseCases) GetDiagnoses ¶ added in v0.13.0
func (u *UseCases) GetDiagnoses(ctx context.Context, offset, limit int) ([]*diagnosismodel.Diagnosis, int, error)
GetDiagnoses returns a paginated list of diagnoses.
func (*UseCases) GetDiagnosis ¶ added in v0.13.0
func (u *UseCases) GetDiagnosis(ctx context.Context, id types.DiagnosisID) (*diagnosismodel.Diagnosis, error)
GetDiagnosis retrieves a single diagnosis by ID.
func (*UseCases) GetDiagnosisIssues ¶ added in v0.13.0
func (u *UseCases) GetDiagnosisIssues(ctx context.Context, id types.DiagnosisID, offset, limit int, status *diagnosismodel.IssueStatus, ruleID *diagnosismodel.RuleID) ([]*diagnosismodel.Issue, int, error)
GetDiagnosisIssues returns paginated issues for a diagnosis. status and ruleID are optional filters.
func (*UseCases) GetSimilarTicketsForAlert ¶ added in v0.1.0
func (uc *UseCases) GetSimilarTicketsForAlert(ctx context.Context, alertID types.AlertID, threshold float64, offset, limit int) ([]*ticket.Ticket, int, error)
GetSimilarTicketsForAlert finds tickets similar to a given alert based on embedding similarity
func (*UseCases) GetTagService ¶ added in v0.2.0
GetTagService returns the tag service if available
func (*UseCases) GetUnboundAlertsFiltered ¶ added in v0.1.0
func (uc *UseCases) GetUnboundAlertsFiltered(ctx context.Context, threshold *float64, keyword *string, ticketID *types.TicketID, offset, limit int) ([]*alert.Alert, int, error)
GetUnboundAlertsFiltered returns unbound alerts filtered by similarity threshold and keyword
func (*UseCases) GetUserIcon ¶
GetUserIcon returns the user's icon image data and content type
func (*UseCases) GetUserProfile ¶
GetUserProfile returns the user's profile name via Slack service
func (*UseCases) HandleAlert ¶
func (*UseCases) HandleHITLAction ¶ added in v0.13.0
func (uc *UseCases) HandleHITLAction(ctx context.Context, slackUser slack.User, requestID types.HITLRequestID, status hitlModel.Status, response map[string]any) error
HandleHITLAction processes a HITL response (approval/denial/answer) from a Slack button click.
func (*UseCases) HandleSalvageRefresh ¶
func (*UseCases) HandleSlackAppMention ¶
HandleSlackAppMention handles a slack app mention event. It will dispatch a slack action to the alert.
func (*UseCases) HandleSlackInteractionBlockActions ¶
func (uc *UseCases) HandleSlackInteractionBlockActions(ctx context.Context, slackUser slack.User, slackThread slack.Thread, actionID slack.ActionID, value, triggerID string) error
HandleSlackInteractionBlockActions handles a slack interaction block action.
func (*UseCases) HandleSlackInteractionViewSubmission ¶
func (*UseCases) HandleSlackMessage ¶
HandleSlackMessage handles a message from a slack user. It persists the message as a session.Message (type=user) on the Slack Session bound to the ticket's thread. Pre-redesign ticket.Comment writes have Type=user on the Slack Session. The legacy persistence remains to keep pre-redesign readers (graphql / base tool) functional until Phase 3.4 migrates callers; the session.Message path is the new source of truth and is what the redesigned chat prompts will consume.
func (*UseCases) IsSlackEnabled ¶ added in v0.1.0
IsSlackEnabled returns whether Slack functionality is enabled
func (*UseCases) ProcessAlertPipeline ¶ added in v0.5.0
func (uc *UseCases) ProcessAlertPipeline( ctx context.Context, schema types.AlertSchema, alertData any, notifier interfaces.Notifier, ) ([]*AlertPipelineResult, error)
ProcessAlertPipeline processes an alert through the complete pipeline. This is a pure function without side effects (no DB save, no Slack notification).
Pipeline stages:
- Ingest Policy Evaluation - transforms raw data into Alert objects
- Metadata Generation - fills missing titles/descriptions using LLM and infers tags from the set of existing tags
- Tag Conversion - converts tag names (from policy + LLM inference) to tag IDs
- Enrich Policy Evaluation - executes enrichment tasks (query/agent)
- Triage Policy Evaluation - applies final metadata and determines publish type
All pipeline events are emitted through the notifier for real-time monitoring. The notifier receives type-safe events for each stage of processing.
func (*UseCases) Refine ¶ added in v0.10.0
Refine executes the refine process: review open tickets and consolidate unbound alerts.
func (*UseCases) ReopenTicket ¶ added in v0.10.0
func (uc *UseCases) ReopenTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
ReopenTicket reopens a resolved or archived ticket back to open. Clears ResolvedAt, ArchivedAt, Conclusion, and Reason.
func (*UseCases) ReprocessQueuedAlert ¶ added in v0.14.0
func (uc *UseCases) ReprocessQueuedAlert(ctx context.Context, queuedAlertID types.QueuedAlertID) (*alert.ReprocessJob, error)
ReprocessQueuedAlert creates a background job to reprocess a queued alert.
func (*UseCases) ReprocessQueuedAlertsByFilter ¶ added in v0.14.0
func (uc *UseCases) ReprocessQueuedAlertsByFilter(ctx context.Context, keyword *string) (*alert.ReprocessBatchJob, error)
ReprocessQueuedAlertsByFilter creates a batch job to reprocess all queued alerts matching the keyword filter.
func (*UseCases) ResolveTicket ¶ added in v0.10.0
func (uc *UseCases) ResolveTicket(ctx context.Context, ticketID types.TicketID, conclusion types.AlertConclusion, reason string) (*ticket.Ticket, error)
ResolveTicket resolves a ticket with a conclusion and reason. Sets Status=resolved, ResolvedAt=now, and records the conclusion/reason.
func (*UseCases) RunDiagnosis ¶ added in v0.13.0
RunDiagnosis executes all registered diagnosis rules, collects issues, saves them as a subcollection under a new Diagnosis header, and returns the header.
func (*UseCases) UnarchiveTicket ¶ added in v0.10.0
func (uc *UseCases) UnarchiveTicket(ctx context.Context, ticketID types.TicketID) (*ticket.Ticket, error)
UnarchiveTicket moves an archived ticket back to resolved state. Clears ArchivedAt but preserves ResolvedAt.