Add live agent views and improve Codex monitoring

This commit is contained in:
William Valentin
2026-03-20 13:59:51 -07:00
parent a87bbc6983
commit 687a7aa79d
10 changed files with 1408 additions and 184 deletions
+18
View File
@@ -125,6 +125,7 @@ func main() {
Limit: limit,
EventType: r.URL.Query().Get("event_type"),
Framework: r.URL.Query().Get("framework"),
ClientID: r.URL.Query().Get("client_id"),
}
events, err := db.ListRecentEvents(r.Context(), f)
if err != nil {
@@ -195,6 +196,23 @@ func main() {
httpx.WriteJSON(w, http.StatusOK, map[string]any{"session": session, "runs": runs})
})
r.Get("/v1/agents/live", func(w http.ResponseWriter, r *http.Request) {
clientID := r.URL.Query().Get("client_id")
framework := r.URL.Query().Get("framework")
if clientID == "" || framework == "" {
httpx.WriteJSON(w, http.StatusBadRequest, map[string]any{"error": "missing_agent_selector"})
return
}
limit, _ := strconv.Atoi(r.URL.Query().Get("limit"))
events, err := db.ListAgentLiveEvents(r.Context(), framework, clientID, limit)
if err != nil {
httpx.WriteJSON(w, http.StatusInternalServerError, map[string]any{"error": "db_error"})
return
}
httpx.WriteJSON(w, http.StatusOK, map[string]any{"events": events})
})
r.Get("/v1/runs/{runID}", func(w http.ResponseWriter, r *http.Request) {
runID := chi.URLParam(r, "runID")
run, spans, err := db.GetRunWithSpans(r.Context(), runID)