notify

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityInfo     = "info"
	SeverityWarning  = "warning"
	SeverityCritical = "critical"
)
View Source
const (
	KindPendingDecision  = "pending_decision"
	KindGuardrailBlocked = "guardrail_blocked"
	KindSessionState     = "session_state"
)

Variables

This section is empty.

Functions

func Validate added in v0.3.0

func Validate(cfg Config) error

Validate checks whether the notification configuration is valid.

Types

type Config

type Config struct {
	// Enabled is the master switch for notifications and alerts.
	Enabled bool `yaml:"enabled"`
	// Bell enables emitting the ASCII BEL character (\a) to the terminal.
	Bell bool `yaml:"bell"`
	// Desktop enables native operating-system desktop notifications.
	Desktop bool `yaml:"desktop"`
	// MinSeverity specifies the minimum severity required to trigger alerts ("info", "warning", "critical").
	MinSeverity string `yaml:"min_severity,omitempty"`
	// Webhooks defines remote webhook endpoints.
	Webhooks []WebhookConfig `yaml:"webhooks,omitempty"`
}

Config controls operator alert and notification behavior.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default notification settings (local bell & desktop enabled, no webhooks).

func DisabledConfig

func DisabledConfig() Config

DisabledConfig returns settings with all notifications disabled.

type HTTPPoster added in v0.3.0

type HTTPPoster interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPPoster abstracts HTTP POST execution for testing.

type Notification

type Notification struct {
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	SessionID string    `json:"session_id,omitempty"`
	AgentName string    `json:"agent_name,omitempty"`
	Reason    string    `json:"reason,omitempty"`
	EventID   string    `json:"event_id,omitempty"`
	Kind      string    `json:"kind,omitempty"`
	Severity  string    `json:"severity,omitempty"`
	Details   string    `json:"details,omitempty"`
	Timestamp time.Time `json:"timestamp"`
}

Notification carries display-safe information about an event needing operator attention.

type Notifier

type Notifier interface {
	Notify(Notification)
}

Notifier delivers operator notifications and alerts.

func New

func New(config Config, bellOutput io.Writer) Notifier

New constructs an active Notifier based on the given configuration.

func NewNoop

func NewNoop() Notifier

NewNoop returns a notifier that discards all notifications.

type WebhookConfig added in v0.3.0

type WebhookConfig struct {
	Name        string            `yaml:"name,omitempty"`
	URL         string            `yaml:"url"`
	Format      string            `yaml:"format"`       // "generic", "slack", "discord" (default: "generic")
	MinSeverity string            `yaml:"min_severity"` // "info", "warning", "critical" (default: "warning")
	Timeout     string            `yaml:"timeout"`      // e.g. "5s" (default: "5s")
	Headers     map[string]string `yaml:"headers,omitempty"`
}

WebhookConfig specifies an HTTP webhook destination for notifications.

type WebhookFormat added in v0.3.0

type WebhookFormat string

WebhookFormat defines the target service serialization schema.

const (
	FormatGeneric WebhookFormat = "generic"
	FormatSlack   WebhookFormat = "slack"
	FormatDiscord WebhookFormat = "discord"
)

Jump to

Keyboard shortcuts

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