From f433424fe73e11558bfd4632471d79eb852ac212 Mon Sep 17 00:00:00 2001 From: jerryfane Date: Sat, 7 Nov 2026 02:27:49 +0100 Subject: [PATCH] feat!: drop pipelines and keychain grants from the DataSource contract (gitmoot/gitmoot#2542) gitmoot is removing its pipelines feature entirely (users moved to gitmoot/stagehand) and, with it, keychain grants (`key grant/revoke`, the keychain_grants table). This removes both from the dashboard contract so the gitmoot side can delete its implementations instead of stubbing them. Removed from the DataSource interface: Pipelines(ctx) ([]PipelineSummary, error) PipelineRun(ctx, id) (PipelineRun, error) PipelineDetail(ctx, name) (PipelineDetail, error) Removed payload types: PipelineSummary, PipelineRunSummary, PipelineRun, PipelineStage, PipelineStageMark, PipelineRunHistoryEntry, PipelineDetail, PipelineKeys, PipelineEnvFileStatus, PipelineStageKeys, PipelineKeyEntry, OverviewScheduled, KeychainGrantView; sentinels ErrPipelineRunNotFound and ErrPipelineNotFound. Removed fields: Overview.Scheduled (the "scheduled" overview panel listed declared pipelines only) and KeychainKeyView.Grants (every grant consumer was a pipeline; grants are gone in gitmoot). Routes removed: GET /api/pipelines, /api/pipelines/{name}, /api/pipeline/run/{id}. web/dist/index.html (hand-maintained, no build step in this repo): removed the Pipelines nav entry and its attention dot, the mobile more-sheet entry, the Pipelines page (list, detail workbench, stage DAG, run history, keys tab) with its CSS, polling and fetches, the /pipelines and /pipelines/ routes (now normalized to Overview), the Activepieces top-bar link ("the flow builder that drives gitmoot pipelines"), the Overview scheduled-pipelines panel, and the Config keychain Grants column/search terms. fakefeed.go: dropped fakePipelineRuns, fakePipelineRunSummary, fakePipelines, fakePipelineHistoryEntry, fakePipelineDetail, the Overview scheduled fixture and keychain grant fixtures; renamed the pipeline-namespaced workflow/wake fixture values to non-pipeline ones. Tests whose subject was a removed surface are deleted (TestHandlePipelines*, TestHandlePipelineRun*, TestHandlePipelineDetail*, TestPipelineStageProgressJSON, TestPipelinesRouteRegistered); surviving overview/keychain tests keep their other assertions. Gate: go build ./... && go vet ./... && go test ./... pass; gofmt clean. --- api.go | 101 +-- api_test.go | 629 +----------------- datasource.go | 191 +----- datasource_test.go | 71 -- fakefeed.go | 502 +------------- server.go | 8 +- server_test.go | 21 - web/dist/index.html | 1514 +------------------------------------------ 8 files changed, 50 insertions(+), 2987 deletions(-) diff --git a/api.go b/api.go index bbdd068..9e23bf6 100644 --- a/api.go +++ b/api.go @@ -237,7 +237,7 @@ func writeJSON(w http.ResponseWriter, code int, v any) { // statusForError maps a DataSource error to an HTTP status code: not-found // sentinels become 404, everything else 500. func statusForError(err error) int { - if errors.Is(err, ErrRunNotFound) || errors.Is(err, ErrJobNotFound) || errors.Is(err, ErrAgentNotFound) || errors.Is(err, ErrPipelineRunNotFound) || errors.Is(err, ErrPipelineNotFound) || errors.Is(err, ErrOrgRoleNotFound) || errors.Is(err, ErrWorkflowNotFound) { + if errors.Is(err, ErrRunNotFound) || errors.Is(err, ErrJobNotFound) || errors.Is(err, ErrAgentNotFound) || errors.Is(err, ErrOrgRoleNotFound) || errors.Is(err, ErrWorkflowNotFound) { return http.StatusNotFound } return http.StatusInternalServerError @@ -411,9 +411,6 @@ func (s *server) handleOverview(w http.ResponseWriter, r *http.Request) { if o.Today.Notable == nil { o.Today.Notable = []OverviewNotable{} } - if o.Scheduled == nil { - o.Scheduled = []OverviewScheduled{} - } if o.Fleet == nil { o.Fleet = []OverviewFleet{} } @@ -442,12 +439,6 @@ func (s *server) handleOverview(w http.ResponseWriter, r *http.Request) { if len(o.Today.Notable) > 5 { o.Today.Notable = o.Today.Notable[:5] } - sort.SliceStable(o.Scheduled, func(i, j int) bool { - if o.Scheduled[i].NextInS != o.Scheduled[j].NextInS { - return o.Scheduled[i].NextInS < o.Scheduled[j].NextInS - } - return o.Scheduled[i].Name < o.Scheduled[j].Name - }) sort.SliceStable(o.Fleet, func(i, j int) bool { if o.Fleet[i].Running != o.Fleet[j].Running { return o.Fleet[i].Running @@ -859,11 +850,6 @@ func (s *server) handleConfig(w http.ResponseWriter, r *http.Request) { if c.Keychain.Keys == nil { c.Keychain.Keys = []KeychainKeyView{} } - for i := range c.Keychain.Keys { - if c.Keychain.Keys[i].Grants == nil { - c.Keychain.Keys[i].Grants = []KeychainGrantView{} - } - } writeJSON(w, http.StatusOK, c) } @@ -890,91 +876,6 @@ func (s *server) handleLearningSkills(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, skills) } -// handlePipelines serves GET /api/pipelines -> []PipelineSummary, the declared -// pipelines with their schedule state and recent run outcomes. Mirrors -// handleRuns; the list and every element's Recent are coerced non-nil so the -// client always sees JSON arrays. -func (s *server) handlePipelines(w http.ResponseWriter, r *http.Request) { - pipelines, err := s.ds.Pipelines(r.Context()) - if err != nil { - http.Error(w, err.Error(), statusForError(err)) - return - } - if pipelines == nil { - pipelines = []PipelineSummary{} - } - for i := range pipelines { - if pipelines[i].Recent == nil { - pipelines[i].Recent = []PipelineRunSummary{} - } - } - writeJSON(w, http.StatusOK, pipelines) -} - -// handlePipelineDetail serves GET /api/pipelines/{name} -> PipelineDetail, one -// pipeline's declared stage DAG and its run history (newest-first, capped at -// 100). Unknown names map to 404 (mirrors handleAgent). Declared, Runs, key -// stages, stage keys/selectors, and each run's Stages are coerced non-nil so the -// client always sees JSON arrays. Server-provided order is preserved. -func (s *server) handlePipelineDetail(w http.ResponseWriter, r *http.Request) { - name := r.PathValue("name") - if name == "" { - http.Error(w, "missing pipeline name", http.StatusBadRequest) - return - } - detail, err := s.ds.PipelineDetail(r.Context(), name) - if err != nil { - http.Error(w, err.Error(), statusForError(err)) - return - } - if detail.Declared == nil { - detail.Declared = []PipelineStage{} - } - if detail.Runs == nil { - detail.Runs = []PipelineRunHistoryEntry{} - } - if detail.Keys.EnvFile.Status == "" { - detail.Keys.EnvFile.Status = "none" - } - if detail.Keys.Stages == nil { - detail.Keys.Stages = []PipelineStageKeys{} - } - for i := range detail.Keys.Stages { - if detail.Keys.Stages[i].Keys == nil { - detail.Keys.Stages[i].Keys = []PipelineKeyEntry{} - } - if detail.Keys.Stages[i].UnresolvedSelectors == nil { - detail.Keys.Stages[i].UnresolvedSelectors = []string{} - } - } - for i := range detail.Runs { - if detail.Runs[i].Stages == nil { - detail.Runs[i].Stages = []PipelineStageMark{} - } - } - writeJSON(w, http.StatusOK, detail) -} - -// handlePipelineRun serves GET /api/pipeline/run/{id} -> PipelineRun, the full -// detail for a single run. Unknown ids map to 404 (mirrors handleJob). Stages is -// coerced non-nil so the client always sees a JSON array. -func (s *server) handlePipelineRun(w http.ResponseWriter, r *http.Request) { - id := r.PathValue("id") - if id == "" { - http.Error(w, "missing pipeline run id", http.StatusBadRequest) - return - } - run, err := s.ds.PipelineRun(r.Context(), id) - if err != nil { - http.Error(w, err.Error(), statusForError(err)) - return - } - if run.Stages == nil { - run.Stages = []PipelineStage{} - } - writeJSON(w, http.StatusOK, run) -} - // handleAttention serves GET /api/attention -> Attention, the "Needs a human" // view (gitmoot #528). Mirrors handleRuns; every list is coerced non-nil so the // client always sees JSON arrays. diff --git a/api_test.go b/api_test.go index 9ab21fc..088ad96 100644 --- a/api_test.go +++ b/api_test.go @@ -392,10 +392,10 @@ func TestFakeOverviewContractOrderingAndDeterminism(t *testing.T) { t.Fatalf("notable rows not newest-first: %+v", overview.Today.Notable) } } - if len(overview.Scheduled) < 3 || len(overview.Fleet) < 4 || !overview.Fleet[0].Running { - t.Fatalf("scheduled/fleet contract scheduled=%+v fleet=%+v", overview.Scheduled, overview.Fleet) + 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\"", "\"next_in_s\"", "\"jobs_today\""} { + for _, field := range []string{"\"needs_you\"", "\"session_id\"", "\"per_hour\"", "\"jobs_today\""} { if !bytes.Contains(raw1, []byte(field)) { t.Fatalf("overview wire payload missing %s: %s", field, raw1) } @@ -1958,23 +1958,11 @@ func TestHandleConfigKeychain(t *testing.T) { t.Fatalf("keychain.keys wire value = %s, want an array, err=%v", keysRaw, err) } for i, keyWire := range keyWires { - for _, field := range []string{"name", "mode", "proxyUpstream", "proxyAuth", "grants", "createdAt"} { + for _, field := range []string{"name", "mode", "proxyUpstream", "proxyAuth", "createdAt"} { if _, ok := keyWire[field]; !ok { t.Fatalf("keychain.keys[%d] omitted %s: %s", i, field, keysRaw) } } - var grantWires []map[string]json.RawMessage - if err := json.Unmarshal(keyWire["grants"], &grantWires); err != nil || grantWires == nil { - t.Fatalf("keychain.keys[%d].grants = %s, want an array, err=%v", i, keyWire["grants"], err) - } - for gi, grantWire := range grantWires { - if _, ok := grantWire["consumerKind"]; !ok { - t.Fatalf("keychain.keys[%d].grants[%d] omitted consumerKind", i, gi) - } - if _, ok := grantWire["consumerID"]; !ok { - t.Fatalf("keychain.keys[%d].grants[%d] omitted consumerID", i, gi) - } - } } var cfg ConfigSnapshot @@ -1994,9 +1982,6 @@ func TestHandleConfigKeychain(t *testing.T) { if key.Name != wantNames[i] { t.Fatalf("keychain key[%d] = %q, want %q", i, key.Name, wantNames[i]) } - if key.Grants == nil || len(key.Grants) < 1 || len(key.Grants) > 2 { - t.Fatalf("keychain key %s grants = %+v, want 1-2 rows", key.Name, key.Grants) - } if _, err := time.Parse(time.RFC3339, key.CreatedAt); err != nil { t.Fatalf("keychain key %s createdAt = %q, want RFC3339: %v", key.Name, key.CreatedAt, err) } @@ -2014,11 +1999,6 @@ func TestHandleConfigKeychain(t *testing.T) { default: t.Fatalf("keychain key %s mode = %q outside injected|proxied", key.Name, key.Mode) } - for _, grant := range key.Grants { - if grant.ConsumerKind != "pipeline" || grant.ConsumerID == "" { - t.Fatalf("keychain key %s invalid grant: %+v", key.Name, grant) - } - } } if injected != 3 || proxied != 1 { t.Fatalf("keychain fixture modes: injected=%d proxied=%d, want 3/1", injected, proxied) @@ -2071,7 +2051,7 @@ func TestConfigKeychainRenderContract(t *testing.T) { t.Fatalf("read Config page: %v", err) } html := string(body) - for _, marker := range []string{"_configRenderKeychain", "cfg-keychain-table", "gitmoot key add", "proxyUpstream", "consumerKind"} { + for _, marker := range []string{"_configRenderKeychain", "cfg-keychain-table", "gitmoot key add", "proxyUpstream"} { if !strings.Contains(html, marker) { t.Fatalf("Config Keychain renderer missing %q", marker) } @@ -2228,605 +2208,6 @@ func TestHandleLearningSkillsDeterministic(t *testing.T) { } } -// realPipelineStates is the set of run states the live pipeline store can emit; -// the fake feed must never present a run state outside it. -var realPipelineStates = map[string]bool{ - "running": true, - "succeeded": true, - "blocked": true, - "failed": true, - "cancelled": true, -} - -// realPipelineTriggers is the set of run triggers the live pipeline store can -// emit; bridge means a run fired through the gitmoot bridge, e.g. email. -var realPipelineTriggers = map[string]bool{ - "manual": true, - "schedule": true, - "bridge": true, -} - -// realPipelineStageStates is the set of per-stage states the live pipeline store -// can emit; the fake feed must never present a stage state outside it. -var realPipelineStageStates = map[string]bool{ - "pending": true, - "queued": true, - "running": true, - "succeeded": true, - "blocked": true, - "failed": true, - "skipped": true, - "cancelled": true, -} - -func TestHandlePipelines(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - raw := getRaw(t, srv.URL+"/api/pipelines") - var pipelines []PipelineSummary - if err := json.Unmarshal(raw, &pipelines); err != nil { - t.Fatalf("decode: %v", err) - } - var wireRows []map[string]json.RawMessage - if err := json.Unmarshal(raw, &wireRows); err != nil { - t.Fatalf("decode wire rows: %v", err) - } - if len(wireRows) != len(pipelines) { - t.Fatalf("wire rows = %d, decoded pipelines = %d", len(wireRows), len(pipelines)) - } - if len(pipelines) < 3 { - t.Fatalf("len(pipelines) = %d, want >= 3", len(pipelines)) - } - - // Sorted by name asc. - for i := 1; i < len(pipelines); i++ { - if pipelines[i-1].Name > pipelines[i].Name { - t.Fatalf("pipelines not name-sorted: %+v", pipelines) - } - } - - enabled, disabled := 0, 0 - byName := map[string]PipelineSummary{} - for i, p := range pipelines { - if p.Name == "" { - t.Fatalf("pipeline missing name: %+v", p) - } - group, ok := wireRows[i]["group"] - if !ok { - t.Fatalf("pipeline %s wire payload missing group: %s", p.Name, raw) - } - var wireGroup string - if err := json.Unmarshal(group, &wireGroup); err != nil || wireGroup == "" || p.Group == "" { - t.Fatalf("pipeline %s group = wire %q decoded %q, err=%v", p.Name, wireGroup, p.Group, err) - } - byName[p.Name] = p - if p.StageCount <= 0 { - t.Fatalf("pipeline %s StageCount = %d, want > 0", p.Name, p.StageCount) - } - // Recent must always be a JSON array, never nil. - if p.Recent == nil { - t.Fatalf("pipeline %s Recent must be non-nil", p.Name) - } - if p.Enabled { - enabled++ - } else { - disabled++ - } - // LastStatus, when set, is a real run state. - if p.LastStatus != "" && !realPipelineStates[p.LastStatus] { - t.Fatalf("pipeline %s LastStatus = %q not a real run state", p.Name, p.LastStatus) - } - // Recent: newest-first by StartedAt desc, every state within the allow-list. - for i, r := range p.Recent { - if r.ID == "" || r.State == "" { - t.Fatalf("pipeline %s recent[%d] missing id/state: %+v", p.Name, i, r) - } - if !realPipelineStates[r.State] { - t.Fatalf("pipeline %s recent[%d] state = %q not a real run state", p.Name, i, r.State) - } - if r.Trigger != "" && !realPipelineTriggers[r.Trigger] { - t.Fatalf("pipeline %s recent[%d] trigger = %q not a real trigger", p.Name, i, r.Trigger) - } - if i > 0 && p.Recent[i-1].StartedAt < r.StartedAt { - t.Fatalf("pipeline %s Recent not newest-first (StartedAt desc): %+v", p.Name, p.Recent) - } - } - } - - // The fixture spans both schedule states so the enabled chip is exercised in - // both directions. - if enabled == 0 || disabled == 0 { - t.Fatalf("want at least one enabled and one disabled pipeline; got enabled=%d disabled=%d", enabled, disabled) - } - - // Group fixture coverage: a custom group spans two repos, acme/api is split - // between two groups, repo-fallback groups are already resolved, and the - // built-in system group has two pipelines. - if byName["nightly-deploy"].Group != "Release Automation" || byName["api-contract-check"].Group != "Release Automation" { - t.Fatalf("expected cross-repo Release Automation group: %+v", pipelines) - } - if byName["api-contract-check"].Repo != "acme/api" || byName["bench-suite"].Repo != "acme/api" || byName["bench-suite"].Group != "Quality" { - t.Fatalf("expected acme/api to span Release Automation and Quality: %+v", pipelines) - } - if byName["listing-refresh"].Group != byName["listing-refresh"].Repo || byName["noted-search-index"].Group != byName["noted-search-index"].Repo { - t.Fatalf("expected resolved repo fallback groups: %+v", pipelines) - } - system := 0 - for _, p := range pipelines { - if p.Group == "Gitmoot System" { - system++ - } - } - if system != 2 { - t.Fatalf("Gitmoot System rows = %d, want 2", system) - } - if ingest := byName["memory-ingest-sweep"]; ingest.Mode != "after: memory-groom-propose" { - t.Fatalf("memory-ingest-sweep Mode = %q, want after trigger", ingest.Mode) - } - if groom := byName["memory-groom-propose"]; groom.NextDueAt == 0 || groom.LastStatus != "succeeded" { - t.Fatalf("memory-groom-propose should exercise due + health rollups: %+v", groom) - } - - // nightly-deploy: enabled scheduled pipeline with a next-due time whose recent - // strip carries an in-flight running run alongside a succeeded and a failed run. - nd, ok := byName["nightly-deploy"] - if !ok { - t.Fatalf("expected a nightly-deploy pipeline: %+v", pipelines) - } - if !nd.Enabled { - t.Fatalf("expected nightly-deploy enabled") - } - if nd.NextDueAt == 0 { - t.Fatalf("expected nightly-deploy to carry a NextDueAt") - } - if nd.Interval == "" { - t.Fatalf("expected nightly-deploy to carry a schedule Interval") - } - if nd.Mode != "email-triggered (bound), scheduled 24h" { - t.Fatalf("nightly-deploy Mode = %q", nd.Mode) - } - recentStates := map[string]bool{} - recentTriggers := map[string]bool{} - for _, r := range nd.Recent { - recentStates[r.State] = true - recentTriggers[r.Trigger] = true - } - for _, want := range []string{"running", "succeeded", "failed"} { - if !recentStates[want] { - t.Fatalf("nightly-deploy recent missing a %q run: %+v", want, nd.Recent) - } - } - if !recentTriggers["bridge"] { - t.Fatalf("nightly-deploy recent missing a bridge-triggered run: %+v", nd.Recent) - } - - // listing-refresh: manual pipeline whose last run is parked-blocked. - if lr := byName["listing-refresh"]; lr.LastStatus != "blocked" || lr.Mode != "manual" { - t.Fatalf("expected listing-refresh LastStatus=blocked + Mode=manual, got status=%q mode=%q", lr.LastStatus, lr.Mode) - } - // bench-suite: disabled pipeline whose last run failed. - if bs := byName["bench-suite"]; bs.Enabled || bs.LastStatus != "failed" || bs.Mode != "scheduled 168h" { - t.Fatalf("expected bench-suite disabled + LastStatus=failed + Mode=scheduled 168h, got enabled=%v status=%q mode=%q", bs.Enabled, bs.LastStatus, bs.Mode) - } -} - -func TestHandlePipelinesDeterministic(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - url := srv.URL + "/api/pipelines" - if a, b := getRaw(t, url), getRaw(t, url); !bytes.Equal(a, b) { - t.Fatalf("pipelines not byte-stable across calls\nfirst: %s\nsecond: %s", a, b) - } -} - -func TestHandlePipelineRun(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - // The parked-blocked diamond fixture exercises needs + a skipped branch. - raw := getRaw(t, srv.URL+"/api/pipeline/run/prun-listing-refresh-0001") - var run PipelineRun - if err := json.Unmarshal(raw, &run); err != nil { - t.Fatalf("decode: %v", err) - } - var wire struct { - Stages []map[string]json.RawMessage `json:"stages"` - } - if err := json.Unmarshal(raw, &wire); err != nil { - t.Fatalf("decode wire stages: %v", err) - } - for i, stage := range wire.Stages { - depsRaw, ok := stage["deps"] - if !ok { - t.Fatalf("stage %d wire object omitted deps: %s", i, stage["id"]) - } - var deps []string - if err := json.Unmarshal(depsRaw, &deps); err != nil { - t.Fatalf("stage %d deps wire value: %v", i, err) - } - if deps == nil { - t.Fatalf("stage %d deps wire value = %s, want an array", i, depsRaw) - } - } - if depsRaw := wire.Stages[0]["deps"]; string(depsRaw) != "[]" { - t.Fatalf("root stage deps wire value = %s, want []", depsRaw) - } - if run.ID != "prun-listing-refresh-0001" { - t.Fatalf("run.ID = %q, want prun-listing-refresh-0001", run.ID) - } - if run.State != "blocked" { - t.Fatalf("run.State = %q, want blocked", run.State) - } - if run.HaltStage != "score" { - t.Fatalf("run.HaltStage = %q, want score", run.HaltStage) - } - // Persisted blocked-needs aggregated at the run level. - if len(run.Needs) == 0 { - t.Fatalf("expected run-level Needs on a blocked run: %+v", run) - } - - // Stages: non-nil, in spec (topological) order — deliberately NOT alphabetical - // (which would be dedupe, fetch, publish, score). - if run.Stages == nil { - t.Fatalf("Stages must be non-nil") - } - wantOrder := []string{"fetch", "score", "dedupe", "publish"} - if len(run.Stages) != len(wantOrder) { - t.Fatalf("len(Stages) = %d, want %d", len(run.Stages), len(wantOrder)) - } - byID := map[string]PipelineStage{} - for i, st := range run.Stages { - if st.ID != wantOrder[i] { - t.Fatalf("Stages not in spec order: got %q at %d, want %q\n%+v", st.ID, i, wantOrder[i], run.Stages) - } - if !realPipelineStageStates[st.State] { - t.Fatalf("stage %s state = %q not a real stage state", st.ID, st.State) - } - byID[st.ID] = st - } - - // The blocked stage carries its own persisted needs. - if score := byID["score"]; score.State != "blocked" || len(score.Needs) == 0 { - t.Fatalf("expected score stage blocked with needs: %+v", score) - } - if score := byID["score"]; score.Kind != "agent_ask" || score.AgentRuntime != "codex" { - t.Fatalf("expected score stage to carry agent_ask/codex metadata: %+v", score) - } - if fetch := byID["fetch"]; fetch.Kind != "shell" { - t.Fatalf("expected fetch stage Kind=shell: %+v", fetch) - } - // The downstream branch of the blocked stage is skipped. - if publish := byID["publish"]; publish.State != "skipped" || publish.Kind != "gate" { - t.Fatalf("expected publish stage skipped: %+v", publish) - } - // Deps present on downstream stages (the client derives the DAG edges from them). - if score := byID["score"]; len(score.Deps) != 1 || score.Deps[0] != "fetch" { - t.Fatalf("score.Deps = %v, want [fetch]", score.Deps) - } - if dedupe := byID["dedupe"]; len(dedupe.Deps) != 1 || dedupe.Deps[0] != "fetch" { - t.Fatalf("dedupe.Deps = %v, want [fetch]", dedupe.Deps) - } - if publish := byID["publish"]; len(publish.Deps) != 2 { - t.Fatalf("publish.Deps = %v, want 2 (the diamond join)", publish.Deps) - } -} - -func TestHandlePipelineRunDeterministic(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - url := srv.URL + "/api/pipeline/run/prun-listing-refresh-0001" - if a, b := getRaw(t, url), getRaw(t, url); !bytes.Equal(a, b) { - t.Fatalf("pipeline run detail not byte-stable across calls\nfirst: %s\nsecond: %s", a, b) - } -} - -func TestHandlePipelineRunNotFound(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - resp, err := http.Get(srv.URL + "/api/pipeline/run/does-not-exist") - if err != nil { - t.Fatalf("GET /api/pipeline/run/does-not-exist: %v", err) - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusNotFound { - t.Fatalf("status = %d, want 404", resp.StatusCode) - } -} - -func TestHandlePipelineDetail(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - // The flaky-diamond fixture exercises the declared DAG + a multi-run history - // whose score stage keeps changing state. - raw := getRaw(t, srv.URL+"/api/pipelines/listing-refresh") - var detail PipelineDetail - if err := json.Unmarshal(raw, &detail); err != nil { - t.Fatalf("decode: %v", err) - } - if detail.Name != "listing-refresh" { - t.Fatalf("detail.Name = %q, want listing-refresh", detail.Name) - } - const wantDescription = "Refreshes the public listings index from Noted.\nScores, deduplicates, and gates publication." - if detail.Description != wantDescription { - t.Fatalf("detail.Description = %q, want %q", detail.Description, wantDescription) - } - var wire map[string]json.RawMessage - if err := json.Unmarshal(raw, &wire); err != nil { - t.Fatalf("decode detail wire payload: %v", err) - } - description, ok := wire["description"] - if !ok { - t.Fatalf("detail wire payload missing description: %s", raw) - } - var wireDescription string - if err := json.Unmarshal(description, &wireDescription); err != nil || wireDescription != wantDescription { - t.Fatalf("detail wire description = %q, want %q, err=%v", wireDescription, wantDescription, err) - } - benchRaw := getRaw(t, srv.URL+"/api/pipelines/bench-suite") - var benchWire map[string]json.RawMessage - if err := json.Unmarshal(benchRaw, &benchWire); err != nil { - t.Fatalf("decode bench detail wire payload: %v", err) - } - if _, ok := benchWire["description"]; ok { - t.Fatalf("bench-suite empty description should be absent from wire payload: %s", benchRaw) - } - - // Declared: current spec DAG, in spec (topological) order — deliberately NOT - // alphabetical — every stage pending, carrying deps/cmd; the flaky score stage - // carries a retry budget. - if detail.Declared == nil { - t.Fatalf("Declared must be non-nil") - } - wantDeclared := []string{"fetch", "score", "dedupe", "publish"} - if len(detail.Declared) != len(wantDeclared) { - t.Fatalf("len(Declared) = %d, want %d: %+v", len(detail.Declared), len(wantDeclared), detail.Declared) - } - declaredIDs := map[string]bool{} - byDeclID := map[string]PipelineStage{} - retrySeen := false - for i, st := range detail.Declared { - if st.ID != wantDeclared[i] { - t.Fatalf("Declared not in spec order: got %q at %d, want %q\n%+v", st.ID, i, wantDeclared[i], detail.Declared) - } - if st.State != "pending" { - t.Fatalf("declared stage %s state = %q, want pending", st.ID, st.State) - } - if st.Cmd == "" { - t.Fatalf("declared stage %s missing cmd", st.ID) - } - if st.Retry > 0 { - retrySeen = true - } - declaredIDs[st.ID] = true - byDeclID[st.ID] = st - } - // The diamond's dependency edges are carried on the downstream stages. - if score := byDeclID["score"]; len(score.Deps) != 1 || score.Deps[0] != "fetch" { - t.Fatalf("declared score.Deps = %v, want [fetch]", score.Deps) - } - if score := byDeclID["score"]; score.Kind != "agent_ask" || score.AgentRuntime != "codex" { - t.Fatalf("declared score stage missing agent metadata: %+v", score) - } - if publish := byDeclID["publish"]; len(publish.Deps) != 2 { - t.Fatalf("declared publish.Deps = %v, want 2 (the diamond join)", publish.Deps) - } - if publish := byDeclID["publish"]; publish.Kind != "gate" { - t.Fatalf("declared publish.Kind = %q, want gate", publish.Kind) - } - if !retrySeen { - t.Fatalf("expected at least one declared stage to carry a retry budget: %+v", detail.Declared) - } - - // Runs: newest-first, capped at 100, never nil; each run's Stages non-nil with - // mark ids within the declared set and states within the allow-lists. - if detail.Runs == nil { - t.Fatalf("Runs must be non-nil") - } - if len(detail.Runs) > 100 { - t.Fatalf("Runs not capped at 100: %d", len(detail.Runs)) - } - if len(detail.Runs) < 2 { - t.Fatalf("expected a multi-run history for listing-refresh, got %d", len(detail.Runs)) - } - // Newest run is the parked-blocked …-0001. - if detail.Runs[0].ID != "prun-listing-refresh-0001" { - t.Fatalf("newest run = %q, want prun-listing-refresh-0001", detail.Runs[0].ID) - } - // Strictly newest-first throughout (StartedAt desc, ID desc tie-break). The - // fixture's history literal is deliberately declared out of chronological - // order, so this fails if finalize() ever stops sorting. - for i := 1; i < len(detail.Runs); i++ { - prev, cur := detail.Runs[i-1], detail.Runs[i] - if cur.StartedAt > prev.StartedAt || (cur.StartedAt == prev.StartedAt && cur.ID > prev.ID) { - t.Fatalf("Runs not newest-first at %d: %s(%d) before %s(%d)", i, prev.ID, prev.StartedAt, cur.ID, cur.StartedAt) - } - } - scoreStates := map[string]bool{} - for i, run := range detail.Runs { - if run.ID == "" || run.State == "" { - t.Fatalf("run[%d] missing id/state: %+v", i, run) - } - if !realPipelineStates[run.State] { - t.Fatalf("run[%d] state = %q not a real run state", i, run.State) - } - if run.Trigger != "" && !realPipelineTriggers[run.Trigger] { - t.Fatalf("run[%d] trigger = %q not a real trigger", i, run.Trigger) - } - if i > 0 && detail.Runs[i-1].StartedAt < run.StartedAt { - t.Fatalf("Runs not newest-first (StartedAt desc): %+v", detail.Runs) - } - if run.Stages == nil { - t.Fatalf("run[%d] (%s) Stages must be non-nil", i, run.ID) - } - for _, mk := range run.Stages { - if !declaredIDs[mk.ID] { - t.Fatalf("run[%d] mark id %q not within the declared set %v", i, mk.ID, wantDeclared) - } - if !realPipelineStageStates[mk.State] { - t.Fatalf("run[%d] mark %s state = %q not a real stage state", i, mk.ID, mk.State) - } - if mk.ID == "score" { - scoreStates[mk.State] = true - } - } - } - // Flaky-stage variety: the score stage reaches >=2 distinct states across the - // history (the "which stage keeps failing" demo). - if len(scoreStates) < 2 { - t.Fatalf("expected the score stage to be flaky (>=2 distinct states), got %v", scoreStates) - } -} - -func TestHandlePipelineDetailKeys(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - allowedStatuses := map[string]bool{"none": true, "ok": true, "missing": true, "bad_mode": true, "bad_owner": true, "bad_location": true, "invalid": true} - allowedSources := map[string]bool{"own": true, "shared": true, "default": true} - allowedModes := map[string]bool{"injected": true, "proxied": true} - - decode := func(name string) ([]byte, PipelineDetail) { - t.Helper() - raw := getRaw(t, srv.URL+"/api/pipelines/"+name) - var wire map[string]json.RawMessage - if err := json.Unmarshal(raw, &wire); err != nil { - t.Fatalf("decode %s wire payload: %v", name, err) - } - keysRaw, ok := wire["keys"] - if !ok { - t.Fatalf("%s wire payload omitted keys: %s", name, raw) - } - var keysWire map[string]json.RawMessage - if err := json.Unmarshal(keysRaw, &keysWire); err != nil { - t.Fatalf("decode %s keys wire payload: %v", name, err) - } - if _, ok := keysWire["envFile"]; !ok { - t.Fatalf("%s keys wire payload omitted envFile: %s", name, keysRaw) - } - stagesRaw, ok := keysWire["stages"] - if !ok { - t.Fatalf("%s keys wire payload omitted stages: %s", name, keysRaw) - } - var stageWires []map[string]json.RawMessage - if err := json.Unmarshal(stagesRaw, &stageWires); err != nil || stageWires == nil { - t.Fatalf("%s keys.stages wire value = %s, want an array, err=%v", name, stagesRaw, err) - } - for i, stageWire := range stageWires { - if _, ok := stageWire["keys"]; !ok { - t.Fatalf("%s keys.stages[%d] omitted keys: %s", name, i, stagesRaw) - } - if _, ok := stageWire["unresolvedSelectors"]; !ok { - t.Fatalf("%s keys.stages[%d] omitted unresolvedSelectors: %s", name, i, stagesRaw) - } - } - var detail PipelineDetail - if err := json.Unmarshal(raw, &detail); err != nil { - t.Fatalf("decode %s detail: %v", name, err) - } - if !allowedStatuses[detail.Keys.EnvFile.Status] { - t.Fatalf("%s envFile.status = %q outside frozen enum", name, detail.Keys.EnvFile.Status) - } - if detail.Keys.Stages == nil { - t.Fatalf("%s keys.stages must be non-nil", name) - } - for i, stage := range detail.Keys.Stages { - if stage.Keys == nil { - t.Fatalf("%s keys.stages[%d].keys must be non-nil", name, i) - } - if stage.UnresolvedSelectors == nil { - t.Fatalf("%s keys.stages[%d].unresolvedSelectors must be non-nil", name, i) - } - for _, key := range stage.Keys { - if !allowedSources[key.Source] { - t.Fatalf("%s stage %s key %s source = %q outside frozen enum", name, stage.ID, key.Name, key.Source) - } - if !allowedModes[key.Mode] { - t.Fatalf("%s stage %s key %s mode = %q outside frozen enum", name, stage.ID, key.Name, key.Mode) - } - if key.Source == "shared" { - t.Fatalf("%s fixture must not fake shared key rows: %+v", name, key) - } - } - } - return raw, detail - } - - _, own := decode("nightly-deploy") - if own.Keys.EnvFile.Status != "ok" || own.Keys.EnvFile.Path != "/home/gitmoot/.config/gitmoot/pipelines/nightly-deploy.env" { - t.Fatalf("nightly-deploy envFile = %+v", own.Keys.EnvFile) - } - wantStages := []string{"source", "build", "deploy"} - if len(own.Keys.Stages) != len(wantStages) { - t.Fatalf("nightly-deploy key stages = %d, want %d", len(own.Keys.Stages), len(wantStages)) - } - for i, want := range wantStages { - if own.Keys.Stages[i].ID != want { - t.Fatalf("nightly-deploy key stage[%d] = %q, want %q", i, own.Keys.Stages[i].ID, want) - } - } - if len(own.Keys.Stages[0].Keys) != 0 { - t.Fatalf("source should render the no-credentials row: %+v", own.Keys.Stages[0]) - } - if got := own.Keys.Stages[1].Keys; len(got) != 1 || got[0] != (PipelineKeyEntry{Name: "BUILD_PROFILE", Source: "default", Mode: "injected"}) { - t.Fatalf("build key rows = %+v", got) - } - if got := own.Keys.Stages[2].Keys; len(got) != 2 || got[0].Name != "TELEGRAM_BOT_TOKEN" || got[1].Name != "TELEGRAM_CHAT_ID" { - t.Fatalf("deploy own key rows = %+v", got) - } - for _, key := range own.Keys.Stages[2].Keys { - if key.Source != "own" || key.Mode != "injected" { - t.Fatalf("deploy key row = %+v, want own/injected", key) - } - } - - _, missing := decode("listing-refresh") - if missing.Keys.EnvFile.Status != "missing" { - t.Fatalf("listing-refresh envFile.status = %q, want missing", missing.Keys.EnvFile.Status) - } - if len(missing.Keys.Stages) != 4 || missing.Keys.Stages[1].ID != "score" { - t.Fatalf("listing-refresh key stages = %+v", missing.Keys.Stages) - } - if got := missing.Keys.Stages[1].UnresolvedSelectors; !reflect.DeepEqual(got, []string{"R2_*", "MODEL_*"}) { - t.Fatalf("score unresolvedSelectors = %v, want [R2_* MODEL_*]", got) - } - - _, empty := decode("bench-suite") - if empty.Keys.EnvFile.Status != "none" || empty.Keys.Stages == nil || len(empty.Keys.Stages) != 0 { - t.Fatalf("bench-suite normalized empty keys = %+v", empty.Keys) - } -} - -func TestHandlePipelineDetailDeterministic(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - url := srv.URL + "/api/pipelines/listing-refresh" - if a, b := getRaw(t, url), getRaw(t, url); !bytes.Equal(a, b) { - t.Fatalf("pipeline detail not byte-stable across calls\nfirst: %s\nsecond: %s", a, b) - } -} - -func TestHandlePipelineDetailNotFound(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - resp, err := http.Get(srv.URL + "/api/pipelines/does-not-exist") - if err != nil { - t.Fatalf("GET /api/pipelines/does-not-exist: %v", err) - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusNotFound { - t.Fatalf("status = %d, want 404", resp.StatusCode) - } -} - func TestStateResponseIsIndented(t *testing.T) { srv := httptest.NewServer(Serve(NewFakeDataSource())) defer srv.Close() diff --git a/datasource.go b/datasource.go index d2376a7..2258295 100644 --- a/datasource.go +++ b/datasource.go @@ -419,14 +419,6 @@ type OverviewToday struct { Notable []OverviewNotable `json:"notable"` } -// OverviewScheduled is one upcoming declared pipeline. -type OverviewScheduled struct { - Name string `json:"name"` - Schedule string `json:"schedule"` - LastStatus string `json:"last_status"` - NextInS int64 `json:"next_in_s"` -} - // OverviewFleet is one registered agent's compact daily rollup. type OverviewFleet struct { Agent string `json:"agent"` @@ -437,11 +429,10 @@ type OverviewFleet struct { // Overview is the additive operator-first landing-page snapshot. type Overview struct { - NeedsYou []OverviewNeedsYou `json:"needs_you"` - Activity OverviewActivity `json:"activity"` - Today OverviewToday `json:"today"` - Scheduled []OverviewScheduled `json:"scheduled"` - Fleet []OverviewFleet `json:"fleet"` + NeedsYou []OverviewNeedsYou `json:"needs_you"` + Activity OverviewActivity `json:"activity"` + Today OverviewToday `json:"today"` + Fleet []OverviewFleet `json:"fleet"` } // OverviewDataSource is an optional extension so older gitmoot bridges remain @@ -759,21 +750,13 @@ type KeychainFileStatus struct { // KeychainKeyView is one names-only registry entry. Mode is injected or // proxied. ProxyUpstream and ProxyAuth are populated only for configured -// proxied keys. Grants is deterministic and never nil; CreatedAt is the -// store-provided timestamp string. +// proxied keys. CreatedAt is the store-provided timestamp string. type KeychainKeyView struct { - Name string `json:"name"` - Mode string `json:"mode"` - ProxyUpstream string `json:"proxyUpstream"` - ProxyAuth string `json:"proxyAuth"` - Grants []KeychainGrantView `json:"grants"` - CreatedAt string `json:"createdAt"` -} - -// KeychainGrantView names one consumer authorized to use a registry key. -type KeychainGrantView struct { - ConsumerKind string `json:"consumerKind"` - ConsumerID string `json:"consumerID"` + Name string `json:"name"` + Mode string `json:"mode"` + ProxyUpstream string `json:"proxyUpstream"` + ProxyAuth string `json:"proxyAuth"` + CreatedAt string `json:"createdAt"` } // ConfigSnapshot is the read-only, sanitized effective configuration consumed @@ -914,148 +897,6 @@ type Skills struct { PendingTotal int `json:"pendingTotal"` } -// Pipelines — the declared shell-stage pipelines (gitmoot #681). - -// PipelineSummary is one row of the Pipelines list: a declared pipeline -// (gitmoot #681) plus its schedule state and recent run outcomes. -type PipelineSummary struct { - Name string `json:"name"` - Repo string `json:"repo,omitempty"` - // Group is the display section resolved by the server from the pipeline spec's - // group, or its repository when the spec leaves group unset. It is never empty. - Group string `json:"group"` - Enabled bool `json:"enabled"` - Mode string `json:"mode,omitempty"` // display mode from the server: "email-triggered (bound|pending|error|unbound)[, scheduled ]" | "scheduled " | "after: " | "manual" - Interval string `json:"interval,omitempty"` // Go duration, e.g. "24h" - Jitter string `json:"jitter,omitempty"` - StageCount int `json:"stageCount"` - LastRunID string `json:"lastRunId,omitempty"` - LastStatus string `json:"lastStatus,omitempty"` // running | succeeded | blocked | failed | cancelled - LastRunAt int64 `json:"lastRunAt,omitempty"` // epoch milliseconds - NextDueAt int64 `json:"nextDueAt,omitempty"` // epoch milliseconds - Recent []PipelineRunSummary `json:"recent"` // newest-first, capped at 10, never nil -} - -// PipelineRunSummary is a lightweight listing entry for one run of a pipeline. -type PipelineRunSummary struct { - ID string `json:"id"` - Trigger string `json:"trigger,omitempty"` // manual | schedule | bridge (bridge = fired through the gitmoot bridge, e.g. by an email trigger) - State string `json:"state"` // running | succeeded | blocked | failed | cancelled - HaltStage string `json:"haltStage,omitempty"` - StartedAt int64 `json:"startedAt,omitempty"` // epoch milliseconds - FinishedAt int64 `json:"finishedAt,omitempty"` // epoch milliseconds - Duration int64 `json:"duration,omitempty"` // milliseconds (finished-started, 0 while running) -} - -// PipelineRun is the full detail of one run: identity/halt state plus the -// stage rows in spec (topological) order — the same order the CLI funnel prints. -type PipelineRun struct { - ID string `json:"id"` - Pipeline string `json:"pipeline"` - Repo string `json:"repo,omitempty"` - Trigger string `json:"trigger,omitempty"` // manual | schedule | bridge - State string `json:"state"` // running | succeeded | blocked | failed | cancelled - SpecHash string `json:"specHash,omitempty"` - HaltStage string `json:"haltStage,omitempty"` - HaltReason string `json:"haltReason,omitempty"` - Needs []string `json:"needs,omitempty"` // persisted blocked-needs, aggregated at run level - StartedAt int64 `json:"startedAt,omitempty"` // epoch milliseconds - FinishedAt int64 `json:"finishedAt,omitempty"` // epoch milliseconds - Stages []PipelineStage `json:"stages"` // spec order, never nil -} - -// PipelineStage is one shell stage of a pipeline run. Deps are the DAG -// dependency edges (the spec's needs list — edges derived client-side, like -// Node.Deps); Needs are the persisted blocked-needs of a parked stage. The two -// are deliberately distinct. -type PipelineStage struct { - ID string `json:"id"` - State string `json:"state"` // pending | queued | running | succeeded | blocked | failed | skipped | cancelled - Kind string `json:"kind,omitempty"` // shell | agent_ask | agent_review | agent_implement | produce | gate | orchestrate - AgentRuntime string `json:"agentRuntime,omitempty"` // runtime backing an agent stage, when known - Deps []string `json:"deps"` // DAG dependency IDs in payload order; may be empty - Cmd string `json:"cmd,omitempty"` - JobID string `json:"jobId,omitempty"` - Attempt int `json:"attempt,omitempty"` - Retry int `json:"retry,omitempty"` // the stage's retry budget from the spec - Needs []string `json:"needs,omitempty"` - Summary string `json:"summary,omitempty"` - // ProgressActivity is the sanitized last output line from gitmoot #816's - // latest-only progress event. It is normally absent, and is populated only - // for running stages after the 60-second progress threshold. - ProgressActivity string `json:"progressActivity,omitempty"` - // ProgressAt is the epoch-millisecond time of the #816 progress event. - // Like ProgressActivity, its absence is normal before the threshold. - ProgressAt int64 `json:"progressAt,omitempty"` - StartedAt int64 `json:"startedAt,omitempty"` // epoch milliseconds - FinishedAt int64 `json:"finishedAt,omitempty"` // epoch milliseconds -} - -// PipelineStageMark is the minimal per-run stage outcome used by the history -// matrix: which stage, and how it ended (or stands). -type PipelineStageMark struct { - ID string `json:"id"` - State string `json:"state"` // pending | queued | running | succeeded | blocked | failed | skipped | cancelled -} - -// PipelineRunHistoryEntry is one row of a pipeline's run history: the run -// summary plus its per-stage marks (in that run's stage order). -type PipelineRunHistoryEntry struct { - ID string `json:"id"` - Trigger string `json:"trigger,omitempty"` // manual | schedule | bridge - State string `json:"state"` // running | succeeded | blocked | failed | cancelled - HaltStage string `json:"haltStage,omitempty"` - StartedAt int64 `json:"startedAt,omitempty"` // epoch milliseconds - FinishedAt int64 `json:"finishedAt,omitempty"` // epoch milliseconds - Duration int64 `json:"duration,omitempty"` // milliseconds (finished-started, 0 while running) - Stages []PipelineStageMark `json:"stages"` // never nil -} - -// PipelineDetail is the click-through detail for one pipeline: its currently -// declared stage DAG (from the stored spec, every stage pending) plus the run -// history, newest-first, capped at 100 runs. -type PipelineDetail struct { - Name string `json:"name"` - // Description is optional free-form display text from the pipeline spec. It - // may be absent when the pipeline has no declared description. - Description string `json:"description,omitempty"` - Declared []PipelineStage `json:"declared"` // current spec DAG, state "pending"; never nil - Runs []PipelineRunHistoryEntry `json:"runs"` // newest-first, capped at 100; never nil - Keys PipelineKeys `json:"keys"` // names-only credential projection; never contains secret values -} - -// PipelineKeys is the names-only credential view for a pipeline. Stages stay in -// spec order and are never nil. -type PipelineKeys struct { - EnvFile PipelineEnvFileStatus `json:"envFile"` - Stages []PipelineStageKeys `json:"stages"` -} - -// PipelineEnvFileStatus reports validation metadata without exposing file -// contents. Status is none | ok | missing | bad_mode | bad_owner | -// bad_location | invalid. -type PipelineEnvFileStatus struct { - Path string `json:"path"` - Status string `json:"status"` -} - -// PipelineStageKeys is one stage's ordered, names-only credential projection. -// Keys and UnresolvedSelectors are never nil. -type PipelineStageKeys struct { - ID string `json:"id"` - Kind string `json:"kind"` - Keys []PipelineKeyEntry `json:"keys"` - UnresolvedSelectors []string `json:"unresolvedSelectors"` -} - -// PipelineKeyEntry identifies one credential by name, source, and delivery -// mode. Source is own | shared | default; Mode is injected | proxied. -type PipelineKeyEntry struct { - Name string `json:"name"` - Source string `json:"source"` - Mode string `json:"mode"` -} - // Attention + binary checks — surfacing evaluator output and human gates where a // human (or the planned Slack/media bridge, gitmoot #519) manages work // (gitmoot #528). @@ -1204,18 +1045,6 @@ type DataSource interface { // the page renders real data, whereas Knowledge and Chat were backed by tables // gitmoot retired and could only ever answer empty. Skills(ctx context.Context) (Skills, error) - // Pipelines returns every declared pipeline with its schedule state and recent - // run outcomes (newest-first, capped at 10), sorted by name. Ordering must be - // deterministic (the UI polls with a signature-skip). - Pipelines(ctx context.Context) ([]PipelineSummary, error) - // PipelineRun returns the full detail for a single run by run id, stages in - // spec (topological) order. Unknown ids return ErrPipelineRunNotFound. - PipelineRun(ctx context.Context, id string) (PipelineRun, error) - // PipelineDetail returns one pipeline's declared stage DAG and its run history - // (newest-first, capped at 100 runs, each with per-stage marks). Unknown names - // return ErrPipelineNotFound. Ordering must be deterministic (the UI polls with - // a signature-skip). - PipelineDetail(ctx context.Context, name string) (PipelineDetail, error) // Attention returns the "Needs a human" view (gitmoot #528): blocked job // gates, pending synth approvals and template candidates awaiting promotion. // Ordering must be deterministic (the UI polls with a signature-skip). diff --git a/datasource_test.go b/datasource_test.go index 796b058..92f8f79 100644 --- a/datasource_test.go +++ b/datasource_test.go @@ -6,77 +6,6 @@ import ( "testing" ) -func TestPipelineStageProgressJSON(t *testing.T) { - t.Run("legacy payload", func(t *testing.T) { - const payload = `{"id":"build","state":"running"}` - var stage PipelineStage - if err := json.Unmarshal([]byte(payload), &stage); err != nil { - t.Fatalf("unmarshal legacy PipelineStage: %v", err) - } - if stage.ID != "build" || stage.State != "running" { - t.Fatalf("legacy PipelineStage identity = %+v", stage) - } - if stage.ProgressActivity != "" || stage.ProgressAt != 0 { - t.Fatalf("legacy PipelineStage gained progress fields: %+v", stage) - } - stage.Deps = []string{} - - got, err := json.Marshal(stage) - if err != nil { - t.Fatalf("marshal legacy PipelineStage: %v", err) - } - const want = `{"id":"build","state":"running","deps":[]}` - if string(got) != want { - t.Fatalf("legacy PipelineStage JSON = %s, want %s", got, want) - } - }) - - t.Run("progress payload", func(t *testing.T) { - const payload = `{"id":"build","state":"running","progressActivity":"compiled package 42/100","progressAt":1720000123456}` - var stage PipelineStage - if err := json.Unmarshal([]byte(payload), &stage); err != nil { - t.Fatalf("unmarshal progress PipelineStage: %v", err) - } - if stage.ID != "build" || stage.State != "running" { - t.Fatalf("progress PipelineStage identity = %+v", stage) - } - if stage.ProgressActivity != "compiled package 42/100" || stage.ProgressAt != 1_720_000_123_456 { - t.Fatalf("progress PipelineStage fields = %+v", stage) - } - stage.Deps = []string{} - - got, err := json.Marshal(stage) - if err != nil { - t.Fatalf("marshal progress PipelineStage: %v", err) - } - const want = `{"id":"build","state":"running","deps":[],"progressActivity":"compiled package 42/100","progressAt":1720000123456}` - if string(got) != want { - t.Fatalf("progress PipelineStage JSON = %s, want %s", got, want) - } - }) - - t.Run("kind runtime payload", func(t *testing.T) { - const payload = `{"id":"answer","state":"running","kind":"agent_ask","agentRuntime":"codex","jobId":"job-1"}` - var stage PipelineStage - if err := json.Unmarshal([]byte(payload), &stage); err != nil { - t.Fatalf("unmarshal kind/runtime PipelineStage: %v", err) - } - if stage.Kind != "agent_ask" || stage.AgentRuntime != "codex" || stage.JobID != "job-1" { - t.Fatalf("kind/runtime PipelineStage fields = %+v", stage) - } - stage.Deps = []string{} - - got, err := json.Marshal(stage) - if err != nil { - t.Fatalf("marshal kind/runtime PipelineStage: %v", err) - } - const want = `{"id":"answer","state":"running","kind":"agent_ask","agentRuntime":"codex","deps":[],"jobId":"job-1"}` - if string(got) != want { - t.Fatalf("kind/runtime PipelineStage JSON = %s, want %s", got, want) - } - }) -} - func TestWorkflowAdditiveJSONContracts(t *testing.T) { t.Run("legacy graph node and state omit workflow fields", func(t *testing.T) { node := GraphNode{ID: "job-1", Type: "job", Label: "legacy", State: "running"} diff --git a/fakefeed.go b/fakefeed.go index 182bd92..1c2b877 100644 --- a/fakefeed.go +++ b/fakefeed.go @@ -20,10 +20,6 @@ var ( ErrJobNotFound = errors.New("job not found") // ErrAgentNotFound indicates the requested agent does not exist. ErrAgentNotFound = errors.New("agent not found") - // ErrPipelineRunNotFound indicates the requested pipeline run does not exist. - ErrPipelineRunNotFound = errors.New("pipeline run not found") - // ErrPipelineNotFound indicates the requested pipeline does not exist. - ErrPipelineNotFound = errors.New("pipeline 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. @@ -620,7 +616,7 @@ func fakeWorkflowIndex(anchor int64) []WorkflowIndexEntry { {Label: "sol/smart-groomer", Summary: "Improving memory grooming with safer split and merge heuristics.", Coordinator: WorkflowCoordinator{Author: "claude-coordinator", Pane: "sol", SessionID: "c40d8a"}, State: "active", Counts: WorkflowCounts{Jobs: 11, Running: 2, Succeeded: 9, Notes: 12}, TokensIn: 680_000, TokensOut: 210_000, FirstAt: anchor - 2*hour, LastAt: anchor - 4*minute, LastNote: "Validation workers are still moving.", Repos: []string{"jerryfane/gitmoot"}}, {Label: "officeqa-point-formula", Coordinator: WorkflowCoordinator{Author: "claude-coordinator", Pane: "kimi", SessionID: "d7c410"}, State: "settled", Counts: WorkflowCounts{Jobs: 16, Succeeded: 12, Failed: 3, Blocked: 1, Notes: 9}, TokensIn: 2_100_000, TokensOut: 800_000, FirstAt: anchor - day, LastAt: anchor - 8*hour, LastNote: "Closing note published.", Repos: []string{"jerryfane/officeqa"}}, {Label: "sol/token-accounting", Coordinator: WorkflowCoordinator{Author: "claude-coordinator", Pane: "sol", SessionID: "1f9b22"}, State: "settled", Counts: WorkflowCounts{Jobs: 9, Succeeded: 7, Failed: 1, Blocked: 1, Notes: 6}, TokensIn: 470_000, TokensOut: 170_000, FirstAt: anchor - 9*hour, LastAt: anchor - 6*hour, LastNote: "Token totals reconciled.", Repos: []string{"jerryfane/gitmoot"}}, - {Label: "pipeline/memory-groom-propose", Coordinator: WorkflowCoordinator{Author: "claude-coordinator", Pane: "pipeline", SessionID: "0f621a"}, State: "settled", Counts: WorkflowCounts{Jobs: 5, Succeeded: 5}, TokensIn: 18_000, TokensOut: 4_000, FirstAt: anchor - 5*hour, LastAt: anchor - 4*hour, Repos: []string{"jerryfane/gitmoot"}}, + {Label: "ops/groom-propose", Coordinator: WorkflowCoordinator{Author: "claude-coordinator", Pane: "ops", SessionID: "0f621a"}, State: "settled", Counts: WorkflowCounts{Jobs: 5, Succeeded: 5}, TokensIn: 18_000, TokensOut: 4_000, FirstAt: anchor - 5*hour, LastAt: anchor - 4*hour, Repos: []string{"jerryfane/gitmoot"}}, {Label: "adhoc/researcher", Coordinator: WorkflowCoordinator{Author: "claude-coordinator", Pane: "adhoc", SessionID: "8aa912"}, State: "settled", Counts: WorkflowCounts{Jobs: 26, Succeeded: 22, Failed: 4}, TokensIn: 3_600_000, TokensOut: 1_300_000, FirstAt: anchor - 3*day, LastAt: anchor - day, Repos: []string{"jerryfane/gitmoot", "jerryfane/sophon"}}, } } @@ -681,7 +677,7 @@ func (f *FakeDataSource) Overview(ctx context.Context) (Overview, error) { {Label: "sol/dashboard-redesign", Running: 2, Agents: []string{"sol-impl-a", "ui-designer-researcher"}, StartedAgoS: 4 * 60}, {Label: "fable/smart-groomer", Running: 3, Agents: []string{"researcher", "research-sol", "wave-impl"}, StartedAgoS: 25 * 60}, }, - UnattendedNote: "pipeline/… + adhoc/… · 4 more jobs running", + UnattendedNote: "ops/… + adhoc/… · 4 more jobs running", Queued: 8, }, Today: OverviewToday{ @@ -695,11 +691,6 @@ func (f *FakeDataSource) Overview(ctx context.Context) (Overview, error) { {Agent: "planner", Title: "Plan MOOT for jerryfane/gitmoot #779", Outcome: "cancelled", ElapsedS: 0, AgeS: 2 * 3600}, }, }, - Scheduled: []OverviewScheduled{ - {Name: "arxiv-paper-summary", Schedule: "every 6h +30m", LastStatus: "failed", NextInS: 2*3600 + 9*60}, - {Name: "memory-groom-propose", Schedule: "every 24h", LastStatus: "succeeded", NextInS: 19*3600 + 32*60}, - {Name: "memory-ingest-sweep", Schedule: "every 24h +30m", LastStatus: "succeeded", NextInS: 21*3600 + 27*60}, - }, Fleet: []OverviewFleet{ {Agent: "researcher", Runtime: "claude", Running: true, JobsToday: 22}, {Agent: "btc-coordinator", Runtime: "codex", Running: true, JobsToday: 41}, @@ -741,7 +732,7 @@ func fakeWakeRows() []WakeRow { State: "pending", AttemptCount: 0, AgeSeconds: 420, CreatedAt: "2026-07-28T23:21:00Z", }, { - ID: "wake-pending-002", TargetRole: "g2", SourceKind: "pipeline", SourceID: "pipeline-run-1230", + ID: "wake-pending-002", TargetRole: "g2", SourceKind: "awaited_fact", SourceID: "fact-release-1230", State: "pending", AttemptCount: 0, AgeSeconds: 180, CreatedAt: "2026-07-28T23:25:00Z", }, { @@ -1927,7 +1918,6 @@ func fakeKeychain() KeychainView { { Name: "GH_TOKEN", Mode: "injected", - Grants: []KeychainGrantView{{ConsumerKind: "pipeline", ConsumerID: "gitmoot-marketing"}, {ConsumerKind: "pipeline", ConsumerID: "trend-scout"}}, CreatedAt: "2026-07-08T09:12:00Z", }, { @@ -1935,19 +1925,16 @@ func fakeKeychain() KeychainView { Mode: "proxied", ProxyUpstream: "https://api.openai.com/v1", ProxyAuth: "bearer", - Grants: []KeychainGrantView{{ConsumerKind: "pipeline", ConsumerID: "trend-scout"}}, CreatedAt: "2026-07-09T14:35:00Z", }, { Name: "TELEGRAM_BOT_TOKEN", Mode: "injected", - Grants: []KeychainGrantView{{ConsumerKind: "pipeline", ConsumerID: "gitmoot-marketing"}, {ConsumerKind: "pipeline", ConsumerID: "trend-scout"}}, CreatedAt: "2026-07-10T07:48:00Z", }, { Name: "TELEGRAM_CHAT_ID", Mode: "injected", - Grants: []KeychainGrantView{{ConsumerKind: "pipeline", ConsumerID: "gitmoot-marketing"}}, CreatedAt: "2026-07-10T07:49:00Z", }, }, @@ -2062,489 +2049,6 @@ func (f *FakeDataSource) Skills(ctx context.Context) (Skills, error) { return fakeSkills(), nil } -// fakePipelineRuns builds the fixed set of pipeline run details (gitmoot #681) -// behind the Pipelines section, keyed by run id. Every timestamp is anchored on -// fakeChartsNow (never time.Now()) so the section is byte-stable across polls. -// The five runs together exercise every real-emittable shape: a healthy linear -// run that fully succeeded (prun-nightly-deploy-0001); an in-flight run with a -// done stage, a running stage and a pending stage (…-0002); a parked-blocked -// diamond carrying persisted needs at both the stage and the run level, with a -// downstream stage skipped (prun-listing-refresh-0001); a failed run with a -// retried stage and a skipped report (prun-bench-suite-0001); and an older -// failed run for run-history/sparkline variety (…-0000). Stages are emitted in -// spec (topological) order — deliberately NOT alphabetical for the diamond — so -// the client renders the DAG the same way the CLI funnel prints it. Some cmds -// and summaries carry angle brackets and ampersands so the client's -// HTML-escaping is exercised. -func fakePipelineRuns() map[string]PipelineRun { - const ( - h = time.Hour - m = time.Minute - ) - // ago returns the epoch-ms d before fakeChartsNow (never time.Now()). - ago := func(d time.Duration) int64 { return fakeChartsNow.Add(-d).UnixMilli() } - - return map[string]PipelineRun{ - // Healthy linear bridge-triggered run: source -> build -> deploy, all succeeded. - // The most recent nightly-deploy run (StartedAt 6h ago), so it is the - // pipeline's LastRun. - "prun-nightly-deploy-0001": { - ID: "prun-nightly-deploy-0001", - Pipeline: "nightly-deploy", - Repo: "acme/webapp", - Trigger: "bridge", - State: "succeeded", - SpecHash: "sha256:9c1f0ade", - StartedAt: ago(6 * h), - FinishedAt: ago(6*h - 13*m), - Stages: []PipelineStage{ - {ID: "source", State: "succeeded", Kind: "shell", Deps: []string{}, Cmd: "git fetch --all && git checkout main", JobID: "job-nd1-source", Summary: "checked out main @ a1b2c3d", StartedAt: ago(6 * h), FinishedAt: ago(6*h - 3*m)}, - {ID: "build", State: "succeeded", Kind: "agent_ask", AgentRuntime: "codex", Deps: []string{"source"}, Cmd: "make build", JobID: "job-nd1-build", Summary: "built 42 packages, 0 warnings", StartedAt: ago(6*h - 3*m), FinishedAt: ago(6*h - 10*m)}, - {ID: "deploy", State: "succeeded", Kind: "gate", Deps: []string{"build"}, Cmd: "./scripts/deploy.sh --env prod", JobID: "job-nd1-deploy", Summary: "deployed to prod, health green", StartedAt: ago(6*h - 10*m), FinishedAt: ago(6*h - 13*m)}, - }, - }, - // In-flight run: source succeeded, build running with progress, deploy - // pending (no job assigned yet). A static snapshot of a previous hung cycle - // (StartedAt 30h ago), so poll-stable byte-equality still holds. - "prun-nightly-deploy-0002": { - ID: "prun-nightly-deploy-0002", - Pipeline: "nightly-deploy", - Repo: "acme/webapp", - Trigger: "bridge", - State: "running", - SpecHash: "sha256:9c1f0ade", - StartedAt: ago(30 * h), - Stages: []PipelineStage{ - {ID: "source", State: "succeeded", Kind: "shell", Deps: []string{}, Cmd: "git fetch --all && git checkout main", JobID: "job-nd2-source", Summary: "checked out main @ b2c3d4e", StartedAt: ago(30 * h), FinishedAt: ago(30*h - 4*m)}, - {ID: "build", State: "running", Kind: "agent_ask", AgentRuntime: "codex", Deps: []string{"source"}, Cmd: "make build", JobID: "job-nd2-build", Summary: "compiling packages", ProgressActivity: "compiled 31 of 42 packages", ProgressAt: ago(29*h + 42*m), StartedAt: ago(30*h - 4*m)}, - {ID: "deploy", State: "pending", Kind: "gate", Deps: []string{"build"}, Cmd: "./scripts/deploy.sh --env prod"}, - }, - }, - // Older scheduled run for hybrid run-history/sparkline variety (StartedAt 3 days ago): - // source + build succeeded, deploy failed. - "prun-nightly-deploy-0000": { - ID: "prun-nightly-deploy-0000", - Pipeline: "nightly-deploy", - Repo: "acme/webapp", - Trigger: "schedule", - State: "failed", - SpecHash: "sha256:9c1f0ade", - HaltStage: "deploy", - HaltReason: "prod healthcheck failed after deploy", - StartedAt: ago(3 * 24 * h), - FinishedAt: ago(3*24*h - 9*m), - Stages: []PipelineStage{ - {ID: "source", State: "succeeded", Kind: "shell", Deps: []string{}, Cmd: "git fetch --all && git checkout main", JobID: "job-nd0-source", Summary: "checked out main @ 0f1e2d3", StartedAt: ago(3 * 24 * h), FinishedAt: ago(3*24*h - 2*m)}, - {ID: "build", State: "succeeded", Kind: "agent_ask", AgentRuntime: "codex", Deps: []string{"source"}, Cmd: "make build", JobID: "job-nd0-build", Summary: "built 41 packages", StartedAt: ago(3*24*h - 2*m), FinishedAt: ago(3*24*h - 7*m)}, - {ID: "deploy", State: "failed", Kind: "gate", Deps: []string{"build"}, Cmd: "./scripts/deploy.sh --env prod", JobID: "job-nd0-deploy", Summary: "deploy script exited 1: prod healthcheck failed", StartedAt: ago(3*24*h - 7*m), FinishedAt: ago(3*24*h - 9*m)}, - }, - }, - // Parked-blocked diamond: fetch -> {score, dedupe} -> publish. score is - // BLOCKED with persisted needs (also aggregated at the run level), dedupe - // succeeded, and the downstream publish is SKIPPED. Stage order is spec - // order (fetch, score, dedupe, publish), NOT alphabetical, so the client - // lays out the DAG correctly. - "prun-listing-refresh-0001": { - ID: "prun-listing-refresh-0001", - Pipeline: "listing-refresh", - Repo: "jerryfane/noted", - Trigger: "manual", - State: "blocked", - SpecHash: "sha256:41ab77e0", - HaltStage: "score", - HaltReason: "scoring model needs the R2 token", - Needs: []string{"set R2 token: gitmoot config set r2.token"}, - StartedAt: ago(2 * h), - Stages: []PipelineStage{ - {ID: "fetch", State: "succeeded", Kind: "shell", Deps: []string{}, Cmd: "gitmoot listings fetch --source noted", JobID: "job-lr1-fetch", Summary: "fetched 128 listings", StartedAt: ago(2 * h), FinishedAt: ago(2*h - 3*m)}, - {ID: "score", State: "blocked", Kind: "agent_ask", AgentRuntime: "codex", Deps: []string{"fetch"}, Cmd: "gitmoot listings score --model r2", JobID: "job-lr1-score", Retry: 2, Needs: []string{"set R2 token: gitmoot config set r2.token"}, Summary: "blocked: scoring needs the R2 token & before it can run", StartedAt: ago(2*h - 3*m)}, - {ID: "dedupe", State: "succeeded", Kind: "shell", Deps: []string{"fetch"}, Cmd: "gitmoot listings dedupe", JobID: "job-lr1-dedupe", Summary: "removed 9 duplicates", StartedAt: ago(2*h - 3*m), FinishedAt: ago(2*h - 6*m)}, - {ID: "publish", State: "skipped", Kind: "gate", Deps: []string{"score", "dedupe"}, Cmd: "gitmoot listings publish", Summary: "skipped: upstream stage score is blocked"}, - }, - }, - // Failed run with a retried stage: setup succeeded, bench FAILED on attempt - // 2, report SKIPPED. The bench cmd and summary carry angle brackets and - // ampersands to exercise the client's HTML-escaping. - "prun-bench-suite-0001": { - ID: "prun-bench-suite-0001", - Pipeline: "bench-suite", - Repo: "acme/api", - Trigger: "manual", - State: "failed", - SpecHash: "sha256:7d3c9b12", - HaltStage: "bench", - HaltReason: "benchmark stage exceeded the 30m timeout on attempt 2", - StartedAt: ago(26 * h), - FinishedAt: ago(26*h - 34*m), - Stages: []PipelineStage{ - {ID: "setup", State: "succeeded", Kind: "shell", Deps: []string{}, Cmd: "make bench-setup", JobID: "job-bs1-setup", Summary: "warmed caches, seeded 10k rows", StartedAt: ago(26 * h), FinishedAt: ago(26*h - 4*m)}, - {ID: "bench", State: "failed", Kind: "shell", Deps: []string{"setup"}, Cmd: `./scripts/bench.sh --filter "p<95> && q>1"`, JobID: "job-bs1-bench", Attempt: 2, Retry: 2, Summary: "benchmark timeout after 2 retries (filter p<95> && q>1)", StartedAt: ago(26*h - 4*m), FinishedAt: ago(26*h - 34*m)}, - {ID: "report", State: "skipped", Kind: "shell", Deps: []string{"bench"}, Cmd: "./scripts/report.sh", Summary: "skipped: upstream stage bench failed"}, - }, - }, - } -} - -// fakePipelineRunSummary projects a full PipelineRun detail down to the -// lightweight listing entry shown in a pipeline's Recent strip. Duration is the -// finished-started span in ms when both are set, else 0 (a still-running or -// parked run reports 0). -func fakePipelineRunSummary(run PipelineRun) PipelineRunSummary { - var duration int64 - if run.StartedAt > 0 && run.FinishedAt > run.StartedAt { - duration = run.FinishedAt - run.StartedAt - } - return PipelineRunSummary{ - ID: run.ID, - Trigger: run.Trigger, - State: run.State, - HaltStage: run.HaltStage, - StartedAt: run.StartedAt, - FinishedAt: run.FinishedAt, - Duration: duration, - } -} - -// fakePipelines builds the fixed Pipelines-list fixture (gitmoot #681). Its -// groups exercise a cross-repository custom group, a repository split across -// groups, server-resolved repository fallbacks, and Gitmoot System. Every -// timestamp is anchored on fakeChartsNow (never time.Now()); the pipeline list -// is sorted by name and each Recent strip is sorted newest-first (StartedAt -// desc, then ID desc — matching the store's ORDER BY started_at DESC, id DESC) -// and coerced non-nil, so the whole view is byte-stable across polls. -func fakePipelines() []PipelineSummary { - // fut returns the epoch-ms d after fakeChartsNow (a future next-due time). - fut := func(d time.Duration) int64 { return fakeChartsNow.Add(d).UnixMilli() } - runs := fakePipelineRuns() - - // runsFor projects the named runs into Recent entries, newest-first (StartedAt - // desc, ID desc), capped at 10 and never nil. - runsFor := func(ids ...string) []PipelineRunSummary { - out := make([]PipelineRunSummary, 0, len(ids)) - for _, id := range ids { - out = append(out, fakePipelineRunSummary(runs[id])) - } - sort.SliceStable(out, func(i, j int) bool { - if out[i].StartedAt != out[j].StartedAt { - return out[i].StartedAt > out[j].StartedAt // newest first - } - return out[i].ID > out[j].ID // ID desc tie-break (unique) - }) - if len(out) > 10 { - out = out[:10] - } - return out - } - - pipelines := []PipelineSummary{ - { - Name: "api-contract-check", - Repo: "acme/api", - Group: "Release Automation", - Enabled: true, - Mode: "scheduled 24h", - Interval: "24h", - StageCount: 2, - Recent: []PipelineRunSummary{}, - }, - { - Name: "bench-suite", - Repo: "acme/api", - Group: "Quality", - Enabled: false, - Mode: "scheduled 168h", - Interval: "168h", - StageCount: 3, - LastRunID: "prun-bench-suite-0001", - LastStatus: "failed", - LastRunAt: runs["prun-bench-suite-0001"].StartedAt, - Recent: runsFor("prun-bench-suite-0001"), - }, - { - Name: "listing-refresh", - Repo: "jerryfane/noted", - // Server-resolved fallback for a spec with no explicit group. - Group: "jerryfane/noted", - Enabled: true, - Mode: "manual", - StageCount: 4, - LastRunID: "prun-listing-refresh-0001", - LastStatus: "blocked", - LastRunAt: runs["prun-listing-refresh-0001"].StartedAt, - Recent: runsFor("prun-listing-refresh-0001"), - }, - { - Name: "memory-groom-propose", - Repo: "jerryfane/gitmoot", - Group: "Gitmoot System", - Enabled: true, - Mode: "scheduled 24h", - Interval: "24h", - StageCount: 3, - LastRunID: "prun-memory-groom-propose-0001", - LastStatus: "succeeded", - LastRunAt: fakeChartsNow.Add(-4 * time.Hour).UnixMilli(), - NextDueAt: fut(3*time.Hour + 36*time.Minute), - Recent: []PipelineRunSummary{{ - ID: "prun-memory-groom-propose-0001", - Trigger: "schedule", - State: "succeeded", - StartedAt: fakeChartsNow.Add(-4 * time.Hour).UnixMilli(), - FinishedAt: fakeChartsNow.Add(-4*time.Hour + 4*time.Minute).UnixMilli(), - Duration: int64(4 * time.Minute / time.Millisecond), - }}, - }, - { - Name: "memory-ingest-sweep", - Repo: "jerryfane/gitmoot", - Group: "Gitmoot System", - Enabled: true, - Mode: "after: memory-groom-propose", - StageCount: 2, - LastRunID: "prun-memory-ingest-sweep-0001", - LastStatus: "succeeded", - LastRunAt: fakeChartsNow.Add(-4*time.Hour + 7*time.Minute).UnixMilli(), - Recent: []PipelineRunSummary{{ - ID: "prun-memory-ingest-sweep-0001", - Trigger: "schedule", - State: "succeeded", - StartedAt: fakeChartsNow.Add(-4*time.Hour + 7*time.Minute).UnixMilli(), - FinishedAt: fakeChartsNow.Add(-4*time.Hour + 17*time.Minute).UnixMilli(), - Duration: int64(10 * time.Minute / time.Millisecond), - }}, - }, - { - Name: "nightly-deploy", - Repo: "acme/webapp", - Group: "Release Automation", - Enabled: true, - Mode: "email-triggered (bound), scheduled 24h", - Interval: "24h", - Jitter: "15m", - StageCount: 3, - LastRunID: "prun-nightly-deploy-0001", - LastStatus: "succeeded", - LastRunAt: runs["prun-nightly-deploy-0001"].StartedAt, - NextDueAt: fut(7 * time.Hour), - Recent: runsFor("prun-nightly-deploy-0002", "prun-nightly-deploy-0001", "prun-nightly-deploy-0000"), - }, - { - Name: "noted-search-index", - Repo: "jerryfane/noted", - // A second spec with no explicit group, resolved by the server to Repo. - Group: "jerryfane/noted", - Enabled: true, - Mode: "manual", - StageCount: 2, - Recent: []PipelineRunSummary{}, - }, - } - - // Sorted by name (deterministic; the UI polls with a signature-skip). Names - // are unique, so the sort is fully determined. - sort.SliceStable(pipelines, func(i, j int) bool { - return pipelines[i].Name < pipelines[j].Name - }) - return pipelines -} - -// Pipelines implements DataSource. It returns the fixed fakePipelines fixture; -// output is deterministic and byte-stable across calls. -func (f *FakeDataSource) Pipelines(ctx context.Context) ([]PipelineSummary, error) { - return fakePipelines(), nil -} - -// PipelineRun implements DataSource. It returns the fixed detail for a run by id -// from the fakePipelineRuns fixture; unknown ids return ErrPipelineRunNotFound. -// Output is deterministic and byte-stable across calls. -func (f *FakeDataSource) PipelineRun(ctx context.Context, id string) (PipelineRun, error) { - run, ok := fakePipelineRuns()[id] - if !ok { - return PipelineRun{}, ErrPipelineRunNotFound - } - return run, nil -} - -// fakePipelineHistoryEntry projects a full PipelineRun detail into a run-history -// entry (gitmoot #708): the run summary plus its per-stage marks in the run's -// (spec) stage order. Duration is the finished-started span in ms when both are -// set, else 0 (a still-running or parked run reports 0). -func fakePipelineHistoryEntry(run PipelineRun) PipelineRunHistoryEntry { - var duration int64 - if run.StartedAt > 0 && run.FinishedAt > run.StartedAt { - duration = run.FinishedAt - run.StartedAt - } - marks := make([]PipelineStageMark, 0, len(run.Stages)) - for _, st := range run.Stages { - marks = append(marks, PipelineStageMark{ID: st.ID, State: st.State}) - } - return PipelineRunHistoryEntry{ - ID: run.ID, - Trigger: run.Trigger, - State: run.State, - HaltStage: run.HaltStage, - StartedAt: run.StartedAt, - FinishedAt: run.FinishedAt, - Duration: duration, - Stages: marks, - } -} - -// fakePipelineDetail builds the fixed click-through detail (gitmoot #708) for one -// pipeline: its currently declared stage DAG (every stage pending, carrying the -// spec's deps/cmd/retry) plus the run history newest-first. Every timestamp is -// anchored on fakeChartsNow (never time.Now()) so the section is byte-stable -// across polls; each history list is sorted newest-first (StartedAt desc, then -// ID desc — a unique tie-break) and every run's marks are emitted in spec order. -// The three declared pipelines exercise the history matrix: -// - nightly-deploy: an ~8-run, 8-day history that is mostly succeeded with one -// failed run mid-history and the in-flight run (…-0002) present — enough for -// a meaningful stage×run matrix and success-rate math. -// - listing-refresh: a ~6-run history whose score stage is FLAKY (blocked in -// several runs, failed in one, succeeded in others — the "which stage keeps -// failing" demo); the newest run is the parked-blocked …-0001. -// - bench-suite: a single failed run. -// -// Unknown names return (PipelineDetail{}, false). -func fakePipelineDetail(name string) (PipelineDetail, bool) { - const ( - m = time.Minute - d = 24 * time.Hour - ) - ago := func(x time.Duration) int64 { return fakeChartsNow.Add(-x).UnixMilli() } - runs := fakePipelineRuns() - - // entry derives a history entry from an existing full run detail (keeps the - // history rows byte-consistent with the /api/pipeline/run/{id} endpoint). - entry := func(id string) PipelineRunHistoryEntry { return fakePipelineHistoryEntry(runs[id]) } - - // sm is a per-stage mark; mk builds a synthetic history entry with a computed - // duration (finished-started, 0 when unfinished/parked). - sm := func(id, state string) PipelineStageMark { return PipelineStageMark{ID: id, State: state} } - mk := func(id, trigger, state, halt string, started, finished int64, marks ...PipelineStageMark) PipelineRunHistoryEntry { - var duration int64 - if started > 0 && finished > started { - duration = finished - started - } - return PipelineRunHistoryEntry{ - ID: id, - Trigger: trigger, - State: state, - HaltStage: halt, - StartedAt: started, - FinishedAt: finished, - Duration: duration, - Stages: marks, - } - } - - // finalize sorts a run history newest-first (StartedAt desc, ID desc) and caps - // it at 100 so the view is fully deterministic. - finalize := func(pname, description string, declared []PipelineStage, history []PipelineRunHistoryEntry, keys PipelineKeys) PipelineDetail { - sort.SliceStable(history, func(i, j int) bool { - if history[i].StartedAt != history[j].StartedAt { - return history[i].StartedAt > history[j].StartedAt // newest first - } - return history[i].ID > history[j].ID // ID desc tie-break (unique) - }) - if len(history) > 100 { - history = history[:100] - } - return PipelineDetail{Name: pname, Description: description, Declared: declared, Runs: history, Keys: keys} - } - - switch name { - case "nightly-deploy": - declared := []PipelineStage{ - {ID: "source", State: "pending", Kind: "shell", Deps: []string{}, Cmd: "git fetch --all && git checkout main"}, - {ID: "build", State: "pending", Kind: "agent_ask", AgentRuntime: "codex", Deps: []string{"source"}, Cmd: "make build"}, - {ID: "deploy", State: "pending", Kind: "gate", Deps: []string{"build"}, Cmd: "./scripts/deploy.sh --env prod"}, - } - ok := []PipelineStageMark{sm("source", "succeeded"), sm("build", "succeeded"), sm("deploy", "succeeded")} - history := []PipelineRunHistoryEntry{ - entry("prun-nightly-deploy-0001"), // succeeded, 6h ago (newest) - entry("prun-nightly-deploy-0002"), // running (in-flight), 30h ago - entry("prun-nightly-deploy-0000"), // failed, 3d ago (mid-history) - mk("prun-nightly-deploy-0100", "schedule", "succeeded", "", ago(2*d), ago(2*d-12*m), ok...), - mk("prun-nightly-deploy-0101", "schedule", "succeeded", "", ago(4*d), ago(4*d-11*m), ok...), - mk("prun-nightly-deploy-0102", "schedule", "succeeded", "", ago(5*d), ago(5*d-14*m), ok...), - mk("prun-nightly-deploy-0103", "schedule", "succeeded", "", ago(6*d), ago(6*d-12*m), ok...), - mk("prun-nightly-deploy-0104", "schedule", "succeeded", "", ago(8*d), ago(8*d-13*m), ok...), - } - keys := PipelineKeys{ - EnvFile: PipelineEnvFileStatus{Path: "/home/gitmoot/.config/gitmoot/pipelines/nightly-deploy.env", Status: "ok"}, - Stages: []PipelineStageKeys{ - {ID: "source", Kind: "shell", Keys: []PipelineKeyEntry{}, UnresolvedSelectors: []string{}}, - {ID: "build", Kind: "agent_ask", Keys: []PipelineKeyEntry{{Name: "BUILD_PROFILE", Source: "default", Mode: "injected"}}, UnresolvedSelectors: []string{}}, - {ID: "deploy", Kind: "gate", Keys: []PipelineKeyEntry{ - {Name: "TELEGRAM_BOT_TOKEN", Source: "own", Mode: "injected"}, - {Name: "TELEGRAM_CHAT_ID", Source: "own", Mode: "injected"}, - }, UnresolvedSelectors: []string{}}, - }, - } - return finalize("nightly-deploy", "Builds and deploys the web application after the nightly source refresh.", declared, history, keys), true - - case "listing-refresh": - declared := []PipelineStage{ - {ID: "fetch", State: "pending", Kind: "shell", Deps: []string{}, Cmd: "gitmoot listings fetch --source noted"}, - {ID: "score", State: "pending", Kind: "agent_ask", AgentRuntime: "codex", Deps: []string{"fetch"}, Cmd: "gitmoot listings score --model r2", Retry: 2}, - {ID: "dedupe", State: "pending", Kind: "shell", Deps: []string{"fetch"}, Cmd: "gitmoot listings dedupe"}, - {ID: "publish", State: "pending", Kind: "gate", Deps: []string{"score", "dedupe"}, Cmd: "gitmoot listings publish"}, - } - // okRun returns a fresh all-succeeded diamond in spec order. - okRun := func() []PipelineStageMark { - return []PipelineStageMark{sm("fetch", "succeeded"), sm("score", "succeeded"), sm("dedupe", "succeeded"), sm("publish", "succeeded")} - } - // Deliberately declared OUT of chronological order so finalize()'s - // newest-first sort is load-bearing (a regression that drops the sort - // fails TestHandlePipelineDetail's descending assertion). - history := []PipelineRunHistoryEntry{ - mk("prun-listing-refresh-0103", "schedule", "succeeded", "", ago(3*d), ago(3*d-9*m), okRun()...), - mk("prun-listing-refresh-0105", "manual", "succeeded", "", ago(5*d), ago(5*d-7*m), okRun()...), - entry("prun-listing-refresh-0001"), // blocked on score, 2h ago (newest) - mk("prun-listing-refresh-0102", "manual", "failed", "score", ago(2*d), ago(2*d-5*m), - sm("fetch", "succeeded"), sm("score", "failed"), sm("dedupe", "succeeded"), sm("publish", "skipped")), - mk("prun-listing-refresh-0104", "schedule", "blocked", "score", ago(4*d), 0, - sm("fetch", "succeeded"), sm("score", "blocked"), sm("dedupe", "succeeded"), sm("publish", "skipped")), - mk("prun-listing-refresh-0101", "schedule", "succeeded", "", ago(1*d), ago(1*d-8*m), okRun()...), - } - keys := PipelineKeys{ - EnvFile: PipelineEnvFileStatus{Path: "/home/gitmoot/.config/gitmoot/pipelines/listing-refresh.env", Status: "missing"}, - Stages: []PipelineStageKeys{ - {ID: "fetch", Kind: "shell", Keys: []PipelineKeyEntry{}, UnresolvedSelectors: []string{}}, - {ID: "score", Kind: "agent_ask", Keys: []PipelineKeyEntry{}, UnresolvedSelectors: []string{"R2_*", "MODEL_*"}}, - {ID: "dedupe", Kind: "shell", Keys: []PipelineKeyEntry{}, UnresolvedSelectors: []string{}}, - {ID: "publish", Kind: "gate", Keys: []PipelineKeyEntry{}, UnresolvedSelectors: []string{}}, - }, - } - return finalize("listing-refresh", "Refreshes the public listings index from Noted.\nScores, deduplicates, and gates publication.", declared, history, keys), true - - case "bench-suite": - declared := []PipelineStage{ - {ID: "setup", State: "pending", Kind: "shell", Deps: []string{}, Cmd: "make bench-setup"}, - {ID: "bench", State: "pending", Kind: "shell", Deps: []string{"setup"}, Cmd: `./scripts/bench.sh --filter "p<95> && q>1"`, Retry: 2}, - {ID: "report", State: "pending", Kind: "shell", Deps: []string{"bench"}, Cmd: "./scripts/report.sh"}, - } - history := []PipelineRunHistoryEntry{ - entry("prun-bench-suite-0001"), // the single failed run - } - return finalize("bench-suite", "", declared, history, PipelineKeys{}), true - } - - return PipelineDetail{}, false -} - -// PipelineDetail implements DataSource. It returns the fixed detail for a -// pipeline by name from the fakePipelineDetail fixture; unknown names return -// ErrPipelineNotFound. Output is deterministic and byte-stable across calls. -func (f *FakeDataSource) PipelineDetail(ctx context.Context, name string) (PipelineDetail, error) { - detail, ok := fakePipelineDetail(name) - if !ok { - return PipelineDetail{}, ErrPipelineNotFound - } - return detail, nil -} - // fakeVerdictRun is the SkillOpt eval run id the fake binary-verdicts fixture is // keyed on (matches the pending candidate skill-reviewer-v3's evaluation). const fakeVerdictRun = "eval-reviewer-0007" diff --git a/server.go b/server.go index 3910da4..51b0a08 100644 --- a/server.go +++ b/server.go @@ -11,8 +11,7 @@ import ( // Serve returns an http.Handler serving the read-only dashboard: the embedded // static UI (with SPA fallback to index.html) plus the JSON API (handleRuns/ // handleJobs/handleAgents/handleAgent/handleCharts/handleHealth/ -// handleLearningSkills/handlePipelines/ -// handlePipelineDetail/handlePipelineRun/handleOverview/handleTasks/ +// handleLearningSkills/handleOverview/handleTasks/ // handleWakeSummary/handleWakes/handleWakeReceipts/ // handleOrg/handleOrgRole/handleWorkflows/handleWorkflow/ // handleAttention/handleJobChecks/handleBinaryVerdicts/ @@ -30,9 +29,6 @@ func Serve(ds DataSource) http.Handler { mux.HandleFunc("GET /api/health", s.handleHealth) mux.HandleFunc("GET /api/config", s.handleConfig) mux.HandleFunc("GET /api/learning/skills", s.handleLearningSkills) - mux.HandleFunc("GET /api/pipelines", s.handlePipelines) - mux.HandleFunc("GET /api/pipelines/{name}", s.handlePipelineDetail) - mux.HandleFunc("GET /api/pipeline/run/{id}", s.handlePipelineRun) mux.HandleFunc("GET /api/overview", s.handleOverview) mux.HandleFunc("GET /api/wakes/summary", s.handleWakeSummary) mux.HandleFunc("GET /api/wakes/receipts", s.handleWakeReceipts) @@ -74,7 +70,7 @@ func newServer(ds DataSource) *server { // The JSON API handlers (handleRuns/handleJobs/handleAgents/handleAgent/ // handleCharts/handleHealth/handleLearningSkills/ -// handlePipelines/handlePipelineDetail/handlePipelineRun/handleOverview/handleTasks/ +// handleOverview/handleTasks/ // handleWakeSummary/handleWakes/handleWakeReceipts/ // handleOrg/handleOrgRole/handleWorkflows/handleWorkflow/ // handleAttention/handleJobChecks/handleBinaryVerdicts/ diff --git a/server_test.go b/server_test.go index aff3669..ca7bc71 100644 --- a/server_test.go +++ b/server_test.go @@ -68,27 +68,6 @@ func TestStateRouteRegistered(t *testing.T) { } } -// TestPipelinesRouteRegistered asserts the /api/pipelines route is wired into -// the mux and served by the JSON handler (not the static SPA fallback, which -// would return an HTML index). Mirrors TestStateRouteRegistered. -func TestPipelinesRouteRegistered(t *testing.T) { - srv := httptest.NewServer(Serve(NewFakeDataSource())) - defer srv.Close() - - resp, err := http.Get(srv.URL + "/api/pipelines") - if err != nil { - t.Fatalf("GET /api/pipelines: %v", err) - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - t.Fatalf("GET /api/pipelines status = %d, want 200", resp.StatusCode) - } - if ct := resp.Header.Get("Content-Type"); !strings.HasPrefix(ct, "application/json") { - t.Fatalf("GET /api/pipelines Content-Type = %q, want application/json", ct) - } -} - // TestOrgRoutesRegistered asserts both optional Org API routes are wired into // the mux and served as JSON rather than falling through to the SPA shell. func TestOrgRoutesRegistered(t *testing.T) { diff --git a/web/dist/index.html b/web/dist/index.html index 0aef891..84d681b 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -30,11 +30,7 @@ .gm-copy{display:inline-flex;align-items:center;gap:5px;border:none;border-radius:6px;font-family:'JetBrains Mono',monospace;font-size:10.5px;font-weight:600;line-height:1;cursor:pointer;padding:4px 9px;transition:background .15s ease,color .15s ease;background:rgba(160,168,220,0.1);color:#a8aecf} .gm-copy:hover{background:rgba(160,168,220,0.16);color:#c7c9e5} .gm-copy.done{background:rgba(158,206,106,0.16);color:#c5f882} - .gm-aplink{display:inline-flex;align-items:center;gap:6px;text-decoration:none;padding:5px 10px;border-radius:7px;border:1px solid rgba(160,168,220,0.16);background:rgba(160,168,220,0.06);color:#c7c9e5;font-family:Inter,system-ui,sans-serif;font-size:12px;font-weight:600;line-height:1;white-space:nowrap;transition:background .15s ease,border-color .15s ease,color .15s ease} - .gm-aplink:hover{background:rgba(158,206,106,0.12);border-color:rgba(158,206,106,0.35);color:#eef0ff} - .gm-aplink svg{flex:none} - .gm-aplink .ext{opacity:.55} - .ov-scroll,.wfi-scroll,.wfd-scroll,.tk-col-body,.tk-detail-body,.pl-list-scroll,.pl-main-body,.pl-runs,.jb-tablewrap,.jd-body,.ag-list,.ag-pane,.gd-body,.ch-scroll,.at-scroll,.hl-body,.cfg-scroll,.xd-body,#lr-skills,.gm-graph-detail-body,.gm-more-sheet,.gm-runs-list{overscroll-behavior-y:contain} + .ov-scroll,.wfi-scroll,.wfd-scroll,.tk-col-body,.tk-detail-body,.jb-tablewrap,.jd-body,.ag-list,.ag-pane,.gd-body,.ch-scroll,.at-scroll,.hl-body,.cfg-scroll,.xd-body,#lr-skills,.gm-graph-detail-body,.gm-more-sheet,.gm-runs-list{overscroll-behavior-y:contain} .ov-fleet-list{overscroll-behavior-x:contain} .gm-ptr-indicator{position:fixed;left:0;top:0;z-index:120;height:0;display:flex;justify-content:center;overflow:visible;pointer-events:none;opacity:0;transform:translateY(-18px);transition:opacity .14s ease,transform .14s ease} .gm-ptr-indicator span{display:inline-flex;align-items:center;gap:7px;height:24px;padding:0 10px;border:1px solid rgba(160,168,220,.14);border-radius:12px;background:rgba(13,15,28,.94);box-shadow:0 5px 18px rgba(0,0,0,.28);color:#7b82aa;font:9px 'JetBrains Mono',monospace;letter-spacing:.05em;text-transform:uppercase;white-space:nowrap} @@ -47,7 +43,7 @@ .gm-skewtitle{font-weight:600}.gm-skewpair{margin-left:8px;color:#a88a55;font:10px 'JetBrains Mono',monospace}.gm-skewhint{margin-left:8px} .gm-skew-dismiss{width:44px;height:44px;flex:none;margin:-8px -12px -8px 0;padding:0;border:0;background:none;color:#a88a55;font-size:16px;cursor:pointer;pointer-events:auto} @media (pointer:coarse){html,body,.gm-shell{overscroll-behavior:none}} - @media (max-width:768px){.gm-aplink{display:none!important}.gm-ptr-scroll{overscroll-behavior-y:none}.tk-tabs,.pl-runs,.wfd-stats{overscroll-behavior-x:contain}} + @media (max-width:768px){.gm-ptr-scroll{overscroll-behavior-y:none}.tk-tabs,.wfd-stats{overscroll-behavior-x:contain}} @media (max-width:768px){.gm-skewbar{left:0;right:0;top:auto;bottom:calc(60px + env(safe-area-inset-bottom));border-bottom:0;border-top:1px solid rgba(224,175,104,.42);z-index:59}} @@ -67,11 +63,6 @@ {{ crumbTitle }}
- - - Activepieces - - {{ daemonText }}
@@ -112,11 +103,6 @@ Jobs
-
- - Pipelines - -
FLEET
@@ -294,7 +280,7 @@
WORK
-
Overview
Tasks
Workflows
Jobs
Pipelines
+
Overview
Tasks
Workflows
Jobs
FLEET
Agents
Org
INSIGHT
@@ -346,7 +332,6 @@ this.state.view = r.view; if (r.view === 'jobs' && r.agent) this._jobsFacetAgent = r.agent; if (r.view === 'agents' && r.agent) this._pendingAgentDetail = r.agent; - if (r.view === 'pipelines') this._pendingPipelineDetail = r.name || null; if (r.view === 'workflows') this._pendingWorkflowLabel = r.name || null; // Normalize unknown paths to '/' (Overview). Also tidy a non-canonical known // path (e.g. a trailing slash). Never rewrite a graph URL, so a @@ -387,13 +372,6 @@ if (p === '/learning') return { view: 'learning', tab: 'skills' }; if (p === '/learning/skills') return { view: 'learning', tab: 'skills' }; if (p === '/jobs') { const a = this._routeQueryAgent(search); return a ? { view: 'jobs', agent: a } : { view: 'jobs' }; } - if (p === '/pipelines') return { view: 'pipelines' }; - if (p.indexOf('/pipelines/') === 0) { - const raw = p.slice(11); // '/pipelines/'.length - let name = raw; - try { name = decodeURIComponent(raw); } catch (e) { name = raw; } - return name ? { view: 'pipelines', name: name } : { view: 'pipelines' }; - } if (p === '/workflows') return { view: 'workflows' }; if (p.indexOf('/workflows/') === 0) { const raw = p.slice(11); // '/workflows/'.length @@ -433,7 +411,6 @@ case 'tasks': return '/tasks'; case 'galaxy': return '/galaxy'; case 'jobs': return opts.agent ? '/jobs?agent=' + encodeURIComponent(opts.agent) : '/jobs'; - case 'pipelines': return opts.name ? '/pipelines/' + encodeURIComponent(opts.name) : '/pipelines'; case 'workflows': return opts.name ? '/workflows/' + encodeURIComponent(opts.name) : '/workflows'; case 'agents': return opts.agent ? '/agents/' + encodeURIComponent(opts.agent) : '/agents'; case 'org': return '/org'; @@ -462,7 +439,6 @@ case 'tasks': return 'gitmoot · tasks'; case 'galaxy': return 'gitmoot · galaxy'; case 'jobs': return opts.agent ? 'gitmoot · jobs · ' + opts.agent : 'gitmoot · jobs'; - case 'pipelines': return opts.name ? 'gitmoot · pipelines · ' + opts.name : 'gitmoot · pipelines'; case 'workflows': return opts.name ? 'gitmoot · workflow · ' + opts.name : 'gitmoot · workflows'; case 'agents': return opts.agent ? 'gitmoot · agents · ' + opts.agent : 'gitmoot · agents'; case 'org': return 'gitmoot · org'; @@ -499,16 +475,7 @@ this._routing = true; try { try { document.title = this._routeTitle(r.view, { agent: r.agent, tab: r.tab, name: r.name }); } catch (e) {} - if (r.view === 'pipelines') { - if (this._pipelinesRoot) { - // pipelines already mounted (possibly hidden): open/close detail in place. - if (r.name) { if (this._plDetailName !== r.name) this.openPipelineDetail(r.name); } - else if (this._plDetailName) this.closePipelineDetail(); - } else { - // not mounted yet: applyView opens the detail after it mounts. - this._pendingPipelineDetail = r.name || null; - } - } else if (r.view === 'workflows') { + if (r.view === 'workflows') { this._workflowLabel = r.name || ''; if (this.state.view === 'workflows' && this._workflowRoot && r.name) { this._pendingWorkflowLabel = null; @@ -556,7 +523,7 @@ // Nav "needs you" amber dots (repurposed from the old you-are-here dot). Each is // seeded once on load (_navSeed), piggybacks the matching view's poll while open, // and re-seeds every 60s. - healthAttn: false, learningAttn: false, pipelinesAttn: false, workflowsAttn: false, tasksAttn: false, attnAttn: false, + healthAttn: false, learningAttn: false, workflowsAttn: false, tasksAttn: false, attnAttn: false, // Mobile: the "More" bottom sheet (Galaxy/Charts/Learning). Transient, not persisted. moreOpen: false, // Mobile responsiveness: seeded from matchMedia so the very first render is @@ -620,7 +587,6 @@ if (this.state.view === 'jobs') this.renderJobsTable(); if (this.state.view === 'agents') { this._agApplyMobileClass(); this.renderAgentsPane(true); } if (this.state.view === 'org' && this._orgData) { this._orgForceFitToken = (this._orgForceFitToken || 0) + 1; this.renderOrg(this._orgData); } - if (this.state.view === 'pipelines' && this._plDetailName) { this._plLayout(); this._plUpdateScrollCue(); } if (this.state.view === 'charts' && this._chartsLoaded) this.renderCharts(false); if (this.state.view === 'overview' && this._overviewData) this.renderOverview(this._overviewData); if (this.state.view === 'tasks' && this._tasksData) this.renderTasks(this._tasksData); @@ -654,7 +620,7 @@ // (the selected run's graph already streams via SSE); background refresh. this._runsPoll = setInterval(() => this.loadRuns(), 15000); // Seed the persistent top bar (daemon liveness) + the needs-you nav dots - // (health/pipelines/learning/attention) from a light batch fetch, then re-seed + // (health/learning/attention) from a light batch fetch, then re-seed // every 60s so the background stays live without adding per-view polls. this._navSeed(); this._navSeedTimer = setInterval(() => this._navSeed(), 60000); @@ -673,9 +639,6 @@ this.stopConfigPoll(); this.stopAttentionPoll(); this.stopSkillsPoll(); - this.stopPipelinesPoll(); - this.stopPipelineRunPoll(); - this.stopPipelineDetailPoll(); this.stopWorkflowPoll(); this.stopOverviewPoll(); this.stopTasksPoll(); @@ -694,7 +657,6 @@ try { document.removeEventListener('keydown', this._orgKeydown); } catch (e) {} try { document.removeEventListener('keydown', this._healthKeydown); } catch (e) {} try { document.removeEventListener('keydown', this._attentionKeydown); } catch (e) {} - try { document.removeEventListener('keydown', this._pipelinesKeydown); } catch (e) {} try { document.removeEventListener('keydown', this._workflowKeydown); } catch (e) {} try { document.removeEventListener('keydown', this._tasksKeydown); } catch (e) {} try { if (this._orgReactRoot) this._orgReactRoot.unmount(); } catch (e) {} @@ -707,7 +669,6 @@ try { if (this._configRoot) this._configRoot.remove(); } catch (e) {} try { if (this._attentionRoot) this._attentionRoot.remove(); } catch (e) {} try { if (this._learningRoot) this._learningRoot.remove(); } catch (e) {} - try { if (this._pipelinesRoot) this._pipelinesRoot.remove(); } catch (e) {} try { if (this._workflowRoot) this._workflowRoot.remove(); } catch (e) {} try { if (this._workflowStrip) this._workflowStrip.remove(); } catch (e) {} try { if (this._overviewRoot) this._overviewRoot.remove(); } catch (e) {} @@ -842,11 +803,7 @@ else if (view === 'config') this.fetchConfig(true); else if (view === 'attention') this.fetchAttention(true); else if (view === 'learning') this.fetchSkills(true); - else if (view === 'pipelines') { - this.fetchPipelines(true); - if (this._plDetailName) this.fetchPipelineDetailData(this._plDetailName, true); - if (this._plDetailName && this._plSelectedRun) this.fetchPipelineRun(this._plSelectedRun, true); - } else if (view === 'graph') { + else if (view === 'graph') { this.loadState(); this.loadRuns(); } @@ -885,7 +842,6 @@ health: ['#health-root .hl-body'], config: ['#config-root .cfg-scroll'], learning: ['#learning-root #lr-skills'], - pipelines: ['#pipelines-root .pl-list-scroll', '#pipelines-root .pl-main-body'], graph: ['.gm-runs-list'] }; return selectors[this.state.view] || []; @@ -1181,30 +1137,6 @@ this.stopSkillsPoll(); if (this._learningRoot) this._learningRoot.style.display = 'none'; } - // Pipelines overlay (declared pipelines list + run detail + hand-rolled stage DAG). - if (v === 'pipelines') { - const root = this.ensurePipelinesDom(); - root.style.display = 'block'; - if (this._plDetailName) this._plLayout(); // reflow the workbench (rail width / mobile strip) - this.startPipelinesPoll(); - this.fetchPipelines(false); - // Deep-link intent (/pipelines/): open the detail once the list loads - // (fetchPipelines completes any pending open). If the data is already cached, - // open it now; also restart the run poll for an already-open detail. - if (this._pendingPipelineDetail && this._pipelinesByName && this._pipelinesByName[this._pendingPipelineDetail]) { - const nm = this._pendingPipelineDetail; this._pendingPipelineDetail = null; this.openPipelineDetail(nm); - } else if (this._plDetailName) { - // re-entering an already-open detail: refresh its data + restart both polls. - this.fetchPipelineDetailData(this._plDetailName, false); - this.startPipelineDetailPoll(); - if (this._plSelectedRun) this.startPipelineRunPoll(); - } - } else { - this.stopPipelinesPoll(); - this.stopPipelineRunPoll(); - this.stopPipelineDetailPoll(); - if (this._pipelinesRoot) this._pipelinesRoot.style.display = 'none'; - } this._queuePullToRefreshSync(); } @@ -1232,10 +1164,9 @@ "#overview-root .ov-today-tiles{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin:6px 0 12px}.ov-tile{padding:10px;border:1px solid rgba(160,168,220,.12);border-radius:7px;background:#0f1120}.ov-tile b{display:block;font:600 18px 'JetBrains Mono';color:#9ece6a}.ov-tile.fail b{color:#f7768e}.ov-tile.cancel b{color:#8b90b8}.ov-tile.wake b{color:#5a6088}.ov-tile.wake.problem{border-color:rgba(224,175,104,.35);background:rgba(224,175,104,.065)}.ov-tile.wake.problem b{color:#e0af68}.ov-tile.wake.aging{border-color:rgba(247,118,142,.52);background:rgba(247,118,142,.09)}.ov-tile.wake.aging b{color:#f7768e}.ov-tile span{display:block;margin-top:4px;color:#555c83;font:8px 'JetBrains Mono';letter-spacing:.1em;text-transform:uppercase}.ov-bars{height:66px;display:flex;align-items:flex-end;gap:3px;border-bottom:1px solid rgba(160,168,220,.07)}.ov-bar{flex:1;min-width:2px;background:#7da357;border-radius:2px 2px 0 0}.ov-bar-axis{display:flex;justify-content:space-between;margin-top:5px;color:#41486d;font:8px 'JetBrains Mono'}.ov-token{margin-top:12px;color:#7c83aa;font:9.5px 'JetBrains Mono'}.ov-token b{color:#cabff2;font-size:13px}", "#overview-root .ov-wake-shell{margin-top:16px;padding:13px 14px 14px}.ov-wake-shell.problem{border-color:rgba(224,175,104,.3)}.ov-wake-shell.aging{border-color:rgba(247,118,142,.44);background:rgba(247,118,142,.025)}.ov-wake-dot{width:8px;height:8px;border-radius:50%;background:#5a6088}.ov-wake-shell.problem .ov-wake-dot{background:#e0af68}.ov-wake-shell.aging .ov-wake-dot{background:#f7768e}.ov-wake-rollup{margin-left:auto;display:flex;align-items:center;gap:6px;color:#62698f;font:9px 'JetBrains Mono';letter-spacing:0;text-transform:none}.ov-wake-chip{padding:2px 7px;border:1px solid rgba(160,168,220,.14);border-radius:5px;background:#0f1120}.ov-wake-chip.bad{color:#f7768e;border-color:rgba(247,118,142,.28);background:rgba(247,118,142,.07)}.ov-wake-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(330px,.8fr);gap:14px;margin-top:8px}.ov-wake-pane{min-width:0;border:1px solid rgba(160,168,220,.1);border-radius:8px;background:#0c0e1a;overflow:hidden}.ov-wake-pane-head{min-height:36px;display:flex;align-items:center;gap:8px;padding:7px 10px;border-bottom:1px solid rgba(160,168,220,.08);color:#8b90b8;font:600 9px 'JetBrains Mono';letter-spacing:.1em;text-transform:uppercase}.ov-wake-pane-head .muted{color:#4f567f;font-weight:400;letter-spacing:0;text-transform:none}.ov-wake-controls{margin-left:auto;display:flex;gap:6px}.ov-wake-controls select{height:26px;max-width:128px;padding:0 24px 0 8px;border:1px solid rgba(160,168,220,.14);border-radius:6px;background:#0f1120;color:#a8aecf;font:9px 'JetBrains Mono'}.ov-wake-list{max-height:286px;overflow:auto}.ov-wake-row{display:grid;grid-template-columns:92px minmax(130px,1fr) 116px 58px 88px 48px;gap:8px;align-items:center;min-height:47px;padding:7px 10px;border-bottom:1px solid rgba(160,168,220,.06);font:9.5px 'JetBrains Mono'}.ov-wake-row:last-child{border-bottom:0}.ov-wake-row.urgent{background:rgba(247,118,142,.055);box-shadow:inset 3px 0 #f7768e}.ov-wake-role{color:#eef0ff;font-weight:600;overflow:hidden;text-overflow:ellipsis}.ov-wake-source{min-width:0;color:#8b90b8}.ov-wake-source b{display:block;color:#c7c9e5;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ov-wake-source span{display:block;margin-top:3px;color:#555c83;font-size:8.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ov-wake-state{display:inline-flex;width:max-content;max-width:100%;padding:3px 6px;border:1px solid rgba(160,168,220,.16);border-radius:5px;color:#8b90b8;background:rgba(160,168,220,.05);overflow:hidden;text-overflow:ellipsis}.ov-wake-state.delivery_unknown,.ov-wake-state.stalled{color:#f7768e;border-color:rgba(247,118,142,.32);background:rgba(247,118,142,.1)}.ov-wake-state.pending,.ov-wake-state.attempted{color:#e0af68;border-color:rgba(224,175,104,.28);background:rgba(224,175,104,.07)}.ov-wake-state.failed{color:#ff9e64;border-color:rgba(255,158,100,.28)}.ov-wake-attempt,.ov-wake-age{text-align:right;color:#697099}.ov-wake-error{color:#e0af68;font-size:8.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ov-receipt-row{display:grid;grid-template-columns:86px minmax(92px,1fr) 48px 74px;gap:8px;align-items:center;min-height:43px;padding:7px 10px;border-bottom:1px solid rgba(160,168,220,.06);font:9.5px 'JetBrains Mono'}.ov-receipt-row:last-child{border-bottom:0}.ov-receipt-kind{min-width:0;color:#c7c9e5}.ov-receipt-kind span{display:block;margin-top:3px;color:#555c83;font-size:8.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ov-receipt-ok{color:#9ece6a;text-align:right}.ov-wake-empty{padding:18px 10px;color:#596087;font:10px 'JetBrains Mono'}.ov-wake-note{padding:8px 10px;border-top:1px solid rgba(160,168,220,.06);color:#4f567f;font:8.5px 'JetBrains Mono';line-height:1.45}", "#overview-root .ov-wake-cols{display:grid;grid-template-columns:92px minmax(130px,1fr) 116px 58px 88px 48px;gap:8px;padding:6px 10px;border-bottom:1px solid rgba(160,168,220,.06);color:#444b70;font:8px 'JetBrains Mono';letter-spacing:.08em;text-transform:uppercase}.ov-wake-cols span:nth-last-child(-n+3){text-align:right}", - "#overview-root .ov-sched-row{display:grid;grid-template-columns:minmax(0,1fr) auto 72px;gap:9px;align-items:center;min-height:49px;border-bottom:1px solid rgba(160,168,220,.06);font:9.5px 'JetBrains Mono'}.ov-sched-row:last-child{border-bottom:0}.ov-sched-name{color:#eef0ff;font-size:11px}.ov-sched-sub{margin-top:4px;color:#555c83;font-size:8.5px}.ov-status{padding:2px 7px;border:1px solid rgba(160,168,220,.18);border-radius:5px;color:#8b90b8}.ov-status.succeeded{color:#9ece6a;border-color:rgba(158,206,106,.28)}.ov-status.failed{color:#f7768e;border-color:rgba(247,118,142,.28)}.ov-next{text-align:right;color:#c7c9e5}.ov-next small{display:block;color:#555c83}", "#overview-root .ov-fleet{grid-column:1/-1}.ov-fleet-list{display:flex;gap:9px;overflow-x:auto}.ov-fleet-item{display:flex;align-items:center;gap:7px;min-width:210px;padding:9px 11px;border:1px solid rgba(160,168,220,.12);border-radius:7px;background:#0f1120;font:9.5px 'JetBrains Mono'}.ov-fleet-item b{color:#eef0ff}.ov-runtime{padding:2px 6px;border:1px solid rgba(160,168,220,.16);border-radius:4px}.ov-runtime.claude{color:#cabff2;background:rgba(187,154,247,.1)}.ov-runtime.codex{color:#8fd3ff;background:rgba(110,198,255,.1)}.ov-runtime.kimi{color:#e8c58a;background:rgba(224,175,104,.1)}.ov-fleet-jobs{margin-left:auto;color:#596087}", "#overview-root .ov-shimmer{height:140px;border-radius:9px;background:#0d0f1c;position:relative;overflow:hidden}.ov-shimmer:after{content:'';position:absolute;inset:0;transform:translateX(-100%);background:linear-gradient(90deg,transparent,rgba(187,154,247,.08),transparent);animation:ovsh 1.35s infinite}@keyframes ovsh{to{transform:translateX(100%)}}.ov-loading{display:grid;grid-template-columns:1.45fr .9fr;gap:16px}.ov-loading .wide{grid-column:1/-1}", - "@media(max-width:768px){#overview-root{left:0!important;top:54px!important;bottom:calc(60px + env(safe-area-inset-bottom))!important}.ov-scroll{padding:14px 15px 24px!important}.ov-needs-list{display:grid!important;overflow:visible!important}.ov-need{width:auto!important;min-width:0!important;min-height:122px!important}.ov-grid{display:block!important;margin-top:13px!important}.ov-stack{display:block!important}.ov-panel{margin-bottom:13px}.ov-notable.empty-mobile,.ov-scheduled.empty-mobile,.ov-fleet.empty-mobile{display:none}.ov-activity-row{grid-template-columns:9px minmax(0,1fr) auto 38px!important}.ov-notable-row{grid-template-columns:22px 92px minmax(0,1fr) 38px!important}.ov-notable-row .elapsed{display:none}.ov-today-tiles{grid-template-columns:repeat(2,1fr)!important}.ov-wake-shell{padding:11px!important}.ov-wake-shell .ov-head{height:auto!important;min-height:28px;flex-wrap:wrap}.ov-wake-rollup{width:100%;margin-left:15px!important;overflow-x:auto;padding-bottom:3px}.ov-wake-grid{grid-template-columns:1fr!important}.ov-wake-list{max-height:none!important}.ov-wake-cols{display:none!important}.ov-wake-row{grid-template-columns:76px minmax(100px,1fr) 104px!important;gap:7px!important;min-height:64px!important}.ov-wake-row .ov-wake-attempt,.ov-wake-row .ov-wake-error,.ov-wake-row .ov-wake-age{grid-row:2}.ov-wake-row .ov-wake-attempt{text-align:left}.ov-wake-row .ov-wake-error{grid-column:2}.ov-wake-row .ov-wake-age{grid-column:3}.ov-receipt-row{grid-template-columns:72px minmax(90px,1fr) 42px 62px!important}.ov-wake-pane-head .muted{display:none}.ov-wake-controls{width:100%;margin-left:0!important}.ov-wake-controls select{flex:1;max-width:none!important}.ov-loading{display:grid!important;grid-template-columns:1fr!important}.ov-loading .wide{grid-column:auto}.ov-fresh{display:block!important;text-align:center;color:#4f567f;font:9.5px 'JetBrains Mono';padding:12px 0 6px}}" + "@media(max-width:768px){#overview-root{left:0!important;top:54px!important;bottom:calc(60px + env(safe-area-inset-bottom))!important}.ov-scroll{padding:14px 15px 24px!important}.ov-needs-list{display:grid!important;overflow:visible!important}.ov-need{width:auto!important;min-width:0!important;min-height:122px!important}.ov-grid{display:block!important;margin-top:13px!important}.ov-stack{display:block!important}.ov-panel{margin-bottom:13px}.ov-notable.empty-mobile,.ov-fleet.empty-mobile{display:none}.ov-activity-row{grid-template-columns:9px minmax(0,1fr) auto 38px!important}.ov-notable-row{grid-template-columns:22px 92px minmax(0,1fr) 38px!important}.ov-notable-row .elapsed{display:none}.ov-today-tiles{grid-template-columns:repeat(2,1fr)!important}.ov-wake-shell{padding:11px!important}.ov-wake-shell .ov-head{height:auto!important;min-height:28px;flex-wrap:wrap}.ov-wake-rollup{width:100%;margin-left:15px!important;overflow-x:auto;padding-bottom:3px}.ov-wake-grid{grid-template-columns:1fr!important}.ov-wake-list{max-height:none!important}.ov-wake-cols{display:none!important}.ov-wake-row{grid-template-columns:76px minmax(100px,1fr) 104px!important;gap:7px!important;min-height:64px!important}.ov-wake-row .ov-wake-attempt,.ov-wake-row .ov-wake-error,.ov-wake-row .ov-wake-age{grid-row:2}.ov-wake-row .ov-wake-attempt{text-align:left}.ov-wake-row .ov-wake-error{grid-column:2}.ov-wake-row .ov-wake-age{grid-column:3}.ov-receipt-row{grid-template-columns:72px minmax(90px,1fr) 42px 62px!important}.ov-wake-pane-head .muted{display:none}.ov-wake-controls{width:100%;margin-left:0!important}.ov-wake-controls select{flex:1;max-width:none!important}.ov-loading{display:grid!important;grid-template-columns:1fr!important}.ov-loading .wide{grid-column:auto}.ov-fresh{display:block!important;text-align:center;color:#4f567f;font:9.5px 'JetBrains Mono';padding:12px 0 6px}}" ].join('\n'); document.head.appendChild(st); const root=document.createElement('div'); root.id='overview-root'; root.style.cssText='position:fixed;left:216px;top:54px;right:0;bottom:0;z-index:42;display:none;flex-direction:column'; @@ -1328,17 +1259,16 @@ if(!this._overviewRoot)return;const box=this._overviewRoot.querySelector('#ov-content'); if(status==='unsupported'){box.innerHTML='
Overview requires a newer gitmoot build. Jobs, Workflows, and the run graph remain available.
';return;} if(!data){box.innerHTML=status==='error'?'
Overview is temporarily unavailable.
':'
';return;} - const esc=this._ovEsc.bind(this),needs=Array.isArray(data.needs_you)?data.needs_you:[],act=data.activity||{},workflows=Array.isArray(act.workflows)?act.workflows:[],today=data.today||{},notable=Array.isArray(today.notable)?today.notable:[],scheduled=Array.isArray(data.scheduled)?data.scheduled:[],fleet=Array.isArray(data.fleet)?data.fleet:[],wake=this._wakeLedgerData||{status:'loading',summary:{}},wakeSummary=wake.summary||{},wakeOutstanding=Math.max(0,Number(wakeSummary.outstanding||0)),wakeAging=wakeOutstanding>0&&Number(wakeSummary.aged_attempted||0)>0,wakeProblem=wakeOutstanding>0||Number(wakeSummary.delivery_unknown||0)>0||Number(wakeSummary.stalled||0)>0; + const esc=this._ovEsc.bind(this),needs=Array.isArray(data.needs_you)?data.needs_you:[],act=data.activity||{},workflows=Array.isArray(act.workflows)?act.workflows:[],today=data.today||{},notable=Array.isArray(today.notable)?today.notable:[],fleet=Array.isArray(data.fleet)?data.fleet:[],wake=this._wakeLedgerData||{status:'loading',summary:{}},wakeSummary=wake.summary||{},wakeOutstanding=Math.max(0,Number(wakeSummary.outstanding||0)),wakeAging=wakeOutstanding>0&&Number(wakeSummary.aged_attempted||0)>0,wakeProblem=wakeOutstanding>0||Number(wakeSummary.delivery_unknown||0)>0||Number(wakeSummary.stalled||0)>0; const needHTML=needs.length?'
Needs you '+needs.length+'stalled workflows · PRs to merge · blocked jobs · groom proposals
'+needs.map(n=>{const stalled=n.kind==='stalled_workflow',badge=stalled?'STALLED':n.kind==='pr_awaiting_merge'?'PR '+(n.ref||''):n.kind==='blocked_job'?'BLOCKED '+(n.ref||''):'GROOM '+(n.ref||''),ci=n.ci?'CI '+(n.ci==='green'?'✓':n.ci==='red'?'✗':'…')+'':'';return '
'+esc(badge)+''+esc(this._ovDur(n.age_s))+'
'+(stalled?'
'+this._wfLabelHTML(n.label||'')+'
':'')+'
'+esc(n.title||'Needs attention')+'
'+(stalled?'pane '+esc(n.pane||'-')+' · sess '+esc(n.session_id||'-')+(n.last_note?'
last note · '+esc(n.last_note):''):esc(n.repo||''))+ci+'
';}).join('')+'
':'
✓Nothing needs you0 PRs · 0 blocked · 0 proposals · 0 stalled workflows
'; const activity='
Live fleet activity by workflow'+Number(act.queued||0)+' queued · Workflows ↗
'+(workflows.length?workflows.map(w=>{const p=this._wfSplitLabel(w.label||'');return '
'+(p.namespace?''+esc(p.namespace)+'/':'')+esc(p.campaign)+'
'+esc((w.agents||[]).join(', '))+'
▶ '+Number(w.running||0)+' running'+esc(this._ovDur(w.started_ago_s))+'
';}).join('')+(act.unattended_note?'
unattended · '+esc(act.unattended_note)+'
':''):'
Fleet idle · no jobs yet · '+Number(act.queued||0)+' queued
')+'
'; const notableHTML='
Notable completions last 5 finished
'+(notable.length?notable.map(n=>'
'+(n.outcome==='succeeded'?'✓':n.outcome==='failed'?'✗':'⊘')+''+esc(n.agent||'agent')+''+esc(n.title||'job')+''+esc(n.elapsed_s?this._ovDur(n.elapsed_s):'-')+''+esc(this._ovDur(n.age_s))+'
').join(''):'
No jobs have finished in the last 24h.
')+'
'; const hours=Array.isArray(today.per_hour)?today.per_hour:[],max=Math.max(1,...hours.map(Number)),bars=hours.some(Number)?'
'+hours.map(v=>'').join('')+'
24h agojobs / hournow
':''; const wakeTileValue=wake.status==='ready'||(wake.status==='error'&&wake.hasSnapshot)?this._ovNum(wakeOutstanding):'-',wakeTileTitle=wakeOutstanding?' title="oldest '+esc(this._ovDur(wakeSummary.oldest_age_seconds))+'"':''; const todayHTML='
Today rolling 24h
'+this._ovNum(today.completed)+'completed
'+this._ovNum(today.failed)+'failed
'+this._ovNum(today.cancelled)+'cancelled
'+wakeTileValue+'wake obligations
'+bars+'
'+this._ovNum(Number(today.tokens_in||0)+Number(today.tokens_out||0))+' tokens · '+this._ovNum(today.tokens_in)+' in · '+this._ovNum(today.tokens_out)+' out
'; - const scheduledHTML='
Scheduled next pipeline runs
'+(scheduled.length?scheduled.map(s=>'
'+esc(s.name)+'
'+esc(s.schedule)+'
'+esc(s.last_status||'-')+'next in'+esc(this._ovDur(s.next_in_s))+'
').join(''):'
No pipelines declared yet.
')+'
'; const fleetHTML='
Fleet at a glance Agents ↗
'+(fleet.length?'
'+fleet.map(a=>'
'+esc(a.agent)+''+esc(a.runtime||'shell')+''+Number(a.jobs_today||0)+' today
').join('')+'
':'
No agents registered yet.
')+'
'; - const fresh=!needs.length&&!workflows.length&&!Number(today.completed||0)&&!Number(today.failed||0)&&!wakeProblem&&!scheduled.length&&!fleet.length; - box.innerHTML=needHTML+this._wakeLedgerHTML()+'
'+activity+notableHTML+'
'+todayHTML+scheduledHTML+'
'+fleetHTML+'
'+(fresh?'':''); + const fresh=!needs.length&&!workflows.length&&!Number(today.completed||0)&&!Number(today.failed||0)&&!wakeProblem&&!fleet.length; + box.innerHTML=needHTML+this._wakeLedgerHTML()+'
'+activity+notableHTML+'
'+todayHTML+'
'+fleetHTML+'
'+(fresh?'':''); } // ============================================================ @@ -1555,7 +1485,7 @@ } 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; pipeline runs live on the Pipelines page.
gitmoot run <prompt> --workflow fable/my-campaign
'; } + _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
'; } _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(); @@ -2804,7 +2734,6 @@ showConfig = () => { this.setState({ view: 'config' }); this._navRoute('config'); }; showAttention = () => { this.setState({ view: 'attention' }); this._navRoute('attention'); }; showLearning = () => { this.setState({ view: 'learning' }); this._navRoute('learning'); }; - showPipelines = () => { this.setState({ view: 'pipelines' }); this._navRoute('pipelines', { name: this._plDetailName || undefined }); }; startJobsPoll() { if (this._jobsPoll) return; @@ -5789,8 +5718,6 @@ "#config-root .cfg-keychain-proxy{display:grid;gap:3px;max-width:300px}", "#config-root .cfg-keychain-upstream{overflow-wrap:anywhere;color:#a8aecf}", "#config-root .cfg-keychain-auth{color:#5f678f;font-size:9px}", - "#config-root .cfg-keychain-grants{display:flex;gap:5px;flex-wrap:wrap;min-width:180px}", - "#config-root .cfg-keychain-grant{display:inline-flex;padding:2px 6px;border:1px solid rgba(110,198,255,.2);border-radius:5px;background:rgba(110,198,255,.06);color:#8fbfe0;font:9px 'JetBrains Mono',monospace;white-space:nowrap}", "#config-root .cfg-keychain-created{color:#69719a;white-space:nowrap}", "#config-root .cfg-keychain-dash{color:#4f567c}", "#config-root .cfg-agent-wrap{border:1px solid rgba(160,168,220,.11);border-radius:8px;overflow:auto;max-height:310px;background:#0a0c17}", @@ -5936,9 +5863,7 @@ const allKeys = Array.isArray(projection.keys) ? projection.keys : []; const headerMatch = !q || ['keychain', path, rawStatus, statusLabel].join(' ').toLowerCase().indexOf(q) >= 0; const filteredKeys = headerMatch ? allKeys : allKeys.filter(key => { - const grants = Array.isArray(key && key.grants) ? key.grants : []; return [key && key.name, key && key.mode, key && key.proxyUpstream, key && key.proxyAuth, key && key.createdAt] - .concat(grants.map(grant => String(grant && grant.consumerKind || '') + ':' + String(grant && grant.consumerID || ''))) .join(' ').toLowerCase().indexOf(q) >= 0; }); if (q && !headerMatch && !filteredKeys.length) return null; @@ -5957,11 +5882,9 @@ const proxy = upstream || auth ? '
' + (upstream ? '' + esc(upstream) + '' : '') + (auth ? '' + esc(auth) + '' : '') + '
' : '-'; - const grants = Array.isArray(key && key.grants) ? key.grants : []; - const grantHTML = grants.length ? grants.map(grant => '' + esc(grant && grant.consumerKind || '') + ':' + esc(grant && grant.consumerID || '') + '').join('') : '-'; - return '' + esc(key && key.name || '') + '' + esc(mode || '-') + '' + proxy + '
' + grantHTML + '
' + esc(key && key.createdAt || '-') + ''; + return '' + esc(key && key.name || '') + '' + esc(mode || '-') + '' + proxy + '' + esc(key && key.createdAt || '-') + ''; }).join(''); - body = '
' + rows + '
NameModeUpstream / AuthGrantsCreated
'; + body = '
' + rows + '
NameModeUpstream / AuthCreated
'; } else if (q && allKeys.length) { body = '
No keychain entries match “' + esc(query) + '”.
'; } else { @@ -5971,7 +5894,7 @@ id: id, label: 'Keychain', count: filteredKeys.length, - html: '
Keychain
' + header + body + '
' + html: '
Keychain
' + header + body + '
' }; } @@ -6470,1383 +6393,14 @@ // and a 60px bottom tab bar appears, so the roots dock to left:0 and stop above // the tab bar. Shared here so the creation-time cssText and the breakpoint // re-dock can never drift. - // ============================================================ - // Pipelines view: declared pipelines (gitmoot #681) with schedule - // state + recent run outcomes (LIST) and a per-run stage DAG (DETAIL), - // built IMPERATIVELY into a body-appended overlay (same pattern as - // Jobs/Learning). The stage DAG is a hand-rolled inline-SVG funnel - // (depth-column layout from stage deps) — no ELK / force-graph. Stages - // that carry a jobId open the shared job-detail panel (_jobDetailHTML). - // ============================================================ - startPipelinesPoll() { - if (!this._plLiveTick) { - // Stage progress ages are derived locally. Keep them moving even when the - // 12s API poll receives an identical response and skips a full re-render. - this._plLiveTick = setInterval(() => { - if (this.state.view === 'pipelines') this.refreshPipelineStageProgress(); - }, 1000); - } - if (!this._pipelinesPoll) { - this._pipelinesPoll = setInterval(() => { - if (this.state.view !== 'pipelines') return; - this.fetchPipelines(true); - // next-due countdowns are derived from a fixed epoch, so the signature-skip - // would freeze them; refresh them every tick regardless of a data change. - this.refreshPipelineCountdowns(); - }, 12000); - } - } - stopPipelinesPoll() { - try { clearInterval(this._pipelinesPoll); } catch (e) {} - try { clearInterval(this._plLiveTick); } catch (e) {} - this._pipelinesPoll = null; - this._plLiveTick = null; - } - // Second poll: while a run detail is open, refresh JUST that run so an in-flight - // run's stages flip live. Self-guarded (no-ops on the list / other views). - startPipelineRunPoll() { - if (this._plRunPoll) return; - this._plRunPoll = setInterval(() => { - if (this.state.view !== 'pipelines' || !this._plDetailName || !this._plSelectedRun) return; - this.fetchPipelineRun(this._plSelectedRun, true); - }, 12000); - } - stopPipelineRunPoll() { try { clearInterval(this._plRunPoll); } catch (e) {} this._plRunPoll = null; } - - // Stage state colors: reuse the canonical run map, plus the two stage-only - // states the DAG must dim — pending (not started) and skipped (never ran). - _plStageColor(state) { - if (state === 'pending') return '#5a6088'; - if (state === 'skipped') return '#3b3f5c'; - return this._galaxyStateColor(state); - } - _fmtEta(d) { - const s = Math.round(d / 1000); - if (s < 60) return s + 's'; - const m = Math.floor(s / 60); - if (m < 60) return m + 'm'; - const h = Math.floor(m / 60), rm = m % 60; - if (h < 24) return rm ? (h + 'h ' + rm + 'm') : (h + 'h'); - const days = Math.floor(h / 24), rh = h % 24; - return rh ? (days + 'd ' + rh + 'h') : (days + 'd'); - } - _plFmtLiveAge(d) { - const total = Math.max(0, Math.floor(d / 1000)); - const s = total % 60; - const m = Math.floor(total / 60); - if (m < 60) return m ? (m + 'm ' + s + 's') : (s + 's'); - const h = Math.floor(m / 60), rm = m % 60; - return h + 'h ' + rm + 'm ' + s + 's'; - } - _plFmtCountdown(ms, now) { - if (!ms || ms <= 0) return '-'; - const d = ms - (now || Date.now()); - if (d <= 0) return 'due now'; - return 'due in ' + this._fmtEta(d); - } - refreshPipelineCountdowns() { - if (!this._pipelinesRoot) return; - const now = Date.now(); - this._pipelinesRoot.querySelectorAll('.pl-due').forEach(el => { - const due = +el.getAttribute('data-due'); - el.textContent = this._plFmtCountdown(due, now); - }); - this._pipelinesRoot.querySelectorAll('.pl-ledger-due').forEach(el => { - const due = +el.getAttribute('data-due'); - el.textContent = this._plFmtLedgerDue(due, now); - }); - // the RUNS-rail footer carries a "next run in …" countdown of its own. - this._pipelinesRoot.querySelectorAll('.pl-nextdue').forEach(el => { - const due = +el.getAttribute('data-due'); - el.textContent = this._plNextRunLabel(due, now); - }); - } - refreshPipelineStageProgress() { - if (!this._pipelinesRoot) return; - const stages = (this._plRun && Array.isArray(this._plRun.stages)) ? this._plRun.stages : []; - const byId = {}; - stages.forEach(stage => { if (stage && stage.id) byId[stage.id] = stage; }); - const now = Date.now(); - this._pipelinesRoot.querySelectorAll('.pl-node-progress').forEach(el => { - const node = el.closest && el.closest('.pl-node'); - const stage = node && byId[node.getAttribute('data-stage')]; - if (!stage || stage.state !== 'running') { el.textContent = ''; return; } - const activity = typeof stage.progressActivity === 'string' ? stage.progressActivity : ''; - const progressAt = Number(stage.progressAt) || 0; - if (activity) { - const ageMs = progressAt > 0 ? Math.max(0, now - progressAt) : 0; - const stale = progressAt > 0 && ageMs > 90000; - const age = progressAt > 0 ? (this._plFmtLiveAge(ageMs) + ' ago') : 'unknown'; - el.textContent = 'last activity ' + age + (stale ? ' (stale)' : '') + ': ' + activity; - el.classList.toggle('stale', stale); - return; - } - el.classList.remove('stale'); - el.textContent = stage.startedAt > 0 ? ('running ' + this._plFmtLiveAge(Math.max(0, now - stage.startedAt))) : ''; - }); - } - - ensurePipelinesDom() { - if (this._pipelinesRoot) return this._pipelinesRoot; - // Runs-rail collapse pref (persisted; the Graph runsOpen pattern) + default tab. - if (this._plRunsOpen == null) { let v = true; try { const s = localStorage.getItem('gitmoot.plRunsOpen'); if (s != null) v = s === '1'; } catch (e) {} this._plRunsOpen = v; } - if (!(this._plExpandedGroups instanceof Set)) this._plExpandedGroups = this._plLoadExpandedGroups(); - if (!this._plTab) this._plTab = 'dag'; - const st = document.createElement('style'); - st.textContent = [ - "#pipelines-root{font-family:Inter,system-ui,sans-serif;color:#c8cce6;overflow:hidden}", - "#pipelines-root #pl-list{height:100%;overflow:hidden;box-sizing:border-box;display:flex;flex-direction:column;min-height:0}", - "#pipelines-root #pl-list .pl-list-head{height:72px;flex:none;display:flex;align-items:center;gap:14px;padding:0 26px;border-bottom:1px solid rgba(160,168,220,.09)}", - "#pipelines-root #pl-list .pl-list-title{font:700 23px 'Space Grotesk',sans-serif;color:#eef0ff}#pipelines-root #pl-list .pl-list-title i{font-style:normal;color:#bb9af7}", - "#pipelines-root #pl-list .pl-list-summary{font:10.5px 'JetBrains Mono',monospace;color:#5a6088;white-space:nowrap}", - "#pipelines-root #pl-list .pl-list-scroll{flex:1;min-height:0;overflow-y:auto;padding:18px 26px 36px;scrollbar-gutter:stable}", - "#pipelines-root #pl-list .pl-group{margin-bottom:20px}", - "#pipelines-root #pl-list .pl-group-toggle{appearance:none;width:100%;height:28px;display:grid;grid-template-columns:minmax(0,1fr) 104px 132px 92px 96px;align-items:center;gap:14px;padding:0;border:0;border-radius:7px;background:transparent;color:inherit;text-align:left;cursor:pointer}", - "#pipelines-root #pl-list .pl-group-toggle:hover{background:rgba(202,191,242,.03)}", - "#pipelines-root #pl-list .pl-group-toggle:focus-visible{outline:1px solid rgba(202,191,242,.42);outline-offset:-1px}", - "#pipelines-root #pl-list .pl-group-chev{display:inline-block;width:12px;text-align:center;font-size:10px;line-height:1;color:#697099;transition:transform .18s ease,color .18s ease}", - "#pipelines-root #pl-list .pl-group-toggle[aria-expanded=true] .pl-group-chev{transform:rotate(90deg);color:#cabff2}", - "#pipelines-root #pl-list .pl-group-main{display:flex;align-items:center;gap:8px;min-width:0;color:#8b90b8;font:600 10.5px 'JetBrains Mono',monospace;letter-spacing:.12em;text-transform:uppercase}", - "#pipelines-root #pl-list .pl-group-marker{width:7px;height:7px;border-radius:50%;flex:none;background:#697099}", - "#pipelines-root #pl-list .pl-group-name{color:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}", - "#pipelines-root #pl-list .pl-group.system .pl-group-name{color:#8b90b8}", - "#pipelines-root #pl-list .pl-built-in{font-family:'JetBrains Mono',monospace;font-size:9px;letter-spacing:.11em;text-transform:uppercase;color:#5a6088;border:1px solid rgba(160,168,220,.14);padding:1px 5px;border-radius:4px;white-space:nowrap;flex:none}", - "#pipelines-root #pl-list .pl-group-count{padding:1px 6px;border-radius:9px;background:rgba(160,168,220,.1);color:#a8aecf;font-size:9px;letter-spacing:0;white-space:nowrap;flex:none}", - "#pipelines-root #pl-list .pl-group-on{font-family:'JetBrains Mono',monospace;font-size:11.5px;text-align:right;white-space:nowrap;color:#565d80}", - "#pipelines-root #pl-list .pl-group-on b{font-weight:400;color:#9cc470}", - "#pipelines-root #pl-list .pl-group-on.zero b{color:#6b7192}", - "#pipelines-root #pl-list .pl-group-dots{display:flex;gap:3px;align-items:center;justify-content:flex-start}", - "#pipelines-root #pl-list .pl-group-dot{width:11px;height:11px;border-radius:3px;flex:none}", - "#pipelines-root #pl-list .pl-group-activity{font-family:'JetBrains Mono',monospace;font-size:11px;color:#6b7192;text-align:right;white-space:nowrap}", - "#pipelines-root #pl-list .pl-group-due{text-align:right}", - "#pipelines-root #pl-list .pl-ledger-due{font-family:'JetBrains Mono',monospace;font-size:11px;color:#8fbd68;white-space:nowrap;letter-spacing:.01em}", - "#pipelines-root #pl-list .pl-ledger-none{font-family:'JetBrains Mono',monospace;font-size:11px;color:#3f4568}", - "#pipelines-root #pl-list .pl-group-rows{display:grid;gap:8px;padding:0;animation:plExpand .2s ease}", - "#pipelines-root #pl-list .pl-row{display:grid;grid-template-columns:minmax(150px,1.4fr) 92px minmax(140px,1.1fr) 118px 84px 186px;align-items:start;gap:12px;padding:12px 14px;border:1px solid rgba(160,168,220,.13);border-radius:8px;background:#0f1120;cursor:pointer;transition:background .15s,border-color .15s}", - "#pipelines-root #pl-list .pl-row:hover{background:#12152a}", - "#pipelines-root #pl-list .pl-row-cell{min-width:0;overflow:hidden}", - "#pipelines-root #pl-list .pl-name{font-family:Inter,system-ui,sans-serif;font-weight:600;font-size:13.5px;color:#dfe1f2;letter-spacing:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}", - "#pipelines-root .pl-repo{font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#565d80;margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}", - "#pipelines-root .pl-mono{font-family:'JetBrains Mono',monospace;font-size:12px;color:#a8aecf}", - "#pipelines-root #pl-list .pl-chip{display:inline-flex;align-items:center;font-family:'JetBrains Mono',monospace;font-size:10.5px;font-weight:400;line-height:1.5;padding:2px 8px;border-radius:6px}", - "#pipelines-root #pl-list .pl-chip.on{color:#9cc470;background:rgba(140,190,90,.05);border:1px solid rgba(140,190,90,.30)}", - "#pipelines-root #pl-list .pl-chip.off{color:#6b7192;background:transparent;border:1px solid rgba(160,168,220,.16)}", - "#pipelines-root #pl-list .pl-modechip{display:inline-flex;align-items:center;max-width:100%;box-sizing:border-box;font-family:'JetBrains Mono',monospace;font-size:10.5px;font-weight:400;line-height:1.5;padding:3px 9px;border-radius:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border:1px solid rgba(160,168,220,.13)}", - "#pipelines-root #pl-list .pl-modechip.bound{color:#9ece6a;background:rgba(158,206,106,0.10);border-color:rgba(158,206,106,0.28)}", - "#pipelines-root #pl-list .pl-modechip.warn{color:#e0af68;background:rgba(224,175,104,0.11);border-color:rgba(224,175,104,0.30)}", - "#pipelines-root #pl-list .pl-modechip.error{color:#f7768e;background:rgba(247,118,142,0.10);border-color:rgba(247,118,142,0.30)}", - "#pipelines-root #pl-list .pl-modechip.muted{color:#6b7192;background:transparent;border-color:rgba(160,168,220,.16)}", - "#pipelines-root #pl-list .pl-modechip.after{color:#8b90b8;background:rgba(255,255,255,.02);border-color:rgba(160,168,220,.13)}", - "#pipelines-root .pl-statechip{display:inline-flex;align-items:center;font-family:'JetBrains Mono',monospace;font-size:10.5px;font-weight:600;padding:3px 9px;border-radius:7px}", - "#pipelines-root #pl-list .pl-due{font-family:'JetBrains Mono',monospace;font-size:11px;color:#8fbd68;white-space:nowrap}", - "#pipelines-root .pl-nohist{font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#3f4568}", - "#pipelines-root #pl-list .pl-strip{display:flex;align-items:center;gap:3px;flex-wrap:wrap}", - "#pipelines-root #pl-list .pl-pip{width:9px;height:9px;border-radius:2px;flex:none}", - "#pipelines-root .pl-empty{padding:60px 20px;text-align:center;color:#5a6088;font-size:13px}", - "#pipelines-root .pl-empty code{font-family:'JetBrains Mono',monospace;font-size:12px;color:#c7c9e5;background:#0a0b16;border:1px solid rgba(160,168,220,0.14);border-radius:6px;padding:2px 7px}", - "@keyframes plExpand{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}", - // ---- detail workbench: [ RUNS rail | main ] ---- - "#pipelines-root #pl-detail{height:100%;min-width:0;min-height:0;background:#0b0d16}", - // left RUNS rail - "#pipelines-root .pl-rail{flex:none;width:280px;background:#0a0b16;border-right:1px solid rgba(160,168,220,0.08);display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}", - "#pipelines-root .pl-rail-full{display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}", - "#pipelines-root .pl-rail-mini{display:none;flex-direction:column;align-items:center;padding-top:14px;gap:12px;flex:1}", - "#pipelines-root .pl-rail-mini .pl-vlabel{writing-mode:vertical-rl;font-family:'JetBrains Mono',monospace;font-size:10px;letter-spacing:0.16em;color:#5a6088}", - "#pipelines-root .pl-rail-head{display:flex;align-items:center;padding:15px 14px 10px;flex:none}", - "#pipelines-root .pl-rail-title{font-family:'JetBrains Mono',monospace;font-size:10.5px;letter-spacing:0.15em;color:#868db5;font-weight:600}", - "#pipelines-root .pl-rail-count{margin-left:7px;font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#5a6088}", - "#pipelines-root .pl-icbtn{width:24px;height:24px;display:flex;align-items:center;justify-content:center;background:rgba(160,168,220,0.06);border:1px solid rgba(160,168,220,0.14);border-radius:7px;color:#868db5;font-size:14px;line-height:1;cursor:pointer;padding:0;flex:none}", - "#pipelines-root .pl-icbtn:hover{border-color:rgba(125,207,255,0.4);color:#c8f0ff}", - "#pipelines-root .pl-runs{flex:1;overflow-y:auto;min-height:0;padding:0 6px 10px}", - "#pipelines-root .pl-runrow{display:flex;flex-direction:column;gap:6px;padding:9px 11px;margin:2px 4px;border-radius:9px;cursor:pointer;border:1px solid transparent}", - "#pipelines-root .pl-runrow:hover{background:rgba(160,168,220,0.05)}", - "#pipelines-root .pl-runrow.sel{background:rgba(158,206,106,0.09);border-color:rgba(158,206,106,0.22)}", - "#pipelines-root .pl-runrow-top{display:flex;align-items:center;gap:9px}", - "#pipelines-root .pl-runrow-dot{width:8px;height:8px;border-radius:50%;flex:none}", - "#pipelines-root .pl-runrow-id{font-family:'JetBrains Mono',monospace;font-size:12.5px;color:#eef0ff;font-weight:600}", - "#pipelines-root .pl-runrow-tg{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;font-family:'JetBrains Mono',monospace;font-size:9px;font-weight:700;flex:none}", - "#pipelines-root .pl-runrow-tg.manual{color:#bb9af7;background:rgba(187,154,247,0.14)}", - "#pipelines-root .pl-runrow-tg.schedule{color:#7dcfff;background:rgba(125,207,255,0.14)}", - "#pipelines-root .pl-runrow-tg.bridge{color:#9ece6a;background:rgba(158,206,106,0.14)}", - "#pipelines-root .pl-runrow-ago{font-family:'JetBrains Mono',monospace;font-size:10px;color:#5a6088;margin-left:auto;flex:none}", - "#pipelines-root .pl-runrow-sub{display:flex;align-items:center;gap:6px;padding-left:17px}", - "#pipelines-root .pl-runrow-dur{font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#7c83a8}", - "#pipelines-root .pl-runs-empty{padding:24px 12px;text-align:center;color:#5a6088;font-family:'JetBrains Mono',monospace;font-size:11px}", - "#pipelines-root .pl-rail-foot{flex:none;padding:12px 16px;border-top:1px solid rgba(160,168,220,0.08);display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}", - "#pipelines-root .pl-rail-foot-dot{width:6px;height:6px;border-radius:50%;background:#7dcfff;box-shadow:0 0 8px rgba(125,207,255,0.6);flex:none}", - "#pipelines-root .pl-rail-foot-txt{font-family:'JetBrains Mono',monospace;font-size:11px;color:#868db5;min-width:0;overflow:hidden;text-overflow:ellipsis}", - // main column - "#pipelines-root .pl-main{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0}", - "#pipelines-root .pl-main-head{flex:none;padding:13px 22px;border-bottom:1px solid rgba(160,168,220,0.08);display:flex;align-items:center;gap:12px}", - "#pipelines-root .pl-back-ic{width:26px;height:26px;display:flex;align-items:center;justify-content:center;background:rgba(160,168,220,0.06);border:1px solid rgba(160,168,220,0.14);border-radius:8px;color:#868db5;font-size:15px;line-height:1;cursor:pointer;padding:0;flex:none}", - "#pipelines-root .pl-back-ic:hover{border-color:rgba(125,207,255,0.4);color:#c8f0ff}", - "#pipelines-root .pl-h-name{font-family:'Space Grotesk',sans-serif;font-size:17px;font-weight:600;color:#eef0ff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:none;max-width:40%}", - "#pipelines-root .pl-h-repo{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#5a6088;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:none}", - "#pipelines-root .pl-h-runid{font-family:'JetBrains Mono',monospace;font-size:12px;color:#a8aecf;flex:none}", - "#pipelines-root .pl-tabs{display:flex;background:#14172a;border:1px solid rgba(160,168,220,0.14);border-radius:9px;padding:2px;gap:2px;flex:none;margin-left:auto}", - "#pipelines-root .pl-tabs button{appearance:none;padding:6px 15px;border:none;border-radius:7px;cursor:pointer;font-family:Inter,sans-serif;font-size:12.5px;font-weight:500;background:transparent;color:#868db5}", - "#pipelines-root .pl-tabs button.on{background:rgba(158,206,106,0.14);color:#c5f882}", - "#pipelines-root .pl-main-body{flex:1;overflow:auto;min-height:0;padding:22px 24px}", - "#pipelines-root .pl-tabbody{display:none}", - "#pipelines-root .pl-tabbody.on{display:block}", - "#pipelines-root .pl-description{max-width:720px;margin:0 0 18px;color:#7c83aa;font-size:13px;line-height:1.55;white-space:pre-line}", - // ---- names-only credential visibility ---- - "#pipelines-root .pl-keys-env{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 14px;margin-bottom:16px;background:#0f1120;border:1px solid rgba(160,168,220,0.13);border-radius:9px}", - "#pipelines-root .pl-keys-env-label{font-family:'JetBrains Mono',monospace;font-size:9.5px;text-transform:uppercase;letter-spacing:0.12em;color:#8b90b8}", - "#pipelines-root .pl-keys-env-path{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#c7c9e5;overflow-wrap:anywhere}", - "#pipelines-root .pl-keys-env-none{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#5a6088}", - "#pipelines-root .pl-keys-status{display:inline-flex;align-items:center;padding:3px 8px;border:1px solid rgba(160,168,220,0.2);border-radius:6px;font-family:'JetBrains Mono',monospace;font-size:9.5px;text-transform:uppercase;letter-spacing:0.06em;color:#8b90b8;background:rgba(160,168,220,0.07)}", - "#pipelines-root .pl-keys-status.ok{color:#9ece6a;border-color:rgba(158,206,106,0.28);background:rgba(158,206,106,0.09)}", - "#pipelines-root .pl-keys-status.missing,#pipelines-root .pl-keys-status.invalid{color:#f7768e;border-color:rgba(247,118,142,0.28);background:rgba(247,118,142,0.09)}", - "#pipelines-root .pl-keys-status.bad_mode,#pipelines-root .pl-keys-status.bad_owner,#pipelines-root .pl-keys-status.bad_location{color:#e0af68;border-color:rgba(224,175,104,0.28);background:rgba(224,175,104,0.09)}", - "#pipelines-root .pl-keys-empty{padding:18px;margin-bottom:16px;background:#090b16;border:1px solid rgba(160,168,220,0.13);border-radius:9px;color:#8b90b8;font-size:12.5px;line-height:1.55}", - "#pipelines-root .pl-keys-empty code{font-family:'JetBrains Mono',monospace;color:#c7c9e5;font-size:11.5px}", - "#pipelines-root .pl-keys-table-wrap{width:100%;overflow-x:auto;overflow-y:hidden;padding-bottom:6px}", - "#pipelines-root .pl-keys-table{width:100%;min-width:720px;border-collapse:collapse;background:#090b16;border:1px solid rgba(160,168,220,0.13);font-size:12.5px}", - "#pipelines-root .pl-keys-table th{text-align:left;padding:9px 12px;font-family:'JetBrains Mono',monospace;font-size:9.5px;text-transform:uppercase;letter-spacing:0.12em;color:#8b90b8;font-weight:600;border-bottom:1px solid rgba(160,168,220,0.13);white-space:nowrap}", - "#pipelines-root .pl-keys-table td{padding:10px 12px;color:#a8aecf;border-bottom:1px solid rgba(160,168,220,0.07);vertical-align:top}", - "#pipelines-root .pl-keys-table tbody+tbody tr:first-child td{border-top:1px solid rgba(160,168,220,0.18)}", - "#pipelines-root .pl-keys-stage{font-family:'JetBrains Mono',monospace;font-size:11.5px;font-weight:600;color:#eef0ff;white-space:nowrap}", - "#pipelines-root .pl-keys-kind{font-family:'JetBrains Mono',monospace;font-size:10px;color:#7c83aa;white-space:nowrap}", - "#pipelines-root .pl-keys-name{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#c7c9e5;white-space:nowrap}", - "#pipelines-root .pl-keys-badge{display:inline-flex;align-items:center;padding:3px 7px;border:1px solid rgba(160,168,220,0.2);border-radius:5px;font-family:'JetBrains Mono',monospace;font-size:9.5px;text-transform:uppercase;letter-spacing:0.04em;color:#8b90b8;background:rgba(160,168,220,0.07);white-space:nowrap}", - "#pipelines-root .pl-keys-badge.own{color:#7dcfff;border-color:rgba(125,207,255,0.28);background:rgba(125,207,255,0.09)}", - "#pipelines-root .pl-keys-badge.default{color:#bb9af7;border-color:rgba(187,154,247,0.28);background:rgba(187,154,247,0.09)}", - "#pipelines-root .pl-keys-badge.shared{color:#9ece6a;border-color:rgba(158,206,106,0.28);background:rgba(158,206,106,0.09)}", - "#pipelines-root .pl-keys-badge.injected{color:#9ece6a;border-color:rgba(158,206,106,0.24);background:rgba(158,206,106,0.07)}", - "#pipelines-root .pl-keys-badge.proxied{color:#e0af68;border-color:rgba(224,175,104,0.24);background:rgba(224,175,104,0.07)}", - "#pipelines-root .pl-keys-no-cred{font-family:'JetBrains Mono',monospace;font-size:11px;color:#5a6088;font-style:italic}", - "#pipelines-root .pl-keys-warning td{padding:9px 12px;background:rgba(224,175,104,0.06);color:#e0af68;font-size:11.5px}", - "#pipelines-root .pl-keys-warning code{display:inline-block;margin-left:5px;padding:2px 6px;border:1px solid rgba(224,175,104,0.22);border-radius:5px;font-family:'JetBrains Mono',monospace;font-size:10px;color:#e0af68;background:rgba(224,175,104,0.06)}", - "#pipelines-root .pl-history-lbl{font-family:'JetBrains Mono',monospace;font-size:9.5px;text-transform:uppercase;letter-spacing:0.12em;color:#5a6088;margin-bottom:8px}", - // ---- banner (blocked / failed) : design accent-bar alert ---- - "#pipelines-root .pl-banner{display:flex;flex-direction:column;gap:12px;border-radius:12px;padding:16px 18px;margin-bottom:18px;border:1px solid;border-left-width:3px}", - "#pipelines-root .pl-banner.blocked{background:color-mix(in srgb,#e0af68 9%,#14172a);border-color:rgba(224,175,104,0.30);border-left-color:#e0af68}", - "#pipelines-root .pl-banner.failed{background:color-mix(in srgb,#f7768e 9%,#14172a);border-color:rgba(247,118,142,0.30);border-left-color:#f7768e}", - "#pipelines-root .pl-banner-head{display:flex;align-items:center;gap:11px;flex-wrap:wrap}", - "#pipelines-root .pl-banner-ic{font-size:16px;flex:none}", - "#pipelines-root .pl-banner.blocked .pl-banner-ic{color:#e0af68}", - "#pipelines-root .pl-banner.failed .pl-banner-ic{color:#f7768e}", - "#pipelines-root .pl-banner-title{font-size:15px;font-weight:600;color:#eef0ff}", - "#pipelines-root .pl-banner-stage{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:7px;font-family:'JetBrains Mono',monospace;font-size:11px}", - "#pipelines-root .pl-banner.blocked .pl-banner-stage{color:#e0af68;background:color-mix(in srgb,#e0af68 14%,transparent);border:1px solid rgba(224,175,104,0.30)}", - "#pipelines-root .pl-banner.failed .pl-banner-stage{color:#f7768e;background:color-mix(in srgb,#f7768e 14%,transparent);border:1px solid rgba(247,118,142,0.30)}", - "#pipelines-root .pl-banner-reason{font-size:12.5px;color:#c8cce6;line-height:1.5}", - "#pipelines-root .pl-needs-lbl{font-family:'JetBrains Mono',monospace;font-size:9.5px;letter-spacing:0.12em;color:#868db5;margin-bottom:8px}", - "#pipelines-root .pl-needs{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}", - "#pipelines-root .pl-needs li{display:flex;align-items:flex-start;gap:9px;font-size:13px;color:#c7c9e5;line-height:1.45}", - "#pipelines-root .pl-needs li::before{content:'\\203a';flex:none;margin-top:1px}", - "#pipelines-root .pl-banner.blocked .pl-needs li::before{color:#e0af68}", - "#pipelines-root .pl-banner.failed .pl-needs li::before{color:#f7768e}", - "#pipelines-root .pl-cmd{display:inline-flex;align-items:center;gap:10px;padding:9px 10px 9px 13px;background:#0a0b16;border:1px solid rgba(160,168,220,0.14);border-radius:9px;align-self:flex-start;max-width:100%;box-sizing:border-box}", - "#pipelines-root .pl-cmd code{font-family:'JetBrains Mono',monospace;font-size:12px;color:#c5f882;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}", - // ---- stage graph (DAG) : design card chips + scroll cue/fade ---- - "#pipelines-root .pl-sg-lbl{font-family:'JetBrains Mono',monospace;font-size:9.5px;letter-spacing:0.14em;color:#5a6088;margin-bottom:6px}", - "#pipelines-root .pl-sg-cue{color:#5a6088}", - "#pipelines-root .pl-sg-wrap{position:relative}", - "#pipelines-root .pl-sg-fade{display:none;position:absolute;top:0;right:0;bottom:10px;width:52px;pointer-events:none;background:linear-gradient(90deg,rgba(11,13,22,0),#0b0d16)}", - "#pipelines-root .pl-sg-wrap.clip .pl-sg-fade{display:block}", - "#pipelines-root .pl-dagwrap{overflow-x:auto;overflow-y:hidden;padding-bottom:10px}", - "#pipelines-root .pl-dag{display:block}", - "#pipelines-root .pl-node{width:100%;height:100%;box-sizing:border-box;background:#0f1120;border:1px solid rgba(160,168,220,0.13);border-radius:9px;padding:11px 13px;display:flex;flex-direction:column;cursor:pointer;overflow:hidden}", - "#pipelines-root .pl-node:hover{border-color:rgba(160,168,220,0.3)}", - "#pipelines-root .pl-node.dim{opacity:0.5}", - "#pipelines-root .pl-node.running{border-color:rgba(122,162,247,0.28)}", - "#pipelines-root .pl-node-top{display:flex;align-items:center;gap:8px}", - "#pipelines-root .pl-node-dot{width:9px;height:9px;border-radius:50%;flex:none}", - "#pipelines-root .pl-node-kind{font-family:'JetBrains Mono',monospace;font-size:8.5px;font-weight:800;line-height:1;color:#868db5;background:rgba(134,141,181,0.10);border:1px solid rgba(134,141,181,0.22);border-radius:5px;padding:3px 5px;flex:none;white-space:nowrap}", - "#pipelines-root .pl-node-id{font-family:Inter,system-ui,sans-serif;font-size:13.5px;font-weight:600;color:#eef0ff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}", - "#pipelines-root .pl-node-runtime{font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#7c83a8;font-weight:600}", - "#pipelines-root .pl-node-try{font-family:'JetBrains Mono',monospace;font-size:9px;color:#e0af68;background:rgba(224,175,104,0.12);border:1px solid rgba(224,175,104,0.3);border-radius:5px;padding:1px 5px;flex:none;white-space:nowrap}", - "#pipelines-root .pl-node-slbl{font-family:'JetBrains Mono',monospace;font-size:8.5px;text-transform:uppercase;letter-spacing:0.05em;flex:none;white-space:nowrap}", - "#pipelines-root .pl-node-sum{font-size:11.5px;line-height:1.35;color:#7c83a8;margin-top:6px;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}", - "#pipelines-root .pl-node-progress{font-family:'JetBrains Mono',monospace;font-size:9.5px;color:#868db5;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}", - "#pipelines-root .pl-node-progress.stale{color:#5a6088;opacity:0.72}", - "#pipelines-root .pl-node-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto;padding-top:6px}", - "#pipelines-root .pl-node-dur{font-family:'JetBrains Mono',monospace;font-size:11px}", - "#pipelines-root .pl-node-job{font-family:'JetBrains Mono',monospace;font-size:10px;color:#7dcfff;white-space:nowrap}", - // ---- STAGES tally chips + matrix note ---- - "#pipelines-root .pl-tally{display:flex;align-items:center;gap:9px;margin-top:14px;padding-top:16px;border-top:1px solid rgba(160,168,220,0.08);flex-wrap:wrap}", - "#pipelines-root .pl-tally-lbl{font-family:'JetBrains Mono',monospace;font-size:9.5px;letter-spacing:0.12em;color:#5a6088;margin-right:4px}", - "#pipelines-root .pl-tchip{display:inline-flex;align-items:center;gap:6px;padding:4px 11px;border-radius:7px;font-family:'JetBrains Mono',monospace;font-size:11px}", - "#pipelines-root .pl-tchip-dot{width:8px;height:8px;border-radius:50%;flex:none}", - "#pipelines-root .pl-mxnote{font-family:'JetBrains Mono',monospace;font-size:12px;color:#868db5;padding:8px 2px;line-height:1.6}", - // ---- stage x run matrix (v1.6) ---- - "#pipelines-root .pl-mx-wrap{overflow-x:auto;padding-bottom:8px;margin-bottom:4px}", - "#pipelines-root .pl-mx{border-collapse:collapse}", - "#pipelines-root .pl-mx td{padding:3px 3px}", - "#pipelines-root .pl-mx-lbl{font-family:'JetBrains Mono',monospace;font-size:11px;color:#a8aecf;text-align:right;padding-right:10px;white-space:nowrap;position:sticky;left:0;background:#07080f}", - "#pipelines-root .pl-mx-cell{cursor:pointer;text-align:center;width:16px;min-width:16px;border-radius:4px}", - "#pipelines-root .pl-mx-cell:hover{background:rgba(160,168,220,0.08)}", - "#pipelines-root .pl-mx-cell.sel{background:rgba(122,162,247,0.16)}", - "#pipelines-root .pl-mx-dot{display:inline-block;width:10px;height:10px;border-radius:50%;vertical-align:middle}", - "#pipelines-root .pl-mx-empty .pl-mx-dot{width:6px;height:6px;background:rgba(90,96,136,0.35)}", - // ---- run-history table (v1.6) ---- - "#pipelines-root .pl-htable{width:100%;border-collapse:collapse;font-size:13px;margin-top:2px}", - "#pipelines-root .pl-htable thead th{text-align:left;padding:8px 12px;font-family:'JetBrains Mono',monospace;font-size:9.5px;text-transform:uppercase;letter-spacing:0.1em;color:#5a6088;font-weight:600;border-bottom:1px solid rgba(160,168,220,0.1);white-space:nowrap}", - "#pipelines-root .pl-htable tbody tr.pl-htrow{border-bottom:1px solid rgba(160,168,220,0.05);cursor:pointer}", - "#pipelines-root .pl-htable tbody tr.pl-htrow:hover{background:rgba(160,168,220,0.04)}", - "#pipelines-root .pl-htable tbody tr.pl-htrow.sel{background:rgba(122,162,247,0.08)}", - "#pipelines-root .pl-htable td{padding:9px 12px;vertical-align:middle;color:#a8aecf}", - "#pipelines-root .pl-ht-note{font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#5a6088;margin-top:8px}", - "#pipelines-root .pl-tbadge{display:inline-flex;align-items:center;font-family:'JetBrains Mono',monospace;font-size:10px;font-weight:600;padding:2px 8px;border-radius:6px;border:1px solid transparent}", - "#pipelines-root .pl-tbadge.manual{color:#7dcfff;background:rgba(125,207,255,0.1);border-color:rgba(125,207,255,0.28)}", - "#pipelines-root .pl-tbadge.schedule{color:#bb9af7;background:rgba(187,154,247,0.1);border-color:rgba(187,154,247,0.28)}", - "#pipelines-root .pl-tbadge.bridge{color:#9ece6a;background:rgba(158,206,106,0.1);border-color:rgba(158,206,106,0.28)}", - // ---- list stats glyph (v1.6) ---- - "#pipelines-root .pl-rate{font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#5a6088;margin-top:6px}", - // ---- selected-run summary caption + parked note ---- - "#pipelines-root .pl-runsum{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px;font-family:'JetBrains Mono',monospace;font-size:12px}", - "#pipelines-root .pl-runsum-t{color:#868db5}", - "#pipelines-root .pl-banner-parked{color:#868db5;font-family:'JetBrains Mono',monospace;font-size:11.5px}", - // ---- declared-DAG preview (v1.6) ---- - "#pipelines-root .pl-declared-note{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#868db5;margin-bottom:12px;display:flex;align-items:center;gap:9px;flex-wrap:wrap}", - "#pipelines-root .pl-declared-note code{font-family:'JetBrains Mono',monospace;font-size:11px;color:#c7c9e5;background:#0a0b16;border:1px solid rgba(160,168,220,0.14);border-radius:6px;padding:3px 8px}", - "@media (max-width:768px){#pipelines-root #pl-list .pl-list-head{height:auto!important;display:block!important;padding:14px 15px 10px!important}#pipelines-root #pl-list .pl-list-title{font-size:20px!important}#pipelines-root #pl-list .pl-list-summary{float:right;margin-top:-20px}#pipelines-root #pl-list .pl-list-scroll{padding:10px 15px 24px!important}#pipelines-root #pl-list .pl-group-toggle{height:auto;grid-template-columns:minmax(0,1fr) auto;gap:7px 8px;padding:4px 0 8px}#pipelines-root #pl-list .pl-group-main{grid-column:1 / -1}#pipelines-root #pl-list .pl-group-on{grid-column:1;grid-row:2;text-align:left}#pipelines-root #pl-list .pl-group-dots{grid-column:2;grid-row:2;justify-content:flex-end}#pipelines-root #pl-list .pl-group-activity{grid-column:1;grid-row:3;text-align:left}#pipelines-root #pl-list .pl-group-due{grid-column:2;grid-row:3}#pipelines-root #pl-list .pl-row{grid-template-columns:minmax(0,1fr) auto;padding:12px;gap:8px 12px}#pipelines-root #pl-list .pl-row-primary{grid-column:1}#pipelines-root #pl-list .pl-row-enabled{grid-column:2}#pipelines-root #pl-list .pl-row-mode,#pipelines-root #pl-list .pl-row-status,#pipelines-root #pl-list .pl-row-due,#pipelines-root #pl-list .pl-row-recent{grid-column:1 / -1}}", - "@media (max-width:768px){#pipelines-root .xd-panel{width:100%;left:0;border-left:none}}", - // detail workbench, mobile: the runs rail collapses to a horizontal run-chip strip above the main area - "@media (max-width:768px){#pipelines-root #pl-detail{flex-direction:column}#pipelines-root .pl-rail{width:auto!important;flex:none;border-right:none;border-bottom:1px solid rgba(160,168,220,0.08);max-height:120px}#pipelines-root .pl-rail-mini{display:none!important}#pipelines-root .pl-rail-head{display:none}#pipelines-root .pl-rail-foot{display:none}#pipelines-root .pl-runs{flex-direction:row;overflow-x:auto;overflow-y:hidden;padding:9px 8px;gap:8px}#pipelines-root .pl-runrow{flex:none;min-width:134px;margin:0}#pipelines-root .pl-main-head{padding:11px 14px;gap:9px;flex-wrap:wrap}#pipelines-root .pl-h-name{max-width:none}#pipelines-root .pl-main-body{padding:14px}}", - "@media (max-width:768px){#pipelines-root .pl-htable,#pipelines-root .pl-htable tbody{display:block}#pipelines-root .pl-htable thead{display:none}#pipelines-root .pl-htable tr.pl-htrow{display:block;background:#0d0f1c;border:1px solid rgba(160,168,220,0.1);border-radius:11px;padding:11px 13px;margin-bottom:8px}#pipelines-root .pl-htable tr.pl-htrow td{display:block;width:auto;padding:4px 0;border:none;white-space:normal}#pipelines-root .pl-mx-lbl{position:static;background:transparent}}", - "@media (pointer:coarse){#pipelines-root .xd-panel .xd-close{width:44px;height:44px;font-size:17px}#pipelines-root .pl-icbtn{width:34px;height:34px;font-size:16px}#pipelines-root .pl-back-ic{width:36px;height:36px}}" - ].join('\n'); - document.head.appendChild(st); - - const root = document.createElement('div'); - root.id = 'pipelines-root'; - root.style.cssText = 'position:fixed;left:216px;top:54px;right:0;bottom:0;z-index:40;background:#080a14;display:none'; - root.innerHTML = [ - '
', - '
Pipelines.
', - '
loading…
', - '
', - '' - ].join('\n'); - document.body.appendChild(root); - this._dockOverlay(root); // mobile: left:0 + bottom clears the tab bar - this._pipelinesRoot = root; - - // One delegated click listener: copy > rail toggle / back / tab > run row/cell > stage node > list row. - root.addEventListener('click', (e) => { - const copy = (e.target.closest && e.target.closest('.gm-copy')) || null; - if (copy) { e.stopPropagation(); this._gmCopyChip(copy); return; } - const act = (e.target.closest && e.target.closest('[data-pl-act]')) || null; - if (act) { - e.stopPropagation(); - const a = act.getAttribute('data-pl-act'); - if (a === 'toggle-runs') this._plToggleRuns(); - else if (a === 'back') { this.closePipelineDetail(); this._navRoute('pipelines'); } - return; - } - const tab = (e.target.closest && e.target.closest('.pl-tabs button[data-pl-tab]')) || null; - if (tab) { this._plSetTab(tab.getAttribute('data-pl-tab')); return; } - const rrow = (e.target.closest && e.target.closest('.pl-runrow')) || null; - if (rrow) { const rid = rrow.getAttribute('data-run'); if (rid) this.selectPipelineRun(rid); return; } - const mxc = (e.target.closest && e.target.closest('.pl-mx-cell')) || null; - if (mxc) { const rid = mxc.getAttribute('data-run'); if (rid) this.selectPipelineRun(rid); return; } - const htr = (e.target.closest && e.target.closest('.pl-htrow')) || null; - if (htr) { const rid = htr.getAttribute('data-run'); if (rid) this.selectPipelineRun(rid); return; } - const node = (e.target.closest && e.target.closest('.pl-node')) || null; - if (node) { const sid = node.getAttribute('data-stage'); if (sid) this.openPipelineStageDetail(sid); return; } - const prow = (e.target.closest && e.target.closest('.pl-row[data-name]')) || null; - if (prow && prow.getAttribute('data-name')) { const nm = prow.getAttribute('data-name'); this.openPipelineDetail(nm); this._navRoute('pipelines', { name: nm }); return; } - const group = (e.target.closest && e.target.closest('.pl-group-toggle[data-pl-group]')) || null; - if (group) { this._plToggleGroup(group.getAttribute('data-pl-group')); return; } - }); - // Escape: close the stage panel first, else back out of the detail. - this._pipelinesKeydown = (e) => { - if (e.key !== 'Escape' || this.state.view !== 'pipelines') return; - if (this._plStagePanel) { this.closePipelineStageDetail(); return; } - if (this._plDetailName) { this.closePipelineDetail(); this._navRoute('pipelines'); } - }; - document.addEventListener('keydown', this._pipelinesKeydown); - return root; - } - - // ---- LIST ------------------------------------------------------------------ - fetchPipelines(isPoll) { - fetch('/api/pipelines', { cache: 'no-store' }) - .then(r => r.ok ? r.text() : Promise.reject(new Error('HTTP ' + r.status))) - .then(txt => { - if (isPoll && this._pipelinesSig === txt) return; // unchanged — skip the re-render - this._pipelinesSig = txt; - let json = null; try { json = JSON.parse(txt); } catch (e) { json = null; } - this._pipelinesData = Array.isArray(json) ? json : []; - this._pipelinesByName = {}; - this._pipelinesData.forEach(p => { if (p && p.name) this._pipelinesByName[p.name] = p; }); - this._navApplyPipelines(this._pipelinesData); - this._pipelinesLoaded = true; - this.renderPipelines(); - // an open detail: refresh its header/history strip from the new summary. - if (this._plDetailName && this._pipelinesByName[this._plDetailName]) { - this.renderPipelineDetailShell(this._pipelinesByName[this._plDetailName]); - } - // a pending deep-link (/pipelines/): open it now the data has landed. - if (this._pendingPipelineDetail && this._pipelinesByName[this._pendingPipelineDetail]) { - const nm = this._pendingPipelineDetail; this._pendingPipelineDetail = null; this.openPipelineDetail(nm); - } - }) - .catch(err => { - if (isPoll) return; // keep the current table on a transient poll failure - this._pipelinesLoaded = true; - const tbl = this._pipelinesRoot && this._pipelinesRoot.querySelector('#pl-table'); - if (tbl) tbl.innerHTML = '
could not load /api/pipelines (' + this._galaxyEsc(err && err.message) + ')
'; - }); - } - - renderPipelines() { - if (!this._pipelinesRoot) return; - const list = Array.isArray(this._pipelinesData) ? this._pipelinesData : []; - const sub = this._pipelinesRoot.querySelector('#pl-sub'); - if (sub) sub.textContent = list.length ? (list.length + ' declared') : ''; - const table = this._pipelinesRoot.querySelector('#pl-table'); - if (!table) return; - if (!list.length) { - table.innerHTML = '
' + (this._pipelinesLoaded ? 'no pipelines declared yet - gitmoot pipeline add <spec.yaml>' : 'loading…') + '
'; - return; - } - const groups = {}; - list.forEach(p => { - if (!p) return; - // New servers resolve group. The repo fallback keeps older responses legible. - const group = (typeof p.group === 'string' && p.group.trim()) || p.repo || 'Other pipelines'; - (groups[group] = groups[group] || []).push(p); - }); - const names = Object.keys(groups).sort((a, b) => { - if (a === 'Gitmoot System') return b === 'Gitmoot System' ? 0 : 1; - if (b === 'Gitmoot System') return -1; - return a.localeCompare(b); - }); - table.innerHTML = names.map(name => this._pipelineGroupHtml(name, groups[name])).join(''); - this.refreshPipelineCountdowns(); - } - - _plLoadExpandedGroups() { - try { - const value = JSON.parse(localStorage.getItem('gitmoot.pl.expandedGroups.v1') || '[]'); - return new Set(Array.isArray(value) ? value.filter(name => typeof name === 'string') : []); - } catch (e) { return new Set(); } - } - - _plToggleGroup(name) { - if (!name) return; - if (!(this._plExpandedGroups instanceof Set)) this._plExpandedGroups = new Set(); - if (this._plExpandedGroups.has(name)) this._plExpandedGroups.delete(name); - else this._plExpandedGroups.add(name); - try { localStorage.setItem('gitmoot.pl.expandedGroups.v1', JSON.stringify(Array.from(this._plExpandedGroups))); } catch (e) {} - this.renderPipelines(); - } - - _plLedgerStateColor(state) { - const colors = { succeeded: '#7fa65a', failed: '#bd5f70', running: '#6181c5', blocked: '#b08b56', queued: '#333a5e', cancelled: '#333a5e' }; - return colors[state] || '#333a5e'; - } - - _plFmtLedgerDue(ms, now) { - return this._plFmtCountdown(ms, now).replace(/^due in /, 'due '); - } - - _pipelineGroupHtml(name, members) { - const esc = (s) => this._galaxyEsc(s); - const pipes = (Array.isArray(members) ? members.slice() : []).sort((a, b) => String(a.name || '').localeCompare(String(b.name || ''))); - const expanded = this._plExpandedGroups instanceof Set && this._plExpandedGroups.has(name); - const enabled = pipes.filter(p => p && p.enabled).length; - const latestAt = pipes.reduce((latest, p) => Math.max(latest, Number(p && p.lastRunAt) || 0), 0); - const dueAt = pipes.reduce((soonest, p) => { - const due = Number(p && p.nextDueAt) || 0; - return due > 0 ? Math.min(soonest, due) : soonest; - }, Infinity); - const countLabel = String(pipes.length); - const dots = pipes.map(p => { - const state = (p && p.lastStatus) || ''; - return ''; - }).join(''); - const activity = latestAt ? esc(this._relFromMs(latestAt)) : '-'; - const due = Number.isFinite(dueAt) - ? '' + esc(this._plFmtLedgerDue(dueAt)) + '' - : '-'; - const system = name === 'Gitmoot System'; - const children = expanded ? '
' + pipes.map(p => this._pipelineRowHtml(p)).join('') + '
' : ''; - return '
' + - '' + children + - '
'; - } - - _pipelineRowHtml(p) { - const esc = (s) => this._galaxyEsc(s); - const sched = p.interval ? ('every ' + p.interval + (p.jitter ? ' +' + p.jitter : '')) : 'manual'; - const mode = (p && typeof p.mode === 'string') ? p.mode.trim() : ''; - const scheduleCell = this._plModeChip(mode || sched); - const enChip = p.enabled ? 'enabled' : 'disabled'; - const lastCol = this._galaxyStateColor(p.lastStatus); - let lastChip; - if (p.lastStatus) { - const chip = '' + esc(p.lastStatus) + ''; - // recency ("succeeded · 18h ago") + a "@ " halt annotation when parked. - const rel = p.lastRunAt ? this._relFromMs(p.lastRunAt) : ''; - const rc0 = (Array.isArray(p.recent) && p.recent.length) ? p.recent[0] : null; - const halt = (rc0 && (p.lastStatus === 'blocked' || p.lastStatus === 'failed') && rc0.haltStage) ? rc0.haltStage : ''; - const sub = [halt ? ('@ ' + esc(halt)) : '', rel ? esc(rel) : ''].filter(Boolean).join(' · '); - lastChip = chip + (sub ? '
' + sub + '
' : ''); - } else { - lastChip = '-'; - } - const due = p.nextDueAt ? '' + esc(this._plFmtCountdown(p.nextDueAt)) + '' : '-'; - const recent = Array.isArray(p.recent) ? p.recent : []; - const strip = recent.length - ? '
' + recent.map(r => { const c = this._plLedgerStateColor(r.state); return ''; }).join('') + '
' - : 'no runs'; - // v1.6: success rate + avg duration computed client-side from recent[]. - const rate = this._plSuccessRate(p.recent); - const avg = this._plAvgDuration(p.recent); - const stats = (rate || avg) ? '
' + [rate, avg].filter(Boolean).join(' · ') + '
' : ''; - return '
' + - '
' + esc(p.name) + '
' + (p.repo ? '
' + esc(p.repo) + '
' : '') + '
' + - '
' + enChip + '
' + - '
' + scheduleCell + '
' + - '
' + lastChip + '
' + - '
' + due + '
' + - '
' + strip + stats + '
' + - '
'; - } - - _plModeChip(mode) { - const esc = (s) => this._galaxyEsc(s); - const raw = String(mode || '').trim(); - if (!raw) return ''; - const m = raw.toLowerCase(); - let cls = 'muted'; - if (m.indexOf('email-triggered') === 0) { - if (m.indexOf('(bound)') !== -1) cls = 'bound'; - else if (m.indexOf('(error)') !== -1) cls = 'error'; - else cls = 'warn'; - } else if (m.indexOf('after:') === 0) { - cls = 'after'; - } else if (m.indexOf('pending') !== -1 || m.indexOf('unbound') !== -1) cls = 'warn'; - return '' + esc(raw) + ''; - } - - // ---- DETAIL (workbench: [ RUNS rail | main ]) ------------------------------ - openPipelineDetail(name) { - if (!name) { this.closePipelineDetail(); return; } - const summary = this._pipelinesByName && this._pipelinesByName[name]; - if (!summary) { this._pendingPipelineDetail = name; return; } // opens after fetchPipelines - const switching = (this._plDetailName !== name); - this._plDetailName = name; - if (switching) { this._plSelectedRun = null; this._plRun = null; this._plTab = 'dag'; } // don't carry a prior pipeline's run/tab - // reset the detail-data channel so a prior pipeline's rail/matrix/table never flashes. - this._plDetail = null; this._plDetailSig = null; - const list = this._pipelinesRoot.querySelector('#pl-list'); - const det = this._pipelinesRoot.querySelector('#pl-detail'); - if (list) list.style.display = 'none'; - if (det) det.style.display = 'flex'; - ['#pl-runs', '#pl-rail-foot', '#pl-tab-dag', '#pl-tab-keys', '#pl-tab-history', '#pl-tab-matrix'].forEach(sel => { const el = this._pipelinesRoot.querySelector(sel); if (el) el.innerHTML = ''; }); - this._plLayout(); - this._plApplyTab(); - this.renderPipelineDetailShell(summary); - // second fetch — the pipeline's declared DAG + full run history (own poll). - this.fetchPipelineDetailData(name, false); - this.startPipelineDetailPoll(); - const recent = Array.isArray(summary.recent) ? summary.recent : []; - const def = summary.lastRunId || (recent[0] && recent[0].id) || ''; - if (def) this.selectPipelineRun(def); - else { this._plSelectedRun = null; this._plRun = null; this.renderPipelineRun(null); this._plRenderMainHead(); } - } - - // The shell = the main header (name/repo/selected #id/state chip) + the RUNS rail - // (run rows + footer). The selected run's #id + state come from _plRenderMainHead. - renderPipelineDetailShell(summary) { - if (!this._pipelinesRoot || !summary) return; - this._plRenderMainHead(); - this._plRenderRail(); - } - - // Main header meta: pipeline name/repo from the summary; the selected run's short - // id + state prefer the loaded run detail, else the history/recent entry. - _plMainMeta() { - const summary = this._pipelinesByName && this._pipelinesByName[this._plDetailName]; - const name = this._plDetailName || (summary && summary.name) || ''; - const repo = (summary && summary.repo) || ''; - const rid = this._plSelectedRun || ''; - let state = '', shortId = ''; - if (rid) { - shortId = String(rid).split('-').pop(); - if (this._plRun && this._plRun.id === rid && this._plRun.state) state = this._plRun.state; - else { - const src = (this._plDetail && Array.isArray(this._plDetail.runs)) ? this._plDetail.runs - : ((summary && Array.isArray(summary.recent)) ? summary.recent : []); - const e = src.find(r => r && r.id === rid); - if (e) state = e.state; - } - } - return { name: name, repo: repo, shortId: shortId, state: state }; - } - _plRenderMainHead() { - const root = this._pipelinesRoot; if (!root) return; - const esc = (s) => this._galaxyEsc(s); - const m = this._plMainMeta(); - const nameEl = root.querySelector('#pl-h-name'); if (nameEl) nameEl.textContent = m.name; - const repoEl = root.querySelector('#pl-h-repo'); if (repoEl) { repoEl.textContent = m.repo; repoEl.style.display = m.repo ? '' : 'none'; } - const idEl = root.querySelector('#pl-h-runid'); if (idEl) idEl.textContent = m.shortId ? ('#' + m.shortId) : ''; - const stEl = root.querySelector('#pl-h-state'); - if (stEl) { - if (m.state) { const c = this._galaxyStateColor(m.state); stEl.innerHTML = '' + esc(m.state) + ''; } - else stEl.innerHTML = ''; - } - } - - // RUNS rail: newest-first run rows (state dot · #shortid · M/S · rel time · ⧗ dur) - // from the full history (detail.runs) when loaded, else the recent strip; footer = - // next-due countdown / manual run command / schedule-paused. - _plRenderRail() { - const root = this._pipelinesRoot; if (!root) return; - const summary = this._pipelinesByName && this._pipelinesByName[this._plDetailName]; - const runs = (this._plDetail && Array.isArray(this._plDetail.runs) && this._plDetail.runs.length) - ? this._plDetail.runs - : ((summary && Array.isArray(summary.recent)) ? summary.recent : []); - const runsEl = root.querySelector('#pl-runs'); - if (runsEl) runsEl.innerHTML = runs.length ? runs.map(r => this._plRunrowHtml(r)).join('') : '
no runs yet
'; - const cntEl = root.querySelector('#pl-rail-count'); - if (cntEl) cntEl.textContent = runs.length ? String(runs.length) : ''; - const footEl = root.querySelector('#pl-rail-foot'); - if (footEl) footEl.innerHTML = this._plFooterHtml(summary); - this.refreshPipelineCountdowns(); - } - _plRunrowHtml(r) { - const esc = (s) => this._galaxyEsc(s); - const col = this._galaxyStateColor(r.state); - const shortId = String(r.id || '').split('-').pop(); - const rel = r.startedAt ? this._relFromMs(r.startedAt) : ''; - const sel = (r.id === this._plSelectedRun) ? ' sel' : ''; - const trig = (r.trigger === 'manual' || r.trigger === 'schedule' || r.trigger === 'bridge') - ? '' + (r.trigger === 'manual' ? 'M' : (r.trigger === 'schedule' ? 'S' : 'B')) + '' : ''; - const dur = (r.duration && r.duration > 0) ? this._fmtDur(r.duration) : (r.state === 'running' ? 'running' : ''); - return '
' + - '
' + - '#' + esc(shortId) + '' + trig + - (rel ? '' + esc(rel) + '' : '') + - '
' + - (dur ? '
⧗ ' + esc(dur) + '
' : '') + - '
'; - } - _plFooterHtml(summary) { - const esc = (s) => this._galaxyEsc(s); - if (!summary) return ''; - const interval = (summary.interval || '').trim(); - if (!interval) { - const cmd = 'gitmoot pipeline run ' + (summary.name || ''); - return '
' + esc(cmd) + '
'; - } - if (!summary.enabled) { - return 'schedule paused'; - } - const due = summary.nextDueAt || 0; - return '' + esc(this._plNextRunLabel(due)) + ''; - } - _plNextRunLabel(ms, now) { - if (!ms || ms <= 0) return 'next run -'; - const d = ms - (now || Date.now()); - if (d <= 0) return 'next run now'; - return 'next run in ' + this._fmtEta(d); - } - - // ---- rail collapse + segmented tabs + responsive flex reflow ---- - _plToggleRuns() { - if (this.state.isMobile) return; // mobile: the rail is a fixed horizontal strip - this._plRunsOpen = !this._plRunsOpen; - try { localStorage.setItem('gitmoot.plRunsOpen', this._plRunsOpen ? '1' : '0'); } catch (e) {} - this._plLayout(); - } - _plLayout() { - const root = this._pipelinesRoot; if (!root) return; - const det = root.querySelector('#pl-detail'); if (!det) return; - const rail = det.querySelector('.pl-rail'); - const full = rail && rail.querySelector('.pl-rail-full'); - const mini = rail && rail.querySelector('.pl-rail-mini'); - if (this.state.isMobile) { - det.style.flexDirection = ''; // the media query lays it out as a column - if (rail) rail.style.width = ''; - if (full) full.style.display = 'flex'; - if (mini) mini.style.display = 'none'; - return; - } - det.style.flexDirection = 'row'; - const open = this._plRunsOpen; - if (rail) rail.style.width = open ? '280px' : '46px'; - if (full) full.style.display = open ? 'flex' : 'none'; - if (mini) mini.style.display = open ? 'none' : 'flex'; - } - _plSetTab(tab) { - if (!tab || this._plTab === tab) return; - this._plTab = tab; - this._plApplyTab(); - } - _plApplyTab() { - const root = this._pipelinesRoot; if (!root) return; - const tab = this._plTab || 'dag'; - root.querySelectorAll('.pl-tabs button[data-pl-tab]').forEach(b => b.classList.toggle('on', b.getAttribute('data-pl-tab') === tab)); - root.querySelectorAll('.pl-tabbody').forEach(el => el.classList.toggle('on', el.getAttribute('data-pl-tab') === tab)); - if (tab === 'dag') this._plUpdateScrollCue(); - } - // Show the right-edge fade + "scroll →" cue only when the stage graph is clipped. - _plUpdateScrollCue() { - const root = this._pipelinesRoot; if (!root) return; - const wrap = root.querySelector('#pl-tab-dag .pl-sg-wrap'); - const scroller = root.querySelector('#pl-tab-dag .pl-dagwrap'); - const cue = root.querySelector('#pl-tab-dag .pl-sg-cue'); - if (!wrap || !scroller) return; - const clip = (scroller.scrollWidth - scroller.clientWidth) > 4; - wrap.classList.toggle('clip', clip); - if (cue) cue.textContent = clip ? ' · scroll →' : ''; - } - - selectPipelineRun(id) { - if (!id) return; - this._plSelectedRun = id; - if (this._pipelinesRoot) { - // keep the rail rows, matrix cells, and history-table rows selection in sync. - this._plSyncRunSelection(id); - this._plRenderMainHead(); - const dag = this._pipelinesRoot.querySelector('#pl-tab-dag'); - if (dag) dag.innerHTML = this._plDescriptionHtml() + '
loading run…
'; - } - this.fetchPipelineRun(id, false); - this.startPipelineRunPoll(); - } - - fetchPipelineRun(id, isPoll) { - const fid = (this._plRunFetchId = id); - fetch('/api/pipeline/run/' + encodeURIComponent(id), { cache: 'no-store' }) - .then(r => r.ok ? r.text() : Promise.reject(new Error('HTTP ' + r.status))) - .then(txt => { - if (this._plRunFetchId !== fid || this._plSelectedRun !== id) return; // superseded - if (isPoll && this._plRunSig === txt && this._plRunSigId === id) return; // unchanged - this._plRunSig = txt; this._plRunSigId = id; - let run = null; try { run = JSON.parse(txt); } catch (e) { run = null; } - this._plRun = run; - this.renderPipelineRun(run); - }) - .catch(err => { - if (isPoll || this._plRunFetchId !== fid || this._plSelectedRun !== id) return; - // when the full run detail is unavailable (e.g. a pruned run), fall back to - // the run's per-stage marks overlaid on the declared DAG so the matrix/table - // click still shows that run's shape. - const fb = this._plRunFromHistory(id); - if (fb) { this._plRun = fb; this.renderPipelineRun(fb); return; } - const area = this._pipelinesRoot && this._pipelinesRoot.querySelector('#pl-tab-dag'); - if (area) area.innerHTML = this._plDescriptionHtml() + '
could not load this run (' + this._galaxyEsc(err && err.message) + ')
'; - this._plRenderMainHead(); - }); - } - - _plDescriptionHtml() { - const detail = this._plDetail; - const description = detail && typeof detail.description === 'string' ? detail.description.trim() : ''; - return description ? '
' + this._galaxyEsc(description) + '
' : ''; - } - - // DAG-tab content: optional description first, then the blocked/failed banner, - // run summary caption, stage graph (scroll cue + right-edge fade), and tally. - // Renders into #pl-tab-dag; History/Matrix live in their tabs. - renderPipelineRun(run) { - if (!this._pipelinesRoot) return; - const area = this._pipelinesRoot.querySelector('#pl-tab-dag'); - if (!area) return; - const description = this._plDescriptionHtml(); - if (!run) { - // a never-run pipeline shows its DECLARED DAG (all pending) once the detail - // data has landed; otherwise the plain empty note. - const d = this._plDetail; - if (d && (!Array.isArray(d.runs) || !d.runs.length) && Array.isArray(d.declared) && d.declared.length) { - area.innerHTML = description + this._plDeclaredDagHtml(d); - } else { - area.innerHTML = description + '
no runs for this pipeline yet
'; - } - this._plRenderMainHead(); - this._plUpdateScrollCue(); - return; - } - const esc = (s) => this._galaxyEsc(s); - const stages = Array.isArray(run.stages) ? run.stages : []; - const dur = (run.finishedAt > run.startedAt) ? this._fmtDur(run.finishedAt - run.startedAt) : ''; - const startedAbs = run.startedAt ? this._plFmtAbsTime(run.startedAt) : ''; - const parkedTs = run.finishedAt > 0 ? run.finishedAt : (run.startedAt || 0); - const parked = ((run.state === 'blocked' || run.state === 'failed') && parkedTs > 0) ? this._relFromMs(parkedTs) : ''; - // _relFromMs/relTime already end with "ago" (or say "just now") — no suffix here. - const parkedTag = parked ? 'parked ' + esc(parked) + '' : ''; - // (a) banner FIRST - let banner = ''; - if (run.state === 'blocked' || run.state === 'failed') { - const level = run.state; - const haltStg = stages.find(s => s.id === run.haltStage) || stages.find(s => s.state === level); - const haltId = run.haltStage || (haltStg && haltStg.id) || '?'; - const title = (level === 'blocked' ? 'Run halted at ' : 'Run failed at ') + haltId; - const needs = Array.isArray(run.needs) ? run.needs : []; - let body = ''; - if (needs.length) body = '
NEEDS
    ' + needs.map(n => '
  • ' + esc(n) + '
  • ').join('') + '
'; - else if (run.haltReason) body = '
' + esc(run.haltReason) + '
'; - let cmd = ''; - if (level === 'blocked') cmd = 'gitmoot pipeline resume ' + (run.id || ''); - else { const jobId = (haltStg && haltStg.jobId) ? haltStg.jobId : ''; cmd = jobId ? ('gitmoot report bug --job ' + jobId) : ''; } - const cmdHtml = cmd ? '
' + esc(cmd) + '
' : ''; - banner = '
' + - '
⚠' + esc(title) + '' + - 'stage · ' + esc(haltId) + '' + parkedTag + '
' + - body + cmdHtml + - '
'; - } - // (b) run summary caption - const capParts = []; - if (startedAbs) capParts.push('' + esc(startedAbs) + ''); - if (dur) capParts.push('⏱ ' + esc(dur) + ''); - const trigB = this._plTriggerBadge(run.trigger) || ''; - const caption = (trigB || capParts.length) ? '
' + trigB + capParts.join('') + '
' : ''; - // (c) stage graph + (d) tally - const sg = '
STAGE GRAPH
' + - '
' + this._pipelineStageDag(stages) + '
'; - const tally = stages.length ? '
' + this._plTallyHtml(stages) + '
' : ''; - area.innerHTML = description + banner + caption + sg + tally; - this.refreshPipelineStageProgress(); - this._plRenderMainHead(); - this._plUpdateScrollCue(); - } - - // STAGES tally: counts by state as design chips (dot + "N label"). "ok" for - // succeeded; state-name otherwise. Ordered by severity, extras appended. - _plTallyHtml(stages) { - const esc = (s) => this._galaxyEsc(s); - const list = Array.isArray(stages) ? stages : []; - if (!list.length) return ''; - const order = ['succeeded', 'running', 'blocked', 'failed', 'skipped', 'pending', 'queued', 'cancelled']; - const labelMap = { succeeded: 'ok', running: 'running', blocked: 'blocked', failed: 'failed', skipped: 'skipped', pending: 'pending', queued: 'queued', cancelled: 'cancelled' }; - const counts = {}; - list.forEach(s => { const st = (s && s.state) || 'pending'; counts[st] = (counts[st] || 0) + 1; }); - const keys = order.filter(k => counts[k]); - Object.keys(counts).forEach(k => { if (keys.indexOf(k) === -1) keys.push(k); }); - const chips = keys.map(k => { - const c = this._plStageColor(k); - const lbl = labelMap[k] || k; - return '' + counts[k] + ' ' + esc(lbl) + ''; - }).join(''); - return 'STAGES' + chips; - } - - // Hand-rolled inline-SVG stage DAG: depth-column layout from stage deps (the - // fallbackLayout algorithm), node chips as foreignObjects, bezier edges L->R. - _plStageHasProgress(s) { - return !!(s && ((typeof s.progressActivity === 'string' && s.progressActivity.length > 0) || Number(s.progressAt) > 0)); - } - _pipelineStageDag(stages) { - const list = Array.isArray(stages) ? stages : []; - if (!list.length) return '
this run has no stages
'; - const byId = {}, ids = {}; - list.forEach(s => { byId[s.id] = s; ids[s.id] = true; }); - const depth = {}; - const getDepth = (s, seen) => { - if (depth[s.id] != null) return depth[s.id]; - if (seen[s.id]) return 0; // cycle guard - seen[s.id] = true; - let d = 0; - (s.deps || []).forEach(dep => { if (ids[dep] && byId[dep]) d = Math.max(d, getDepth(byId[dep], seen) + 1); }); - depth[s.id] = d; - return d; - }; - list.forEach(s => getDepth(s, {})); - const cols = {}; - list.forEach(s => { (cols[depth[s.id]] = cols[depth[s.id]] || []).push(s.id); }); // spec order within a column - const NW = 240, LEGACY_NH = 100, PROGRESS_NH = 118, GX = 66, GY = 26, pad = 16; - const nodeH = (s) => (s && s.state === 'running' && this._plStageHasProgress(s)) ? PROGRESS_NH : LEGACY_NH; - const depthKeys = Object.keys(cols).map(Number); - const maxDepth = Math.max.apply(null, depthKeys); - const colHeight = (col) => col.reduce((sum, id) => sum + nodeH(byId[id]), 0) + Math.max(0, col.length - 1) * GY; - let totalH = 0; depthKeys.forEach(k => { totalH = Math.max(totalH, colHeight(cols[k])); }); - const pos = {}; - depthKeys.forEach(k => { - const col = cols[k]; - let y = pad + (totalH - colHeight(col)) / 2; - col.forEach(id => { - const h = nodeH(byId[id]); - pos[id] = { x: pad + k * (NW + GX), y: y, h: h }; - y += h + GY; - }); - }); - const svgW = pad * 2 + (maxDepth + 1) * NW + maxDepth * GX; - const svgH = pad * 2 + totalH; - let edges = ''; - list.forEach(s => { - (s.deps || []).forEach(dep => { - if (!ids[dep] || !pos[dep] || !pos[s.id]) return; - const a = pos[dep], b = pos[s.id]; - const sx = a.x + NW, sy = a.y + a.h / 2, tx = b.x, ty = b.y + b.h / 2; - const dx = Math.max(24, (tx - sx) / 2); - const running = s.state === 'running'; - const stroke = running ? '#7aa2f7' : 'rgba(160,168,220,0.2)'; - const w = running ? 1.9 : 1.3; - const extra = running ? ' stroke-dasharray="5 7" style="animation:dashflow 0.8s linear infinite"' : ''; - edges += ''; - }); - }); - let nodes = ''; - list.forEach(s => { - const p = pos[s.id]; if (!p) return; - nodes += '' + this._pipelineStageChip(s) + ''; - }); - return '
' + edges + nodes + '
'; - } - - _pipelineStageChip(s) { - const esc = (v) => this._galaxyEsc(v); - const state = s.state || 'pending'; - const col = this._plStageColor(state); - const running = state === 'running'; - const dim = (state === 'pending' || state === 'skipped'); - // Attempt is 0-based (verified against the gitmoot bridge: job ids a0/a1/a2, - // resume does row.Attempt+1); Retry is the spec budget, so max attempts = - // retry+1. Surface the badge only once a retry has been consumed (att>0), - // reading "attempt N/M" (1-based) when a budget exists, else a plain count. - const att = (s.attempt && s.attempt > 0) ? s.attempt : 0; - const ret = (s.retry && s.retry > 0) ? s.retry : 0; - // Full label for the tooltip; a compact glyph ("3/3" or "×2") on the crowded card. - const tryFull = att ? (ret ? ('attempt ' + (att + 1) + '/' + (ret + 1)) : ('attempt ' + (att + 1))) : ''; - const tryLabel = att ? (ret ? ((att + 1) + '/' + (ret + 1)) : ('×' + (att + 1))) : ''; - let elapsed = ''; - if (s.startedAt > 0) { - const end = s.finishedAt > 0 ? s.finishedAt : (running ? Date.now() : 0); - if (end > 0) elapsed = this._fmtDur(Math.max(0, end - s.startedAt)); - } - const summary = s.summary || s.cmd || ''; - const clickable = !!s.jobId; - const kind = this._plStageKindBadge(s.kind); - const runtime = (s && typeof s.agentRuntime === 'string') ? s.agentRuntime.trim() : ''; - const stageLabel = esc(s.id) + (runtime ? ' (' + esc(runtime) + ')' : ''); - // Design card: header row (dot · name · [attempt] · STATE label), summary line, - // footer (duration in state color + a "job ▸" affordance opening the slide-in). - return '
' + - '
' + - '' + - (kind ? '' + esc(kind) + '' : '') + - '' + stageLabel + '' + - (tryLabel ? '' + esc(tryLabel) + '' : '') + - '' + esc(state) + '' + - '
' + - '
' + esc(summary) + '
' + - (running && this._plStageHasProgress(s) ? '
' : '') + - '
' + - '' + esc(elapsed || '-') + '' + - (clickable ? 'job ▸' : '') + - '
' + - '
'; - } - - _plStageKindBadge(kind) { - const k = String(kind || '').trim(); - if (!k) return ''; - const map = { - shell: 'SHELL', - agent_ask: 'ASK', - agent_review: 'REVIEW', - agent_implement: 'IMPLEMENT', - produce: 'PRODUCE', - gate: 'GATE', - orchestrate: 'ORCH' - }; - return map[k] || k.replace(/^agent_/, '').replace(/_/g, ' ').toUpperCase(); - } - - closePipelineDetail() { - this._plDetailName = null; - this._plSelectedRun = null; - this._plRun = null; - this._plDetail = null; this._plDetailSig = null; - this.stopPipelineRunPoll(); - this.stopPipelineDetailPoll(); - this.closePipelineStageDetail(); - if (this._pipelinesRoot) { - const det = this._pipelinesRoot.querySelector('#pl-detail'); - const list = this._pipelinesRoot.querySelector('#pl-list'); - if (det) det.style.display = 'none'; - if (list) list.style.display = ''; - try { this._pipelinesRoot.scrollTop = 0; } catch (e) {} - } - } - - // ---- stage -> job slide-in (reuses the shared _jobDetailHTML; Galaxy pattern) ---- - openPipelineStageDetail(stageId) { - const run = this._plRun; - if (!run) return; - const stage = (Array.isArray(run.stages) ? run.stages : []).find(s => s.id === stageId); - if (!stage) return; - this._ensureDetailStyles(); - if (stage.jobId) { - const summary = { id: stage.jobId, title: stage.id, state: stage.state }; - this.renderPipelineStagePanel(this._jobDetailHTML(summary, null, 'loading')); - const fid = (this._plStageFetchId = stage.jobId); - fetch('/api/job/' + encodeURIComponent(stage.jobId), { cache: 'no-store' }) - .then(r => r.ok ? r.json() : Promise.reject(new Error('HTTP ' + r.status))) - .then(job => { if (this._plStageFetchId === fid) this.renderPipelineStagePanel(this._jobDetailHTML(summary, job || {}, 'ok')); }) - .catch(() => { if (this._plStageFetchId === fid) this.renderPipelineStagePanel(this._jobDetailHTML(summary, null, 'error')); }); - } else { - this._plStageFetchId = null; - this.renderPipelineStagePanel(this._pipelineStageCardHTML(stage)); - } - } - renderPipelineStagePanel(html) { - if (!this._pipelinesRoot) return; - if (!this._plStagePanel || !this._plStagePanel.parentNode) { - const el = document.createElement('div'); - el.className = 'xd-panel'; - this._pipelinesRoot.appendChild(el); - this._plStagePanel = el; - } - this._plStagePanel.innerHTML = html; - const c = this._plStagePanel.querySelector('.xd-close'); - if (c) c.addEventListener('click', () => this.closePipelineStageDetail()); - } - closePipelineStageDetail() { - this._plStageFetchId = null; - try { if (this._plStagePanel) this._plStagePanel.remove(); } catch (e) {} - this._plStagePanel = null; - } - // Minimal stage card for stages with no job (pending / skipped). Reuses the - // shared .xd-* panel styles so it matches the job-detail panel. - _pipelineStageCardHTML(stage) { - const esc = (s) => this._galaxyEsc(s); - const state = stage.state || 'pending'; - const col = this._plStageColor(state); - const deps = Array.isArray(stage.deps) ? stage.deps : []; - const needs = Array.isArray(stage.needs) ? stage.needs : []; - return [ - '
', - '', - '
' + esc(stage.id) + '
stage · ' + esc(state) + '
', - '', - '
', - '' + esc(state) + '', - 'no job yet', - '
', - '
', - '
Command
' + esc(stage.cmd || '-') + '
', - (deps.length ? '
Depends on
' + esc(deps.join(', ')) + '
' : ''), - (needs.length ? '
Needs
' + esc(needs.join('\n')) + '
' : ''), - (stage.summary ? '
Summary
' + esc(stage.summary) + '
' : ''), - '
' - ].join(''); - } - - // ========================================================================== - // Pipeline detail data (declared DAG + full run history) — a SECOND fetch against - // /api/pipelines/, its own 12s signature-skip poll while a detail is open. - // Drives the RUNS rail (full history), the History and Matrix tabs, and the - // never-run declared preview. Every new member is _pl-prefixed (the v1.5 shadow - // lesson: a duplicate member name silently overrides an existing one). - // ========================================================================== - - // Absolute local time (month/day + HH:MM), matching the Jobs/Health idiom. - _plFmtAbsTime(ms) { - if (!ms || ms <= 0) return '-'; - try { return new Date(ms).toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }); } - catch (e) { return '-'; } - } - - // Trigger badge (manual | schedule | bridge) — an empty string for anything else. - _plTriggerBadge(trigger) { - const t = (trigger === 'manual' || trigger === 'schedule' || trigger === 'bridge') ? trigger : ''; - if (!t) return ''; - return '' + t + ''; - } - - // "8/10 ✓" success rate over finished (non-running) recent runs; "" when none. - _plSuccessRate(recent) { - const list = Array.isArray(recent) ? recent : []; - let finished = 0, ok = 0; - list.forEach(r => { if (r && r.state && r.state !== 'running') { finished++; if (r.state === 'succeeded') ok++; } }); - if (!finished) return ''; - return ok + '/' + finished + ' ✓'; - } - - // "~4m" average duration over finished recent runs with a duration; "" when none. - _plAvgDuration(recent) { - const list = Array.isArray(recent) ? recent : []; - let sum = 0, n = 0; - list.forEach(r => { if (r && r.duration && r.duration > 0) { sum += r.duration; n++; } }); - if (!n) return ''; - return '~' + this._fmtDur(Math.round(sum / n)); - } - - startPipelineDetailPoll() { - if (this._plDetailPoll) return; - this._plDetailPoll = setInterval(() => { - if (this.state.view !== 'pipelines' || !this._plDetailName) return; - this.fetchPipelineDetailData(this._plDetailName, true); - }, 12000); - } - stopPipelineDetailPoll() { try { clearInterval(this._plDetailPoll); } catch (e) {} this._plDetailPoll = null; } - - fetchPipelineDetailData(name, isPoll) { - if (!name) return; - const fname = (this._plDetailFetchName = name); - fetch('/api/pipelines/' + encodeURIComponent(name), { cache: 'no-store' }) - .then(r => r.ok ? r.text() : Promise.reject(new Error('HTTP ' + r.status))) - .then(txt => { - if (this._plDetailFetchName !== fname || this._plDetailName !== name) return; // superseded - if (isPoll && this._plDetailSig === txt) return; // unchanged — skip re-render - this._plDetailSig = txt; - let detail = null; try { detail = JSON.parse(txt); } catch (e) { detail = null; } - this._plDetail = detail; - this.renderPipelineDetailData(); - }) - .catch(err => { - // the detail data is supplementary (the header + selected run render from - // the list + run endpoints); a first-load failure clears the Keys, - // History, and Matrix tabs, while a poll failure keeps what's on screen. - if (isPoll || this._plDetailFetchName !== fname || this._plDetailName !== name) return; - ['#pl-tab-keys', '#pl-tab-history', '#pl-tab-matrix'].forEach(sel => { const el = this._pipelinesRoot && this._pipelinesRoot.querySelector(sel); if (el) el.innerHTML = ''; }); - }); - } - - // Render the detail-data driven panes: the RUNS rail (full history), Keys, - // History, and Matrix tabs, then re-apply the run selection, visible tab, and - // live countdown labels. - renderPipelineDetailData() { - if (!this._pipelinesRoot) return; - const detail = this._plDetail; - const runs = (detail && Array.isArray(detail.runs)) ? detail.runs : []; - // the rail rows + run count now come from the full history endpoint. - this._plRenderRail(); - this._plRenderMainHead(); - const tb = this._pipelinesRoot.querySelector('#pl-tab-history'); - if (tb) tb.innerHTML = runs.length ? this._plHistoryTableHtml(detail) : '
no runs yet.
'; - const mx = this._pipelinesRoot.querySelector('#pl-tab-matrix'); - // The matrix compares stages ACROSS runs — with fewer than 2 runs it would be a - // one-column duplicate of the DAG, so show a note instead of hiding silently. - if (mx) mx.innerHTML = runs.length >= 2 ? this._plMatrixHtml(detail) - : '
The stage × run matrix needs at least 2 runs to compare - this pipeline has ' + runs.length + '.
'; - this._plRenderKeysTab(detail); - if (runs.length && !this._plSelectedRun) { - // the list's recent strip was empty/stale but history has runs: pick newest. - this.selectPipelineRun(runs[0].id); - } else if (!runs.length && !this._plSelectedRun) { - // never-run pipeline: paint the declared DAG preview. - this.renderPipelineRun(null); - } - if (this._plSelectedRun) { - this._plSyncRunSelection(this._plSelectedRun); - // A run response may arrive before its detail payload. Repaint so the - // description appears as soon as the detail endpoint has supplied it. - if (this._plRun && this._plRun.id === this._plSelectedRun) this.renderPipelineRun(this._plRun); - } - this._plApplyTab(); - this.refreshPipelineCountdowns(); - } - - _plRenderKeysTab(detail) { - const pane = this._pipelinesRoot && this._pipelinesRoot.querySelector('#pl-tab-keys'); - if (!pane) return; - const esc = (s) => this._galaxyEsc(s); - const projection = detail && detail.keys && typeof detail.keys === 'object' ? detail.keys : {}; - const envFile = projection.envFile && typeof projection.envFile === 'object' ? projection.envFile : {}; - const rawStatus = typeof envFile.status === 'string' && envFile.status ? envFile.status : 'none'; - const statuses = ['none', 'ok', 'missing', 'bad_mode', 'bad_owner', 'bad_location', 'invalid']; - const statusClass = statuses.indexOf(rawStatus) !== -1 ? rawStatus : 'invalid'; - const statusLabels = { none: 'none', ok: 'ok', missing: 'missing', bad_mode: 'bad mode', bad_owner: 'bad owner', bad_location: 'bad location', invalid: 'invalid' }; - const statusLabel = statusLabels[rawStatus] || rawStatus; - const path = typeof envFile.path === 'string' ? envFile.path : ''; - const pathHTML = path ? '' + esc(path) + '' : 'not declared'; - const envHTML = '
env_file' + pathHTML + - '' + esc(statusLabel) + '
'; - - const stages = Array.isArray(projection.stages) ? projection.stages : []; - let keyCount = 0; - const groups = stages.map(stage => { - const entries = Array.isArray(stage && stage.keys) ? stage.keys : []; - const selectors = Array.isArray(stage && stage.unresolvedSelectors) ? stage.unresolvedSelectors : []; - keyCount += entries.length; - const stageID = stage && stage.id != null ? String(stage.id) : ''; - const kind = stage && stage.kind != null ? String(stage.kind) : ''; - const kindLabel = this._plStageKindBadge(kind) || kind || '-'; - let rows = ''; - if (entries.length) { - entries.forEach((entry, index) => { - const source = entry && entry.source != null ? String(entry.source) : ''; - const mode = entry && entry.mode != null ? String(entry.mode) : ''; - const sourceClass = ['own', 'shared', 'default'].indexOf(source) !== -1 ? source : ''; - const modeClass = ['injected', 'proxied'].indexOf(mode) !== -1 ? mode : ''; - rows += '' + (index === 0 ? '' + esc(stageID) + '' + - '' + esc(kindLabel) + '' : '') + - '' + esc(entry && entry.name != null ? entry.name : '') + '' + - '' + esc(source || '-') + '' + - '' + esc(mode || '-') + ''; - }); - } else { - rows = '' + esc(stageID) + '' + esc(kindLabel) + - 'no credentials'; - } - if (selectors.length) { - rows += 'Unresolved selectors for ' + esc(stageID) + ':' + - selectors.map(selector => '' + esc(selector) + '').join('') + ''; - } - return '' + rows + ''; - }).join(''); - - const emptyHTML = rawStatus === 'none' && keyCount === 0 - ? '
No credentials are declared; under #968 deny-by-default, stages receive nothing unless their env_keys explicitly allow access.
' - : ''; - const tableHTML = stages.length ? '
' + - '' + groups + '
StageKindKeySourceDelivery
' : ''; - pane.innerHTML = envHTML + emptyHTML + tableHTML; - } - - // Stage x run matrix: rows = stage ids (declared order, then any history-only - // ids appended), columns = last <=15 runs oldest->newest (newest rightmost, - // aligned with the outcomes strip). Cells are state dots; a cell click selects - // the run. Horizontal scroll on overflow. - _plMatrixHtml(detail) { - const esc = (s) => this._galaxyEsc(s); - const runs = (Array.isArray(detail.runs) ? detail.runs.slice(0, 15) : []).reverse(); // oldest -> newest - if (runs.length < 2) return ''; // cross-run comparison needs at least two runs - const declared = Array.isArray(detail.declared) ? detail.declared : []; - const order = [], seen = {}; - declared.forEach(s => { if (s && s.id && !seen[s.id]) { seen[s.id] = true; order.push(s.id); } }); - runs.forEach(r => (Array.isArray(r.stages) ? r.stages : []).forEach(m => { if (m && m.id && !seen[m.id]) { seen[m.id] = true; order.push(m.id); } })); - if (!order.length) return ''; - const rowsHtml = order.map(sid => { - let cells = ''; - runs.forEach(r => { - const marks = Array.isArray(r.stages) ? r.stages : []; - const mk = marks.find(m => m && m.id === sid); - const shortId = String(r.id || '').split('-').pop(); - const rel = r.startedAt ? this._relFromMs(r.startedAt) : ''; - const state = mk ? mk.state : '-'; - const tip = '#' + shortId + (rel ? ' · ' + rel : '') + ' · ' + sid + ': ' + state; - if (mk) { - const col = this._plStageColor(mk.state); - cells += ''; - } else { - cells += ''; - } - }); - return '' + esc(sid) + '' + cells + ''; - }).join(''); - return '
stage × run
' + - '
' + rowsHtml + '
'; - } - - // Run-history table: started (absolute + relative) · trigger · state · duration - // · halt stage. Newest-first, capped at 100 (server) with a note at the cap; a - // row click selects the run. Reuses the .pl- table idiom + mobile card reflow. - _plHistoryTableHtml(detail) { - const esc = (s) => this._galaxyEsc(s); - const runs = Array.isArray(detail.runs) ? detail.runs : []; - if (!runs.length) return ''; - const rows = runs.map(r => { - const col = this._galaxyStateColor(r.state); - const shortId = String(r.id || '').split('-').pop(); - const abs = r.startedAt ? this._plFmtAbsTime(r.startedAt) : '-'; - const rel = r.startedAt ? this._relFromMs(r.startedAt) : ''; - const dur = (r.finishedAt > r.startedAt) ? this._fmtDur(r.finishedAt - r.startedAt) : (r.state === 'running' ? 'running' : '-'); - const halt = r.haltStage ? esc(r.haltStage) : '-'; - const stateChip = '' + esc(r.state) + ''; - const sel = (r.id === this._plSelectedRun) ? ' sel' : ''; - const trig = this._plTriggerBadge(r.trigger) || '-'; - return '' + - '
' + esc(abs) + '
' + (rel ? '
' + esc(rel) + '
' : '') + '' + - '' + trig + '' + - '' + stateChip + '' + - '' + esc(dur) + '' + - '' + halt + '' + - ''; - }).join(''); - const note = (runs.length >= 100) ? '
showing last 100 runs
' : ''; - return '
run history
' + - '' + rows + '
startedtriggerstatedurationhalt
' + note; - } - - // Never-run pipeline: render the DECLARED DAG (all pending, dimmed by the chip's - // pending styling) with a copyable run command. - _plDeclaredDagHtml(detail) { - const esc = (s) => this._galaxyEsc(s); - const declared = Array.isArray(detail.declared) ? detail.declared : []; - if (!declared.length) return '
no stages declared for this pipeline
'; - const name = detail.name || this._plDetailName || ''; - const cmd = 'gitmoot pipeline run ' + name; - const note = '
never run yet - ' + esc(cmd) + '' + - '
'; - return note + this._pipelineStageDag(declared); - } - - // Toggle the selection highlight across all three run selectors (rail rows, - // matrix columns, history-table rows) for the given run id. - _plSyncRunSelection(id) { - if (!this._pipelinesRoot) return; - this._pipelinesRoot.querySelectorAll('.pl-runrow').forEach(c => c.classList.toggle('sel', c.getAttribute('data-run') === id)); - this._pipelinesRoot.querySelectorAll('.pl-htrow').forEach(r => r.classList.toggle('sel', r.getAttribute('data-run') === id)); - this._pipelinesRoot.querySelectorAll('.pl-mx-cell').forEach(c => c.classList.toggle('sel', c.getAttribute('data-run') === id)); - } - - // Fallback run detail synthesized from the history entry's per-stage marks - // overlaid on the declared DAG (deps/cmd by stage id) — used when the full - // /api/pipeline/run/ detail is unavailable so a matrix/table click still - // shows that run's shape. Returns null when the run is not in the history. - _plRunFromHistory(id) { - const detail = this._plDetail; - if (!detail || !Array.isArray(detail.runs)) return null; - const e = detail.runs.find(r => r && r.id === id); - if (!e) return null; - const declBy = {}; - (Array.isArray(detail.declared) ? detail.declared : []).forEach(s => { if (s && s.id) declBy[s.id] = s; }); - const stages = (Array.isArray(e.stages) ? e.stages : []).map(m => { - const d = declBy[m.id] || {}; - return { id: m.id, state: m.state, deps: Array.isArray(d.deps) ? d.deps : [], cmd: d.cmd || '' }; - }); - return { id: e.id, pipeline: detail.name, trigger: e.trigger, state: e.state, haltStage: e.haltStage, startedAt: e.startedAt, finishedAt: e.finishedAt, stages: stages }; - } - // ---- Persistent top bar + nav "needs you" dots ---------------------------- // One light batch fetch that feeds the always-visible signals (daemon liveness - // for the top bar; amber needs-you dots for Health/Pipelines/Learning/Attention). + // for the top bar; amber needs-you dots for Health/Learning/Attention). // Runs once on load and every 60s; the per-view fetches also call the same // _*Apply* updaters so an open view keeps its own dot live between seeds. _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/pipelines', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (Array.isArray(j)) this._navApplyPipelines(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/learning/skills', { cache: 'no-store' }).then(r => r.ok ? r.json() : null).then(j => { if (j) this._navApplySkills(j); }).catch(() => {}); @@ -7884,10 +6438,6 @@ if (attn !== this.state.healthAttn) patch.healthAttn = attn; if (Object.keys(patch).length) this.setState(patch); } - _navApplyPipelines(arr) { - const bad = (Array.isArray(arr) ? arr : []).some(p => p && (p.lastStatus === 'failed' || p.lastStatus === 'blocked')); - if (bad !== this.state.pipelinesAttn) this.setState({ pipelinesAttn: bad }); - } _navApplyWorkflows(arr) { const stalled = (Array.isArray(arr) ? arr : []).some(w => w && w.state === 'stalled'); if (stalled !== this.state.workflowsAttn) this.setState({ workflowsAttn: stalled }); @@ -7925,14 +6475,13 @@ _navMoreCharts = () => { this.setState({ moreOpen: false }); this.showCharts(); }; _navMoreLearning = () => { this.setState({ moreOpen: false }); this.showLearning(); }; _navMoreConfig = () => { this.setState({ moreOpen: false }); this.showConfig(); }; - _navMorePipelines = () => { this.setState({ moreOpen: false }); this.showPipelines(); }; _navMoreAgents = () => { this.setState({ moreOpen: false }); this.showAgents(); }; _navMoreOrg = () => { this.setState({ moreOpen: false }); this.showOrg(); }; _navMoreAttention = () => { this.setState({ moreOpen: false }); this.showAttention(); }; _navMoreHealth = () => { this.setState({ moreOpen: false }); this.showHealth(); }; // ---- Shared copy chip ----------------------------------------------------- - // Unified copy affordance (Learning / Agents / Pipelines). Reads the command from + // Unified copy affordance (Learning / Agents). Reads the command from // data-cmd, or takes an explicit text override (Agents copies a prompt's text), // writes to the clipboard, and flashes "✓ copied" via the global .gm-copy.done class. _gmCopyChip(btn, textOverride) { @@ -7953,7 +6502,7 @@ el.style.bottom = this._overlayBottom(); } _redockOverlays() { - [this._overviewRoot, this._tasksRoot, this._galaxyRoot, this._workflowRoot, this._jobsRoot, this._agentsRoot, this._orgRoot, this._chartsRoot, this._healthRoot, this._configRoot, this._learningRoot, this._pipelinesRoot] + [this._overviewRoot, this._tasksRoot, this._galaxyRoot, this._workflowRoot, this._jobsRoot, this._agentsRoot, this._orgRoot, this._chartsRoot, this._healthRoot, this._configRoot, this._learningRoot] .forEach(r => this._dockOverlay(r)); } @@ -8561,7 +7110,6 @@ const isConfig = view === 'config'; const isAttention = view === 'attention'; const isLearning = view === 'learning'; - const isPipelines = view === 'pipelines'; const isWorkflows = view === 'workflows'; // shared nav-item base; active items pick up the green highlight const navBase = { display: 'flex', alignItems: 'center', gap: '11px', padding: '9px 11px', borderRadius: '9px', fontSize: '13.5px', fontWeight: 500, cursor: 'pointer', marginTop: '2px' }; @@ -8575,7 +7123,6 @@ const tasksNavStyle = { ...navActive(isTasks), position: 'relative' }; const galaxyNavStyle = { ...navActive(isGalaxy), position: 'relative' }; const jobsNavStyle = { ...navActive(isJobs), position: 'relative' }; - const pipelinesNavStyle = { ...navActive(isPipelines), position: 'relative' }; const workflowsNavStyle = { ...navActive(isWorkflows), position: 'relative' }; const agentsNavStyle = { ...navActive(isAgents), position: 'relative' }; const orgNavStyle = { ...navActive(isOrg), position: 'relative' }; @@ -8589,7 +7136,6 @@ const needsDot = (on, color) => { const c=color||'#e0af68'; return { width: '6px', height: '6px', borderRadius: '50%', flex: 'none', background: on ? c : 'transparent', boxShadow: on ? '0 0 8px '+c : 'none' }; }; const healthAttn = !!this.state.healthAttn; const learningAttn = !!this.state.learningAttn; - const pipelinesAttn = !!this.state.pipelinesAttn; const workflowsAttn = !!this.state.workflowsAttn; const tasksAttn = !!this.state.tasksAttn; const attnAttn = !!this.state.attnAttn; @@ -8637,17 +7183,16 @@ // ---- top-bar breadcrumb: "section › entity", or "group › section" when no entity ---- // Graph keeps its repo › run-title (and the run-state dot); every other view shows - // its section + a cheaply-available selected entity (pipeline / agent), + // its section + a cheaply-available selected entity (agent / workflow), // falling back to its nav group + section name. - const NAV_GROUP = { overview: 'work', tasks: 'work', graph: 'work', jobs: 'work', pipelines: 'work', workflows: 'work', agents: 'fleet', org: 'fleet', galaxy: 'insight', charts: 'insight', learning: 'insight', attention: 'system', health: 'system', config: 'system' }; - const SECT = { overview: 'overview', tasks: 'tasks', graph: 'graph', jobs: 'jobs', pipelines: 'pipelines', workflows: 'workflows', agents: 'agents', org: 'org', galaxy: 'galaxy', charts: 'charts', learning: 'learning', attention: 'attention', health: 'health', config: 'config' }; + const NAV_GROUP = { overview: 'work', tasks: 'work', graph: 'work', jobs: 'work', workflows: 'work', agents: 'fleet', org: 'fleet', galaxy: 'insight', charts: 'insight', learning: 'insight', attention: 'system', health: 'system', config: 'system' }; + const SECT = { overview: 'overview', tasks: 'tasks', graph: 'graph', jobs: 'jobs', workflows: 'workflows', agents: 'agents', org: 'org', galaxy: 'galaxy', charts: 'charts', learning: 'learning', attention: 'attention', health: 'health', config: 'config' }; let crumbRoot, crumbLeaf, crumbShowDot = isOrg; if (isGraph) { crumbRoot = activeRun.repo || 'graph'; crumbLeaf = activeRun.title || 'run'; crumbShowDot = true; } else { let entity = ''; - if (isPipelines && this._plDetailName) entity = this._plDetailName; - else if (isAgents && this._agentsSelected) entity = this._agentsSelected; + if (isAgents && this._agentsSelected) entity = this._agentsSelected; else if (isJobs && this._jobsFacetAgent) entity = this._jobsFacetAgent; else if (isWorkflows && this._workflowLabel) entity = this._workflowLabel; else if (view === 'learning') entity = 'skills'; @@ -8666,23 +7211,23 @@ showGraph: this.showGraph, showOverview: this.showOverview, showTasks: this.showTasks, showGalaxy: this.showGalaxy, showJobs: this.showJobs, showAgents: this.showAgents, showOrg: this.showOrg, showCharts: this.showCharts, showHealth: this.showHealth, showConfig: this.showConfig, showLearning: this.showLearning, - showPipelines: this.showPipelines, showWorkflows: this.showWorkflows, showAttention: this.showAttention, - graphNavStyle, overviewNavStyle, tasksNavStyle, galaxyNavStyle, jobsNavStyle, pipelinesNavStyle, workflowsNavStyle, agentsNavStyle, orgNavStyle, chartsNavStyle, healthNavStyle, configNavStyle, attentionNavStyle, learningNavStyle, + showWorkflows: this.showWorkflows, showAttention: this.showAttention, + graphNavStyle, overviewNavStyle, tasksNavStyle, galaxyNavStyle, jobsNavStyle, workflowsNavStyle, agentsNavStyle, orgNavStyle, chartsNavStyle, healthNavStyle, configNavStyle, attentionNavStyle, learningNavStyle, graphNavDotStyle: needsDot(false), galaxyNavDotStyle: needsDot(false), jobsNavDotStyle: needsDot(false), agentsNavDotStyle: needsDot(false), orgNavDotStyle: needsDot(false), chartsNavDotStyle: needsDot(false), healthNavDotStyle: needsDot(healthAttn && !isHealth), configNavDotStyle: needsDot(false), attentionNavDotStyle: needsDot(attnAttn && !isAttention, '#f7768e'), tasksNavDotStyle: needsDot(tasksAttn && !isTasks), - learningNavDotStyle: needsDot(false), pipelinesNavDotStyle: needsDot(pipelinesAttn && !isPipelines), + learningNavDotStyle: needsDot(false), workflowsNavDotStyle: needsDot(workflowsAttn && !isWorkflows), - tabPipesAttnStyle: tabPip(pipelinesAttn), tabHealthAttnStyle: tabPip(healthAttn), + tabHealthAttnStyle: tabPip(healthAttn), tabAttnAttnStyle: tabPip(attnAttn, '#f7768e'), tabTasksAttnStyle: tabPip(tasksAttn && !isTasks), tabWorkflowsAttnStyle: tabPip(workflowsAttn && !isWorkflows), - tabMoreAttnStyle: tabPip(pipelinesAttn || healthAttn || attnAttn), + tabMoreAttnStyle: tabPip(healthAttn || attnAttn), moreSheetVisible, closeMoreSheet: this._navCloseMore, showMore: this._navOpenMore, showOverviewFromMore: this._navMoreOverview, showTasksFromMore: this._navMoreTasks, showWorkflowsFromMore: this._navMoreWorkflows, showJobsFromMore: this._navMoreJobs, showGalaxyFromMore: this._navMoreGalaxy, showChartsFromMore: this._navMoreCharts, showLearningFromMore: this._navMoreLearning, - showConfigFromMore: this._navMoreConfig, showPipelinesFromMore: this._navMorePipelines, + showConfigFromMore: this._navMoreConfig, showAgentsFromMore: this._navMoreAgents, showOrgFromMore: this._navMoreOrg, showAttentionFromMore: this._navMoreAttention, showHealthFromMore: this._navMoreHealth, moreLearnDotStyle: needsDot(learningAttn), daemonText, daemonTextStyle, liveWord, liveBadgeStyle, liveDotStyle, @@ -8691,8 +7236,7 @@ tabGraphStyle: tabStyle(isGraph), tabOverviewStyle: tabStyle(isOverview), tabTasksStyle: { ...tabStyle(isTasks), position: 'relative' }, tabJobsStyle: tabStyle(isJobs), tabWorkflowsStyle: { ...tabStyle(isWorkflows), position: 'relative' }, tabAgentsStyle: tabStyle(isAgents), tabHealthStyle: { ...tabStyle(isHealth), position: 'relative' }, tabAttentionStyle: { ...tabStyle(isAttention), position: 'relative' }, - tabPipelinesStyle: { ...tabStyle(isPipelines), position: 'relative' }, - tabMoreStyle: { ...tabStyle(isGraph || isJobs || isGalaxy || isCharts || isLearning || isConfig || isPipelines || isAgents || isOrg || isAttention || isHealth), position: 'relative' }, + tabMoreStyle: { ...tabStyle(isGraph || isJobs || isGalaxy || isCharts || isLearning || isConfig || isAgents || isOrg || isAttention || isHealth), position: 'relative' }, crumbRepoStyle, crumbSepStyle, liveTextStyle, detailAsideStyle, zoomCtrlStyle, footerStyle, crumbRepo: crumbRoot, crumbTitle: crumbLeaf, crumbDotStyle: crumbShowDot ? { width: '8px', height: '8px', borderRadius: '50%', flex: 'none', background: isOrg ? '#bb9af7' : crumbCol.c, boxShadow: isOrg ? '0 0 8px rgba(187,154,247,.6)' : (activeRun.state === 'running' ? '0 0 8px ' + crumbCol.g : 'none'), animation: (!isOrg && activeRun.state === 'running') ? 'dotpulse 1.4s ease-in-out infinite' : 'none' } : { display: 'none' },