Documentation
¶
Index ¶
- func Param(r *http.Request, name string) string
- type AIAdvisor
- type Options
- type Params
- type Router
- func (rt *Router) DELETE(p string, h http.HandlerFunc)
- func (rt *Router) GET(p string, h http.HandlerFunc)
- func (rt *Router) Handle(method, pattern string, h http.HandlerFunc)
- func (rt *Router) POST(p string, h http.HandlerFunc)
- func (rt *Router) PUT(p string, h http.HandlerFunc)
- func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rt *Router) SetNotFound(h http.HandlerFunc)
- func (rt *Router) Use(mw func(http.HandlerFunc) http.HandlerFunc)
- type SSEHub
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AIAdvisor ¶
type AIAdvisor interface {
Enabled() bool
Status() map[string]any
Analyze(ctx context.Context, prompt string) (*ai.AnalyzeResult, error)
Chat(ctx context.Context, message string) (*ai.AnalyzeResult, error)
BackgroundState() ai.BackgroundState
}
AIAdvisor is the minimal interface the server needs from the AI package.
type Options ¶
type Options struct {
Cfg *config.Config
CfgPath string
OnCfgApply func(*config.Config) // invoked after a successful in-process config update
Store *storage.Store
Controller *controller.Controller
Alerts *anomaly.AlertStore
Emitter *event.Emitter
Advisor AIAdvisor
StaticFS fs.FS
Version string
}
Options bundles every dependency the Server needs.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a tiny method+path router that supports `:param` segments.
func (*Router) Handle ¶
func (rt *Router) Handle(method, pattern string, h http.HandlerFunc)
Handle registers a handler for a method+pattern.
func (*Router) ServeHTTP ¶
func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
func (*Router) SetNotFound ¶
func (rt *Router) SetNotFound(h http.HandlerFunc)
SetNotFound overrides the default 404 handler.
func (*Router) Use ¶
func (rt *Router) Use(mw func(http.HandlerFunc) http.HandlerFunc)
Use appends a middleware that wraps every handler.
type SSEHub ¶
type SSEHub struct {
// contains filtered or unexported fields
}
SSEHub fans out emitter events to all connected SSE clients. It throttles per-event-type to avoid overwhelming slow clients.
func (*SSEHub) ClientCount ¶
ClientCount returns the number of active SSE clients.
func (*SSEHub) Handler ¶
func (h *SSEHub) Handler() http.HandlerFunc
Handler returns the SSE HTTP handler.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP server hosting the REST API, SSE stream, and embedded UI.
func (*Server) ExecuteAISuggestion ¶ added in v0.2.0
func (s *Server) ExecuteAISuggestion(suggestion ai.Suggestion, confirm bool) error