Honeycomb und Control-Patch

This commit is contained in:
2026-08-04 05:28:51 +02:00
parent 23339a8be3
commit 3af51bf888
21 changed files with 1222 additions and 79 deletions
+34
View File
@@ -31,6 +31,9 @@ func (s *Server) Handler() http.Handler {
mux.HandleFunc("GET /api/status", s.handleStatus)
mux.HandleFunc("GET /api/graph", s.handleGraph)
mux.HandleFunc("GET /api/analysis", s.handleAnalysis)
mux.HandleFunc("GET /api/runtime-settings", s.handleGetRuntimeSettings)
mux.HandleFunc("PUT /api/runtime-settings", s.handleSetRuntimeSettings)
mux.HandleFunc("GET /api/categories", s.handleCategories)
mux.HandleFunc("GET /api/stream", s.Broker.ServeSSE)
mux.HandleFunc("POST /api/query", s.handleQuery)
mux.HandleFunc("POST /api/events", s.handleEvent)
@@ -60,6 +63,33 @@ func (s *Server) handleGraph(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleAnalysis(w http.ResponseWriter, r *http.Request) {
writeJSON(w, 200, s.Graph.Analyze())
}
func (s *Server) handleGetRuntimeSettings(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, s.Engine.RuntimeSettings())
}
func (s *Server) handleSetRuntimeSettings(w http.ResponseWriter, r *http.Request) {
if !s.authorized(r) {
writeJSON(w, http.StatusUnauthorized, map[string]string{"error": "unauthorized"})
return
}
var settings engine.RuntimeSettings
if err := decode(r, &settings); err != nil {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
return
}
updated, err := s.Engine.SetRuntimeSettings(settings)
if err != nil {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
return
}
writeJSON(w, http.StatusOK, updated)
}
func (s *Server) handleCategories(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, map[string]any{"categories": s.Engine.Categories()})
}
func (s *Server) handleQuery(w http.ResponseWriter, r *http.Request) {
if !s.authorized(r) {
writeJSON(w, 401, map[string]string{"error": "unauthorized"})
@@ -145,6 +175,10 @@ func (s *Server) handleEnrich(w http.ResponseWriter, r *http.Request) {
return
}
if r.URL.Query().Get("async") == "1" {
if !s.Engine.ThinkingEnabled() {
writeJSON(w, http.StatusConflict, map[string]any{"error": "AI-THINK is disabled by runtime settings", "status": s.Engine.Status()})
return
}
if !s.Engine.RequestEnrich("manual") {
writeJSON(w, http.StatusConflict, map[string]any{"error": "AI-THINK is already running or queued", "status": s.Engine.Status()})
return