Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-16042-matrix-header-tab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add a Matrix tab to the Activity Monitor header, shown only when `dashboard.matrix.enabled` is set; the status payload gains an additive `matrixEnabled` boolean (#16042, RFC #15862).
2 changes: 2 additions & 0 deletions src/docs/streaming-the-activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ full-screen Activity Monitor.

## Matrix mode (separate channel)

When `dashboard.matrix.enabled` is set, the Activity Monitor header also shows a **Matrix** tab that opens `?kiosk=1&view=matrix` in the same window.

Matrix is an experimental, default-off code display for a separate channel,
[`twitch.tv/hivecommonsmatrix`](https://www.twitch.tv/hivecommonsmatrix).
It depends on the Matrix display renderer (`/?kiosk=1&view=matrix`,
Expand Down
52 changes: 52 additions & 0 deletions src/pkg/dashboard/matrix_header_tab_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package dashboard

import (
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"

"github.com/hivecommons/hive/pkg/config"
)

func TestDashboardMatrixHeaderTabHiddenByDefault(t *testing.T) {
raw, err := staticFS.ReadFile("static/index.html")
if err != nil {
t.Fatalf("reading embedded static/index.html: %v", err)
}
html := string(raw)
start := strings.Index(html, `id="oc-matrix-tab"`)
if start < 0 {
t.Fatal("static/index.html missing the Matrix header tab")
}
open := html[strings.LastIndex(html[:start], "<a "):]
open = open[:strings.Index(open, ">")]
for _, want := range []string{`href="?kiosk=1&amp;view=matrix"`, ` hidden`, `nav-chip`} {
if !strings.Contains(open, want) {
t.Fatalf("Matrix header tab %q missing %q", open, want)
}
}
if !strings.Contains(html, "data.matrixEnabled") {
t.Fatal("static/index.html never toggles the Matrix tab from the status payload")
}
}

func TestHandleStatus_MatrixEnabledFlag(t *testing.T) {
for _, enabled := range []bool{false, true} {
s := newTestServer()
s.MatrixObserver(config.MatrixConfig{Enabled: enabled, Repos: []string{"org/repo"}})
s.UpdateStatus(minimalPayload())

rec := httptest.NewRecorder()
s.handleStatus(rec, httptest.NewRequest(http.MethodGet, "/api/status", nil))

var raw map[string]any
if err := json.NewDecoder(rec.Body).Decode(&raw); err != nil {
t.Fatalf("decode error: %v", err)
}
if got, ok := raw["matrixEnabled"].(bool); !ok || got != enabled {
t.Errorf("matrixEnabled = %v (present=%v), want %v", raw["matrixEnabled"], ok, enabled)
}
}
}
6 changes: 5 additions & 1 deletion src/pkg/dashboard/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3719,7 +3719,7 @@ func (s *Server) handleStatus(w http.ResponseWriter, r *http.Request) {
return
}
now := time.Now().UTC()
payload := statusWithWebhooks{StatusPayload: s.statusWithOverviewBands(status, now), Webhooks: github.WebhookHealthSnapshot(), CIFailureSignals: github.CIFailureSignals().Snapshot()}
payload := statusWithWebhooks{StatusPayload: s.statusWithOverviewBands(status, now), Webhooks: github.WebhookHealthSnapshot(), CIFailureSignals: github.CIFailureSignals().Snapshot(), MatrixEnabled: s.currentMatrixConfig().Active()}
if s.deps != nil && s.deps.EvalLoop != nil {
loop := s.deps.EvalLoop()
payload.EvalLoopStatus = &loop
Expand All @@ -3740,6 +3740,10 @@ type statusWithWebhooks struct {
// signals, the last one, webhook-triggered kicks and unmatched heads.
CIFailureSignals github.CIFailureSignalsStatus `json:"ci_failure_signals"`
*EvalLoopStatus
// MatrixEnabled reports whether the Matrix block is active (enabled with
// at least one repo, see config.MatrixConfig.Active) so the header shows
// the Matrix tab only on hives whose /api/matrix/lines will serve it.
MatrixEnabled bool `json:"matrixEnabled"`
// UpgradeProgress is the spoke's view of the scheduled-upgrade state
// machine (scheduled / draining / pulling / … / missed) with the drain
// countdown, derived at serve time (#14856). Absent on a hive the hub
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/settings_parity_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ compliance.frameworks[] # TODO #11854
contribute.token_idle_max # TODO #11854
contribute.token_max_age # TODO #11854
convergence.mutation.max_writers_per_target # boundary capacity tuning; yaml-only (#14645)
dashboard.matrix.enabled # experimental default-off Matrix block; nothing reads it yet (#15862)
dashboard.matrix.enabled # experimental default-off Matrix block; gates the header tab via /api/status, no Settings control (#15862, #16042)
dashboard.matrix.exclude_paths[] # experimental default-off Matrix block; nothing reads it yet (#15862)
dashboard.matrix.repos[] # experimental default-off Matrix block; nothing reads it yet (#15862)
debug.pprof_addr # loopback-only pprof bind address, operator/debug knob, not a Settings control (#14681)
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/html/topbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<div class="oc-topbar-right">
<button type="button" class="nav-chip nav-chip--icon nav-chip--action feedback-bug-btn" id="feedback-bug-btn" data-action="openFeedbackModal" data-arg0="submit" title="Report a bug or request a feature" aria-label="Report a bug or request a feature"><span class="nav-chip__icon" aria-hidden="true">🐛</span><span class="feedback-pill" id="feedback-unread-pill" hidden>0</span></button>
<button class="nav-chip nav-chip--icon nav-chip--action layout-toggle" data-action="toggleLayout" title="Switch to Dark Mode" aria-label="Switch to Dark Mode">☾</button>
<a class="nav-chip nav-chip--action" id="oc-matrix-tab" href="?kiosk=1&amp;view=matrix" title="Matrix display — opt-in code rain" aria-label="Matrix display" hidden><span class="nav-chip__label">Matrix</span></a>
<button type="button" class="nav-chip nav-chip--action" id="oc-settings-btn" data-action="openConfigDialog" data-arg0="governor" title="Settings — governor, agents, thresholds, and all hive settings" aria-label="Settings"><span class="nav-chip__icon" aria-hidden="true">⚙</span><span class="nav-chip__label">Settings</span></button>
<span id="dashboard-custom-style-note" class="nav-chip nav-chip--status nav-chip--neutral dashboard-custom-style-note" style="display:none" role="status"></span>
<!-- Agent Logs hidden (redundant with per-agent output) -->
Expand Down
4 changes: 4 additions & 0 deletions src/pkg/dashboard/static-src/js/refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@
if (data.statusSeq < _statusSeqFloor || data.statusSeq < _lastStatusSeq) return;
_lastStatusSeq = data.statusSeq;
}
if (typeof data.matrixEnabled === 'boolean') {
const matrixTab = document.getElementById('oc-matrix-tab');
if (matrixTab) matrixTab.hidden = !data.matrixEnabled;
}
if (document.body.style.opacity === '0') document.body.style.opacity = '1';
const scrollAnchor = captureScrollAnchor();
updateNavbarClockTimeZone(data);
Expand Down
5 changes: 5 additions & 0 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7760,6 +7760,7 @@ <h2 class="config-title">🐝 Getting Started<span id="welcome-progress" class="
<div class="oc-topbar-right">
<button type="button" class="nav-chip nav-chip--icon nav-chip--action feedback-bug-btn" id="feedback-bug-btn" data-action="openFeedbackModal" data-arg0="submit" title="Report a bug or request a feature" aria-label="Report a bug or request a feature"><span class="nav-chip__icon" aria-hidden="true">🐛</span><span class="feedback-pill" id="feedback-unread-pill" hidden>0</span></button>
<button class="nav-chip nav-chip--icon nav-chip--action layout-toggle" data-action="toggleLayout" title="Switch to Dark Mode" aria-label="Switch to Dark Mode">☾</button>
<a class="nav-chip nav-chip--action" id="oc-matrix-tab" href="?kiosk=1&amp;view=matrix" title="Matrix display — opt-in code rain" aria-label="Matrix display" hidden><span class="nav-chip__label">Matrix</span></a>
<button type="button" class="nav-chip nav-chip--action" id="oc-settings-btn" data-action="openConfigDialog" data-arg0="governor" title="Settings — governor, agents, thresholds, and all hive settings" aria-label="Settings"><span class="nav-chip__icon" aria-hidden="true">⚙</span><span class="nav-chip__label">Settings</span></button>
<span id="dashboard-custom-style-note" class="nav-chip nav-chip--status nav-chip--neutral dashboard-custom-style-note" style="display:none" role="status"></span>
<!-- Agent Logs hidden (redundant with per-agent output) -->
Expand Down Expand Up @@ -43863,6 +43864,10 @@ <h3 class="modal-h">How Agents Use Knowledge (Priming)</h3>
if (data.statusSeq < _statusSeqFloor || data.statusSeq < _lastStatusSeq) return;
_lastStatusSeq = data.statusSeq;
}
if (typeof data.matrixEnabled === 'boolean') {
const matrixTab = document.getElementById('oc-matrix-tab');
if (matrixTab) matrixTab.hidden = !data.matrixEnabled;
}
if (document.body.style.opacity === '0') document.body.style.opacity = '1';
const scrollAnchor = captureScrollAnchor();
updateNavbarClockTimeZone(data);
Expand Down
Loading