alert

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package alert handles multi-channel alerting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID        string
	Level     Level
	Title     string
	Message   string
	AgentID   string
	Agent     agent.Agent
	Timestamp time.Time
	Read      bool
}

Alert represents an alert message

type Channel

type Channel interface {
	Send(ctx context.Context, alert *Alert) error
	Name() string
}

Channel represents an alert channel

type DesktopChannel

type DesktopChannel struct{}

DesktopChannel sends desktop notifications

func (*DesktopChannel) Name

func (c *DesktopChannel) Name() string

func (*DesktopChannel) Send

func (c *DesktopChannel) Send(ctx context.Context, alert *Alert) error

type DiscordChannel

type DiscordChannel struct {
	// contains filtered or unexported fields
}

DiscordChannel sends Discord notifications

func (*DiscordChannel) Name

func (c *DiscordChannel) Name() string

func (*DiscordChannel) Send

func (c *DiscordChannel) Send(ctx context.Context, alert *Alert) error

type Level

type Level string

Level represents alert severity

const (
	LevelInfo    Level = "info"
	LevelWarning Level = "warning"
	LevelError   Level = "error"
	LevelSuccess Level = "success"
)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages alert channels and distribution

func NewManager

func NewManager(cfg *config.AlertsConfig, st *store.Store) *Manager

NewManager creates a new alert manager

func (*Manager) List

func (m *Manager) List(limit int, unreadOnly bool) []*Alert

List returns all alerts

func (*Manager) MarkAllRead

func (m *Manager) MarkAllRead()

MarkAllRead marks all alerts as read

func (*Manager) MarkRead

func (m *Manager) MarkRead(id string)

MarkRead marks an alert as read

func (*Manager) OnAlert

func (m *Manager) OnAlert(fn func(*Alert))

OnAlert sets the callback for new alerts (for TUI)

func (*Manager) Send

func (m *Manager) Send(ctx context.Context, alert *Alert) error

Send sends an alert to all configured channels

func (*Manager) SendAgentEvent

func (m *Manager) SendAgentEvent(ctx context.Context, event agent.Event) error

SendAgentEvent sends an alert for an agent event

func (*Manager) UnreadCount

func (m *Manager) UnreadCount() int

UnreadCount returns the number of unread alerts

type SlackChannel

type SlackChannel struct {
	// contains filtered or unexported fields
}

SlackChannel sends Slack notifications

func (*SlackChannel) Name

func (c *SlackChannel) Name() string

func (*SlackChannel) Send

func (c *SlackChannel) Send(ctx context.Context, alert *Alert) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL