Files
Pulse/internal/api/monitor_wrappers.go
rcourtman ffb8928dbf refactor(api): Update handlers for native AI chat service
Adapts API handlers to use the new native chat service:

ai_handler.go:
- Replace opencode.Service with chat.Service
- Add AIService interface for testability
- Add factory function for service creation (mockable)
- Update provider wiring to use tools package types

ai_handlers.go:
- Add Notable field to model list response
- Simplify command approval - execution handled by agentic loop
- Remove inline command execution from approval endpoint

router.go:
- Update imports: mcp -> tools, opencode -> chat
- Add monitor wrapper types for cleaner dependency injection
- Update patrol wiring for new chat service

agent_profiles:
- Rename agent_profiles_mcp.go -> agent_profiles_tools.go
- Update imports for tools package

monitor_wrappers.go:
- New file with wrapper types for alert/notification monitors
- Enables interface-based dependency injection
2026-01-19 19:20:00 +00:00

71 lines
1.9 KiB
Go

package api
import (
"github.com/rcourtman/pulse-go-rewrite/internal/ai/memory"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
"github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/notifications"
)
// AlertMonitorWrapper wraps *monitoring.Monitor to satisfy AlertMonitor interface.
type AlertMonitorWrapper struct {
m *monitoring.Monitor
}
// NewAlertMonitorWrapper creates a new wrapper for AlertMonitor.
func NewAlertMonitorWrapper(m *monitoring.Monitor) AlertMonitor {
if m == nil {
return nil
}
return &AlertMonitorWrapper{m: m}
}
func (w *AlertMonitorWrapper) GetAlertManager() AlertManager {
return w.m.GetAlertManager()
}
func (w *AlertMonitorWrapper) GetConfigPersistence() ConfigPersistence {
return w.m.GetConfigPersistence()
}
func (w *AlertMonitorWrapper) GetIncidentStore() *memory.IncidentStore {
return w.m.GetIncidentStore()
}
func (w *AlertMonitorWrapper) GetNotificationManager() *notifications.NotificationManager {
return w.m.GetNotificationManager()
}
func (w *AlertMonitorWrapper) SyncAlertState() {
w.m.SyncAlertState()
}
func (w *AlertMonitorWrapper) GetState() models.StateSnapshot {
return w.m.GetState()
}
// NotificationMonitorWrapper wraps *monitoring.Monitor to satisfy NotificationMonitor interface.
type NotificationMonitorWrapper struct {
m *monitoring.Monitor
}
// NewNotificationMonitorWrapper creates a new wrapper for NotificationMonitor.
func NewNotificationMonitorWrapper(m *monitoring.Monitor) NotificationMonitor {
if m == nil {
return nil
}
return &NotificationMonitorWrapper{m: m}
}
func (w *NotificationMonitorWrapper) GetNotificationManager() NotificationManager {
return w.m.GetNotificationManager()
}
func (w *NotificationMonitorWrapper) GetConfigPersistence() NotificationConfigPersistence {
return w.m.GetConfigPersistence()
}
func (w *NotificationMonitorWrapper) GetState() models.StateSnapshot {
return w.m.GetState()
}