From 4740a5955841af3cfcec068924ace004ee0c07a9 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Thu, 29 Oct 2026 23:30:02 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat(dashboard):=20Contributors?= =?UTF-8?q?=20sidebar=20pill=20reads=20online/total?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Contributors nav item showed a bare registered count. It now shows online/total (e.g. 3/12) through the same setSidebarPairBadge pill the Governor and Overview items use, with the tooltip "N online · M registered (heartbeat within 15m)". Online is the stage tracker's presence predicate (ContributeWSHub .Presence / liveConnectionsFor): a registered contributor whose relay heartbeat landed within governor.labels.stage.presence_window, so the pill and "waiting on @x (offline 13m)" never disagree. - /api/status.contributorPool gains online + presence_window - /api/contributors rows gain online; the list sorts online first with a tokenised green/grey presence dot (.contrib-status-dot) - Contributors header shows the same N online / M registered - docs/dashboard-sections.md documents the window Fixes #15651 Signed-off-by: Andrew Anderson --- .../added-contributors-online-total-badge.md | 1 + src/docs/dashboard-sections.md | 2 +- src/pkg/dashboard/api_contribute.go | 54 +++++++++++-- src/pkg/dashboard/contribute_admin.go | 6 ++ src/pkg/dashboard/contribute_fleet.go | 26 +++++++ src/pkg/dashboard/contribute_profiles.go | 10 ++- .../dashboard/contributor_pool_online_test.go | 76 +++++++++++++++++++ src/pkg/dashboard/sidebar_pair_badge_test.go | 31 ++++++++ .../static-src/css/sparklines-indicators.css | 7 ++ ...nous-inception-knowledge-contributors.html | 2 +- .../dashboard/static-src/html/sidebar.html | 2 +- .../dashboard/static-src/js/contributors.js | 44 ++++++++--- src/pkg/dashboard/static-src/js/sections.js | 8 +- src/pkg/dashboard/static/index.html | 63 +++++++++++---- 14 files changed, 289 insertions(+), 43 deletions(-) create mode 100644 changelog.d/added-contributors-online-total-badge.md create mode 100644 src/pkg/dashboard/contributor_pool_online_test.go diff --git a/changelog.d/added-contributors-online-total-badge.md b/changelog.d/added-contributors-online-total-badge.md new file mode 100644 index 0000000000..bc4e26d944 --- /dev/null +++ b/changelog.d/added-contributors-online-total-badge.md @@ -0,0 +1 @@ +- The sidebar **Contributors** item now reads **online/total** (for example `3/12`), the same two-part pill Governor and Overview use, with the tooltip *N online · M registered (heartbeat within 15m)* ([#15651](https://github.com/hivecommons/hive/issues/15651)). *Online* is the stage tracker's own presence test — a registered contributor whose relay heartbeat landed within `governor.labels.stage.presence_window` — so the pill and *waiting on @name (offline 13m)* always agree. `/api/status.contributorPool` gains `online` and `presence_window`; `/api/contributors` rows gain `online`; the Contributors header shows the same figure and the card list sorts online contributors first with a green/grey presence dot. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 92e642109a..0b091fa40d 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -617,7 +617,7 @@ The people who lend their computers or AI helpers to your projects, and how far **What it tells you.** A contributor is a person who signed up to help. Some connect their own AI worker. This section lists them and their trust level. -**How the numbers are worked out.** The summary shows active contributors and all registered contributors. Active means seen recently. +**How the numbers are worked out.** The sidebar pill and the section header read **online/total**, for example `3/12`: how many registered contributors are online right now over how many have registered. *Online* means the contributor's relay sent a heartbeat within the presence window — `governor.labels.stage.presence_window`, 15 minutes by default. It is the same test the tracker uses when it says *waiting on @name (offline 13m)*, so the two never disagree. Hover the pill for *N online · M registered (heartbeat within 15m)*. The list puts online contributors first; each card's dot is green when online and grey when offline. **What it is good for.** Use it to give trusted people more access, or remove access. Share the `/contribute` link to invite people. diff --git a/src/pkg/dashboard/api_contribute.go b/src/pkg/dashboard/api_contribute.go index 8d82c11424..21b6db2e17 100644 --- a/src/pkg/dashboard/api_contribute.go +++ b/src/pkg/dashboard/api_contribute.go @@ -83,25 +83,65 @@ var inviteTrustTiers = map[string]bool{"trusted": true, "merger": true, "advisor // the inviter username. An empty string means the token is invalid, tampered, // or expired — the caller must treat that as "no attribution" (a plain // self-registration), never as an error. +// ContributorPoolStatus feeds the sidebar's Contributors "online/total" +// pill and the section header. Online uses the SAME presence predicate the +// stage tracker's "waiting on @x (offline 13m)" reads +// (ContributeWSHub.Presence): a registered contributor whose relay +// heartbeat landed within governor.labels.stage.presence_window (15m by +// default). Active is the older "has a live socket" count kept for callers +// that still read it. type ContributorPoolStatus struct { - Active int `json:"active"` - Registered int `json:"registered"` - ByRole map[string]int `json:"by_role,omitempty"` + Active int `json:"active"` + Online int `json:"online"` + Registered int `json:"registered"` + // PresenceWindow is the window Online was judged against ("15m"). + PresenceWindow string `json:"presence_window"` + ByRole map[string]int `json:"by_role,omitempty"` } func (s *Server) BuildContributorPoolStatus() *ContributorPoolStatus { profiles := listContributorProfiles() - active := 0 + active, online := 0, 0 var byRole map[string]int + window := config.DefaultPresenceWindow if s.contributeHub != nil { active = s.contributeHub.ActiveCount() byRole = s.contributeHub.RoleBreakdown() + window = s.contributeHub.presenceWindow() + online = countOnlineContributors(profiles, s.contributeHub.LastHeartbeats(), window, time.Now()) } return &ContributorPoolStatus{ - Active: active, - Registered: len(profiles), - ByRole: byRole, + Active: active, + Online: online, + Registered: len(profiles), + PresenceWindow: stageTrackerShortDuration(window), + ByRole: byRole, + } +} + +// countOnlineContributors counts the registered profiles whose freshest +// relay heartbeat is within window of now — the tracker's presence +// predicate (liveConnectionsFor) applied across the registry, so the +// sidebar pill and the "(offline 13m)" caption never disagree. A profile +// with no heartbeat, or one exactly older than the window, is offline; +// a heartbeat landing exactly at the window edge still counts, as in +// liveConnectionsFor. +func countOnlineContributors(profiles []ContributorProfile, lastSeen map[string]time.Time, window time.Duration, now time.Time) int { + if len(profiles) == 0 || len(lastSeen) == 0 { + return 0 + } + byUser := make(map[string]time.Time, len(lastSeen)) + for user, t := range lastSeen { + byUser[strings.ToLower(strings.TrimSpace(user))] = t + } + n := 0 + for _, p := range profiles { + t, ok := byUser[strings.ToLower(strings.TrimSpace(p.GitHubUsername))] + if ok && !t.IsZero() && now.Sub(t) <= window { + n++ + } } + return n } func (s *Server) registerContributeRoutes() { diff --git a/src/pkg/dashboard/contribute_admin.go b/src/pkg/dashboard/contribute_admin.go index 50b954d9a0..bbf3f6642a 100644 --- a/src/pkg/dashboard/contribute_admin.go +++ b/src/pkg/dashboard/contribute_admin.go @@ -69,10 +69,16 @@ func (s *Server) paneTailViewer(r *http.Request) bool { func (s *Server) handleContributorsList(w http.ResponseWriter, r *http.Request) { profiles := listContributorProfiles() var liveStates map[string]ContributorLiveState + var heartbeats map[string]time.Time + window := config.DefaultPresenceWindow if s.contributeHub != nil { liveStates = s.contributeHub.LiveStates() + heartbeats = s.contributeHub.LastHeartbeats() + window = s.contributeHub.presenceWindow() } + now := time.Now() for i := range profiles { + profiles[i].Online = countOnlineContributors(profiles[i:i+1], heartbeats, window, now) == 1 policy := s.contributorTokenPolicy() if err := policy.migrate(&profiles[i], time.Now().UTC()); err != nil { jsonError(w, "Token migration failed; retry", http.StatusConflict) diff --git a/src/pkg/dashboard/contribute_fleet.go b/src/pkg/dashboard/contribute_fleet.go index b80cdb5459..838d34f2f0 100644 --- a/src/pkg/dashboard/contribute_fleet.go +++ b/src/pkg/dashboard/contribute_fleet.go @@ -19,6 +19,32 @@ func (h *ContributeWSHub) ActiveCount() int { return len(seen) } +// LastHeartbeats returns, per connected GitHub username (as the profile +// spells it), the freshest pong across that contributor's live sockets. +// It is the registry-wide form of the lookup Presence() does for one +// author, so callers can apply the presence window themselves. +func (h *ContributeWSHub) LastHeartbeats() map[string]time.Time { + h.mu.RLock() + defer h.mu.RUnlock() + out := make(map[string]time.Time) + for _, c := range h.connections { + c.mu.Lock() + user := "" + if c.profile != nil { + user = c.profile.GitHubUsername + } + pong := c.lastPong + c.mu.Unlock() + if user == "" { + continue + } + if pong.After(out[user]) { + out[user] = pong + } + } + return out +} + // relayConnectedSince reports whether a relay finished authenticating at or // after since. Only the timestamp counts: a relay that connected before the // window and merely stayed up wrote no relay_* row in it, so counting it diff --git a/src/pkg/dashboard/contribute_profiles.go b/src/pkg/dashboard/contribute_profiles.go index 9da54675fb..9e14b53105 100644 --- a/src/pkg/dashboard/contribute_profiles.go +++ b/src/pkg/dashboard/contribute_profiles.go @@ -230,9 +230,13 @@ type ContributorProfile struct { Collaborators []CollaboratorRecord `json:"collaborators,omitempty"` OperatorMessages []ContributorOperatorMessage `json:"operator_messages,omitempty"` Active bool `json:"active,omitempty"` - CurrentTask *WSTaskAssign `json:"current_task,omitempty"` - ActiveTasks []WSTaskAssign `json:"active_tasks,omitempty"` - Sessions int `json:"sessions,omitempty"` + // Online is the tracker's presence verdict (heartbeat within + // governor.labels.stage.presence_window); filled on the list response + // only, never persisted. + Online bool `json:"online,omitempty"` + CurrentTask *WSTaskAssign `json:"current_task,omitempty"` + ActiveTasks []WSTaskAssign `json:"active_tasks,omitempty"` + Sessions int `json:"sessions,omitempty"` // Version is the profile's optimistic-concurrency token (hivecommons/hive H2, // CWE-613/639). It is bumped on every persisted change. A caller that loaded the // profile at version N may only persist its edit if the on-disk version is still diff --git a/src/pkg/dashboard/contributor_pool_online_test.go b/src/pkg/dashboard/contributor_pool_online_test.go new file mode 100644 index 0000000000..9162bceaf5 --- /dev/null +++ b/src/pkg/dashboard/contributor_pool_online_test.go @@ -0,0 +1,76 @@ +package dashboard + +import ( + "testing" + "time" +) + +// TestCountOnlineContributors pins the sidebar's "online/total" numerator +// to the tracker's presence predicate: a heartbeat within the presence +// window (inclusive edge) counts, anything older, missing or for an +// unregistered account does not. +func TestCountOnlineContributors(t *testing.T) { + now := time.Date(2026, 10, 29, 12, 0, 0, 0, time.UTC) + window := 15 * time.Minute + profiles := []ContributorProfile{ + {ContributorID: "a", GitHubUsername: "Karibhou"}, + {ContributorID: "b", GitHubUsername: "hanthor"}, + {ContributorID: "c", GitHubUsername: "quiet"}, + } + cases := []struct { + name string + profiles []ContributorProfile + seen map[string]time.Time + want int + }{ + {name: "zero contributors", seen: map[string]time.Time{"Karibhou": now}, want: 0}, + {name: "no heartbeats", profiles: profiles, want: 0}, + {name: "all offline", profiles: profiles, seen: map[string]time.Time{ + "Karibhou": now.Add(-window - time.Second), + "hanthor": now.Add(-2 * time.Hour), + }, want: 0}, + {name: "edge of window is online", profiles: profiles, seen: map[string]time.Time{ + "Karibhou": now.Add(-window), + }, want: 1}, + {name: "case-insensitive login match", profiles: profiles, seen: map[string]time.Time{ + "karibhou": now.Add(-time.Minute), + }, want: 1}, + {name: "mixed", profiles: profiles, seen: map[string]time.Time{ + "Karibhou": now.Add(-time.Minute), + "hanthor": now.Add(-13 * time.Minute), + "quiet": now.Add(-16 * time.Minute), + "stranger": now, + }, want: 2}, + {name: "zero heartbeat is offline", profiles: profiles, seen: map[string]time.Time{"Karibhou": {}}, want: 0}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + if got := countOnlineContributors(tc.profiles, tc.seen, window, now); got != tc.want { + t.Fatalf("countOnlineContributors = %d, want %d", got, tc.want) + } + }) + } +} + +// TestBuildContributorPoolStatusOnline runs the aggregation through the +// live hub: a registered contributor whose socket's last pong is within +// the window is online; a stale socket is active-but-offline. +func TestBuildContributorPoolStatusOnline(t *testing.T) { + t.Setenv("HIVE_CONTRIBUTORS_DIR", t.TempDir()) + for _, u := range []string{"fresh", "stale", "never"} { + if err := saveContributorProfile(&ContributorProfile{ContributorID: "id-" + u, GitHubUsername: u, TrustTier: contributorTierContributor}); err != nil { + t.Fatal(err) + } + } + hub := &ContributeWSHub{connections: map[string]*ContributorConnection{}} + hub.connections["c1"] = &ContributorConnection{connID: "c1", profile: &ContributorProfile{ContributorID: "id-fresh", GitHubUsername: "fresh"}, lastPong: time.Now().Add(-time.Minute)} + hub.connections["c2"] = &ContributorConnection{connID: "c2", profile: &ContributorProfile{ContributorID: "id-stale", GitHubUsername: "stale"}, lastPong: time.Now().Add(-time.Hour)} + s := &Server{contributeHub: hub} + got := s.BuildContributorPoolStatus() + if got.Online != 1 || got.Registered != 3 || got.Active != 2 { + t.Fatalf("pool = online %d / active %d / registered %d, want 1 / 2 / 3", got.Online, got.Active, got.Registered) + } + if got.PresenceWindow != "15m" { + t.Fatalf("presence_window = %q, want 15m", got.PresenceWindow) + } +} diff --git a/src/pkg/dashboard/sidebar_pair_badge_test.go b/src/pkg/dashboard/sidebar_pair_badge_test.go index fe2f271e93..a577e7b9b3 100644 --- a/src/pkg/dashboard/sidebar_pair_badge_test.go +++ b/src/pkg/dashboard/sidebar_pair_badge_test.go @@ -23,6 +23,12 @@ func TestSidebarPairBadgeWiring(t *testing.T) { `const pill = overviewSidebarPill(openIssues, openPRs, equationLabel, staleSince, unlisted);`, `setSidebarPairBadge(document.getElementById('overview-sidebar-badge'), pill.issues, pill.prs, pill.title);`, `if (data && data.actionableNow) setSidebarPairBadge(document.getElementById('governor-sidebar-badge'), issueCount, prCount, 'actionable: ' + issueCount + ' issues / ' + prCount + ' PRs')`, + // Contributors reads online/total off /api/status.contributorPool + // with the tracker's presence window in the tooltip (#15651). + `Contributors`, + `if (sidebarBadge) setSidebarPairBadge(sidebarBadge, onlineCount, totalCount, tip);`, + `function contributorsOnlineTitle(online, total, window)`, + ``, } { if !strings.Contains(html, want) { t.Errorf("index.html missing sidebar x/y pill wiring %q", want) @@ -71,3 +77,28 @@ func TestSidebarPairBadgeCounts(t *testing.T) { t.Fatalf("sidebar pair badge counts = %q, want %q", got, want) } } + +// TestContributorsOnlineBadgeHelpers executes the Contributors pill +// helpers under node: the tooltip names the window the tracker uses and +// the list sorts online contributors first without mutating its input. +func TestContributorsOnlineBadgeHelpers(t *testing.T) { + node, err := exec.LookPath("node") + if err != nil { + t.Skip("node not on PATH — Contributors online/total helpers were NOT executed by this run") + } + html := indexHTML(t) + script := strings.Join([]string{ + jsFunc(t, html, "contributorsOnlineTitle"), + jsFunc(t, html, "contributorsOnlineFirst"), + `const src = [{github_username:'zed'}, {github_username:'amy', online:true}, {github_username:'bob', online:false}, {github_username:'kim', online:true}]; + const sorted = contributorsOnlineFirst(src).map(c => c.github_username).join(','); + process.stdout.write([contributorsOnlineTitle(3, 12, '15m'), contributorsOnlineTitle(undefined, '2'), sorted, src[0].github_username].join('|'));`, + }, "\n") + out, err := exec.Command(node, "-e", script).CombinedOutput() + if err != nil { + t.Fatalf("node: %v\n%s", err, out) + } + if got, want := string(out), "3 online · 12 registered (heartbeat within 15m)|0 online · 2 registered|amy,kim,bob,zed|zed"; got != want { + t.Fatalf("contributors online helpers = %q, want %q", got, want) + } +} diff --git a/src/pkg/dashboard/static-src/css/sparklines-indicators.css b/src/pkg/dashboard/static-src/css/sparklines-indicators.css index a0144de8f7..8c63ac62e1 100644 --- a/src/pkg/dashboard/static-src/css/sparklines-indicators.css +++ b/src/pkg/dashboard/static-src/css/sparklines-indicators.css @@ -19,6 +19,13 @@ .spark-row { display: flex; align-items: center; gap: var(--sp-3); overflow: hidden; } .contributors-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(500px,100%),1fr)); gap:var(--sp-5); } + /* Contributors header pill and card presence dot: "online" is the + tracker's presence window (governor.labels.stage.presence_window). */ + .contrib-status-badge { font-size: 0.7rem; padding: var(--sp-1) var(--sp-4); border-radius: var(--r-pill); margin-left: var(--sp-4); background: var(--line); color: var(--fg); } + .contrib-status-badge:empty { display: none; } + .contrib-status-badge.is-online { background: var(--status-ok); color: var(--bg); } + .contrib-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--status-neutral); } + .contrib-status-dot.online { background: var(--status-ok); } .contrib-card { --contrib-accent: #5aa7ff; --contrib-accent-2: #74df9a; diff --git a/src/pkg/dashboard/static-src/html/nous-inception-knowledge-contributors.html b/src/pkg/dashboard/static-src/html/nous-inception-knowledge-contributors.html index 8d8fc54758..2035629e91 100644 --- a/src/pkg/dashboard/static-src/html/nous-inception-knowledge-contributors.html +++ b/src/pkg/dashboard/static-src/html/nous-inception-knowledge-contributors.html @@ -24,7 +24,7 @@ + Share /contribute link → 🏆 Leaderboard diff --git a/src/pkg/dashboard/static-src/html/sidebar.html b/src/pkg/dashboard/static-src/html/sidebar.html index b5f4da751e..f740488230 100644 --- a/src/pkg/dashboard/static-src/html/sidebar.html +++ b/src/pkg/dashboard/static-src/html/sidebar.html @@ -34,7 +34,7 @@
Intelligence
diff --git a/src/pkg/dashboard/static-src/js/contributors.js b/src/pkg/dashboard/static-src/js/contributors.js index 31d67f6600..3c1f4af243 100644 --- a/src/pkg/dashboard/static-src/js/contributors.js +++ b/src/pkg/dashboard/static-src/js/contributors.js @@ -313,15 +313,15 @@ // Split into active (non-revoked) and revoked lists const showingRevokedFilter = _contributorFilters.has('revoked'); - const nonRevoked = filtered.filter(c => c.trust_tier !== 'revoked'); + const nonRevoked = contributorsOnlineFirst(filtered.filter(c => c.trust_tier !== 'revoked')); const revoked = filtered.filter(c => c.trust_tier === 'revoked'); // --- Card grid: only non-revoked contributors --- let html = ''; if (nonRevoked.length > 0) { const cards = nonRevoked.map(c => { - const dotColor = c.active ? 'var(--green)' : 'var(--muted)'; - const dotTitle = c.active ? 'Online' : 'Offline'; + const dotClass = c.online ? 'online' : 'offline'; + const dotTitle = c.online ? 'Online — heartbeat within the presence window' : 'Offline — no heartbeat within the presence window'; // The face is the profile link. The @username beside it used to be a // second anchor to that same profile; it stays as plain text so there // is one control per destination. @@ -340,7 +340,7 @@ const initialTint = contribTintReadCache(login) || contribTintFallback(login); return `
- + ${avatarHtml} @${esc(c.github_username)} ${trustTierBadge(c.trust_tier)} @@ -494,16 +494,40 @@ const sidebarBadge = document.getElementById('contributors-sidebar-badge'); const statusBadge = document.getElementById('contributors-status-badge'); if (!pool) return; - const activeCount = pool.active || 0; - const totalCount = pool.registered || 0; - if (sidebarBadge) setSidebarCountBadge(sidebarBadge, totalCount, `${activeCount} active of ${totalCount} registered`); + const onlineCount = Number(pool.online) || 0; + const totalCount = Number(pool.registered) || 0; + const tip = contributorsOnlineTitle(onlineCount, totalCount, pool.presence_window); + // Same two-part pill as Governor / Overview: "online/total". + if (sidebarBadge) setSidebarPairBadge(sidebarBadge, onlineCount, totalCount, tip); setSectionSummary('contributors-section', contributorsSectionSummary(_cachedContributors || [], pool)); if (statusBadge) { - statusBadge.textContent = `${activeCount} active / ${totalCount} registered`; - statusBadge.style.background = activeCount > 0 ? 'var(--green)' : 'var(--line)'; - statusBadge.style.color = '#fff'; + statusBadge.textContent = `${onlineCount} online / ${totalCount} registered`; + statusBadge.title = tip; + statusBadge.classList.toggle('is-online', onlineCount > 0); } } + // contributorsOnlineTitle is the pill tooltip: "3 online · 12 registered + // (heartbeat within 15m)". The window is the hub's presence_window, the + // same one the tracker's "(offline 13m)" caption is judged against. + function contributorsOnlineTitle(online, total, window) { + const o = Number(online) || 0; + const t = Number(total) || 0; + const w = window ? ` (heartbeat within ${window})` : ''; + return `${o} online · ${t} registered${w}`; + } + + // contributorsOnlineFirst orders a contributor list online first, then by + // login, so the people who can take work now sit at the top. Pure; does + // not mutate its input. + function contributorsOnlineFirst(list) { + return (Array.isArray(list) ? list.slice() : []).sort((a, b) => { + const ao = a && a.online ? 1 : 0; + const bo = b && b.online ? 1 : 0; + if (ao !== bo) return bo - ao; + return String((a && a.github_username) || '').localeCompare(String((b && b.github_username) || '')); + }); + } + // fetchContributors() + fetchLeaderboard() — deferred to _deferredInit diff --git a/src/pkg/dashboard/static-src/js/sections.js b/src/pkg/dashboard/static-src/js/sections.js index 4534db06a6..766a990101 100644 --- a/src/pkg/dashboard/static-src/js/sections.js +++ b/src/pkg/dashboard/static-src/js/sections.js @@ -96,7 +96,7 @@ 'nous-section': { title: '🧪 Experiment Lab (nous)', summary: '—', settingsHtml: sectionSettingsGear('Experiment Lab', 'openNousConfig', 'Experiment Lab Configuration') }, 'inception-section': { title: '💡 Inception (spektacular)', summary: 'ready', badgeHtml: '⚡ Powered by Spektacular' }, 'knowledge-section': { title: '📚 Knowledge', summary: '0 facts' }, - 'contributors-section': { title: '👥 Contributors', summary: '0 active / 0 registered' }, + 'contributors-section': { title: '👥 Contributors', summary: '0 online / 0 registered' }, 'debug-section': { title: '🩺 Diagnostics', summary: 'health' }, 'logs-section': { title: '📋 Agent Logs', summary: 'logs' }, 'agents-section': { title: '🤖 Agents', summary: '0 running / 0 total' }, @@ -1266,12 +1266,12 @@ next kick: ${agentCollapsedTimestampDetail(nextMs, a && (a.nextKickAt || a.nextK } function contributorsSectionSummary(contributors, pool) { contributors = Array.isArray(contributors) ? contributors : []; - const active = contributors.filter(c => c && c.active).length || Number(pool && pool.active) || 0; + const online = pool && pool.online != null ? (Number(pool.online) || 0) : contributors.filter(c => c && c.online).length; const total = contributors.length || Number(pool && pool.registered) || 0; const ranked = contributors.slice().sort((a, b) => (Number(b.total_tasks_completed || b.tasks_completed) || 0) - (Number(a.total_tasks_completed || a.tasks_completed) || 0)); const top = ranked[0] && (ranked[0].github_username || ranked[0].login); - if (top) return `${total} contributors · ${active} active · top: @${top}`; - return total ? `${total} contributors · ${active} active` : '0 contributors'; + if (top) return `${total} contributors · ${online} online · top: @${top}`; + return total ? `${total} contributors · ${online} online` : '0 contributors'; } function inceptionSectionSummary() { const campaigns = Array.isArray(_campaigns) ? _campaigns : []; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index fcf464087f..fda13c4e1e 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -3242,6 +3242,13 @@ .spark-row { display: flex; align-items: center; gap: var(--sp-3); overflow: hidden; } .contributors-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(500px,100%),1fr)); gap:var(--sp-5); } + /* Contributors header pill and card presence dot: "online" is the + tracker's presence window (governor.labels.stage.presence_window). */ + .contrib-status-badge { font-size: 0.7rem; padding: var(--sp-1) var(--sp-4); border-radius: var(--r-pill); margin-left: var(--sp-4); background: var(--line); color: var(--fg); } + .contrib-status-badge:empty { display: none; } + .contrib-status-badge.is-online { background: var(--status-ok); color: var(--bg); } + .contrib-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--status-neutral); } + .contrib-status-dot.online { background: var(--status-ok); } .contrib-card { --contrib-accent: #5aa7ff; --contrib-accent-2: #74df9a; @@ -7124,7 +7131,7 @@

🐝 Getting Started
Resources
📦Projects0 - 👥Contributors0 + 👥Contributors

Intelligence
@@ -7556,7 +7563,7 @@ + Share /contribute link → 🏆 Leaderboard
@@ -8825,7 +8832,7 @@

Where to get help

'nous-section': { title: '🧪 Experiment Lab (nous)', summary: '—', settingsHtml: sectionSettingsGear('Experiment Lab', 'openNousConfig', 'Experiment Lab Configuration') }, 'inception-section': { title: '💡 Inception (spektacular)', summary: 'ready', badgeHtml: '⚡ Powered by Spektacular' }, 'knowledge-section': { title: '📚 Knowledge', summary: '0 facts' }, - 'contributors-section': { title: '👥 Contributors', summary: '0 active / 0 registered' }, + 'contributors-section': { title: '👥 Contributors', summary: '0 online / 0 registered' }, 'debug-section': { title: '🩺 Diagnostics', summary: 'health' }, 'logs-section': { title: '📋 Agent Logs', summary: 'logs' }, 'agents-section': { title: '🤖 Agents', summary: '0 running / 0 total' }, @@ -9995,12 +10002,12 @@

Where to get help

} function contributorsSectionSummary(contributors, pool) { contributors = Array.isArray(contributors) ? contributors : []; - const active = contributors.filter(c => c && c.active).length || Number(pool && pool.active) || 0; + const online = pool && pool.online != null ? (Number(pool.online) || 0) : contributors.filter(c => c && c.online).length; const total = contributors.length || Number(pool && pool.registered) || 0; const ranked = contributors.slice().sort((a, b) => (Number(b.total_tasks_completed || b.tasks_completed) || 0) - (Number(a.total_tasks_completed || a.tasks_completed) || 0)); const top = ranked[0] && (ranked[0].github_username || ranked[0].login); - if (top) return `${total} contributors · ${active} active · top: @${top}`; - return total ? `${total} contributors · ${active} active` : '0 contributors'; + if (top) return `${total} contributors · ${online} online · top: @${top}`; + return total ? `${total} contributors · ${online} online` : '0 contributors'; } function inceptionSectionSummary() { const campaigns = Array.isArray(_campaigns) ? _campaigns : []; @@ -39637,15 +39644,15 @@ // Split into active (non-revoked) and revoked lists const showingRevokedFilter = _contributorFilters.has('revoked'); - const nonRevoked = filtered.filter(c => c.trust_tier !== 'revoked'); + const nonRevoked = contributorsOnlineFirst(filtered.filter(c => c.trust_tier !== 'revoked')); const revoked = filtered.filter(c => c.trust_tier === 'revoked'); // --- Card grid: only non-revoked contributors --- let html = ''; if (nonRevoked.length > 0) { const cards = nonRevoked.map(c => { - const dotColor = c.active ? 'var(--green)' : 'var(--muted)'; - const dotTitle = c.active ? 'Online' : 'Offline'; + const dotClass = c.online ? 'online' : 'offline'; + const dotTitle = c.online ? 'Online — heartbeat within the presence window' : 'Offline — no heartbeat within the presence window'; // The face is the profile link. The @username beside it used to be a // second anchor to that same profile; it stays as plain text so there // is one control per destination. @@ -39664,7 +39671,7 @@ const initialTint = contribTintReadCache(login) || contribTintFallback(login); return `
- + ${avatarHtml} @${esc(c.github_username)} ${trustTierBadge(c.trust_tier)} @@ -39818,17 +39825,41 @@ const sidebarBadge = document.getElementById('contributors-sidebar-badge'); const statusBadge = document.getElementById('contributors-status-badge'); if (!pool) return; - const activeCount = pool.active || 0; - const totalCount = pool.registered || 0; - if (sidebarBadge) setSidebarCountBadge(sidebarBadge, totalCount, `${activeCount} active of ${totalCount} registered`); + const onlineCount = Number(pool.online) || 0; + const totalCount = Number(pool.registered) || 0; + const tip = contributorsOnlineTitle(onlineCount, totalCount, pool.presence_window); + // Same two-part pill as Governor / Overview: "online/total". + if (sidebarBadge) setSidebarPairBadge(sidebarBadge, onlineCount, totalCount, tip); setSectionSummary('contributors-section', contributorsSectionSummary(_cachedContributors || [], pool)); if (statusBadge) { - statusBadge.textContent = `${activeCount} active / ${totalCount} registered`; - statusBadge.style.background = activeCount > 0 ? 'var(--green)' : 'var(--line)'; - statusBadge.style.color = '#fff'; + statusBadge.textContent = `${onlineCount} online / ${totalCount} registered`; + statusBadge.title = tip; + statusBadge.classList.toggle('is-online', onlineCount > 0); } } + // contributorsOnlineTitle is the pill tooltip: "3 online · 12 registered + // (heartbeat within 15m)". The window is the hub's presence_window, the + // same one the tracker's "(offline 13m)" caption is judged against. + function contributorsOnlineTitle(online, total, window) { + const o = Number(online) || 0; + const t = Number(total) || 0; + const w = window ? ` (heartbeat within ${window})` : ''; + return `${o} online · ${t} registered${w}`; + } + + // contributorsOnlineFirst orders a contributor list online first, then by + // login, so the people who can take work now sit at the top. Pure; does + // not mutate its input. + function contributorsOnlineFirst(list) { + return (Array.isArray(list) ? list.slice() : []).sort((a, b) => { + const ao = a && a.online ? 1 : 0; + const bo = b && b.online ? 1 : 0; + if (ao !== bo) return bo - ao; + return String((a && a.github_username) || '').localeCompare(String((b && b.github_username) || '')); + }); + } + // fetchContributors() + fetchLeaderboard() — deferred to _deferredInit // ── System resource gauge history for sparklines ── From c12fe133f77f1179e695d725360a196dce88d01f Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Thu, 29 Oct 2026 23:34:04 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=96=20docs(api-reference):=20refre?= =?UTF-8?q?sh=20api=5Fcontribute.go=20line=20citations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit check-docs-citations.py --fix after ContributorPoolStatus grew online / presence_window (#15651). Signed-off-by: Andrew Anderson --- src/docs/api-reference/contribute.md | 82 ++++++++++++------------ src/docs/api-reference/dashboard-misc.md | 26 ++++---- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/docs/api-reference/contribute.md b/src/docs/api-reference/contribute.md index c9cf281e51..d663fe449f 100644 --- a/src/docs/api-reference/contribute.md +++ b/src/docs/api-reference/contribute.md @@ -5,50 +5,50 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/contribute` | Public | Contribute Landing | `pkg/dashboard/api_contribute.go:125` | -| `GET` | `/contribute/{tab}` | Public | Contribute Landing | `pkg/dashboard/api_contribute.go:131` | -| `GET` | `/api/contribute/ws` | Public | s.contribute Hub.Handle WS | `pkg/dashboard/api_contribute.go:139` | -| `POST` | `/api/contribute/register` | Public | Contribute Register | `pkg/dashboard/api_contribute.go:140` | -| `POST` | `/api/contribute/invite` | Public | Contribute Invite | `pkg/dashboard/api_contribute.go:146` | -| `POST` | `/api/contribute/reissue-token` | Public | Contribute Reissue Token | `pkg/dashboard/api_contribute.go:147` | -| `GET` | `/api/contribute/status` | Public | Contribute Status | `pkg/dashboard/api_contribute.go:149` | -| `GET` | `/api/contribute/repositories` | Public | Contribution-eligible repositories for a contributor `repo_scope`: `{repositories:[{id,forge,host,full_name}],generated_at}`, the monitored repos minus `hub.disabled_repos`; `id` is `{forge}/{host}/{owner}/{name}` lower-cased ([#12805](https://github.com/hivecommons/hive/issues/12805)) | `pkg/dashboard/api_contribute.go:152` | -| `GET` | `/api/contribute/activity` | Public | Contribute Activity | `pkg/dashboard/api_contribute.go:156` | -| `GET` | `/api/contribute/fleet` | Public | Contribute Fleet | `pkg/dashboard/api_contribute.go:157` | -| `GET` | `/api/contribute/events` | Public | Contribute Events (SSE). Every frame carries a monotonic `seq`; a connection whose channel filled gets a `gap` frame naming how many events it missed, so a long-lived client can tell "nothing happened" from "I missed events" ([#6218](https://github.com/hivecommons/hive/issues/6218)) | `pkg/dashboard/api_contribute.go:161` | -| `GET` | `/api/contribute/queue` | Public | Contribute Queue | `pkg/dashboard/api_contribute.go:164` | -| `GET` | `/api/contribute/opportunistic` | Public | Contribute Opportunistic | `pkg/dashboard/api_contribute.go:168` | -| `GET` | `/api/contribute/limits` | Public | Contribute Limits | `pkg/dashboard/api_contribute.go:173` | -| `GET` | `/api/contribute/metrics` | Public | Contribute Metrics | `pkg/dashboard/api_contribute.go:179` | -| `GET` | `/api/contribute/me` | Public path; caller identity resolved server-side (401 anonymous; a signed-in caller with no profile on this hive gets 200 with `has_profile:false` and no counters, [#12111](https://github.com/hivecommons/hive/issues/12111)) | The caller's OWN contribution stats — issues worked (24h and all-time), completions that produced a verified PR (24h and all-time, [#7894](https://github.com/hivecommons/hive/issues/7894)), and failures. No username parameter, so it only ever answers for its caller ([#6543](https://github.com/hivecommons/hive/issues/6543)) | `pkg/dashboard/api_contribute.go:189` | +| `GET` | `/contribute` | Public | Contribute Landing | `pkg/dashboard/api_contribute.go:165` | +| `GET` | `/contribute/{tab}` | Public | Contribute Landing | `pkg/dashboard/api_contribute.go:171` | +| `GET` | `/api/contribute/ws` | Public | s.contribute Hub.Handle WS | `pkg/dashboard/api_contribute.go:179` | +| `POST` | `/api/contribute/register` | Public | Contribute Register | `pkg/dashboard/api_contribute.go:180` | +| `POST` | `/api/contribute/invite` | Public | Contribute Invite | `pkg/dashboard/api_contribute.go:186` | +| `POST` | `/api/contribute/reissue-token` | Public | Contribute Reissue Token | `pkg/dashboard/api_contribute.go:187` | +| `GET` | `/api/contribute/status` | Public | Contribute Status | `pkg/dashboard/api_contribute.go:189` | +| `GET` | `/api/contribute/repositories` | Public | Contribution-eligible repositories for a contributor `repo_scope`: `{repositories:[{id,forge,host,full_name}],generated_at}`, the monitored repos minus `hub.disabled_repos`; `id` is `{forge}/{host}/{owner}/{name}` lower-cased ([#12805](https://github.com/hivecommons/hive/issues/12805)) | `pkg/dashboard/api_contribute.go:192` | +| `GET` | `/api/contribute/activity` | Public | Contribute Activity | `pkg/dashboard/api_contribute.go:196` | +| `GET` | `/api/contribute/fleet` | Public | Contribute Fleet | `pkg/dashboard/api_contribute.go:197` | +| `GET` | `/api/contribute/events` | Public | Contribute Events (SSE). Every frame carries a monotonic `seq`; a connection whose channel filled gets a `gap` frame naming how many events it missed, so a long-lived client can tell "nothing happened" from "I missed events" ([#6218](https://github.com/hivecommons/hive/issues/6218)) | `pkg/dashboard/api_contribute.go:201` | +| `GET` | `/api/contribute/queue` | Public | Contribute Queue | `pkg/dashboard/api_contribute.go:204` | +| `GET` | `/api/contribute/opportunistic` | Public | Contribute Opportunistic | `pkg/dashboard/api_contribute.go:208` | +| `GET` | `/api/contribute/limits` | Public | Contribute Limits | `pkg/dashboard/api_contribute.go:213` | +| `GET` | `/api/contribute/metrics` | Public | Contribute Metrics | `pkg/dashboard/api_contribute.go:219` | +| `GET` | `/api/contribute/me` | Public path; caller identity resolved server-side (401 anonymous; a signed-in caller with no profile on this hive gets 200 with `has_profile:false` and no counters, [#12111](https://github.com/hivecommons/hive/issues/12111)) | The caller's OWN contribution stats — issues worked (24h and all-time), completions that produced a verified PR (24h and all-time, [#7894](https://github.com/hivecommons/hive/issues/7894)), and failures. No username parameter, so it only ever answers for its caller ([#6543](https://github.com/hivecommons/hive/issues/6543)) | `pkg/dashboard/api_contribute.go:229` | | `GET` | `/api/contribute/run-stats/models` | Public | Per-model run evidence for the contributor wall: runs, verified-PR share, and failure rate over the selected window. | `pkg/dashboard/api_contribute.go` | | `GET` | `/api/contribute/wall` | Public | Contributor wall posts when the hive-wide wall switch is enabled; anonymous readers see visible posts, authors can still see their own hidden posts. | `pkg/dashboard/api_contribute.go` | | `POST` | `/api/contribute/wall` | Signed-in contributor | Create a 500-character plain-text wall post or one-level reply, with optional `model`, `backend`, and `repo` tags. Returns 401 anonymous, 403 when disabled/revoked/muted, and 429 when rate-limited. | `pkg/dashboard/api_contribute.go` | | `DELETE` | `/api/contribute/wall/{id}` | Post author | Author deletes their own wall post; action is audit logged. | `pkg/dashboard/api_contribute.go` | | `POST` | `/api/contribute/wall/{id}/hide` | Owner/read-write | Hide a wall post from public readers while leaving it visible to the author; action is audit logged and pushed over `/api/contribute/events`. | `pkg/dashboard/api_contribute.go` | | `POST` | `/api/contribute/wall/{id}/flag` | Signed-in contributor | Flag a wall post for Management review; action is audit logged. | `pkg/dashboard/api_contribute.go` | -| `GET` | `/api/contribute/triage` | Public | Contribute Triage | `pkg/dashboard/api_contribute.go:210` | -| `PUT` | `/api/contribute/queue/order` | Public | Contribute Queue Order | `pkg/dashboard/api_contribute.go:214` | -| `POST` | `/api/contribute/queue/hold` | Public | Contribute Queue Hold | `pkg/dashboard/api_contribute.go:219` | -| `POST` | `/api/contribute/queue/hold/clear` | Public | Contribute Queue Hold Clear | `pkg/dashboard/api_contribute.go:223` | -| `GET` | `/api/contribute/interests` | Public | Contribute Interests | `pkg/dashboard/api_contribute.go:229` | -| `PUT` | `/api/contribute/interests` | Public | Contribute Interests | `pkg/dashboard/api_contribute.go:230` | -| `GET` | `/api/contributors` | Dashboard auth/session | Contributors List | `pkg/dashboard/api_contribute.go:238` | -| `GET` | `/api/contributors/{id}` | Dashboard auth/session | Contributor Get | `pkg/dashboard/api_contribute.go:239` | +| `GET` | `/api/contribute/triage` | Public | Contribute Triage | `pkg/dashboard/api_contribute.go:250` | +| `PUT` | `/api/contribute/queue/order` | Public | Contribute Queue Order | `pkg/dashboard/api_contribute.go:254` | +| `POST` | `/api/contribute/queue/hold` | Public | Contribute Queue Hold | `pkg/dashboard/api_contribute.go:259` | +| `POST` | `/api/contribute/queue/hold/clear` | Public | Contribute Queue Hold Clear | `pkg/dashboard/api_contribute.go:263` | +| `GET` | `/api/contribute/interests` | Public | Contribute Interests | `pkg/dashboard/api_contribute.go:269` | +| `PUT` | `/api/contribute/interests` | Public | Contribute Interests | `pkg/dashboard/api_contribute.go:270` | +| `GET` | `/api/contributors` | Dashboard auth/session | Contributors List | `pkg/dashboard/api_contribute.go:278` | +| `GET` | `/api/contributors/{id}` | Dashboard auth/session | Contributor Get | `pkg/dashboard/api_contribute.go:279` | | `POST` | `/api/contributors/{id}/wall-mute` | Owner only | Mute or unmute a contributor from posting to the contributor wall; action is audit logged. | `pkg/dashboard/api_contribute.go` | -| `PUT` | `/api/contributors/{id}/trust` | Owner only | Contributor Trust | `pkg/dashboard/api_contribute.go:241` | -| `PUT` | `/api/contributors/{id}/agent-role` | Owner only | Contributor Agent Role | `pkg/dashboard/api_contribute.go:242` | -| `PUT` | `/api/contributors/{id}/agent-role-grants` | Owner only | Contributor Agent Role Grants | `pkg/dashboard/api_contribute.go:243` | -| `POST` | `/api/contributors/{id}/revoke` | Owner only | Contributor Revoke | `pkg/dashboard/api_contribute.go:244` | -| `POST` | `/api/contributors/{id}/requeue` | Dashboard auth/session | Contributor Requeue | `pkg/dashboard/api_contribute.go:245` | -| `DELETE` | `/api/contributors/{id}` | Owner only | Contributor Delete | `pkg/dashboard/api_contribute.go:246` | -| `GET` | `/contribute/dossier/{username}` | Public | Contributor Dossier Page (HTML) | `pkg/dashboard/api_contribute.go:138` | -| `GET` | `/api/contribute/run-stats` | Public | Contribute Run Stats | `pkg/dashboard/api_contribute.go:197` | -| `GET` | `/api/contribute/runs` | Public | Contribute Per-Run History | `pkg/dashboard/api_contribute.go:287` | -| `GET` | `/api/contribute/decisions` | Owner/read-write | Contribute Hub Decisions | `pkg/dashboard/api_contribute.go:297` | -| `GET` | `/api/contribute/dossier` | Public | Contribute Dossier Get | `pkg/dashboard/api_contribute.go:234` | -| `POST` | `/api/contribute/dossier` | Public | Contribute Dossier Update | `pkg/dashboard/api_contribute.go:235` | -| `GET` | `/api/leaderboard/contributor/{username}/heraldry` | Public | Contributor Heraldry | `pkg/dashboard/api_contribute.go:267` | +| `PUT` | `/api/contributors/{id}/trust` | Owner only | Contributor Trust | `pkg/dashboard/api_contribute.go:281` | +| `PUT` | `/api/contributors/{id}/agent-role` | Owner only | Contributor Agent Role | `pkg/dashboard/api_contribute.go:282` | +| `PUT` | `/api/contributors/{id}/agent-role-grants` | Owner only | Contributor Agent Role Grants | `pkg/dashboard/api_contribute.go:283` | +| `POST` | `/api/contributors/{id}/revoke` | Owner only | Contributor Revoke | `pkg/dashboard/api_contribute.go:284` | +| `POST` | `/api/contributors/{id}/requeue` | Dashboard auth/session | Contributor Requeue | `pkg/dashboard/api_contribute.go:285` | +| `DELETE` | `/api/contributors/{id}` | Owner only | Contributor Delete | `pkg/dashboard/api_contribute.go:286` | +| `GET` | `/contribute/dossier/{username}` | Public | Contributor Dossier Page (HTML) | `pkg/dashboard/api_contribute.go:178` | +| `GET` | `/api/contribute/run-stats` | Public | Contribute Run Stats | `pkg/dashboard/api_contribute.go:237` | +| `GET` | `/api/contribute/runs` | Public | Contribute Per-Run History | `pkg/dashboard/api_contribute.go:327` | +| `GET` | `/api/contribute/decisions` | Owner/read-write | Contribute Hub Decisions | `pkg/dashboard/api_contribute.go:337` | +| `GET` | `/api/contribute/dossier` | Public | Contribute Dossier Get | `pkg/dashboard/api_contribute.go:274` | +| `POST` | `/api/contribute/dossier` | Public | Contribute Dossier Update | `pkg/dashboard/api_contribute.go:275` | +| `GET` | `/api/leaderboard/contributor/{username}/heraldry` | Public | Contributor Heraldry | `pkg/dashboard/api_contribute.go:307` | | `GET` | `/api/cards/player/{asset}` | Public | OpenAPI alias for a cacheable contributor social-card SVG (`asset` is `.svg`). | `pkg/dashboard/social_cards.go:112` | | `GET` | `/api/cards/achievement/{login}/{asset}` | Public | OpenAPI alias for a cacheable attained-achievement SVG (`asset` is `.svg`). | `pkg/dashboard/social_cards.go:113` | | `GET` | `/api/cards/leaderboard/{asset}` | Public | OpenAPI alias for a cacheable leaderboard-summary SVG (`contributors.svg`, `teams.svg`, or `swarm.svg`). | `pkg/dashboard/social_cards.go:114` | @@ -58,10 +58,10 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `GET` | `/share/player/{login}` | Public | Share landing page with Open Graph/Twitter metadata for a contributor card and link to the public dossier. | `pkg/dashboard/social_cards.go:115` | | `GET` | `/share/achievement/{login}/{achievementID}` | Public | Share landing page with metadata for an unlocked achievement card and link to the public dossier. | `pkg/dashboard/social_cards.go:116` | | `GET` | `/share/leaderboard/{board}` | Public | Share landing page with metadata for a public leaderboard card and link to live standings. | `pkg/dashboard/social_cards.go:117` | -| `PUT` | `/api/contribute/help-links` | Owner/read-write | Contribute Help Links | `pkg/dashboard/api_contribute.go:155` | -| `GET` | `/api/contribute/operators/message` | Public path; caller identity resolved server-side (401 anonymous, 403 without a profile) | Returns only the signed-in contributor's unacknowledged operator messages; no username/body field can select another recipient ([#8461](https://github.com/hivecommons/hive/issues/8461)). | `pkg/dashboard/api_contribute.go:190` | -| `POST` | `/api/contribute/operators/message` | Owner/read-write | Sends a sanitized, length-capped one-to-one operator note to a contributor profile, persists it until acknowledgement, and pushes it to matching live relay sockets only ([#8461](https://github.com/hivecommons/hive/issues/8461)). | `pkg/dashboard/api_contribute.go:191` | -| `POST` | `/api/contribute/operators/message/ack` | Public path; caller identity resolved server-side | Acknowledges the signed-in contributor's own message, optionally recording a short sanitized reply for operators. | `pkg/dashboard/api_contribute.go:192` | +| `PUT` | `/api/contribute/help-links` | Owner/read-write | Contribute Help Links | `pkg/dashboard/api_contribute.go:195` | +| `GET` | `/api/contribute/operators/message` | Public path; caller identity resolved server-side (401 anonymous, 403 without a profile) | Returns only the signed-in contributor's unacknowledged operator messages; no username/body field can select another recipient ([#8461](https://github.com/hivecommons/hive/issues/8461)). | `pkg/dashboard/api_contribute.go:230` | +| `POST` | `/api/contribute/operators/message` | Owner/read-write | Sends a sanitized, length-capped one-to-one operator note to a contributor profile, persists it until acknowledgement, and pushes it to matching live relay sockets only ([#8461](https://github.com/hivecommons/hive/issues/8461)). | `pkg/dashboard/api_contribute.go:231` | +| `POST` | `/api/contribute/operators/message/ack` | Public path; caller identity resolved server-side | Acknowledges the signed-in contributor's own message, optionally recording a short sanitized reply for operators. | `pkg/dashboard/api_contribute.go:232` | ### Issue claims (hivecommons/hive#8380) diff --git a/src/docs/api-reference/dashboard-misc.md b/src/docs/api-reference/dashboard-misc.md index 81fecb9e29..9ed968f728 100644 --- a/src/docs/api-reference/dashboard-misc.md +++ b/src/docs/api-reference/dashboard-misc.md @@ -46,21 +46,21 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `PUT` | `/api/hive-id` | Owner only | Hive IDSet | `pkg/dashboard/api.go:426` | | `POST` | `/api/chat` | Dashboard auth/session | Chat | `pkg/dashboard/api.go:455` | | `GET` | `/api/auth/token` | Public | Auth Token | `pkg/dashboard/api.go:489` | -| `GET` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:248` | -| `POST` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:249` | -| `GET` | `/api/docs` | Dashboard auth/session | APIDocs | `pkg/dashboard/api_contribute.go:250` | -| `GET` | `/leaderboard` | Public | Leaderboard Page | `pkg/dashboard/api_contribute.go:252` | -| `GET` | `/api/leaderboard` | Public | Leaderboard API | `pkg/dashboard/api_contribute.go:253` | -| `GET` | `/api/leaderboard/teams` | Public | Team Leaderboards | `pkg/dashboard/api_contribute.go:254` | -| `GET` | `/api/leaderboard/style` | Public | Leaderboard Style | `pkg/dashboard/api_contribute.go:255` | +| `GET` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:288` | +| `POST` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:289` | +| `GET` | `/api/docs` | Dashboard auth/session | APIDocs | `pkg/dashboard/api_contribute.go:290` | +| `GET` | `/leaderboard` | Public | Leaderboard Page | `pkg/dashboard/api_contribute.go:292` | +| `GET` | `/api/leaderboard` | Public | Leaderboard API | `pkg/dashboard/api_contribute.go:293` | +| `GET` | `/api/leaderboard/teams` | Public | Team Leaderboards | `pkg/dashboard/api_contribute.go:294` | +| `GET` | `/api/leaderboard/style` | Public | Leaderboard Style | `pkg/dashboard/api_contribute.go:295` | | `GET` | `/api/leaderboard/battle-log` | Public | Scrubbed public Battle Log activity feed for leaderboard widgets. | `pkg/dashboard/battle_log.go:108` | | `GET` | `/api/leaderboard/hive-of-week` | Public | Featured weekly project metadata, configured render URLs (empty when none), gource source URL, and embed snippets. | `pkg/dashboard/battle_log.go:109` | | `GET` | `/api/leaderboard/gource-log` | Public | Gource custom log source for a project/week, derived from public hive event data. | `pkg/dashboard/battle_log.go:110` | | `POST` | `/api/leaderboard/hive-of-week/archive` | Owner only | Archive the selected project's weekly gource source log into knowledge; stores source only, never rendered video. | `pkg/dashboard/battle_log.go:111` | -| `GET` | `/api/leaderboard/contributor/{username}` | Public | Contributor Profile | `pkg/dashboard/api_contribute.go:262` | -| `GET` | `/api/hives` | Dashboard auth/session | Hives List | `pkg/dashboard/api_contribute.go:273` | -| `POST` | `/api/hives/register` | Dashboard auth/session | Hives Register | `pkg/dashboard/api_contribute.go:274` | -| `POST` | `/api/hives/{id}/heartbeat` | Dashboard auth/session | Hives Heartbeat | `pkg/dashboard/api_contribute.go:275` | -| `DELETE` | `/api/hives/{id}` | Owner only | Hives Delete | `pkg/dashboard/api_contribute.go:276` | -| `POST` | `/api/hives/onboard` | Dashboard auth/session | Hives Onboard | `pkg/dashboard/api_contribute.go:277` | +| `GET` | `/api/leaderboard/contributor/{username}` | Public | Contributor Profile | `pkg/dashboard/api_contribute.go:302` | +| `GET` | `/api/hives` | Dashboard auth/session | Hives List | `pkg/dashboard/api_contribute.go:313` | +| `POST` | `/api/hives/register` | Dashboard auth/session | Hives Register | `pkg/dashboard/api_contribute.go:314` | +| `POST` | `/api/hives/{id}/heartbeat` | Dashboard auth/session | Hives Heartbeat | `pkg/dashboard/api_contribute.go:315` | +| `DELETE` | `/api/hives/{id}` | Owner only | Hives Delete | `pkg/dashboard/api_contribute.go:316` | +| `POST` | `/api/hives/onboard` | Dashboard auth/session | Hives Onboard | `pkg/dashboard/api_contribute.go:317` | | `GET` | `/sso` | Public | SSO | `pkg/dashboard/server.go:1633` |