From 8006dd2809e026c3554ec8a4e1487e015d5eb232 Mon Sep 17 00:00:00 2001 From: atlas Date: Mon, 8 Jun 2026 22:55:31 +0200 Subject: [PATCH] feat(c0re): extend stylix theming to the gateway-served agent UIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds on the merged dashboard theming: the themed-frontend overlay now swaps colors.css in both the dashboard/ and agent/ dist subtrees, and the agent frontend dir (HIVE_AGENT_FRONTEND_DIR, which the gateway serves agent static files from) points at the themed tree too. So when stylix is enabled on the host, both the dashboard and the gateway-served agent UIs re-theme from the host palette — still zero-op auto-detect, still a no-op (both dirs on the unthemed dist) when stylix isn't imported. Not covered: an agent reached directly on its own harness web server (no gateway) serves from its per-agent mergedDist, built in the agent's own nixosSystem with no host stylix access — that path needs the base16 palette forwarded host->agent and is tracked separately. --- nix/modules/hive-c0re.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index 49d0036a..7a1fc782 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -86,20 +86,26 @@ let --base0F: ${c.base0F}; } ''; - # Overlay the generated colors.css onto the dashboard dist subtree. - # Dashboard-first: only the dashboard surface is wired to this - # (HIVE_STATIC_DIR below), so we swap only the dashboard's colors.css. - # Agent theming is a separate follow-up — the per-agent harness builds - # its frontend in its own nixosSystem, so it needs the base16 palette - # forwarded host→agent rather than this host-side overlay. + # Overlay the generated colors.css onto both dist subtrees. Both the + # dashboard (served by hive-c0re via HIVE_STATIC_DIR) and the agent UIs + # (served by the gateway from HIVE_AGENT_FRONTEND_DIR — static files + # straight from the store) read their colors.css from this host-side + # tree, so swapping both re-themes both surfaces. + # + # Not covered here: an agent reached directly on its own harness web + # server (no gateway) serves from its per-agent `mergedDist`, built in + # the agent's own nixosSystem with no access to the host's stylix + # colours — theming that path needs the base16 palette forwarded + # host→agent, tracked separately. themedFrontend = c: pkgs.runCommand "hyperhive-frontend-themed" { } '' cp -r ${cfg.frontend} $out chmod -R u+w $out install -m644 ${themedColorsCss c} $out/dashboard/static/colors.css + install -m644 ${themedColorsCss c} $out/agent/static/colors.css ''; - servedDashboardFrontend = + servedFrontend = if stylixThemeColors != null then themedFrontend stylixThemeColors else cfg.frontend; in { @@ -723,7 +729,7 @@ in # Path to the dashboard static dist. The hive-c0re axum router # serves this via `tower_http::ServeDir` for any path it doesn't # match against an API/action route. - HIVE_STATIC_DIR = "${servedDashboardFrontend}/dashboard"; + HIVE_STATIC_DIR = "${servedFrontend}/dashboard"; # Path to the base agent frontend dist. hive-c0re's # gateway_nginx.rs uses this to generate split location # blocks in agents.conf — static HTML/CSS/JS served from the @@ -731,7 +737,7 @@ in # agent daemon. The nix store is shared across nspawn # containers, so this path is reachable from inside the # gateway container's nginx. - HIVE_AGENT_FRONTEND_DIR = "${cfg.frontend}/agent"; + HIVE_AGENT_FRONTEND_DIR = "${servedFrontend}/agent"; # Path to the static runtime asset tree (branding + claude # prompts). `hive_sh4re::assets::*` reads paths underneath. # `forge.rs` reads the avatar PNGs from here on startup.