diff --git a/README.md b/README.md index 65e1a12..f070b22 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ HTTP surface: | Route | Returns | | --- | --- | | `GET /api/overview` | `Overview` | -| `GET /api/tasks` | `[]TaskSummary` | -| `GET /api/workflows`, `GET /api/workflow/{label}` | `[]WorkflowIndexEntry`, `WorkflowView` | -| `GET /api/jobs`, `GET /api/job/{id}` | `[]JobSummary`, `Node` | -| `GET /api/job/{id}/checks` | `JobChecks` | -| `GET /api/agents`, `GET /api/agent/{name}` | `[]AgentSummary`, `AgentDetail` | +| `GET /api/prs` | `[]TaskSummary` | +| `GET /api/campaigns`, `GET /api/campaign/{label}` | `[]WorkflowIndexEntry`, `WorkflowView` | +| `GET /api/runs`, `GET /api/run/{id}` | `[]JobSummary`, `Node` | +| `GET /api/run/{id}/checks` | `JobChecks` | +| `GET /api/reviewers`, `GET /api/reviewer/{name}` | `[]AgentSummary`, `AgentDetail` | | `GET /api/org`, `GET /api/org/role/{name}` | `OrgView`, `OrgRoleView` | | `GET /api/graph?repo=` | `Graph` (Galaxy) | | `GET /api/charts?days=` | `Charts` | diff --git a/api.go b/api.go index e07a303..6c333ab 100644 --- a/api.go +++ b/api.go @@ -268,11 +268,11 @@ func workflowStateRank(state string) int { func overviewNeedRank(kind string) int { switch kind { - case "stalled_workflow": + case "stalled_campaign": return 0 case "pr_awaiting_merge": return 1 - case "blocked_job": + case "blocked_run": return 2 default: return 3 @@ -361,12 +361,12 @@ func (s *server) handleOverview(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, o) } -// handleTasks serves GET /api/tasks. Ordering is normalized for byte-stable +// handleTasks serves GET /api/prs. Ordering is normalized for byte-stable // polling: lifecycle columns first, then most-recently-updated within a column. func (s *server) handleTasks(w http.ResponseWriter, r *http.Request) { ds, ok := s.ds.(TasksDataSource) if !ok { - http.Error(w, "tasks unsupported by data source", http.StatusNotFound) + http.Error(w, "prs unsupported by data source", http.StatusNotFound) return } tasks, err := ds.Tasks(r.Context()) @@ -446,13 +446,13 @@ func (s *server) handleOrgRole(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, v) } -// handleWorkflows serves GET /api/workflows. The handler normalizes the +// handleWorkflows serves GET /api/campaigns. The handler normalizes the // first-slash label split and ordering so optional data sources share one // deterministic wire contract. func (s *server) handleWorkflows(w http.ResponseWriter, r *http.Request) { ds, ok := s.ds.(WorkflowDataSource) if !ok { - http.Error(w, "workflow index unsupported by data source", http.StatusNotFound) + http.Error(w, "campaign index unsupported by data source", http.StatusNotFound) return } entries, err := ds.Workflows(r.Context()) @@ -485,23 +485,23 @@ func (s *server) handleWorkflows(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, entries) } -// handleWorkflow serves GET /api/workflow/{label}. Workflows are an optional +// handleWorkflow serves GET /api/campaign/{label}. Workflows are an optional // datasource extension so older bridges remain source-compatible. func (s *server) handleWorkflow(w http.ResponseWriter, r *http.Request) { label := r.PathValue("label") if label == "" { - http.Error(w, "missing workflow label", http.StatusBadRequest) + http.Error(w, "missing campaign label", http.StatusBadRequest) return } ds, ok := s.ds.(WorkflowDataSource) if !ok { - http.Error(w, "workflow view unsupported by data source", http.StatusNotFound) + http.Error(w, "campaign view unsupported by data source", http.StatusNotFound) return } q := WorkflowQuery{ - RunCursor: r.URL.Query().Get("runCursor"), + RunCursor: r.URL.Query().Get("rootCursor"), NoteCursor: r.URL.Query().Get("noteCursor"), - MaxRuns: workflowLimit(r.URL.Query().Get("maxRuns"), workflowMaxRuns), + MaxRuns: workflowLimit(r.URL.Query().Get("maxRoots"), workflowMaxRuns), MaxNotes: workflowLimit(r.URL.Query().Get("maxNotes"), workflowMaxNotes), } view, err := ds.Workflow(r.Context(), label, q) @@ -531,7 +531,7 @@ func (s *server) handleWorkflow(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, view) } -// handleJobs serves GET /api/jobs -> []JobSummary, every job across all runs +// handleJobs serves GET /api/runs -> []JobSummary, every job across all runs // (the client filters). func (s *server) handleJobs(w http.ResponseWriter, r *http.Request) { jobs, err := s.ds.Jobs(r.Context()) @@ -545,7 +545,7 @@ func (s *server) handleJobs(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, jobs) } -// handleAgents serves GET /api/agents -> []AgentSummary. +// handleAgents serves GET /api/reviewers -> []AgentSummary. func (s *server) handleAgents(w http.ResponseWriter, r *http.Request) { agents, err := s.ds.Agents(r.Context()) if err != nil { @@ -558,12 +558,12 @@ func (s *server) handleAgents(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, agents) } -// handleAgent serves GET /api/agent/{name} -> AgentDetail, the click-through +// handleAgent serves GET /api/reviewer/{name} -> AgentDetail, the click-through // detail for a single agent. Unknown names map to 404 (mirrors handleJob). func (s *server) handleAgent(w http.ResponseWriter, r *http.Request) { name := r.PathValue("name") if name == "" { - http.Error(w, "missing agent name", http.StatusBadRequest) + http.Error(w, "missing reviewer name", http.StatusBadRequest) return } detail, err := s.ds.Agent(r.Context(), name) @@ -675,13 +675,13 @@ func (s *server) handleAttention(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, att) } -// handleJobChecks serves GET /api/job/{id}/checks -> JobChecks, the job-detail +// handleJobChecks serves GET /api/run/{id}/checks -> JobChecks, the job-detail // failed-check section (gitmoot #711). An unknown job is not a 404 — it returns // the resolved policy Mode with an empty Failed list. Failed is coerced non-nil. func (s *server) handleJobChecks(w http.ResponseWriter, r *http.Request) { id := r.PathValue("id") if id == "" { - http.Error(w, "missing job id", http.StatusBadRequest) + http.Error(w, "missing run id", http.StatusBadRequest) return } checks, err := s.ds.JobChecks(r.Context(), id) @@ -695,11 +695,11 @@ func (s *server) handleJobChecks(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, checks) } -// handleJob serves GET /api/job/{id} -> Node. +// handleJob serves GET /api/run/{id} -> Node. func (s *server) handleJob(w http.ResponseWriter, r *http.Request) { id := r.PathValue("id") if id == "" { - http.Error(w, "missing job id", http.StatusBadRequest) + http.Error(w, "missing run id", http.StatusBadRequest) return } node, err := s.ds.Job(r.Context(), id) diff --git a/api_test.go b/api_test.go index 6bdb2bc..a45d6a7 100644 --- a/api_test.go +++ b/api_test.go @@ -257,7 +257,7 @@ func TestHandleWorkflowUnsupportedDataSource(t *testing.T) { srv := httptest.NewServer(Serve(ds)) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/workflow/demo-panel") + resp, err := http.Get(srv.URL + "/api/campaign/demo-panel") if err != nil { t.Fatalf("GET unsupported workflow: %v", err) } @@ -276,7 +276,7 @@ func TestHandleWorkflowsUnsupportedDataSource(t *testing.T) { srv := httptest.NewServer(Serve(ds)) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/workflows") + resp, err := http.Get(srv.URL + "/api/campaigns") if err != nil { t.Fatalf("GET unsupported workflows: %v", err) } @@ -291,7 +291,7 @@ func TestHandleOverviewAndTasksUnsupportedDataSource(t *testing.T) { srv := httptest.NewServer(Serve(ds)) defer srv.Close() - for _, path := range []string{"/api/overview", "/api/tasks"} { + for _, path := range []string{"/api/overview", "/api/prs"} { resp, err := http.Get(srv.URL + path) if err != nil { t.Fatalf("GET %s: %v", path, err) @@ -316,7 +316,7 @@ func TestFakeOverviewContractOrderingAndDeterminism(t *testing.T) { if err := json.Unmarshal(raw1, &overview); err != nil { t.Fatalf("decode overview: %v", err) } - if len(overview.NeedsYou) < 4 || overview.NeedsYou[0].Kind != "stalled_workflow" || overview.NeedsYou[0].Label == "" || overview.NeedsYou[0].Pane == "" || overview.NeedsYou[0].SessionID == "" || overview.NeedsYou[0].LastNote == "" { + if len(overview.NeedsYou) < 4 || overview.NeedsYou[0].Kind != "stalled_campaign" || overview.NeedsYou[0].Label == "" || overview.NeedsYou[0].Pane == "" || overview.NeedsYou[0].SessionID == "" || overview.NeedsYou[0].LastNote == "" { t.Fatalf("needs_you stalled-first contract = %+v", overview.NeedsYou) } ciSeen := map[string]bool{} @@ -347,7 +347,7 @@ func TestFakeOverviewContractOrderingAndDeterminism(t *testing.T) { if len(overview.Fleet) < 4 || !overview.Fleet[0].Running { t.Fatalf("fleet contract = %+v", overview.Fleet) } - for _, field := range []string{"\"needs_you\"", "\"session_id\"", "\"per_hour\"", "\"jobs_today\""} { + for _, field := range []string{"\"needs_you\"", "\"session_id\"", "\"per_hour\"", "\"runs_today\""} { if !bytes.Contains(raw1, []byte(field)) { t.Fatalf("overview wire payload missing %s: %s", field, raw1) } @@ -358,8 +358,8 @@ func TestFakeTasksContractOrderingAndDeterminism(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - raw1 := getRaw(t, srv.URL+"/api/tasks") - raw2 := getRaw(t, srv.URL+"/api/tasks") + raw1 := getRaw(t, srv.URL+"/api/prs") + raw2 := getRaw(t, srv.URL+"/api/prs") if !bytes.Equal(raw1, raw2) { t.Fatalf("tasks changed across identical reads\nfirst=%s\nsecond=%s", raw1, raw2) } @@ -518,7 +518,7 @@ func TestFakeOrgRoleContractAndDeterminism(t *testing.T) { } for _, field := range []string{ `"merge_rule"`, `"blocked_since"`, `"last_handoff_at"`, - `"recycle_after"`, `"jobs_today"`, `"escalations"`, + `"recycle_after"`, `"runs_today"`, `"escalations"`, } { if !bytes.Contains(raw1, []byte(field)) { t.Fatalf("org role wire payload missing %s: %s", field, raw1) @@ -588,8 +588,8 @@ func TestHandleOrgNormalizesNilCollections(t *testing.T) { if path, ok := identity["path"].([]any); !ok || path == nil { t.Fatalf("sparse role path = %#v, want []", identity["path"]) } - if jobs, ok := activity["jobs_today"].(map[string]any); !ok || jobs == nil { - t.Fatalf("sparse role jobs_today = %#v, want {}", activity["jobs_today"]) + if jobs, ok := activity["runs_today"].(map[string]any); !ok || jobs == nil { + t.Fatalf("sparse role runs_today = %#v, want {}", activity["runs_today"]) } if escalations, ok := role["escalations"].([]any); !ok || escalations == nil { t.Fatalf("sparse role escalations = %#v, want []", role["escalations"]) @@ -601,7 +601,7 @@ func TestHandleWorkflowNotFound(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/workflow/unknown") + resp, err := http.Get(srv.URL + "/api/campaign/unknown") if err != nil { t.Fatalf("GET unknown workflow: %v", err) } @@ -616,7 +616,7 @@ func TestHandleWorkflowSlashLabelRoundTrip(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/workflow/fable%2Fdashboard-redesign?maxRuns=50&maxNotes=200") + resp, err := http.Get(srv.URL + "/api/campaign/fable%2Fdashboard-redesign?maxRoots=50&maxNotes=200") if err != nil { t.Fatalf("GET namespaced workflow: %v", err) } @@ -639,7 +639,7 @@ func TestHandleWorkflowClampsCursorsAndLimits(t *testing.T) { srv := httptest.NewServer(Serve(ds)) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/workflow/panel?runCursor=run-c¬eCursor=note-c&maxRuns=999&maxNotes=-4") + resp, err := http.Get(srv.URL + "/api/campaign/panel?rootCursor=run-c¬eCursor=note-c&maxRoots=999&maxNotes=-4") if err != nil { t.Fatalf("GET workflow: %v", err) } @@ -670,11 +670,11 @@ func TestFakeWorkflowContractAndPagination(t *testing.T) { } } for _, link := range graph.Links { - if link.Kind == "workflow" { + if link.Kind == "campaign" { workflowLinks++ } } - if hub == nil || hub.Type != "workflow" || hub.JobCount != 7 || hub.NoteCount != 33 || workflowLinks != 7 { + if hub == nil || hub.Type != "campaign" || hub.JobCount != 7 || hub.NoteCount != 33 || workflowLinks != 7 { t.Fatalf("workflow galaxy fixture hub=%+v links=%d", hub, workflowLinks) } @@ -746,7 +746,7 @@ func TestFakeGalaxyAgentRecordCoverage(t *testing.T) { seenPanelAgent := false seenUnregistered := false for _, node := range graph.Nodes { - if node.Type != "agent" { + if node.Type != "reviewer" { continue } name := node.Agent @@ -813,7 +813,7 @@ func TestFakeWorkflowIndexContractOrderingAndDeterminism(t *testing.T) { get := func() ([]byte, []WorkflowIndexEntry) { t.Helper() - resp, err := http.Get(srv.URL + "/api/workflows") + resp, err := http.Get(srv.URL + "/api/campaigns") if err != nil { t.Fatalf("GET workflows: %v", err) } @@ -904,12 +904,12 @@ func TestFakeWorkflowDisabled(t *testing.T) { t.Fatalf("Graph: %v", err) } for _, node := range graph.Nodes { - if node.Type == "workflow" { + if node.Type == "campaign" { t.Fatalf("disabled graph contains workflow node: %+v", node) } } for _, link := range graph.Links { - if link.Kind == "workflow" { + if link.Kind == "campaign" { t.Fatalf("disabled graph contains workflow link: %+v", link) } } @@ -926,9 +926,9 @@ func TestHandleJobs(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/jobs") + resp, err := http.Get(srv.URL + "/api/runs") if err != nil { - t.Fatalf("GET /api/jobs: %v", err) + t.Fatalf("GET /api/runs: %v", err) } defer resp.Body.Close() @@ -968,9 +968,9 @@ func TestHandleAgents(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/agents") + resp, err := http.Get(srv.URL + "/api/reviewers") if err != nil { - t.Fatalf("GET /api/agents: %v", err) + t.Fatalf("GET /api/reviewers: %v", err) } defer resp.Body.Close() @@ -1002,7 +1002,7 @@ func TestHandleAgent(t *testing.T) { // researcher carries an [agents.] config section. var detail AgentDetail - if err := json.Unmarshal(getRaw(t, srv.URL+"/api/agent/researcher"), &detail); err != nil { + if err := json.Unmarshal(getRaw(t, srv.URL+"/api/reviewer/researcher"), &detail); err != nil { t.Fatalf("decode: %v", err) } if detail.Name != "researcher" { @@ -1024,7 +1024,7 @@ func TestHandleAgentWithoutConfig(t *testing.T) { defer srv.Close() var detail AgentDetail - if err := json.Unmarshal(getRaw(t, srv.URL+"/api/agent/ci-runner"), &detail); err != nil { + if err := json.Unmarshal(getRaw(t, srv.URL+"/api/reviewer/ci-runner"), &detail); err != nil { t.Fatalf("decode: %v", err) } if detail.Name != "ci-runner" { @@ -1040,9 +1040,9 @@ func TestHandleAgentNotFound(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/agent/does-not-exist") + resp, err := http.Get(srv.URL + "/api/reviewer/does-not-exist") if err != nil { - t.Fatalf("GET /api/agent/does-not-exist: %v", err) + t.Fatalf("GET /api/reviewer/does-not-exist: %v", err) } defer resp.Body.Close() @@ -1057,7 +1057,7 @@ func TestHandleAgentDeterministic(t *testing.T) { // researcher does not appear in the seeded run, so its detail (summary + // config) is byte-stable across calls. - url := srv.URL + "/api/agent/researcher" + url := srv.URL + "/api/reviewer/researcher" if a, b := getRaw(t, url), getRaw(t, url); !bytes.Equal(a, b) { t.Fatalf("agent detail not byte-stable across calls\nfirst: %s\nsecond: %s", a, b) } @@ -1067,9 +1067,9 @@ func TestHandleJob(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/job/job-2") + resp, err := http.Get(srv.URL + "/api/run/job-2") if err != nil { - t.Fatalf("GET /api/job/job-2: %v", err) + t.Fatalf("GET /api/run/job-2: %v", err) } defer resp.Body.Close() @@ -1092,9 +1092,9 @@ func TestHandleJobNotFound(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/job/nope") + resp, err := http.Get(srv.URL + "/api/run/nope") if err != nil { - t.Fatalf("GET /api/job/nope: %v", err) + t.Fatalf("GET /api/run/nope: %v", err) } defer resp.Body.Close() @@ -1142,7 +1142,7 @@ func TestHandleJobChecks(t *testing.T) { defer srv.Close() var jc JobChecks - if err := json.Unmarshal(getRaw(t, srv.URL+"/api/job/job-5/checks"), &jc); err != nil { + if err := json.Unmarshal(getRaw(t, srv.URL+"/api/run/job-5/checks"), &jc); err != nil { t.Fatalf("decode: %v", err) } if jc.JobID != "job-5" { @@ -1168,7 +1168,7 @@ func TestHandleJobChecksUnknownJobNotFound(t *testing.T) { // An unknown job is NOT a 404 — it returns the resolved policy Mode with an // empty (non-nil) Failed list. var jc JobChecks - if err := json.Unmarshal(getRaw(t, srv.URL+"/api/job/does-not-exist/checks"), &jc); err != nil { + if err := json.Unmarshal(getRaw(t, srv.URL+"/api/run/does-not-exist/checks"), &jc); err != nil { t.Fatalf("decode: %v", err) } if jc.Mode == "" { @@ -1626,9 +1626,9 @@ func TestJSONResponseIsIndented(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() - resp, err := http.Get(srv.URL + "/api/job/job-1") + resp, err := http.Get(srv.URL + "/api/run/job-1") if err != nil { - t.Fatalf("GET /api/job/job-1: %v", err) + t.Fatalf("GET /api/run/job-1: %v", err) } defer resp.Body.Close() diff --git a/datasource.go b/datasource.go index c635783..07aa180 100644 --- a/datasource.go +++ b/datasource.go @@ -20,13 +20,13 @@ type Event struct { Label string `json:"label"` } -// Node is the full detail of a single job served by GET /api/job/{id}. +// Node is the full detail of a single job served by GET /api/run/{id}. type Node struct { ID string `json:"id"` ParentID string `json:"parentId,omitempty"` Deps []string `json:"deps,omitempty"` Title string `json:"title"` - Agent string `json:"agent"` + Agent string `json:"reviewer"` Runtime string `json:"runtime"` // codex | claude | kimi | shell Model string `json:"model,omitempty"` State NodeState `json:"state"` @@ -46,14 +46,14 @@ type Node struct { type JobSummary struct { ID string `json:"id"` Title string `json:"title"` // first line of prompt, fallback id - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` Runtime string `json:"runtime,omitempty"` // codex | claude | kimi | shell Repo string `json:"repo,omitempty"` // Kind is the job's action/type: ask | review | implement | ... Kind string `json:"kind,omitempty"` State NodeState `json:"state"` - Depth int `json:"depth"` // job-tree depth (0 = root) - Run string `json:"run,omitempty"` // root/run id this job belongs to + Depth int `json:"depth"` // job-tree depth (0 = root) + Run string `json:"root,omitempty"` // root/run id this job belongs to PR int `json:"pr,omitempty"` Started int64 `json:"started,omitempty"` // epoch ms Updated int64 `json:"updated,omitempty"` // epoch ms @@ -73,7 +73,7 @@ type AgentSummary struct { Capabilities []string `json:"capabilities,omitempty"` AutonomyPolicy string `json:"autonomyPolicy,omitempty"` Health string `json:"health,omitempty"` - JobCount int `json:"jobCount"` + JobCount int `json:"runCount"` RunningCount int `json:"runningCount"` SucceededCount int `json:"succeededCount"` FailedCount int `json:"failedCount"` @@ -99,28 +99,28 @@ type AgentDetail struct { Config *AgentConfigInfo `json:"config,omitempty"` } -// GraphNode is a node in the whole-history "galaxy" graph. Type is "job" (a real -// job, colored by State), "repo" (a repository hub), "agent" (an agent hub), or -// "workflow" (a label hub). The hubs are synthetic grouping nodes that cluster +// GraphNode is a node in the whole-history "galaxy" graph. Type is "run" (a real +// job, colored by State), "repo" (a repository hub), "reviewer" (an agent hub), or +// "campaign" (a label hub). The hubs are synthetic grouping nodes that cluster // jobs and give the force-directed graph its structure. Rollup fields are only // populated on workflow hubs. type GraphNode struct { ID string `json:"id"` - Type string `json:"type"` // job | repo | agent | workflow + Type string `json:"type"` // run | repo | reviewer | campaign Label string `json:"label"` State NodeState `json:"state,omitempty"` - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` Repo string `json:"repo,omitempty"` - Run string `json:"run,omitempty"` - JobCount int `json:"jobCount,omitempty"` + Run string `json:"root,omitempty"` + JobCount int `json:"runCount,omitempty"` NoteCount int `json:"noteCount,omitempty"` TokensIn int `json:"tokensIn,omitempty"` TokensOut int `json:"tokensOut,omitempty"` } // GraphLink is an edge in the galaxy graph. Kind is "parent"/"dep" (parent and -// dependency links between jobs), "repo" (job -> its repo hub), "agent" -// (job -> its agent hub), or "workflow" (labeled job -> its workflow hub). +// dependency links between jobs), "repo" (job -> its repo hub), "reviewer" +// (job -> its agent hub), or "campaign" (labeled job -> its workflow hub). type GraphLink struct { Source string `json:"source"` Target string `json:"target"` @@ -142,7 +142,7 @@ type WorkflowSummary struct { // Summary is an optional human-readable one-liner from workflow_meta. It is // empty when unset and contains untrusted free text that clients must escape. Summary string `json:"summary"` - Jobs int `json:"jobs"` + Jobs int `json:"runs"` Queued int `json:"queued"` Running int `json:"running"` Succeeded int `json:"succeeded"` @@ -166,7 +166,7 @@ type WorkflowCoordinator struct { // WorkflowCounts contains the index-level job outcomes and journal note count. type WorkflowCounts struct { - Jobs int `json:"jobs"` + Jobs int `json:"runs"` Running int `json:"running"` Queued int `json:"queued"` Succeeded int `json:"succeeded"` @@ -175,7 +175,7 @@ type WorkflowCounts struct { Notes int `json:"notes"` } -// WorkflowIndexEntry is one row in GET /api/workflows. Namespace and Campaign +// WorkflowIndexEntry is one row in GET /api/campaigns. Namespace and Campaign (wire: name) // are the first-slash split of Label; labels without a slash have an empty // Namespace. Timestamps are epoch milliseconds. type WorkflowIndexEntry struct { @@ -184,7 +184,7 @@ type WorkflowIndexEntry struct { // empty when unset and contains untrusted free text that clients must escape. Summary string `json:"summary"` Namespace string `json:"namespace"` - Campaign string `json:"campaign"` + Campaign string `json:"name"` Auto bool `json:"auto"` Coordinator WorkflowCoordinator `json:"coordinator"` State string `json:"state"` // active | settled | stalled @@ -199,13 +199,13 @@ type WorkflowIndexEntry struct { } // WorkflowNode is the compact job shape retained for complete workflow run -// trees. Full job prompt, output, and events remain available from /api/job/{id}. +// trees. Full job prompt, output, and events remain available from /api/run/{id}. type WorkflowNode struct { ID string `json:"id"` ParentID string `json:"parentId,omitempty"` Deps []string `json:"deps,omitempty"` Title string `json:"title"` - Agent string `json:"agent"` + Agent string `json:"reviewer"` Runtime string `json:"runtime"` Model string `json:"model,omitempty"` State NodeState `json:"state"` @@ -218,7 +218,7 @@ type WorkflowNode struct { type WorkflowChild struct { ID string `json:"id"` Action string `json:"action"` - Agent string `json:"agent"` + Agent string `json:"reviewer"` Runtime string `json:"runtime,omitempty"` State NodeState `json:"state"` ElapsedS int64 `json:"elapsed_s"` @@ -227,9 +227,9 @@ type WorkflowChild struct { // WorkflowRun is one complete run tree in a workflow page. Pagination is by // these roots, so Nodes is never split across pages. type WorkflowRun struct { - RunID string `json:"runId"` + RunID string `json:"rootId"` Title string `json:"title"` - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` Runtime string `json:"runtime,omitempty"` Repo string `json:"repo,omitempty"` State NodeState `json:"state"` @@ -259,9 +259,9 @@ type WorkflowView struct { StalledForS int64 `json:"stalled_for_s,omitempty"` Coordinator WorkflowCoordinator `json:"coordinator,omitempty"` WorkDir string `json:"work_dir,omitempty"` - Runs []WorkflowRun `json:"runs"` + Runs []WorkflowRun `json:"roots"` Notes []WorkflowNoteView `json:"notes"` - NextRunCursor string `json:"nextRunCursor"` + NextRunCursor string `json:"nextRootCursor"` NextNoteCursor string `json:"nextNoteCursor"` Truncated bool `json:"truncated"` } @@ -286,7 +286,7 @@ type WorkflowDataSource interface { // Link is either a dashboard path or an external URL. Stalled workflow cards // additionally carry the read-only coordinator handoff fields. type OverviewNeedsYou struct { - Kind string `json:"kind"` // pr_awaiting_merge | blocked_job | unlabeled_jobs | stalled_workflow + Kind string `json:"kind"` // pr_awaiting_merge | blocked_run | unlabeled_runs | stalled_campaign Repo string `json:"repo,omitempty"` Ref string `json:"ref,omitempty"` Title string `json:"title"` @@ -304,22 +304,22 @@ type OverviewNeedsYou struct { type OverviewWorkflowActivity struct { Label string `json:"label"` Namespace string `json:"namespace"` - Campaign string `json:"campaign"` + Campaign string `json:"name"` Running int `json:"running"` - Agents []string `json:"agents"` + Agents []string `json:"reviewers"` StartedAgoS int64 `json:"started_ago_s"` } // OverviewActivity is the live fleet block on the Overview page. type OverviewActivity struct { - Workflows []OverviewWorkflowActivity `json:"workflows"` + Workflows []OverviewWorkflowActivity `json:"campaigns"` UnattendedNote string `json:"unattended_note,omitempty"` Queued int `json:"queued"` } // OverviewNotable is one of the five most-recent terminal jobs shown today. type OverviewNotable struct { - Agent string `json:"agent"` + Agent string `json:"reviewer"` Title string `json:"title"` Outcome string `json:"outcome"` // succeeded | failed | cancelled ElapsedS int64 `json:"elapsed_s"` @@ -339,10 +339,10 @@ type OverviewToday struct { // OverviewFleet is one registered agent's compact daily rollup. type OverviewFleet struct { - Agent string `json:"agent"` + Agent string `json:"reviewer"` Runtime string `json:"runtime"` Running bool `json:"running"` - JobsToday int `json:"jobs_today"` + JobsToday int `json:"runs_today"` } // Overview is the additive operator-first landing-page snapshot. @@ -359,7 +359,7 @@ type OverviewDataSource interface { Overview(ctx context.Context) (Overview, error) } -// TaskSummary is one read-only lifecycle card on GET /api/tasks. UpdatedAt is +// TaskSummary is one read-only lifecycle card on GET /api/prs. UpdatedAt is // epoch milliseconds; AgeS is the server-computed display age. Merged entries // are limited to the most recent seven days by the data source. type TaskSummary struct { @@ -367,7 +367,7 @@ type TaskSummary struct { Title string `json:"title"` Repo string `json:"repo"` State string `json:"state"` // pr_open | blocked | merged - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` PRNumber int `json:"pr_number,omitempty"` CI string `json:"ci,omitempty"` // green | red | pending | "" BlockedReason string `json:"blocked_reason,omitempty"` @@ -436,14 +436,14 @@ type OrgBadges struct { // answers "is the lane busy right now"; JobsToday answers "what // happened today". Lets a role whose seat has gone idle still show as // active while its dispatched workers are mid-flight (gitmoot#1127). - ActiveJobs int `json:"active_jobs,omitempty"` + ActiveJobs int `json:"active_runs,omitempty"` } // OrgEscalation is one open read-only escalation. type OrgEscalation struct { From string `json:"from"` To string `json:"to"` - Wf string `json:"wf"` + Wf string `json:"campaign"` Question string `json:"question"` At string `json:"at"` // RFC3339 } @@ -497,7 +497,7 @@ type OrgRoleRecycle struct { // OrgRoleActivity is the role's aggregate activity for the current UTC day. type OrgRoleActivity struct { - JobsToday map[string]int `json:"jobs_today"` + JobsToday map[string]int `json:"runs_today"` Notes int `json:"notes"` } @@ -519,32 +519,32 @@ type ChartDay struct { type ChartAgent struct { Name string `json:"name"` Runtime string `json:"runtime,omitempty"` - Jobs int `json:"jobs"` + Jobs int `json:"runs"` TokensOut int `json:"tokensOut,omitempty"` } // ChartRepo is one repository's job count over the charted range. type ChartRepo struct { Repo string `json:"repo"` - Jobs int `json:"jobs"` + Jobs int `json:"runs"` } // ChartTotals rolls up the whole charted range into headline figures. type ChartTotals struct { - Jobs int `json:"jobs"` + Jobs int `json:"runs"` Succeeded int `json:"succeeded"` Failed int `json:"failed"` TokensIn int `json:"tokensIn"` TokensOut int `json:"tokensOut"` - ActiveAgents int `json:"activeAgents"` // distinct agents with >=1 job in range + ActiveAgents int `json:"activeReviewers"` // distinct agents with >=1 job in range } // Charts is the data behind the Charts page: a per-day time series plus // top-agent/top-repo breakdowns and range totals. type Charts struct { - Days []ChartDay `json:"days"` // oldest->newest, continuous zero-filled range - Agents []ChartAgent `json:"agents"` // top 12 by Jobs desc, name tie-break - Repos []ChartRepo `json:"repos"` // top 12 by Jobs desc, repo tie-break + Days []ChartDay `json:"days"` // oldest->newest, continuous zero-filled range + Agents []ChartAgent `json:"reviewers"` // top 12 by Jobs desc, name tie-break + Repos []ChartRepo `json:"repos"` // top 12 by Jobs desc, repo tie-break Totals ChartTotals `json:"totals"` } @@ -661,7 +661,7 @@ type HealthResourceLock struct { type HealthStuckJob struct { ID string `json:"id"` Title string `json:"title"` - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` Repo string `json:"repo,omitempty"` State string `json:"state"` Reason string `json:"reason,omitempty"` @@ -672,7 +672,7 @@ type HealthStuckJob struct { type HealthFailure struct { ID string `json:"id"` Title string `json:"title"` - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` Repo string `json:"repo,omitempty"` At int64 `json:"at,omitempty"` // epoch ms } @@ -707,7 +707,7 @@ type ResultCheck struct { // not run; an empty Failed under "warn"/"block" means the job passed every // check. type JobChecks struct { - JobID string `json:"jobId"` + JobID string `json:"runId"` Mode string `json:"mode"` // off | warn | block Failed []ResultCheck `json:"failed"` // failed checks, insertion order; never nil } @@ -715,10 +715,10 @@ type JobChecks struct { // AttentionGate is a blocked job waiting on a human-satisfiable gate (gitmoot // #693 job_gates): one open (unsatisfied) need on a job. type AttentionGate struct { - JobID string `json:"jobId"` + JobID string `json:"runId"` Need string `json:"need"` Title string `json:"title,omitempty"` - Agent string `json:"agent,omitempty"` + Agent string `json:"reviewer,omitempty"` Repo string `json:"repo,omitempty"` State NodeState `json:"state,omitempty"` PR int `json:"pr,omitempty"` diff --git a/datasource_test.go b/datasource_test.go index dd1a1e6..3272eb2 100644 --- a/datasource_test.go +++ b/datasource_test.go @@ -8,24 +8,24 @@ import ( func TestWorkflowAdditiveJSONContracts(t *testing.T) { t.Run("legacy graph node omits workflow fields", func(t *testing.T) { - node := GraphNode{ID: "job-1", Type: "job", Label: "legacy", State: "running"} + node := GraphNode{ID: "job-1", Type: "run", Label: "legacy", State: "running"} got, err := json.Marshal(node) if err != nil { t.Fatalf("marshal legacy GraphNode: %v", err) } - const wantNode = `{"id":"job-1","type":"job","label":"legacy","state":"running"}` + const wantNode = `{"id":"job-1","type":"run","label":"legacy","state":"running"}` if string(got) != wantNode { t.Fatalf("legacy GraphNode JSON = %s, want %s", got, wantNode) } }) t.Run("labeled graph node round trips", func(t *testing.T) { - const payload = `{"id":"workflow::panel","type":"workflow","label":"panel","jobCount":7,"noteCount":3,"tokensIn":22400,"tokensOut":9700}` + const payload = `{"id":"workflow::panel","type":"campaign","label":"panel","runCount":7,"noteCount":3,"tokensIn":22400,"tokensOut":9700}` var node GraphNode if err := json.Unmarshal([]byte(payload), &node); err != nil { t.Fatalf("unmarshal workflow GraphNode: %v", err) } - if node.Type != "workflow" || node.JobCount != 7 || node.NoteCount != 3 || node.TokensIn != 22400 || node.TokensOut != 9700 { + if node.Type != "campaign" || node.JobCount != 7 || node.NoteCount != 3 || node.TokensIn != 22400 || node.TokensOut != 9700 { t.Fatalf("workflow GraphNode fields = %+v", node) } got, err := json.Marshal(node) @@ -63,7 +63,7 @@ func TestOrgBadgesActiveJobsAdditiveJSONContract(t *testing.T) { if err != nil { t.Fatalf("marshal OrgBadges with ActiveJobs: %v", err) } - const want = `{"missed_wakes":0,"active_jobs":3}` + const want = `{"missed_wakes":0,"active_runs":3}` if string(got) != want { t.Fatalf("OrgBadges JSON = %s, want %s", got, want) } diff --git a/fakefeed.go b/fakefeed.go index 425c763..b85b18f 100644 --- a/fakefeed.go +++ b/fakefeed.go @@ -15,13 +15,13 @@ import ( // by the API handlers). var ( // ErrJobNotFound indicates the requested job/node does not exist. - ErrJobNotFound = errors.New("job not found") + ErrJobNotFound = errors.New("run not found") // ErrAgentNotFound indicates the requested agent does not exist. - ErrAgentNotFound = errors.New("agent not found") + ErrAgentNotFound = errors.New("reviewer not found") // ErrOrgRoleNotFound indicates the requested org role does not exist. ErrOrgRoleNotFound = errors.New("org role not found") // ErrWorkflowNotFound indicates the requested workflow label does not exist. - ErrWorkflowNotFound = errors.New("workflow not found") + ErrWorkflowNotFound = errors.New("campaign not found") ) const ( @@ -257,7 +257,7 @@ func (f *FakeDataSource) Graph(ctx context.Context, repo string) (Graph, error) } agents := map[string]bool{} for _, n := range nodes { - g.Nodes = append(g.Nodes, GraphNode{ID: n.ID, Type: "job", Label: n.Title, State: n.State, Agent: n.Agent, Repo: fakeRepo, Run: fakeRunID}) + g.Nodes = append(g.Nodes, GraphNode{ID: n.ID, Type: "run", Label: n.Title, State: n.State, Agent: n.Agent, Repo: fakeRepo, Run: fakeRunID}) if n.ParentID != "" && ids[n.ParentID] { g.Links = append(g.Links, GraphLink{Source: n.ParentID, Target: n.ID, Kind: "parent"}) } @@ -269,35 +269,35 @@ func (f *FakeDataSource) Graph(ctx context.Context, repo string) (Graph, error) g.Links = append(g.Links, GraphLink{Source: n.ID, Target: "repo::" + fakeRepo, Kind: "repo"}) if n.Agent != "" { agents[n.Agent] = true - g.Links = append(g.Links, GraphLink{Source: n.ID, Target: "agent::" + n.Agent, Kind: "agent"}) + g.Links = append(g.Links, GraphLink{Source: n.ID, Target: "agent::" + n.Agent, Kind: "reviewer"}) } } unregistered := fakeUnregisteredGalaxyNode(nodes[0].StartedAt) - g.Nodes = append(g.Nodes, GraphNode{ID: unregistered.ID, Type: "job", Label: unregistered.Title, State: unregistered.State, Agent: unregistered.Agent, Repo: fakeRepo, Run: fakeRunID}) + g.Nodes = append(g.Nodes, GraphNode{ID: unregistered.ID, Type: "run", Label: unregistered.Title, State: unregistered.State, Agent: unregistered.Agent, Repo: fakeRepo, Run: fakeRunID}) g.Links = append(g.Links, GraphLink{Source: unregistered.ID, Target: "repo::" + fakeRepo, Kind: "repo"}, - GraphLink{Source: unregistered.ID, Target: "agent::" + unregistered.Agent, Kind: "agent"}, + GraphLink{Source: unregistered.ID, Target: "agent::" + unregistered.Agent, Kind: "reviewer"}, ) agents[unregistered.Agent] = true g.Nodes = append(g.Nodes, GraphNode{ID: "repo::" + fakeRepo, Type: "repo", Label: fakeRepo, Repo: fakeRepo}) for a := range agents { - g.Nodes = append(g.Nodes, GraphNode{ID: "agent::" + a, Type: "agent", Label: a, Agent: a}) + g.Nodes = append(g.Nodes, GraphNode{ID: "agent::" + a, Type: "reviewer", Label: a, Agent: a}) } if workflowsEnabled { extra := fakeWorkflowSingleNode(nodes[0].StartedAt) - g.Nodes = append(g.Nodes, GraphNode{ID: extra.ID, Type: "job", Label: extra.Title, State: extra.State, Agent: extra.Agent, Repo: fakeRepo, Run: "run-demo-single"}) + g.Nodes = append(g.Nodes, GraphNode{ID: extra.ID, Type: "run", Label: extra.Title, State: extra.State, Agent: extra.Agent, Repo: fakeRepo, Run: "run-demo-single"}) g.Links = append(g.Links, GraphLink{Source: extra.ID, Target: "repo::" + fakeRepo, Kind: "repo"}, - GraphLink{Source: extra.ID, Target: "agent::" + extra.Agent, Kind: "agent"}, + GraphLink{Source: extra.ID, Target: "agent::" + extra.Agent, Kind: "reviewer"}, ) if !agents[extra.Agent] { - g.Nodes = append(g.Nodes, GraphNode{ID: "agent::" + extra.Agent, Type: "agent", Label: extra.Agent, Agent: extra.Agent}) + g.Nodes = append(g.Nodes, GraphNode{ID: "agent::" + extra.Agent, Type: "reviewer", Label: extra.Agent, Agent: extra.Agent}) } for _, n := range append(nodes, extra) { - g.Links = append(g.Links, GraphLink{Source: n.ID, Target: "workflow::" + fakeWorkflow, Kind: "workflow"}) + g.Links = append(g.Links, GraphLink{Source: n.ID, Target: "workflow::" + fakeWorkflow, Kind: "campaign"}) } g.Nodes = append(g.Nodes, GraphNode{ - ID: "workflow::" + fakeWorkflow, Type: "workflow", Label: fakeWorkflow, + ID: "workflow::" + fakeWorkflow, Type: "campaign", Label: fakeWorkflow, JobCount: len(nodes) + 1, NoteCount: len(fakeWorkflowNotes(nodes[0].StartedAt)), TokensIn: 1_230_000, TokensOut: 15_300, }) } @@ -537,9 +537,9 @@ func (f *FakeDataSource) Overview(ctx context.Context) (Overview, error) { return Overview{ NeedsYou: []OverviewNeedsYou{ {Kind: "pr_awaiting_merge", Repo: "jerryfane/vetrina", Ref: "#77", Title: "Charlotte selfimprove pass 3 — layout tokens", AgeS: 11 * 3600, CI: "pending", Link: "https://github.com/jerryfane/vetrina/pull/77"}, - {Kind: "stalled_workflow", Repo: "jerryfane/arxiv-post-agent", Ref: "40m", Title: "1 run failed · coordinator silent", AgeS: 40 * 60, Link: "/workflows/fable%2Farxiv-retry-hardening", Label: fakeStalledWorkflow, Pane: "fable", SessionID: "a3f19c", LastNote: "synthesized temp JSON + env var; 16KiB caps"}, + {Kind: "stalled_campaign", Repo: "jerryfane/arxiv-post-agent", Ref: "40m", Title: "1 run failed · coordinator silent", AgeS: 40 * 60, Link: "/campaigns/fable%2Farxiv-retry-hardening", Label: fakeStalledWorkflow, Pane: "fable", SessionID: "a3f19c", LastNote: "synthesized temp JSON + env var; 16KiB caps"}, {Kind: "pr_awaiting_merge", Repo: "jerryfane/gitmoot", Ref: "#892", Title: "Require an exact-head review before the merge gate opens", AgeS: 2 * 3600, CI: "green", Link: "https://github.com/jerryfane/gitmoot/pull/892"}, - {Kind: "blocked_job", Repo: "jerryfane/gitmoot", Ref: "planner", Title: "Job blocked · needs writable /root/.gitmoot", AgeS: 5 * 86400, Link: "/attention"}, + {Kind: "blocked_run", Repo: "jerryfane/gitmoot", Ref: "planner", Title: "Run blocked · needs writable /root/.gitmoot", AgeS: 5 * 86400, Link: "/attention"}, {Kind: "pr_awaiting_merge", Repo: "jerryfane/arxiv-post-agent", Ref: "#418", Title: "Fix arxiv summary retry backoff on 429", AgeS: 6 * 3600, CI: "red", Link: "https://github.com/jerryfane/arxiv-post-agent/pull/418"}, }, Activity: OverviewActivity{ diff --git a/server.go b/server.go index 6848d80..ad3e6b6 100644 --- a/server.go +++ b/server.go @@ -15,21 +15,21 @@ func Serve(ds DataSource) http.Handler { s := newServer(ds) mux := http.NewServeMux() - mux.HandleFunc("GET /api/jobs", s.handleJobs) - mux.HandleFunc("GET /api/agents", s.handleAgents) - mux.HandleFunc("GET /api/agent/{name}", s.handleAgent) + mux.HandleFunc("GET /api/runs", s.handleJobs) + mux.HandleFunc("GET /api/reviewers", s.handleAgents) + mux.HandleFunc("GET /api/reviewer/{name}", s.handleAgent) mux.HandleFunc("GET /api/charts", s.handleCharts) mux.HandleFunc("GET /api/health", s.handleHealth) mux.HandleFunc("GET /api/config", s.handleConfig) mux.HandleFunc("GET /api/overview", s.handleOverview) - mux.HandleFunc("GET /api/tasks", s.handleTasks) + mux.HandleFunc("GET /api/prs", s.handleTasks) mux.HandleFunc("GET /api/org", s.handleOrg) mux.HandleFunc("GET /api/org/role/{name}", s.handleOrgRole) - mux.HandleFunc("GET /api/workflows", s.handleWorkflows) - mux.HandleFunc("GET /api/workflow/{label}", s.handleWorkflow) + mux.HandleFunc("GET /api/campaigns", s.handleWorkflows) + mux.HandleFunc("GET /api/campaign/{label}", s.handleWorkflow) mux.HandleFunc("GET /api/attention", s.handleAttention) - mux.HandleFunc("GET /api/job/{id}/checks", s.handleJobChecks) - mux.HandleFunc("GET /api/job/{id}", s.handleJob) + mux.HandleFunc("GET /api/run/{id}/checks", s.handleJobChecks) + mux.HandleFunc("GET /api/run/{id}", s.handleJob) mux.HandleFunc("GET /api/graph", s.handleGraph) mux.HandleFunc("GET /api/events", s.handleChangeEvents) diff --git a/server_test.go b/server_test.go index 66f257b..087e75e 100644 --- a/server_test.go +++ b/server_test.go @@ -60,8 +60,15 @@ func TestRemovedRoutesNotFound(t *testing.T) { "/api/wakes/summary", "/api/wakes/receipts", "/api/run/eval-reviewer-0007/verdicts", - "/api/runs", "/api/state", + "/api/jobs", + "/api/job/job-5", + "/api/job/job-5/checks", + "/api/agents", + "/api/agent/researcher", + "/api/tasks", + "/api/workflows", + "/api/workflow/fable%2Fdashboard-redesign", "/api/state?run=run-noted-001", "/api/learning/skills", "/events", diff --git a/web/dist/index.html b/web/dist/index.html index 5814b96..47a2ec1 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -84,26 +84,26 @@ Overview -
+
- Tasks + PRs
-
+
- Workflows + Campaigns
-
+
- Jobs + Runs
FLEET
-
+
- Agents + Reviewers
@@ -125,12 +125,12 @@
SYSTEM
-
+
Needs a human
-
+
Health @@ -156,9 +156,9 @@
WORK
-
Overview
Tasks
Workflows
Jobs
+
Overview
PRs
Campaigns
Runs
FLEET
-
Agents
Org
+
Reviewers
Org
INSIGHT
Galaxy
Charts
SYSTEM
@@ -171,14 +171,14 @@ Overview
-
+
- Tasks + PRs
-
+
- Workflows + Campaigns
@@ -220,39 +220,43 @@ } // ---- client-side router ---------------------------------------------------- - // Route table: / -> overview | /tasks | /workflows[/
';}).join(''); + _tkCard(task){const esc=this._ovEsc.bind(this),state=task.state||'',rt=this._tkRuntime(task.reviewer),age=this._ovDur(task.age_s),ci=task.ci||'',status=state==='pr_open'?'
#'+Number(task.pr_number||0)+' · CI '+(ci==='green'?'✓':ci==='red'?'✗':'…')+'
':state==='merged'?'
merged'+(task.pr_number?' · #'+Number(task.pr_number):'')+'
':'';return '
'+esc(task.title)+'
'+esc(this._tkRepo(task.repo))+''+(task.reviewer?''+esc(task.reviewer)+'':'')+''+esc(age)+'
'+status+(state==='blocked'?'
'+esc(task.blocked_reason||'blocked')+'
':'')+'
';} + _tkDetail(task){if(!task)return'';const esc=this._ovEsc.bind(this),state=task.state||'',rt=this._tkRuntime(task.reviewer),steps=['pr_open','merged'],current=state==='blocked'?0:Math.max(0,steps.indexOf(state)),life=steps.map((s,i)=>{const done=i'+(done?'✓':blocked?'⚑':cur?'●':'○')+''+esc(s==='pr_open'?'PR open':s.charAt(0).toUpperCase()+s.slice(1))+''+(blocked?'blocked here':done?'done':'')+'
';}).join(''); let stateBox='';if(state==='blocked')stateBox='
! BLOCKED
'+esc(task.blocked_reason||'Needs operator input')+'Resolve in Needs a human →
';else if(state==='pr_open'){const href='https://github.com/'+String(task.repo||'').replace(/^\/+|\/+$/g,'')+'/pull/'+Number(task.pr_number||0);stateBox='
PR #'+Number(task.pr_number||0)+' · CI '+esc(task.ci||'pending')+'
Open on GitHub ↗
';}else if(state==='merged')stateBox='
Merged'+(task.pr_number?' via PR #'+Number(task.pr_number):'')+' · '+esc(this._ovDur(task.age_s))+' ago
'; - const jobs=(this._tasksJobs||[]).filter(j=>(j.repo&&j.repo===task.repo)||(task.agent&&j.agent===task.agent)).slice(0,3),jobHTML=jobs.length?jobs.map(j=>'
'+esc(j.kind||'job')+''+esc(j.agent||'agent')+''+esc(j.started?this._fmtDur(j.duration):'-')+'
').join(''):'
No linked jobs reported.
'; - return ''; + const jobs=(this._tasksJobs||[]).filter(j=>(j.repo&&j.repo===task.repo)||(task.reviewer&&j.reviewer===task.reviewer)).slice(0,3),jobHTML=jobs.length?jobs.map(j=>'
'+esc(j.kind||'run')+''+esc(j.reviewer||'-')+''+esc(j.started?this._fmtDur(j.duration):'-')+'
').join(''):'
No linked runs reported.
'; + return ''; } renderTasks(data,status){ - if(!this._tasksRoot)return;const board=this._tasksRoot.querySelector('#tk-board'),summary=this._tasksRoot.querySelector('#tk-summary'),tabs=this._tasksRoot.querySelector('#tk-tabs'),slot=this._tasksRoot.querySelector('#tk-detail-slot');if(status==='unsupported'){summary.textContent='';tabs.innerHTML='';board.innerHTML='
Tasks requires a newer gitmoot build.
';slot.innerHTML='';return;}if(!data){summary.textContent='';tabs.innerHTML='';board.innerHTML=status==='error'?'
Tasks are temporarily unavailable.
':'
';slot.innerHTML='';return;} - const all=Array.isArray(data)?data:[],repos=[...new Set(all.map(t=>t.repo).filter(Boolean))].sort(),agents=[...new Set(all.map(t=>t.agent).filter(Boolean))].sort(),repoSel=this._tasksRoot.querySelector('#tk-repo'),agentSel=this._tasksRoot.querySelector('#tk-agent'),fill=(el,vals,label,current)=>{el.innerHTML=''+vals.map(v=>'').join('');};fill(repoSel,repos,'Repo',this._tasksFilters.repo);fill(agentSel,agents,'Agent',this._tasksFilters.agent); - const q=String(this._tasksFilters.query||'').toLowerCase(),filtered=all.filter(t=>(this._tasksFilters.repo==='all'||t.repo===this._tasksFilters.repo)&&(this._tasksFilters.agent==='all'||t.agent===this._tasksFilters.agent)&&(!q||[t.title,t.repo,t.agent,t.blocked_reason,String(t.pr_number||'')].join(' ').toLowerCase().indexOf(q)>=0));const states=[['pr_open','PR open'],['blocked','Blocked'],['merged','Merged · 7d']],counts={};states.forEach(s=>counts[s[0]]=filtered.filter(t=>t.state===s[0]).length);const tracked=['pr_open','blocked'].reduce((n,s)=>n+counts[s],0);summary.textContent=tracked+' tracked · '+counts.blocked+' blocked';tabs.innerHTML=states.map(s=>'').join(''); + if(!this._tasksRoot)return;const board=this._tasksRoot.querySelector('#tk-board'),summary=this._tasksRoot.querySelector('#tk-summary'),tabs=this._tasksRoot.querySelector('#tk-tabs'),slot=this._tasksRoot.querySelector('#tk-detail-slot');if(status==='unsupported'){summary.textContent='';tabs.innerHTML='';board.innerHTML='
PRs requires a newer gitmoot build.
';slot.innerHTML='';return;}if(!data){summary.textContent='';tabs.innerHTML='';board.innerHTML=status==='error'?'
PRs are temporarily unavailable.
':'
';slot.innerHTML='';return;} + const all=Array.isArray(data)?data:[],repos=[...new Set(all.map(t=>t.repo).filter(Boolean))].sort(),agents=[...new Set(all.map(t=>t.reviewer).filter(Boolean))].sort(),repoSel=this._tasksRoot.querySelector('#tk-repo'),agentSel=this._tasksRoot.querySelector('#tk-agent'),fill=(el,vals,label,current)=>{el.innerHTML=''+vals.map(v=>'').join('');};fill(repoSel,repos,'Repo',this._tasksFilters.repo);fill(agentSel,agents,'Reviewer',this._tasksFilters.agent); + const q=String(this._tasksFilters.query||'').toLowerCase(),filtered=all.filter(t=>(this._tasksFilters.repo==='all'||t.repo===this._tasksFilters.repo)&&(this._tasksFilters.agent==='all'||t.reviewer===this._tasksFilters.agent)&&(!q||[t.title,t.repo,t.reviewer,t.blocked_reason,String(t.pr_number||'')].join(' ').toLowerCase().indexOf(q)>=0));const states=[['pr_open','PR open'],['blocked','Blocked'],['merged','Merged · 7d']],counts={};states.forEach(s=>counts[s[0]]=filtered.filter(t=>t.state===s[0]).length);const tracked=['pr_open','blocked'].reduce((n,s)=>n+counts[s],0);summary.textContent=tracked+' tracked · '+counts.blocked+' blocked';tabs.innerHTML=states.map(s=>'').join(''); board.innerHTML=states.map(s=>{const items=filtered.filter(t=>t.state===s[0]);const empty={pr_open:'- no open PRs -',blocked:'- nothing blocked -',merged:'- none -'}[s[0]];return '
'+s[1]+''+items.length+'
'+(items.length?items.map(t=>this._tkCard(t)).join(''):'
'+empty+'
')+'
';}).join('');const selected=all.find(t=>t.id===this._tasksSelected);if(this._tasksSelected&&!selected)this._tasksSelected='';slot.innerHTML=this._tkDetail(selected);const hint=this._tasksRoot.querySelector('.tk-hint');if(hint)hint.remove();if(all.length&&!selected){const h=document.createElement('div');h.className='tk-hint';h.textContent='Click any card to open its detail panel';this._tasksRoot.appendChild(h);} } @@ -1084,8 +1088,8 @@ root.id = 'workflow-root'; root.style.cssText = 'position:fixed;left:216px;top:54px;right:0;bottom:0;z-index:42;display:none'; root.innerHTML = [ - '
Workflows.
', - '
', + '
Campaigns.
', + '
', '', '
', '
', @@ -1139,18 +1143,18 @@ const seen=new Set(),out=[];[primary,secondary].forEach(list=>(Array.isArray(list)?list:[]).forEach(item=>{const key=keyOf(item);if(seen.has(key))return;seen.add(key);out.push(item);}));return out; } _wfApplyWorkflowPage(label,json,mode) { - json=json||{};const h=this._wfHistory(label),freshRuns=Array.isArray(json.runs)?json.runs:[],freshNotes=Array.isArray(json.notes)?json.notes:[]; + json=json||{};const h=this._wfHistory(label),freshRuns=Array.isArray(json.roots)?json.roots:[],freshNotes=Array.isArray(json.notes)?json.notes:[]; if(!h.loaded){ - h.runs=freshRuns.slice();h.notes=freshNotes.slice();h.nextRunCursor=String(json.nextRunCursor||'');h.nextNoteCursor=String(json.nextNoteCursor||'');h.runExhausted=!h.nextRunCursor;h.noteExhausted=!h.nextNoteCursor;h.loaded=true; + h.runs=freshRuns.slice();h.notes=freshNotes.slice();h.nextRunCursor=String(json.nextRootCursor||'');h.nextNoteCursor=String(json.nextNoteCursor||'');h.runExhausted=!h.nextRunCursor;h.noteExhausted=!h.nextNoteCursor;h.loaded=true; }else if(mode==='history'){ const oldRunCursor=h.nextRunCursor,oldNoteCursor=h.nextNoteCursor,loadRuns=!h.runExhausted,loadNotes=!h.noteExhausted; - if(loadRuns){h.runs=this._wfMergeEntries(h.runs,freshRuns,r=>String(r&&r.runId||''));h.nextRunCursor=String(json.nextRunCursor||'');if(!h.nextRunCursor||h.nextRunCursor===oldRunCursor)h.runExhausted=true;} + if(loadRuns){h.runs=this._wfMergeEntries(h.runs,freshRuns,r=>String(r&&r.rootId||''));h.nextRunCursor=String(json.nextRootCursor||'');if(!h.nextRunCursor||h.nextRunCursor===oldRunCursor)h.runExhausted=true;} if(loadNotes){h.notes=this._wfMergeEntries(h.notes,freshNotes,n=>String(n&&n.id||''));h.nextNoteCursor=String(json.nextNoteCursor||'');if(!h.nextNoteCursor||h.nextNoteCursor===oldNoteCursor)h.noteExhausted=true;} }else{ // Polls replace overlapping recent entries while retaining the older cursor window. - h.runs=this._wfMergeEntries(freshRuns,h.runs,r=>String(r&&r.runId||''));h.notes=this._wfMergeEntries(freshNotes,h.notes,n=>String(n&&n.id||'')); + h.runs=this._wfMergeEntries(freshRuns,h.runs,r=>String(r&&r.rootId||''));h.notes=this._wfMergeEntries(freshNotes,h.notes,n=>String(n&&n.id||'')); } - h.data=Object.assign({},h.data||{},json,{runs:h.runs,notes:h.notes,nextRunCursor:h.nextRunCursor,nextNoteCursor:h.nextNoteCursor,truncated:!(h.runExhausted&&h.noteExhausted)});return h.data; + h.data=Object.assign({},h.data||{},json,{roots:h.runs,notes:h.notes,nextRootCursor:h.nextRunCursor,nextNoteCursor:h.nextNoteCursor,truncated:!(h.runExhausted&&h.noteExhausted)});return h.data; } _wfCaptureAnchor(scroll) { if(!scroll)return null;const root=scroll.getBoundingClientRect(),entries=Array.from(scroll.querySelectorAll('[data-wf-entry-key]')); @@ -1178,9 +1182,9 @@ _wfLoadEarlier(source,label) { const h=label&&this._wfHistory(label);if(!h||label!==this._workflowLabel||h.inFlight||this._workflowDetailLoading||(h.runExhausted&&h.noteExhausted)||(source==='auto'&&h.autoBatches>=10))return; h.inFlight=true;if(source==='auto')h.autoBatches++;this._wfDisconnectHistoryObserver();const button=this._workflowRoot&&this._workflowRoot.querySelector('#wf-load-earlier');if(button){button.disabled=true;button.textContent='loading earlier…';} - const params=new URLSearchParams({maxRuns:'4',maxNotes:'8'});if(h.nextRunCursor)params.set('runCursor',h.nextRunCursor);if(h.nextNoteCursor)params.set('noteCursor',h.nextNoteCursor);const token=this._workflowNavToken||0; - fetch('/api/workflow/'+encodeURIComponent(label)+'?'+params.toString(),{cache:'no-store'}).then(r=>r.ok?r.json():r.text().then(t=>Promise.reject(new Error(t.trim()||('HTTP '+r.status))))) - .then(json=>{if(token!==this._workflowNavToken||label!==this._workflowLabel){h.inFlight=false;return;}const responseLabel=json&&json.summary&&json.summary.label;if(responseLabel&&responseLabel!==label)throw new Error('workflow response label mismatch');h.inFlight=false;this._workflowData=this._wfApplyWorkflowPage(label,json,'history');this.renderWorkflow(this._workflowData);}) + const params=new URLSearchParams({maxRoots:'4',maxNotes:'8'});if(h.nextRunCursor)params.set('rootCursor',h.nextRunCursor);if(h.nextNoteCursor)params.set('noteCursor',h.nextNoteCursor);const token=this._workflowNavToken||0; + fetch('/api/campaign/'+encodeURIComponent(label)+'?'+params.toString(),{cache:'no-store'}).then(r=>r.ok?r.json():r.text().then(t=>Promise.reject(new Error(t.trim()||('HTTP '+r.status))))) + .then(json=>{if(token!==this._workflowNavToken||label!==this._workflowLabel){h.inFlight=false;return;}const responseLabel=json&&json.summary&&json.summary.label;if(responseLabel&&responseLabel!==label)throw new Error('campaign response label mismatch');h.inFlight=false;this._workflowData=this._wfApplyWorkflowPage(label,json,'history');this.renderWorkflow(this._workflowData);}) .catch(()=>{h.inFlight=false;if(token===this._workflowNavToken&&label===this._workflowLabel){const retry=this._workflowRoot.querySelector('#wf-load-earlier');if(retry){retry.disabled=false;retry.textContent='load earlier failed · retry ↓';}this._wfSetupHistoryObserver();}}); } @@ -1191,14 +1195,14 @@ const token=isPoll?(this._workflowNavToken||0):((this._workflowNavToken||0)+1); if(!isPoll)this._workflowNavToken=token; this._workflowIndexLoading=true; - fetch('/api/workflows',{cache:'no-store'}).then(r=>r.ok?r.json():r.text().then(t=>Promise.reject(new Error(t.trim()||('HTTP '+r.status))))) + fetch('/api/campaigns',{cache:'no-store'}).then(r=>r.ok?r.json():r.text().then(t=>Promise.reject(new Error(t.trim()||('HTTP '+r.status))))) .then(json=>{ if(token!==this._workflowNavToken||this._workflowLabel)return; const entries=Array.isArray(json)?json:[]; this._workflowIndexData=entries; this._navApplyWorkflows(entries); this.renderWorkflowIndex(entries); }) .catch(()=>{ if(token===this._workflowNavToken&&!this._workflowLabel&&!this._workflowIndexData)this.renderWorkflowIndexError(); }) .finally(()=>{this._workflowIndexLoading=false;}); } renderWorkflowIndexLoading() { this._wfShowIndex(); this._workflowRoot.querySelector('#wfi-summary').textContent='loading'; this._workflowRoot.querySelector('#wfi-content').innerHTML='
'+Array.from({length:7},()=>'
').join('')+'
'; } renderWorkflowIndexError() { this._wfShowIndex(); this._workflowRoot.querySelector('#wfi-summary').textContent='0 in range'; this._workflowRoot.querySelector('#wfi-content').innerHTML=this._wfEmptyIndexHTML(); } - _wfEmptyIndexHTML() { return '
☷
No workflows yet
Every run joins a workflow. Label one to start a campaign - unlabeled runs stay on the Jobs page.
gitmoot run <prompt> --workflow fable/my-campaign
'; } + _wfEmptyIndexHTML() { return '
☷
No campaigns yet
Label a run to start a campaign - unlabeled runs stay on the Runs page.
gitmoot ask <reviewer> <question> --campaign fable/my-campaign
'; } _wfSyncIndexControls(entries) { const namespaces=Array.from(new Set(entries.map(w=>w.namespace||this._wfSplitLabel(w.label).namespace).filter(Boolean))).sort(); const repos=Array.from(new Set(entries.flatMap(w=>Array.isArray(w.repos)?w.repos:[]).filter(Boolean))).sort(); @@ -1214,19 +1218,19 @@ const coordText=(coord.author||'coordinator')+(coord.session_id?' · sess '+coord.session_id:''); const summary=w.summary?'
'+this._wfEsc(w.summary)+'
':''; const note=state==='stalled'&&w.last_note?'
last note · '+this._wfEsc(w.last_note)+'
':''; - return '
'+this._wfLabelHTML(w.label)+'
'+summary+'
'+this._wfEsc(coordText)+'
'+note+'
'+this._wfOutcomeHTML(c)+'
'+this._wfNum(c.jobs)+' jobs · '+this._wfNum(c.notes)+' notes · '+this._wfNum(tokens)+' tok
'+this._wfEsc(state==='stalled'?this._wfDuration(w.stalled_for_s):this._wfSpan(w.first_at,w.last_at))+'
'+this._wfEsc(this._wfDate(w.first_at,true))+(w.first_at!==w.last_at?' → '+this._wfEsc(state==='active'?'now':this._wfDate(w.last_at,true)):'')+'
'; + return '
'+this._wfLabelHTML(w.label)+'
'+summary+'
'+this._wfEsc(coordText)+'
'+note+'
'+this._wfOutcomeHTML(c)+'
'+this._wfNum(c.runs)+' runs · '+this._wfNum(c.notes)+' notes · '+this._wfNum(tokens)+' tok
'+this._wfEsc(state==='stalled'?this._wfDuration(w.stalled_for_s):this._wfSpan(w.first_at,w.last_at))+'
'+this._wfEsc(this._wfDate(w.first_at,true))+(w.first_at!==w.last_at?' → '+this._wfEsc(state==='active'?'now':this._wfDate(w.last_at,true)):'')+'
'; } renderWorkflowIndex(entries) { if(!this._workflowRoot)return; this._wfShowIndex(); entries=Array.isArray(entries)?entries:[]; this._wfSyncIndexControls(entries); const scroll=this._workflowRoot.querySelector('#wfi-scroll'),top=scroll.scrollTop,q=String(this._workflowFilters.query||'').trim().toLowerCase(),ns=this._workflowFilters.namespace||'all',repo=this._workflowFilters.repo||'all'; const days=this._workflowFilters.range==='all'?0:Number(this._workflowFilters.range||14),cutoff=days?Date.now()-days*86400000:0; const older=entries.filter(w=>w.state==='settled'&&cutoff&&Number(w.last_at||0){const split=this._wfSplitLabel(w.label),namespace=w.namespace||split.namespace;if(ns!=='all'&&namespace!==ns)return false;if(repo!=='all'&&!(Array.isArray(w.repos)&&w.repos.includes(repo)))return false;if(w.state==='settled'&&cutoff&&Number(w.last_at||0){const split=this._wfSplitLabel(w.label),namespace=w.namespace||split.namespace;if(ns!=='all'&&namespace!==ns)return false;if(repo!=='all'&&!(Array.isArray(w.repos)&&w.repos.includes(repo)))return false;if(w.state==='settled'&&cutoff&&Number(w.last_at||0)w.state==='stalled'),active=shown.filter(w=>w.state==='active'),recent=shown.filter(w=>w.state==='recent'),settled=shown.filter(w=>w.state==='settled'); this._workflowRoot.querySelector('#wfi-summary').textContent=shown.length+' in range · '+active.length+' active · '+stalled.length+' stalled'; const group=(items,state,title)=>items.length?'
'+title+''+items.length+'
'+items.map(w=>this._wfIndexRow(w)).join('')+'
':''; - let html=!entries.length?this._wfEmptyIndexHTML():!shown.length?'
No workflows match these filters
Clear the search or widen the namespace, repo, or time range.
':group(stalled,'stalled','Stalled · needs a look')+group(active,'active','Active · running now')+group(recent,'recent','Recent · no work in flight')+group(settled,'settled','Settled · last '+(days?days+'d':'all')); - if(shown.length&&older)html+='
+ '+older+' older workflow'+(older===1?'':'s')+' · widen the range to view
'; + let html=!entries.length?this._wfEmptyIndexHTML():!shown.length?'
No campaigns match these filters
Clear the search or widen the namespace, repo, or time range.
':group(stalled,'stalled','Stalled · needs a look')+group(active,'active','Active · running now')+group(recent,'recent','Recent · no work in flight')+group(settled,'settled','Settled · last '+(days?days+'d':'all')); + if(shown.length&&older)html+='
+ '+older+' older campaign'+(older===1?'':'s')+' · widen the range to view
'; this._workflowRoot.querySelector('#wfi-content').innerHTML=html; scroll.scrollTop=top; } @@ -1240,14 +1244,14 @@ } const token=this._workflowNavToken||0; this._workflowDetailLoading=true; - fetch('/api/workflow/'+encodeURIComponent(label)+'?maxRuns=4&maxNotes=8',{cache:'no-store'}) + fetch('/api/campaign/'+encodeURIComponent(label)+'?maxRoots=4&maxNotes=8',{cache:'no-store'}) .then(r=>r.ok?r.json():r.text().then(t=>Promise.reject(new Error(t.trim()||('HTTP '+r.status))))) .then(json=>{ if(token!==this._workflowNavToken||label!==this._workflowLabel)return; const responseLabel=json&&json.summary&&json.summary.label; - if(responseLabel&&responseLabel!==label)throw new Error('workflow response label mismatch'); + if(responseLabel&&responseLabel!==label)throw new Error('campaign response label mismatch'); this._workflowData=this._wfApplyWorkflowPage(label,json||{summary:{label:label},runs:[],notes:[]},history&&history.loaded?'poll':'initial'); - if(!Object.keys(this._workflowExpanded||{}).length){const runs=this._workflowData.runs||[],open=runs.find(r=>r.state==='running')||runs[0];if(open&&open.runId)this._workflowExpanded[open.runId]=true;} + if(!Object.keys(this._workflowExpanded||{}).length){const runs=this._workflowData.roots||[],open=runs.find(r=>r.state==='running')||runs[0];if(open&&open.rootId)this._workflowExpanded[open.rootId]=true;} this.renderWorkflow(this._workflowData); }) .catch(err=>{if(token===this._workflowNavToken&&label===this._workflowLabel&&(!isPoll||!this._workflowData))this.renderWorkflowError(label,err);}) @@ -1255,26 +1259,26 @@ } renderWorkflowLoading(label) { this._wfShowDetail(); const p=this._wfSplitLabel(label); - this._workflowRoot.querySelector('#wfd-content').innerHTML='
'+(p.namespace?''+this._wfEsc(p.namespace)+'/':'')+this._wfEsc(p.campaign)+'
'; + this._workflowRoot.querySelector('#wfd-content').innerHTML='
'+(p.namespace?''+this._wfEsc(p.namespace)+'/':'')+this._wfEsc(p.campaign)+'
'; } renderWorkflowError(label,err) { this._workflowData=null; - this._workflowRoot.querySelector('#wfd-content').innerHTML='
'+this._wfLabelHTML(label)+'
Workflow unavailable
'+this._wfEsc(err&&err.message?err.message:'workflow unavailable')+'
'; + this._workflowRoot.querySelector('#wfd-content').innerHTML='
'+this._wfLabelHTML(label)+'
Campaign unavailable
'+this._wfEsc(err&&err.message?err.message:'campaign unavailable')+'
'; } _wfRunShape(run) { run=run||{}; const nodes=Array.isArray(run.nodes)?run.nodes:[],by={};nodes.forEach(n=>{by[n.id]=n;}); const root=nodes.find(n=>!n.parentId||!by[n.parentId])||nodes[0]||{}; let children=Array.isArray(run.children)?run.children:[]; - if(!children.length&&nodes.length>1)children=nodes.filter(n=>n!==root).map(n=>({id:n.id,action:String(n.title||'').split(':')[0]||'job',agent:n.agent||'',runtime:n.runtime||'',state:n.state||'queued',elapsed_s:n.startedAt?Math.max(0,Number(n.endedAt||Date.now())-Number(n.startedAt))/1000:0})); + if(!children.length&&nodes.length>1)children=nodes.filter(n=>n!==root).map(n=>({id:n.id,action:String(n.title||'').split(':')[0]||'run',reviewer:n.reviewer||'',runtime:n.runtime||'',state:n.state||'queued',elapsed_s:n.startedAt?Math.max(0,Number(n.endedAt||Date.now())-Number(n.startedAt))/1000:0})); const started=Number(run.started_at||run.startedAt||root.startedAt||0),ended=Number(run.ended_at||run.endedAt||root.endedAt||0),state=run.state||root.state||'queued'; - return {id:run.runId||root.id||'',title:run.title||root.title||run.runId||'run',agent:run.agent||root.agent||'',runtime:run.runtime||root.runtime||'',repo:run.repo||'',state:state,started:started,ended:ended,elapsed:Number(run.elapsed_s||run.elapsedS||(started?Math.max(0,(ended||Date.now())-started)/1000:0)),children:children}; + return {id:run.rootId||root.id||'',title:run.title||root.title||run.rootId||'run',reviewer:run.reviewer||root.reviewer||'',runtime:run.runtime||root.runtime||'',repo:run.repo||'',state:state,started:started,ended:ended,elapsed:Number(run.elapsed_s||run.elapsedS||(started?Math.max(0,(ended||Date.now())-started)/1000:0)),children:children}; } _wfStatusGlyph(state){return({running:'●',succeeded:'✓',failed:'✗',blocked:'⚑',queued:'·',cancelled:'×'})[state]||'·';} _wfRuntime(runtime){runtime=String(runtime||'').toLowerCase();return runtime==='claude'||runtime==='codex'||runtime==='kimi'?runtime:'shell';} _wfTimelineRun(run) { const r=this._wfRunShape(run),open=!!this._workflowExpanded[r.id]; - const children=open&&r.children.length?'
'+r.children.map(c=>{const state=c.state||'queued';return '
'+this._wfEsc(c.action||'job')+''+this._wfEsc(c.agent||'agent')+''+this._wfEsc(state)+''+this._wfEsc(c.elapsed_s?this._wfDuration(c.elapsed_s):'-')+'
';}).join('')+'
':''; - return '
'+this._wfStatusGlyph(r.state)+'
▸'+this._wfEsc(r.title)+''+this._wfEsc(r.state==='succeeded'?'done':r.state)+''+this._wfEsc(this._wfDuration(r.elapsed))+'
'+this._wfEsc(r.agent||'agent')+''+this._wfEsc(r.repo||'repository')+'
'+children+'
'; + const children=open&&r.children.length?'
'+r.children.map(c=>{const state=c.state||'queued';return '
'+this._wfEsc(c.action||'run')+''+this._wfEsc(c.reviewer||'-')+''+this._wfEsc(state)+''+this._wfEsc(c.elapsed_s?this._wfDuration(c.elapsed_s):'-')+'
';}).join('')+'
':''; + return '
'+this._wfStatusGlyph(r.state)+'
▸'+this._wfEsc(r.title)+''+this._wfEsc(r.state==='succeeded'?'done':r.state)+''+this._wfEsc(this._wfDuration(r.elapsed))+'
'+this._wfEsc(r.reviewer||'-')+''+this._wfEsc(r.repo||'repository')+'
'+children+'
'; } _wfTimelineNote(note) { const id=String(note.id),open=!!this._workflowExpanded['note:'+id]; @@ -1282,13 +1286,13 @@ } renderWorkflow(data) { if(!this._workflowRoot)return; this._wfShowDetail();data=data||{}; - const sum=data.summary||{},label=sum.label||this._workflowLabel||'',runs=Array.isArray(data.runs)?data.runs:[],notes=Array.isArray(data.notes)?data.notes:[],state=data.state||((sum.running||sum.queued)?'active':'settled'),coord=data.coordinator||{},split=this._wfSplitLabel(label); + const sum=data.summary||{},label=sum.label||this._workflowLabel||'',runs=Array.isArray(data.roots)?data.roots:[],notes=Array.isArray(data.notes)?data.notes:[],state=data.state||((sum.running||sum.queued)?'active':'settled'),coord=data.coordinator||{},split=this._wfSplitLabel(label); const scroll=this._workflowRoot.querySelector('#wfd-scroll'),anchor=this._wfCaptureAnchor(scroll),tokensIn=Number(sum.tokensIn||0),tokensOut=Number(sum.tokensOut||0); const labelHTML=(split.namespace?''+this._wfEsc(split.namespace)+'/':'')+this._wfEsc(split.campaign); const titleHTML=sum.summary?'
'+labelHTML+'
'+this._wfEsc(sum.summary)+'
':'
'+labelHTML+'
'; const outcome=this._wfOutcomeHTML({running:sum.running,queued:sum.queued,succeeded:sum.succeeded,failed:sum.failed,blocked:sum.blocked})||'-'; const coordHTML='
coordinator'+this._wfEsc(coord.author||'unattended')+'· pane '+this._wfEsc(coord.pane||'-')+'· sess '+this._wfEsc(coord.session_id||'-')+''+(coord.session_id?'':'')+'
'; - const stats='
'+this._wfNum(sum.jobs||0)+'jobs
'+outcome+'outcomes
'+this._wfNum(tokensIn)+' in'+this._wfNum(tokensOut)+' out · tokens
'+this._wfNum(sum.notes||notes.length)+'journal notes
'+this._wfSpan(sum.firstAt,sum.lastAt)+''+this._wfDate(sum.firstAt)+' → '+(state==='active'?'now':this._wfDate(sum.lastAt))+'
'; + const stats='
'+this._wfNum(sum.runs||0)+'runs
'+outcome+'outcomes
'+this._wfNum(tokensIn)+' in'+this._wfNum(tokensOut)+' out · tokens
'+this._wfNum(sum.notes||notes.length)+'journal notes
'+this._wfSpan(sum.firstAt,sum.lastAt)+''+this._wfDate(sum.firstAt)+' → '+(state==='active'?'now':this._wfDate(sum.lastAt))+'
'; let stalled=''; if(state==='stalled'){ const failed=runs.map(r=>this._wfRunShape(r)).find(r=>r.state==='failed'||r.state==='blocked'),latest=notes.slice().sort((a,b)=>Number(b.createdAt||0)-Number(a.createdAt||0))[0],resume='cd '+(data.work_dir||'/root/gitmoot')+' && claude --resume '+(coord.session_id||''); @@ -1297,7 +1301,7 @@ const items=[];runs.forEach(run=>{const r=this._wfRunShape(run);items.push({kind:'run',at:r.state==='running'?Date.now():(r.ended||r.started||0),id:r.id,value:run});});notes.forEach(note=>items.push({kind:'note',at:Number(note.createdAt||0),id:String(note.id),value:note}));items.sort((a,b)=>(b.at-a.at)||String(b.id).localeCompare(String(a.id))); const history=this._wfHistory(label),hasEarlier=!(history.runExhausted&&history.noteExhausted); const timeline=!items.length?'
☷
Mission log reserved
The first run dispatched under this label opens the mission log here.
':'
Mission logjournal + run trees · newest first'+(state==='active'?'● live':'')+'
'+items.map(item=>item.kind==='run'?this._wfTimelineRun(item.value):this._wfTimelineNote(item.value)).join('')+(hasEarlier?'':'')+'
'; - this._workflowRoot.querySelector('#wfd-content').innerHTML='
'+titleHTML+'● '+this._wfEsc(state==='empty'?'reserved':state)+''+coordHTML+'
'+stats+stalled+timeline; + this._workflowRoot.querySelector('#wfd-content').innerHTML='
'+titleHTML+'● '+this._wfEsc(state==='empty'?'reserved':state)+''+coordHTML+'
'+stats+stalled+timeline; this._wfRestoreAnchor(scroll,anchor);this._wfSetupHistoryObserver(); } @@ -1415,7 +1419,7 @@ '
summoning the galaxy…
', '
', '
gitmoot·galaxy
', - '
job graph · force-directed
', + '
run graph · force-directed
', '
showing 0 nodes / 0 links
', '
', '
', @@ -1425,8 +1429,8 @@ '
', '
nodes
', '
repo hub
', - '
agent hub
', - '
job state
', + '
reviewer hub
', + '
run state
', '
succeeded
', '
running
', '
failed
', @@ -1484,13 +1488,13 @@ buildGalaxyGraph() { if (this._galaxyGraph) return; // guard: only ever mount one ForceGraph instance - const nodeColor = (n) => n.type === 'repo' ? '#7dcfff' : n.type === 'agent' ? '#bb9af7' : n.type === 'workflow' ? '#2dd4bf' : this._galaxyStateColor(n.state); - const nodeRadius = (n) => n.type === 'repo' ? 8.5 : n.type === 'workflow' ? 7.0 : n.type === 'agent' ? 4.6 : 3.0; + const nodeColor = (n) => n.type === 'repo' ? '#7dcfff' : n.type === 'reviewer' ? '#bb9af7' : n.type === 'campaign' ? '#2dd4bf' : this._galaxyStateColor(n.state); + const nodeRadius = (n) => n.type === 'repo' ? 8.5 : n.type === 'campaign' ? 7.0 : n.type === 'reviewer' ? 4.6 : 3.0; const linkStyle = (kind) => { switch (kind) { case 'repo': return { color:'#7dcfff', alpha:0.16, width:0.5 }; - case 'agent': return { color:'#bb9af7', alpha:0.13, width:0.5 }; - case 'workflow': return { color:'#2dd4bf', alpha:0.10, width:0.45 }; + case 'reviewer': return { color:'#bb9af7', alpha:0.13, width:0.5 }; + case 'campaign': return { color:'#2dd4bf', alpha:0.10, width:0.45 }; case 'dep': return { color:'#a0a8dc', alpha:0.55, width:0.9 }; default: return { color:'#a0a8dc', alpha:0.35, width:0.7 }; } @@ -1501,15 +1505,15 @@ const tooltip = (n) => { let parts = '
' + esc(n.label || n.id) + '
'; if (n.type === 'repo') parts += '
type repo hub
'; - else if (n.type === 'agent') parts += '
type agent hub
'; - else if (n.type === 'workflow') { - parts += '
type workflow hub
'; - parts += '
jobs ' + esc(n.jobCount || 0) + ' · notes ' + esc(n.noteCount || 0) + '
'; + else if (n.type === 'reviewer') parts += '
type reviewer hub
'; + else if (n.type === 'campaign') { + parts += '
type campaign hub
'; + parts += '
runs ' + esc(n.runCount || 0) + ' · notes ' + esc(n.noteCount || 0) + '
'; parts += '
tokens ' + esc((n.tokensIn || 0).toLocaleString('en-US')) + ' in · ' + esc((n.tokensOut || 0).toLocaleString('en-US')) + ' out
'; } else { - parts += '
type job · state ' + esc(n.state) + '
'; - parts += '
agent ' + esc(n.agent) + '
'; + parts += '
type run · state ' + esc(n.state) + '
'; + parts += '
reviewer ' + esc(n.reviewer) + '
'; parts += '
repo ' + esc(n.repo) + '
'; } return parts; @@ -1535,7 +1539,7 @@ } let r = nodeRadius(n); const col = nodeColor(n); // Feature 3: running job nodes breathe (needs continuous redraw — provided by particles). - const isRun = n.type === 'job' && n.state === 'running'; + const isRun = n.type === 'run' && n.state === 'running'; let pulse = 1; // FIX-2: only apply the time-varying pulse when the data actually has a running // job — otherwise a static (all-historical) graph produces identical frames and @@ -1549,7 +1553,7 @@ // additive 'lighter' blend is set ONCE per frame in onRenderFramePre/Post below. // Only touch per-element state (fillStyle/globalAlpha), and shadowBlur solely // for the small-graph glow path (reset to 0 right after the glow fill). - let blur = this._galaxyBig ? 0 : (n.type === 'repo' ? 26 : n.type === 'workflow' ? 20 : n.type === 'agent' ? 15 : 9); + let blur = this._galaxyBig ? 0 : (n.type === 'repo' ? 26 : n.type === 'campaign' ? 20 : n.type === 'reviewer' ? 15 : 9); if (isRun) blur = (this._galaxyBig ? 16 : 20) * (0.6 + 0.7 * pulse); if (hi) blur = Math.max(blur, this._galaxyBig ? 8 : 16); // BEACON BLOOM: a big, soft, pulsing halo around each running node — floored to a @@ -1570,9 +1574,9 @@ ctx.beginPath(); ctx.arc(n.x, n.y, r + 1.6, 0, 2 * Math.PI); ctx.strokeStyle = col; ctx.lineWidth = 0.9; ctx.globalAlpha = 0.9; ctx.stroke(); } - if (n.type !== 'job' && scale > 1.5) { + if (n.type !== 'run' && scale > 1.5) { ctx.globalAlpha = Math.min(1, (scale - 1.5) / 1.2) * dim; - ctx.font = (n.type === 'repo' || n.type === 'workflow' ? '600 ' : '500 ') + (n.type === 'repo' ? 4.4 : n.type === 'workflow' ? 4.0 : 3.4) + "px 'Space Grotesk',sans-serif"; + ctx.font = (n.type === 'repo' || n.type === 'campaign' ? '600 ' : '500 ') + (n.type === 'repo' ? 4.4 : n.type === 'campaign' ? 4.0 : 3.4) + "px 'Space Grotesk',sans-serif"; ctx.fillStyle = col; ctx.textAlign = 'center'; ctx.textBaseline = 'top'; const txt = n.type === 'repo' ? (n.label || '').split('/').pop() : n.label; ctx.fillText(txt || '', n.x, n.y + r + 1.5); @@ -1844,7 +1848,7 @@ // Coarse pointers (touch) get a 1.4x larger hit radius per node type — fingers // are less precise than a mouse. const boost = this._coarsePointer ? 1.4 : 1; - const thr = (n.type === 'repo' ? 26 : n.type === 'agent' ? 18 : 12) * boost; // hit radius in CSS px + const thr = (n.type === 'repo' ? 26 : n.type === 'reviewer' ? 18 : 12) * boost; // hit radius in CSS px if (d > thr) continue; const score = d / thr; // "how deep inside its own hit-circle" — lets hubs win near centre if (score < bestScore) { bestScore = score; best = n; } @@ -1879,7 +1883,7 @@ if (!G.d3Force('link') && saved.link) G.d3Force('link', saved.link); if (!G.d3Force('center') && saved.center) G.d3Force('center', saved.center); G.d3Force('charge').strength(-70).distanceMax(360); - G.d3Force('link').distance((l) => l.kind === 'repo' ? 26 : l.kind === 'workflow' ? 30 : l.kind === 'agent' ? 22 : 18).strength((l) => l.kind === 'workflow' ? 0.2 : 0.5); + G.d3Force('link').distance((l) => l.kind === 'repo' ? 26 : l.kind === 'campaign' ? 30 : l.kind === 'reviewer' ? 22 : 18).strength((l) => l.kind === 'campaign' ? 0.2 : 0.5); } catch (e) {} } @@ -1915,9 +1919,9 @@ if (!this._galaxyGraph) return; const raw = this._galaxyRaw || { nodes: [], links: [] }; // fresh clones so force-graph can mutate x/y and resolve source/target refs - const nodes = (raw.nodes || []).map(n => ({ id: n.id, type: n.type, label: n.label, state: n.state, agent: n.agent, repo: n.repo, run: n.run, jobCount: n.jobCount, noteCount: n.noteCount, tokensIn: n.tokensIn, tokensOut: n.tokensOut })); + const nodes = (raw.nodes || []).map(n => ({ id: n.id, type: n.type, label: n.label, state: n.state, reviewer: n.reviewer, repo: n.repo, root: n.root, runCount: n.runCount, noteCount: n.noteCount, tokensIn: n.tokensIn, tokensOut: n.tokensOut })); const links = (raw.links || []).map(l => ({ source: (l.source && l.source.id) || l.source, target: (l.target && l.target.id) || l.target, kind: l.kind })); - this.syncGalaxyWorkflowLegend(nodes.some(n => n.type === 'workflow')); + this.syncGalaxyWorkflowLegend(nodes.some(n => n.type === 'campaign')); // FIX-4: the legacy prefix is byte-identical to the original counts + id:state // signature. Workflow rollups and workflow-link identity live in an optional suffix, // which is exactly empty for legacy payloads. Equal-count workflow rewires therefore @@ -1977,7 +1981,7 @@ // FIX-2: does the current data have any running job? Drives the time-varying pulse // in nodeCanvasObject — when false, running-node draws use no Date.now() term so a // static graph renders identical frames and the loop can idle. - this._galaxyHasRunning = nodes.some(n => n.type === 'job' && n.state === 'running'); + this._galaxyHasRunning = nodes.some(n => n.type === 'run' && n.state === 'running'); // Only fit on first load / repo-filter change — never on a poll refresh (Feature 4). // FIX-A: a fresh (non-poll) layout starts a new settle, so un-pin: _galaxyWake must // not reheat until this settle completes & onEngineStop re-pins (else continuous mouse @@ -2020,13 +2024,13 @@ }; for (let i = 0; i < nodes.length; i++) { const n = nodes[i]; - if (n.type !== 'workflow') continue; + if (n.type !== 'campaign') continue; workflowNodes++; - addWorkflow('n:' + (n.id || '') + ':' + (n.jobCount || 0) + ':' + (n.noteCount || 0) + ':' + (n.tokensIn || 0) + ':' + (n.tokensOut || 0)); + addWorkflow('n:' + (n.id || '') + ':' + (n.runCount || 0) + ':' + (n.noteCount || 0) + ':' + (n.tokensIn || 0) + ':' + (n.tokensOut || 0)); } for (let i = 0; i < links.length; i++) { const l = links[i]; - if (l.kind !== 'workflow') continue; + if (l.kind !== 'campaign') continue; workflowLinks++; const source = (l.source && l.source.id) || l.source || ''; const target = (l.target && l.target.id) || l.target || ''; @@ -2059,7 +2063,7 @@ row = document.createElement('div'); row.id = 'g-workflow-legend'; row.className = 'row'; - row.innerHTML = 'workflow hub'; + row.innerHTML = 'campaign hub'; grp.appendChild(row); } @@ -2083,7 +2087,7 @@ openGalaxyDetail(node) { if (!node) { this.closeGalaxyDetail(); return; } - if (node.type === 'workflow') { + if (node.type === 'campaign') { this.closeGalaxyDetail(); this.showWorkflow(node.label || String(node.id || '').replace(/^workflow::/, '')); return; @@ -2102,19 +2106,19 @@ // the panel DOM/fetch below don't depend on the render loop). if (this._galaxyWake) this._galaxyWake(); - if (node.type === 'agent') { this.loadGalaxyAgentDetail(node); return; } + if (node.type === 'reviewer') { this.loadGalaxyAgentDetail(node); return; } if (node.type === 'repo') { this.renderGalaxyHubDetail(node); return; } // job node -> fetch full detail. this.renderGalaxyJobDetail(node, null, 'loading'); const fid = (this._galaxyDetailFetchId = node.id); - fetch('/api/job/' + encodeURIComponent(node.id), { cache: 'no-store' }) + fetch('/api/run/' + encodeURIComponent(node.id), { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(job => { if (this._galaxyDetailFetchId === fid) this.renderGalaxyJobDetail(node, job || {}, 'ok'); }) .catch(() => { if (this._galaxyDetailFetchId === fid) this.renderGalaxyJobDetail(node, null, 'error'); }); } _galaxyAgentName(node) { - return String((node && (node.agent || node.label)) || (node && node.id) || '').replace(/^agent::/, ''); + return String((node && (node.reviewer || node.label)) || (node && node.id) || '').replace(/^agent::/, ''); } _galaxyFetchJSON(url) { @@ -2129,7 +2133,7 @@ _galaxyAgentSummaries() { if (Array.isArray(this._agentsData)) return Promise.resolve(this._agentsData); if (this._galaxyAgentsFetch) return this._galaxyAgentsFetch; - this._galaxyAgentsFetch = this._galaxyFetchJSON('/api/agents').then(json => { + this._galaxyAgentsFetch = this._galaxyFetchJSON('/api/reviewers').then(json => { this._agentsData = Array.isArray(json) ? json : []; this._agentsLoaded = true; return this._agentsData; @@ -2141,7 +2145,7 @@ if (!this._galaxyAgentDetails) this._galaxyAgentDetails = {}; if (Object.prototype.hasOwnProperty.call(this._galaxyAgentDetails, name)) return Promise.resolve(this._galaxyAgentDetails[name]); if (this._agDetailName === name && this._agDetailStatus === 'ok') return Promise.resolve(this._agDetail || null); - return this._galaxyFetchJSON('/api/agent/' + encodeURIComponent(name)).then(detail => { + return this._galaxyFetchJSON('/api/reviewer/' + encodeURIComponent(name)).then(detail => { this._galaxyAgentDetails[name] = detail || null; return this._galaxyAgentDetails[name]; }); @@ -2150,7 +2154,7 @@ _galaxyAgentJobs() { if (Array.isArray(this._agAllJobs) && Date.now() - (this._agAllJobsAt || 0) < 10000) return Promise.resolve(this._agAllJobs); if (this._galaxyAgentJobsFetch) return this._galaxyAgentJobsFetch; - this._galaxyAgentJobsFetch = this._galaxyFetchJSON('/api/jobs').then(json => { + this._galaxyAgentJobsFetch = this._galaxyFetchJSON('/api/runs').then(json => { this._agAllJobs = Array.isArray(json) ? json : []; this._agAllJobsAt = Date.now(); return this._agAllJobs; @@ -2202,7 +2206,7 @@ const end = new Date(start); end.setDate(end.getDate() + 1); const today = jobs.filter(j => { const at = Number((j && (j.started || j.updated)) || 0); - return j && j.agent === name && at >= start.getTime() && at < end.getTime(); + return j && j.reviewer === name && at >= start.getTime() && at < end.getTime(); }); const hasTokens = today.some(j => Object.prototype.hasOwnProperty.call(j, 'tokensIn') || Object.prototype.hasOwnProperty.call(j, 'tokensOut')); return { @@ -2233,12 +2237,12 @@ '' + esc(liveLabel) + '
'; if (status === 'loading') { - this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'agent', color: '#8b90b8', headerMeta: '', body: '
Loading agent record…
' }); + this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'reviewer', color: '#8b90b8', headerMeta: '', body: '
Loading reviewer record…
' }); return; } if (status === 'error') { const failure = loadError && loadError.status ? ('HTTP ' + loadError.status) : 'network error'; - this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'agent', color: '#8b90b8', headerMeta: '', body: '
Could not load agent record (' + esc(failure) + ')
' }); + this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'reviewer', color: '#8b90b8', headerMeta: '', body: '
Could not load reviewer record (' + esc(failure) + ')
' }); return; } @@ -2246,20 +2250,20 @@ try { const set = this._galaxyAdj && this._galaxyAdj.neighbors[node.id]; connected = set ? set.size : 0; } catch (e) {} const today = this._galaxyAgentToday(jobs, name); const tokenFmt = (n) => n > 0 ? this._fmtTokens(n) : '0'; - let stats = '
' + connected + 'connected jobs
'; + let stats = '
' + connected + 'connected runs
'; if (today) { stats += '
' + today.succeeded + 'succeeded today
' + '
' + today.failed + 'failed today
'; if (today.hasTokens) stats += '
' + esc(tokenFmt(today.tokensIn)) + ' / ' + esc(tokenFmt(today.tokensOut)) + 'tokens in / out today
'; } - const agentJobs = Array.isArray(jobs) ? jobs.filter(j => j && j.agent === name) : []; + const agentJobs = Array.isArray(jobs) ? jobs.filter(j => j && j.reviewer === name) : []; const lastJobAt = agentJobs.reduce((latest, j) => Math.max(latest, Number(j.updated || j.started) || 0), 0); - const jobsHref = '/jobs?agent=' + encodeURIComponent(name); - const actionHTML = 'Jobs for this agent↗'; + const jobsHref = '/runs?reviewer=' + encodeURIComponent(name); + const actionHTML = 'Runs for this reviewer↗'; if (status === 'unregistered') { const activityHTML = lastJobAt ? '
Profile
last activity' + esc(this._agRelShort(lastJobAt) || 'now') + '
' : ''; - const body = '
Not a registered agent; only its job history remains.
' + + const body = '
Not a registered reviewer; only its run history remains.
' + '
Activity
' + stats + '
' + activityHTML + actionHTML; const el = this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'not registered', color: '#656b91', headerMeta: '', body: body }); const link = el.querySelector('.ga-action'); @@ -2277,7 +2281,7 @@ const body = '
Activity
' + stats + '
' + (rows.length ? '
Profile
' + rows.join('') + '
' : '') + actionHTML; - const el = this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'agent', color: color, headerMeta: headerMeta, body: body }); + const el = this._galaxyPanelShell({ className: 'gd-agent-panel', title: name, subtitle: 'reviewer', color: color, headerMeta: headerMeta, body: body }); const link = el.querySelector('.ga-action'); if (link) link.addEventListener('click', (e) => { e.preventDefault(); this.closeGalaxyDetail(); this.showJobs(name); }); } @@ -2296,17 +2300,17 @@ ' ', '
', '
' + esc(node.label || node.id) + '
', - '
' + (isRepo ? 'repository hub' : 'agent') + '
', + '
' + (isRepo ? 'repository hub' : 'reviewer') + '
', '
', ' ', '
', '
', - ' ' + (isRepo ? 'repository hub' : 'agent') + '', + ' ' + (isRepo ? 'repository hub' : 'reviewer') + '', '
', '
', '
', '
', - '
connected jobs
' + n + '
', + '
connected runs
' + n + '
', '
', '
' ].join(''); @@ -2394,8 +2398,8 @@ // Jobs + Agents pages. Both are body-appended, position:fixed // overlays covering the content area (right of the 216px nav // rail), mirroring the galaxy overlay so the DC runtime's style - // sanitizer never touches them. Data comes from /api/jobs and - // /api/agents, polled every 12s while the respective view is + // sanitizer never touches them. Data comes from /api/runs and + // /api/reviewers, polled every 12s while the respective view is // active. Escaping + state colors reuse _galaxyEsc / // _galaxyStateColor; job detail reuses the galaxy detail layout. // ============================================================ @@ -2903,7 +2907,7 @@ return '
' + sorted.map(e => '
' + this._orgEsc(e.from) + '→' + this._orgEsc(e.to) + '' + this._orgEsc(this._orgCompactAge(e.at)) + '
' + '
' + this._orgEsc(e.question) + '
' + - (e.wf ? '' + this._orgEsc(e.wf) + ' ↗' : '') + + (e.campaign ? '' + this._orgEsc(e.campaign) + ' ↗' : '') + '
' ).join('') + '
'; } @@ -2973,7 +2977,7 @@ if (recycle.remaining) recycleRows.push('
' + this._orgEsc('remaining · ' + recycle.remaining) + '
'); if (recycle.overdue) recycleRows.push('
' + this._orgEsc('overdue · ' + recycle.overdue) + '
'); const activity = (detail && detail.activity) || {}; - const jobs = activity.jobs_today && typeof activity.jobs_today === 'object' ? activity.jobs_today : {}; + const jobs = activity.runs_today && typeof activity.runs_today === 'object' ? activity.runs_today : {}; const jobParts = Object.keys(jobs).sort().map(k => jobs[k] + ' ' + k); const activityRows = []; if (jobParts.length) activityRows.push(jobParts.join(' · ')); @@ -3282,18 +3286,19 @@ root.style.cssText = 'position:fixed;left:216px;top:54px;right:0;bottom:0;z-index:40;background:#07080f;display:none;flex-direction:column;overflow:hidden;font-family:Inter,system-ui,sans-serif;color:#c8cce6'; root.innerHTML = [ '
', - '
Jobs.
', + '
Runs.
', '
showing 0 of 0
', '
', '
', ' ', '
', ' ', ' ', - ' ', + ' ', + ' ', '
', ' ', '
', @@ -3311,16 +3316,19 @@ stSel.addEventListener('change', () => { this._jobsFacetState = stSel.value; this.renderJobsTable(); }); const rpSel = root.querySelector('#jb-repo'); rpSel.addEventListener('change', () => { this._jobsFacetRepo = rpSel.value; this.renderJobsTable(); }); + // Kind = the run's stored type (review | ask | implement | …). + const kdSel = root.querySelector('#jb-kind'); + kdSel.addEventListener('change', () => { this._jobsFacetKind = kdSel.value; this.renderJobsTable(); }); const agSel = root.querySelector('#jb-agent'); - // Keep the URL's ?agent= facet in sync (replaceState, so in-page facet edits + // Keep the URL's ?reviewer= facet in sync (replaceState, so in-page facet edits // don't stack history) — otherwise Back/reload would resurrect a cleared filter. agSel.addEventListener('change', () => { this._jobsFacetAgent = agSel.value; this.renderJobsTable(); this._navRoute('jobs', { agent: this._jobsFacetAgent || undefined }, true); }); root.querySelector('#jb-clear').addEventListener('click', () => { - this._jobsQuery = ''; this._jobsFacetState = ''; this._jobsFacetRepo = ''; this._jobsFacetAgent = ''; - q.value = ''; stSel.value = ''; rpSel.value = ''; agSel.value = ''; + this._jobsQuery = ''; this._jobsFacetState = ''; this._jobsFacetRepo = ''; this._jobsFacetKind = ''; this._jobsFacetAgent = ''; + q.value = ''; stSel.value = ''; rpSel.value = ''; kdSel.value = ''; agSel.value = ''; this.renderJobsTable(); this._navRoute('jobs', { agent: this._jobsFacetAgent || undefined }, true); }); @@ -3344,14 +3352,14 @@ } fetchJobs(isPoll) { - fetch('/api/jobs', { cache: 'no-store' }) + fetch('/api/runs', { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(json => { this._jobsData = Array.isArray(json) ? json : []; this._jobsLoaded = true; this.renderJobs(isPoll); }) .catch(err => { if (isPoll) return; // keep current data on a transient poll failure this._jobsData = this._jobsData || []; this._jobsLoaded = true; const tbl = this._jobsRoot && this._jobsRoot.querySelector('#jb-table'); - if (tbl) tbl.innerHTML = '
could not load /api/jobs (' + this._galaxyEsc(err && err.message) + ')
'; + if (tbl) tbl.innerHTML = '
could not load /api/runs (' + this._galaxyEsc(err && err.message) + ')
'; }); } @@ -3367,7 +3375,7 @@ const sel = this._jobsRoot.querySelector('#' + id); if (!sel) return; const vals = Array.from(new Set(data.map(j => j[key]).filter(Boolean))); - if (cur && vals.indexOf(cur) < 0) vals.push(cur); // keep a preset filter selectable even with 0 jobs + if (cur && vals.indexOf(cur) < 0) vals.push(cur); // keep a preset filter selectable even with 0 runs vals.sort(); const sig = vals.join('|'); if (sel._sig !== sig) { @@ -3381,7 +3389,8 @@ }; build('jb-state', 'state', this._jobsFacetState); build('jb-repo', 'repo', this._jobsFacetRepo); - build('jb-agent', 'agent', this._jobsFacetAgent); + build('jb-kind', 'kind', this._jobsFacetKind); + build('jb-agent', 'reviewer', this._jobsFacetAgent); } renderJobsTable() { @@ -3389,13 +3398,14 @@ const esc = (s) => this._galaxyEsc(s); const data = this._jobsData || []; const q = (this._jobsQuery || '').trim().toLowerCase(); - const fs = this._jobsFacetState || '', fr = this._jobsFacetRepo || '', fa = this._jobsFacetAgent || ''; + const fs = this._jobsFacetState || '', fr = this._jobsFacetRepo || '', fk = this._jobsFacetKind || '', fa = this._jobsFacetAgent || ''; const filtered = data.filter(j => { if (fs && (j.state || '') !== fs) return false; if (fr && (j.repo || '') !== fr) return false; - if (fa && (j.agent || '') !== fa) return false; + if (fk && (j.kind || '') !== fk) return false; + if (fa && (j.reviewer || '') !== fa) return false; if (q) { - const hay = ((j.title || '') + ' ' + (j.agent || '') + ' ' + (j.id || '') + ' ' + (j.repo || '')).toLowerCase(); + const hay = ((j.title || '') + ' ' + (j.reviewer || '') + ' ' + (j.id || '') + ' ' + (j.repo || '')).toLowerCase(); if (hay.indexOf(q) < 0) return false; } return true; @@ -3422,18 +3432,18 @@ if (tbl) { const listHTML = (jobs) => { if (this.state.isMobile) return '
' + jobs.map(j => this._jobsCardHtml(j, esc)).join('') + '
'; - const headCols = ['', 'Title', 'Agent', 'Repo', 'Kind', 'Depth', 'Tokens', 'Started', 'Duration']; + const headCols = ['', 'Title', 'Reviewer', 'Repo', 'Kind', 'Depth', 'Tokens', 'Started', 'Duration']; return '' + headCols.map(h => '').join('') + '' + jobs.map(j => this._jobsRowHtml(j, esc)).join('') + '
' + esc(h) + '
'; }; let html = shown.length ? listHTML(shown) - : '
' + (this._jobsLoaded ? (data.length ? (older.length ? 'No active or recently completed jobs' : 'No jobs match the filters') : 'No jobs yet') : 'loading…') + '
'; + : '
' + (this._jobsLoaded ? (data.length ? (older.length ? 'No active or recently completed runs' : 'No runs match the filters') : 'No runs yet') : 'loading…') + '
'; if (older.length) { - const countLabel = older.length + ' older completed job' + (older.length === 1 ? '' : 's'); + const countLabel = older.length + ' older completed run' + (older.length === 1 ? '' : 's'); html += '
' + - '▸' + older.length + ' older completed job' + (older.length === 1 ? '' : 's') + 'more than 2h ago' + + '▸' + older.length + ' older completed run' + (older.length === 1 ? '' : 's') + 'more than 2h ago' + listHTML(olderShown) + (older.length > CAP ? '
showing first ' + CAP + ' of ' + esc(countLabel) + '
' : '') + '
'; @@ -3444,7 +3454,7 @@ } if (wrap) wrap.scrollTop = prevScroll; const foot = this._jobsRoot.querySelector('#jb-foot'); - if (foot) foot.textContent = primary.length > CAP ? ('showing ' + CAP + ' of ' + primary.length + ' active and recent jobs - refine filters') : ''; + if (foot) foot.textContent = primary.length > CAP ? ('showing ' + CAP + ' of ' + primary.length + ' active and recent runs - refine filters') : ''; } _jobsRowHtml(j, esc) { @@ -3457,7 +3467,7 @@ const tin = this._fmtTokens(j.tokensIn), tout = this._fmtTokens(j.tokensOut); const tok = (tin || tout) ? ((tin || '0') + '↓ / ' + (tout || '0') + '↑') : ''; const rtBadge = rt ? '' + esc(rt) + '' : ''; - const agentCell = j.agent ? (esc(j.agent) + rtBadge) : (rt ? rtBadge : '-'); + const agentCell = j.reviewer ? (esc(j.reviewer) + rtBadge) : (rt ? rtBadge : '-'); return '' + '' + esc(state) + '' + '' + esc(j.title || j.id) + '' + @@ -3481,7 +3491,7 @@ const rtCol = this._runtimeColor(rt); const isSel = this._jobsSelected === j.id; const rtBadge = rt ? '' + esc(rt) + '' : ''; - const agentTxt = j.agent ? '' + esc(j.agent) + '' : ''; + const agentTxt = j.reviewer ? '' + esc(j.reviewer) + '' : ''; const kind = j.kind ? '' + esc(j.kind) + '' : ''; const age = j.started ? esc(this._relFromMs(j.started)) : ''; const dur = j.started ? esc(this._fmtDur(j.duration)) : ''; @@ -3515,7 +3525,7 @@ this.renderJobsTable(); // highlight the selected row // stale-fetch guard: only the latest click's response is rendered. const fid = (this._jobsDetailFetchId = id); - fetch('/api/job/' + encodeURIComponent(id), { cache: 'no-store' }) + fetch('/api/run/' + encodeURIComponent(id), { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(job => { if (this._jobsDetailFetchId === fid) this.renderJobsDetail(summary, job || {}, 'ok'); }) .catch(() => { if (this._jobsDetailFetchId === fid) this.renderJobsDetail(summary, null, 'error'); }); @@ -3601,7 +3611,7 @@ // status rollup + dense agent rows) beside a persistent right detail pane // that fills the width (monogram header + derived-status chip, 4 stat // tiles, CONFIG card, and a RECENT RUNS list populated client-side from - // /api/jobs filtered by the selected agent). Body-appended imperative + // /api/runs filtered by the selected agent). Body-appended imperative // overlay (#agents-root), same sanitizer-skip pattern as jobs/charts. // DERIVED STATUS (busy | failing | idle) replaces the raw health string // everywhere; the word "unknown" is never rendered. Mobile (<=768px) @@ -3706,8 +3716,8 @@ root.style.cssText = 'position:fixed;left:216px;top:54px;right:0;bottom:0;z-index:40;background:#07080f;display:none;font-family:Inter,system-ui,sans-serif;color:#c8cce6'; root.innerHTML = [ '
', - '
AGENTS(0)
', - '
', + '
REVIEWERS(0)
', + '
', '
', '
', '
', @@ -3739,7 +3749,7 @@ this._agStatusFilter = (this._agStatusFilter === s) ? 'all' : s; this.renderAgents(); }); - // Agent row click -> select that agent (persistent pane). + // Reviewer row click -> select that reviewer (persistent pane). root.querySelector('#ag-list').addEventListener('click', (e) => { const row = (e.target.closest && e.target.closest('[data-agent]')) || null; if (row) { const nm = row.getAttribute('data-agent'); if (nm) this.openAgentsDetail(nm); } @@ -3759,7 +3769,7 @@ } fetchAgents(isPoll) { - fetch('/api/agents', { cache: 'no-store' }) + fetch('/api/reviewers', { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(json => { this._agentsData = Array.isArray(json) ? json : []; @@ -3773,7 +3783,7 @@ this._agentsLoaded = true; this.renderAgents(); const pane = this._agentsRoot && this._agentsRoot.querySelector('#ag-pane'); - if (pane && !this._agentsSelected) pane.innerHTML = '
could not load /api/agents (' + this._galaxyEsc(err && err.message) + ')
'; + if (pane && !this._agentsSelected) pane.innerHTML = '
could not load /api/reviewers (' + this._galaxyEsc(err && err.message) + ')
'; }); } @@ -3833,7 +3843,7 @@ const list = this._agentsRoot.querySelector('#ag-list'); if (list) { if (!filtered.length) { - list.innerHTML = '
' + (this._agentsLoaded ? (reals.length ? 'No agents match' : 'No agents registered') : 'loading…') + '
'; + list.innerHTML = '
' + (this._agentsLoaded ? (reals.length ? 'No reviewers match' : 'No reviewers registered') : 'loading…') + '
'; } else { list.innerHTML = filtered.map(({ a, st }) => this._agRowHtml(a, st)).join(''); } @@ -3896,13 +3906,13 @@ if (!this._agentsRoot) return; this._agentsRoot.classList.toggle('ag-detail', !!(this.state.isMobile && this._agMobileDetail)); } - // Fetch /api/agent/ once per selection (cached by name). status: loading|ok|error. + // Fetch /api/reviewer/ once per selection (cached by name). status: loading|ok|error. _agEnsureDetail(name) { if (this._agDetailName === name) { this.renderAgentsPane(false); return; } if (this._agDetailFetchName === name) return; // in-flight for this name this._agDetailFetchName = name; this._agDetailStatus = 'loading'; - fetch('/api/agent/' + encodeURIComponent(name), { cache: 'no-store' }) + fetch('/api/reviewer/' + encodeURIComponent(name), { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(detail => { if (this._agDetailFetchName !== name) return; @@ -3915,7 +3925,7 @@ if (this._agentsSelected === name) this.renderAgentsPane(false); }); } - // Recent runs + avg-duration come from /api/jobs filtered by agent. The full jobs + // Recent runs + avg-duration come from /api/runs filtered by agent. The full jobs // payload is fetched once and cached (10s) across selections, then filtered per // render — so switching agents is instant and no per-agent request is issued. _agEnsureRecent(name) { @@ -3923,7 +3933,7 @@ if (fresh) { this.renderAgentsPane(false); return; } if (this._agJobsInFlight) return; this._agJobsInFlight = true; - fetch('/api/jobs', { cache: 'no-store' }) + fetch('/api/runs', { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(json => { this._agJobsInFlight = false; this._agAllJobs = Array.isArray(json) ? json : []; this._agAllJobsAt = Date.now(); if (this.state.view === 'agents') this.renderAgentsPane(false); }) .catch(() => { this._agJobsInFlight = false; if (!this._agAllJobs) { this._agAllJobs = []; this._agAllJobsAt = Date.now(); if (this.state.view === 'agents') this.renderAgentsPane(false); } }); @@ -3942,11 +3952,11 @@ const a = (this._agentsData || []).find(x => x.name === name) || {}; const st = this._agDerivedStatus(a); const dReady = this._agDetailName === name ? (this._agDetailStatus || '') : 'loading'; - const jobs = (this._agAllJobs || []).filter(j => (j.agent || '') === name); + const jobs = (this._agAllJobs || []).filter(j => (j.reviewer || '') === name); const first = jobs.length ? (jobs[0].id + ':' + (jobs[0].updated || 0)) : ''; // The jobs-loaded flag matters even for a 0-job agent: it flips RECENT RUNS from // "loading…" to "no runs recorded yet" (and the sig would otherwise be identical). - return [name, st, a.jobCount || 0, a.runningCount || 0, a.succeededCount || 0, a.failedCount || 0, a.lastActive || 0, dReady, this._agAllJobs ? 1 : 0, jobs.length, first].join('|'); + return [name, st, a.runCount || 0, a.runningCount || 0, a.succeededCount || 0, a.failedCount || 0, a.lastActive || 0, dReady, this._agAllJobs ? 1 : 0, jobs.length, first].join('|'); } _agTileHtml(label, val, col) { @@ -3959,7 +3969,7 @@ const esc = (s) => this._galaxyEsc(s); const name = this._agentsSelected; if (!name) { - pane.innerHTML = '
' + (this._agentsLoaded ? 'No agent selected' : 'loading…') + '
'; + pane.innerHTML = '
' + (this._agentsLoaded ? 'No reviewer selected' : 'loading…') + '
'; this._agPaneLastSig = null; return; } @@ -3977,15 +3987,15 @@ const d = (detailReady && this._agDetail) ? this._agDetail : {}; const cfg = d.config || null; - // Agent's jobs (client-side, from the cached /api/jobs payload). - const jobs = (this._agAllJobs || []).filter(j => (j.agent || '') === name); + // Agent's jobs (client-side, from the cached /api/runs payload). + const jobs = (this._agAllJobs || []).filter(j => (j.reviewer || '') === name); let durSum = 0, durCnt = 0; for (let i = 0; i < jobs.length; i++) { if (jobs[i].duration > 0) { durSum += jobs[i].duration; durCnt++; } } const avgDur = durCnt ? this._fmtDur(Math.round(durSum / durCnt)) : '-'; const recent = jobs.slice(0, 8); // Stat tiles. - const jobCount = a.jobCount || 0, running = a.runningCount || 0, succ = a.succeededCount || 0, failed = a.failedCount || 0; + const jobCount = a.runCount || 0, running = a.runningCount || 0, succ = a.succeededCount || 0, failed = a.failedCount || 0; const term = succ + failed; const pct = term > 0 ? Math.round(100 * succ / term) : null; const pctCol = pct == null ? '#5a6088' : (pct >= 85 ? '#9ece6a' : (pct >= 70 ? '#e0af68' : '#f7768e')); @@ -3997,7 +4007,7 @@ const cfgHtml = '
' + cfgRow('runtime', runtime || '-') + cfgRow('model', model || '-') + - cfgRow('job timeout', timeout) + + cfgRow('run timeout', timeout) + cfgRow('avg duration', avgDur) + '
'; @@ -4024,7 +4034,7 @@ const pillPulse = (st === 'busy' || st === 'failing'); pane.innerHTML = '
' + - '' + + '' + '
' + '
' + esc(mono) + '
' + '
' + @@ -4145,7 +4155,7 @@ '
', '
', '
', - '
Jobs / day' + jobsLegend + '
', + '
Runs / day' + jobsLegend + '
', '
', '
', '
', @@ -4153,7 +4163,7 @@ '
', '
', '
', - '
Top agents' + rtLegend + '
', + '
Top reviewers' + rtLegend + '
', '
Top repos
', '
', '', @@ -4192,8 +4202,8 @@ this._chartScale = s; if (this._chartsLoaded) this.renderCharts(false); }); - // Row click-throughs: Top agents -> Jobs filtered by that agent (?agent= facet); - // Top repos -> Jobs scoped by the repo facet the Jobs page already supports. + // Row click-throughs: Top reviewers -> Runs filtered by that reviewer (?reviewer= facet); + // Top repos -> Runs scoped by the repo facet the Runs page already supports. // Delegated (rows are rebuilt each render) + keyboard-activatable (role=button). const gotoAgent = (row) => { const nm = row.getAttribute('data-agent'); if (!nm) return; this._jobsFacetRepo = ''; this.showJobs(nm); }; const gotoRepo = (row) => { const rp = row.getAttribute('data-repo'); if (!rp) return; this._jobsFacetRepo = rp; this._jobsFacetAgent = ''; this.showJobs(); }; @@ -4235,18 +4245,18 @@ // divide-by-zero guarded (empty range -> '—'). repos count is the top-repos // breakdown length (capped at 12 server-side); activeAgents is exact. _chartsTilesHtml(t, data, range) { - const jobs = t.jobs || 0, ok = t.succeeded || 0, fail = t.failed || 0; + const jobs = t.runs || 0, ok = t.succeeded || 0, fail = t.failed || 0; const fi = (n) => (n || 0).toLocaleString('en-US'); const pct = (num) => jobs > 0 ? (num / jobs * 100).toFixed(1) + '%' : '-'; - const nAgents = t.activeAgents || 0, nRepos = ((data && data.repos) || []).length; + const nAgents = t.activeReviewers || 0, nRepos = ((data && data.repos) || []).length; const rl = range ? (range + 'd') : 'all'; const tile = (cls, label, val, valCol, sub) => '
' + label + '
' + '
' + val + '
' + '
' + sub + '
'; - return tile('ok', 'SUCCESS RATE', pct(ok), '#9ece6a', fi(ok) + ' succeeded / ' + fi(jobs) + ' jobs') + + return tile('ok', 'SUCCESS RATE', pct(ok), '#9ece6a', fi(ok) + ' succeeded / ' + fi(jobs) + ' runs') + tile('bad', 'FAILURE RATE', pct(fail), '#f7768e', fi(fail) + ' failed') + - tile('tot', 'TOTAL JOBS · ' + rl, fi(jobs), '#7aa2f7', 'across ' + nAgents + ' agent' + (nAgents === 1 ? '' : 's') + ' · ' + nRepos + ' repo' + (nRepos === 1 ? '' : 's')); + tile('tot', 'TOTAL RUNS · ' + rl, fi(jobs), '#7aa2f7', 'across ' + nAgents + ' reviewer' + (nAgents === 1 ? '' : 's') + ' · ' + nRepos + ' repo' + (nRepos === 1 ? '' : 's')); } renderCharts(isPoll) { @@ -4257,7 +4267,7 @@ root.querySelectorAll('.ch-chip').forEach(b => b.classList.toggle('on', (+b.getAttribute('data-days')) === range)); const totals = data.totals || {}; const sEl = root.querySelector('#ch-status'); - if (sEl) sEl.textContent = (totals.jobs || 0) + ' jobs · ' + (range ? ('last ' + range + 'd') : 'all time'); + if (sEl) sEl.textContent = (totals.runs || 0) + ' runs · ' + (range ? ('last ' + range + 'd') : 'all time'); const tt = root.querySelector('#ch-tiles'); if (tt) tt.innerHTML = this._chartsTilesHtml(totals, data, range); const days = Array.isArray(data.days) ? data.days : []; // Tokens card header: total + active scale toggle state. @@ -4265,16 +4275,16 @@ if (tokTot) tokTot.textContent = this._fmtCompact((totals.tokensIn || 0) + (totals.tokensOut || 0)) + ' total'; const scaleWrap = root.querySelector('#ch-scale'); if (scaleWrap) scaleWrap.querySelectorAll('.ch-sbtn').forEach(b => b.classList.toggle('on', b.getAttribute('data-scale') === (this._chartScale || 'linear'))); - const jp = root.querySelector('#ch-jobs'); if (jp) jp.innerHTML = days.length ? this._chartStacked(jp, days) : '
no jobs in range
'; + const jp = root.querySelector('#ch-jobs'); if (jp) jp.innerHTML = days.length ? this._chartStacked(jp, days) : '
no runs in range
'; const tp = root.querySelector('#ch-tokens'); if (tp) tp.innerHTML = days.length ? this._chartTokens(tp, days) : '
no tokens in range
'; const ap = root.querySelector('#ch-agents'); if (ap) { - const rows = (data.agents || []).map(a => ({ name: a.name || '-', value: a.jobs || 0, color: this._runtimeColor(a.runtime || '') })); + const rows = (data.reviewers || []).map(a => ({ name: a.name || '-', value: a.runs || 0, color: this._runtimeColor(a.runtime || '') })); ap.innerHTML = rows.length ? '
' + this._chartsAgentRows(rows) + '
' : this._chartsAgentRows(rows); } const rp = root.querySelector('#ch-repos'); if (rp) { - const rows = (data.repos || []).map(r => ({ repo: r.repo || '-', value: r.jobs || 0 })); + const rows = (data.repos || []).map(r => ({ repo: r.repo || '-', value: r.runs || 0 })); rp.innerHTML = rows.length ? '
' + this._chartsRepoRows(rows) + '
' : this._chartsRepoRows(rows); } } @@ -4300,23 +4310,23 @@ ' v' + f(h - r) + ' h' + f(-w) + ' Z'; } - // Top-agents rows (clickable -> Jobs?agent=). Bars colored by runtime so the + // Top-reviewers rows (clickable -> Runs?reviewer=). Bars colored by runtime so the // header runtime legend matches. rows: {name, value, color}. _chartsAgentRows(rows) { const esc = (s) => this._galaxyEsc(s); - if (!rows.length) return '
no agents in range
'; + if (!rows.length) return '
no reviewers in range
'; let maxV = 0; rows.forEach(r => { if (r.value > maxV) maxV = r.value; }); return rows.map(r => { const w = maxV > 0 ? Math.max(2, (r.value / maxV) * 100) : 0; const col = r.color || '#7aa2f7'; - return '
' + + return '
' + '' + esc(r.name) + '' + '
' + '' + (r.value || 0).toLocaleString('en-US') + '
'; }).join(''); } - // Top-repos rows (clickable -> Jobs scoped by the repo facet). The owner prefix + // Top-repos rows (clickable -> Runs scoped by the repo facet). The owner prefix // is split off into a small grey line above the repo name. rows: {repo, value}. _chartsRepoRows(rows) { const esc = (s) => this._galaxyEsc(s); @@ -4328,7 +4338,7 @@ const slash = repo.indexOf('/'); const name = slash >= 0 ? repo.slice(slash + 1) : repo; const owner = slash >= 0 ? repo.slice(0, slash) + '/' : ''; - return '
' + + return '
' + '' + esc(name) + '' + (owner ? '' + esc(owner) + '' : '') + '' + '
' + '' + (r.value || 0).toLocaleString('en-US') + '
'; @@ -4344,7 +4354,7 @@ const W = Math.max(320, (plotEl && plotEl.clientWidth) || 900), H = 180; const mL = 4, mR = 4, mT = 8, mB = 22; const plotW = W - mL - mR, plotH = H - mT - mB, n = days.length; - if (!n) return '
no jobs in range
'; + if (!n) return '
no runs in range
'; const SEG = this._jobSegs(); let maxTotal = 0; days.forEach(d => { let s = 0; SEG.forEach(g => { s += (d[g[0]] || 0); }); if (s > maxTotal) maxTotal = s; }); @@ -4475,7 +4485,7 @@ // blocked job gates (#693). Body-appended overlay, same // pattern as Health; polled with a signature-skip so a byte-stable // /api/attention response never re-renders. A gate row expands to - // lazily fetch that job's failed result checks (/api/job//checks). + // lazily fetch that job's failed result checks (/api/run//checks). // ============================================================ startAttentionPoll() { if (this._attentionPoll) return; @@ -4533,7 +4543,7 @@ '
Needs a human.
', '
Everything parked on an explicit human decision - retry, approve, reject, continue or escalate.
', '
', - '
Blocked job gates
', + '
Blocked run gates
', '
' ].join('\n'); document.body.appendChild(root); @@ -4597,18 +4607,18 @@ const gatesEl = root.querySelector('#at-gates'); if (gatesEl) { if (!gates.length) { - gatesEl.innerHTML = '
No jobs are blocked on a human gate.
'; + gatesEl.innerHTML = '
No runs are blocked on a human gate.
'; } else { gatesEl.innerHTML = gates.map(g => { const meta = []; - meta.push('' + esc(g.jobId) + ''); - if (g.agent) meta.push('' + esc(g.agent) + ''); + meta.push('' + esc(g.runId) + ''); + if (g.reviewer) meta.push('' + esc(g.reviewer) + ''); if (g.repo) meta.push('' + esc(g.repo) + ''); if (g.pr) meta.push('#' + esc(g.pr) + ''); if (g.createdAt) meta.push('' + esc(this._relFromMs(g.createdAt)) + ''); - return '
' + + return '
' + '
' + - '
' + esc(g.title || g.jobId) + '
' + + '
' + esc(g.title || g.runId) + '
' + '
' + meta.join('') + '
' + '' + esc(g.need) + '
' + '
'; @@ -4625,7 +4635,7 @@ const esc = (s) => this._galaxyEsc(s); box.setAttribute('data-loaded', '1'); box.innerHTML = '
loading result checks…
'; - fetch('/api/job/' + encodeURIComponent(jobId) + '/checks', { cache: 'no-store' }) + fetch('/api/run/' + encodeURIComponent(jobId) + '/checks', { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(jc => { jc = jc || {}; @@ -4720,7 +4730,7 @@ '
', '
', '
', - '
STUCK JOBS
', + '
STUCK RUNS
', '
LOCKS amber >24h · red >7d
', '
' ].join('\n'); @@ -4822,7 +4832,7 @@ }); const vitals = [ - { label: 'ACTIVE', val: activeN, sub: 'jobs running', tone: '#7aa2f7' }, + { label: 'ACTIVE', val: activeN, sub: 'runs running', tone: '#7aa2f7' }, { label: 'BLOCKED + STUCK', val: blockedStuckN, sub: blockedStuckN > 0 ? 'need triage' : 'all moving', tone: blockedStuckN > 0 ? '#e0af68' : '#9ece6a' }, { label: 'LOCKS', val: lockN, sub: lockN > 0 ? ('oldest ' + this._hlAgeShort(oldestAge)) : 'none held', tone: lockTone }, { label: 'FAILURES · recent', val: failN, sub: failRate.toFixed(1) + '% overall rate', tone: failN === 0 ? '#9ece6a' : failTone } @@ -4904,7 +4914,7 @@ return '
' + '
✓
' + '
All clear - daemon healthy
' + - '
' + upSeg + ' · no stuck jobs · no aging locks · failures within threshold
' + + '
' + upSeg + ' · no stuck runs · no aging locks · failures within threshold
' + '
' + updHtml + '
'; } const n = s.count; @@ -4924,7 +4934,7 @@ const state = j.state || 'blocked'; const col = this._galaxyStateColor(state); const dot = ''; - const ag = j.agent ? '' : ''; + const ag = j.reviewer ? '' : ''; const repo = j.repo ? '' + esc(j.repo) + '' : ''; const why = j.reason ? '' : ''; const body = j.reason ? '' : ''; @@ -4959,7 +4969,7 @@ else { body.setAttribute('hidden', ''); if (chev) chev.textContent = '▸'; } } - // Navigate to /agents/ and open that agent's detail panel (house cross-link law). + // Navigate to /reviewers/ and open that reviewer's detail panel (house cross-link law). _hlGotoAgent(name) { if (!name) return; this._pendingAgentDetail = name; @@ -4979,7 +4989,7 @@ const d = this._healthData || {}; const all = (d.stuck || []).concat(d.recentFailures || []); const m = all.find(x => x.id === id); - return m ? { id: m.id, title: m.title, agent: m.agent, repo: m.repo, state: m.state } : null; + return m ? { id: m.id, title: m.title, agent: m.reviewer, repo: m.repo, state: m.state } : null; } ensureHealthDetailEl() { @@ -5003,7 +5013,7 @@ const summary = this._healthJobSummary(id) || { id: id }; this.renderHealthDetail(summary, null, 'loading'); const fid = (this._healthDetailFetchId = id); - fetch('/api/job/' + encodeURIComponent(id), { cache: 'no-store' }) + fetch('/api/run/' + encodeURIComponent(id), { cache: 'no-store' }) .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) .then(job => { if (this._healthDetailFetchId === fid) this.renderHealthDetail(summary, job || {}, 'ok'); }) .catch(() => { if (this._healthDetailFetchId === fid) this.renderHealthDetail(summary, null, 'error'); }); @@ -5392,7 +5402,7 @@ if (!data || !(data.contract_version > 0) || !Array.isArray(data.sections)) { this._configRenderAnchors([]); const ver = this.state.daemonVersion ? 'daemon ' + this._galaxyEsc(this.state.daemonVersion) + ' · ' : ''; - box.innerHTML = '
No effective config reported
This daemon build predates effective-config export. Upgrade gitmoot to inspect flags, knobs, and per-agent settings here.
' + ver + 'config export unavailable
'; + box.innerHTML = '
No effective config reported
This daemon build predates effective-config export. Upgrade gitmoot to inspect flags, knobs, and per-reviewer settings here.
' + ver + 'config export unavailable
'; return; } if (data.exists === false) { @@ -5444,11 +5454,11 @@ }); if (agents.length) { const id = this._configSlug('agents'); - anchors.push({ id: id, label: 'Per-agent', count: agents.length }); + anchors.push({ id: id, label: 'Per-reviewer', count: agents.length }); const rt = a => { const runtime = String(a.runtime || 'shell').toLowerCase(), cls = /claude/.test(runtime) ? 'claude' : /codex/.test(runtime) ? 'codex' : /kimi/.test(runtime) ? 'kimi' : 'shell'; return '' + esc(a.runtime || 'shell') + ''; }; const trs = agents.map(a => '' + esc(a.name) + '' + rt(a) + '' + esc((Array.isArray(a.capabilities) ? a.capabilities : []).join(', ') || '-') + '' + esc(a.autonomy_policy || '-') + '' + esc(a.model || '-') + '').join(''); const cards = agents.map(a => '
' + esc(a.name) + '' + rt(a) + '
' + esc(a.model || 'default') + '
').join(''); - out.push('
Per-agent overrides
' + trs + '
AgentRuntimeCapabilitiesPolicyModel
' + cards + '
'); + out.push('
Per-reviewer overrides
' + trs + '
ReviewerRuntimeCapabilitiesPolicyModel
' + cards + '
'); } const unknown = (Array.isArray(data.unknown_keys) ? data.unknown_keys : []).filter(k => !q || String(k).toLowerCase().indexOf(q) >= 0); if (unknown.length) anchors.push({ id: this._configSlug('unknown'), label: 'Unknown', count: unknown.length }); @@ -5485,8 +5495,8 @@ _navSeed() { const healthSeq = ++this._healthFetchSeq; fetch('/api/health', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (j && healthSeq === this._healthFetchSeq) this._tbApplyHealth(j); }).catch(() => {}); - fetch('/api/workflows', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (Array.isArray(j)) this._navApplyWorkflows(j); }).catch(() => {}); - fetch('/api/tasks', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (Array.isArray(j)) this._navApplyTasks(j); }).catch(() => {}); + fetch('/api/campaigns', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (Array.isArray(j)) this._navApplyWorkflows(j); }).catch(() => {}); + fetch('/api/prs', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (Array.isArray(j)) this._navApplyTasks(j); }).catch(() => {}); fetch('/api/attention', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (j) this._navApplyAttention(j); }).catch(() => {}); } _tbApplyHealth(data) { @@ -5660,10 +5670,10 @@ const liveTextStyle = { fontFamily: "'JetBrains Mono'", fontSize: '11px', letterSpacing: '0.08em', color: dUp ? '#c5f882' : '#868db5', fontWeight: 600 }; // ---- top-bar breadcrumb: "section › entity", or "group › section" when no entity ---- - // Every view shows its section + a cheaply-available selected entity (agent / - // workflow), falling back to its nav group + section name. + // Every view shows its section + a cheaply-available selected entity (reviewer / + // campaign), falling back to its nav group + section name. const NAV_GROUP = { overview: 'work', tasks: 'work', jobs: 'work', workflows: 'work', agents: 'fleet', org: 'fleet', galaxy: 'insight', charts: 'insight', attention: 'system', health: 'system', config: 'system' }; - const SECT = { overview: 'overview', tasks: 'tasks', jobs: 'jobs', workflows: 'workflows', agents: 'agents', org: 'org', galaxy: 'galaxy', charts: 'charts', attention: 'attention', health: 'health', config: 'config' }; + const SECT = { overview: 'overview', tasks: 'prs', jobs: 'runs', workflows: 'campaigns', agents: 'reviewers', org: 'org', galaxy: 'galaxy', charts: 'charts', attention: 'attention', health: 'health', config: 'config' }; let crumbRoot, crumbLeaf; let entity = ''; if (isAgents && this._agentsSelected) entity = this._agentsSelected;