Add review workflows, tree-shaped workflows and a workflow editor

This commit is contained in:
Ian Gulliver
2026-10-20 18:52:04 -07:00
parent 9869fad988
commit f2188c53eb
31 changed files with 2179 additions and 863 deletions
-19
View File
@@ -54,22 +54,3 @@ func (s *Server) UpdateAway(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, http.StatusOK, u)
}
func (s *Server) UpdateReviewModels(w http.ResponseWriter, r *http.Request) {
req := api.ReviewModels{}
if !readJSON(w, r, &req) {
return
}
if strings.TrimSpace(req.ReviewModel) == "" || strings.TrimSpace(req.SecondReviewModel) == "" {
writeError(w, http.StatusBadRequest, errors.New("review_model and second_review_model are required"))
return
}
u, err := s.store.UpdateReviewModels(r.Context(), actor(r), req.ReviewModel, req.SecondReviewModel)
if err != nil {
writeStoreError(w, err)
return
}
writeJSON(w, http.StatusOK, u)
}
+25
View File
@@ -5,7 +5,9 @@ import (
"io"
"net/http"
"net/url"
"strings"
"g.fc.run/ai/byre/internal/api"
"g.fc.run/ai/byre/internal/workflow"
)
@@ -21,6 +23,16 @@ func (s *Server) ListWorkflows(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) GetWorkflow(w http.ResponseWriter, r *http.Request, name string) {
accept := r.Header.Get("Accept")
if strings.Contains(accept, "application/json") && !strings.Contains(accept, "yaml") {
def, err := s.store.GetWorkflow(r.Context(), name)
if err != nil {
writeStoreError(w, err)
return
}
writeJSON(w, http.StatusOK, def)
return
}
file, err := s.agents.WorkflowFile(r.Context(), name)
if err != nil {
writeAgentError(w, err)
@@ -46,6 +58,19 @@ func (s *Server) PutWorkflow(w http.ResponseWriter, r *http.Request, name string
writeJSON(w, http.StatusOK, summary)
}
func (s *Server) SetReviewWorkflow(w http.ResponseWriter, r *http.Request, projectID string) {
req := api.ReviewWorkflow{}
if !readJSON(w, r, &req) {
return
}
p, err := s.agents.SetReviewWorkflow(r.Context(), projectID, req.Workflow, actor(r))
if err != nil {
writeAgentError(w, err)
return
}
writeJSON(w, http.StatusOK, p)
}
func (s *Server) DeleteWorkflow(w http.ResponseWriter, r *http.Request, name string) {
err := s.store.DeleteWorkflow(r.Context(), name, actor(r))
if err != nil {