Documentation
¶
Overview ¶
Package alert provides ring buffer storage and delivery routing for process alerts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertEntry ¶
type AlertEntry struct {
PatternID string `json:"pattern_id"`
Severity string `json:"severity"`
Category string `json:"category"`
Description string `json:"description"`
Line string `json:"line"`
ScriptID string `json:"script_id"`
ProjectPath string `json:"project_path,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
AlertEntry represents a single alert stored in the daemon.
type AlertHub ¶
type AlertHub struct {
// contains filtered or unexported fields
}
AlertHub routes formatted alert messages to available delivery mechanisms: PTY overlay (stdin injection) and/or MCP session notifications.
func (*AlertHub) AddMCPSink ¶
func (h *AlertHub) AddMCPSink(sink MCPAlertSink)
AddMCPSink registers an MCP session for alert delivery.
func (*AlertHub) Deliver ¶
Deliver sends a pre-formatted alert message to all available sinks. Checks the push config to determine which channels are enabled.
func (*AlertHub) RemoveMCPSink ¶
func (h *AlertHub) RemoveMCPSink(sink MCPAlertSink)
RemoveMCPSink unregisters an MCP session sink.
func (*AlertHub) SetOverlaySink ¶
func (h *AlertHub) SetOverlaySink(sink OverlayAlertSink)
SetOverlaySink sets the overlay (PTY stdin) delivery sink.
func (*AlertHub) SetPushConfig ¶
func (h *AlertHub) SetPushConfig(pc *config.PushConfig)
SetPushConfig sets the push channel configuration. When set, Deliver checks each channel before dispatching. A nil config means all channels are enabled (universal default).
type AlertStoreFilter ¶
type AlertStoreFilter struct {
Since time.Time
ProcessID string
Severity string
ProjectPath string
Limit int
}
AlertStoreFilter is the daemon-side filter for querying alerts.
type MCPAlertSink ¶
MCPAlertSink delivers alert messages via MCP session notifications.
type OverlayAlertSink ¶
OverlayAlertSink delivers alert messages via PTY stdin injection.
type ProcessAlertStore ¶
type ProcessAlertStore struct {
// contains filtered or unexported fields
}
ProcessAlertStore is a ring buffer store for alert entries. head points to the oldest entry; new entries are written at (head+len) % maxSize.
func NewProcessAlertStore ¶
func NewProcessAlertStore(maxSize int) *ProcessAlertStore
NewProcessAlertStore creates a new alert store with the given capacity.
func (*ProcessAlertStore) Add ¶
func (s *ProcessAlertStore) Add(entry *AlertEntry)
Add inserts an alert entry into the ring buffer.
func (*ProcessAlertStore) ClearForProcess ¶
func (s *ProcessAlertStore) ClearForProcess(processID string) int
ClearForProcess removes all alert entries for the given process ID. Returns the number of entries removed.
func (*ProcessAlertStore) Len ¶
func (s *ProcessAlertStore) Len() int
Len returns the current number of entries.
func (*ProcessAlertStore) Query ¶
func (s *ProcessAlertStore) Query(filter AlertStoreFilter) []*AlertEntry
Query returns entries matching the filter, oldest-to-newest.