From c353dc18939071d1c22317be014cd61e80530f0e Mon Sep 17 00:00:00 2001 From: iris Date: Sun, 31 May 2026 23:18:35 +0200 Subject: [PATCH] fix: emit relative container link URLs from harness, update dashboard join Container link URLs (/screen.html, /stats.html) were root-relative, which works when the agent is accessed directly at :port/ but resolves to the gateway root when accessed via /agent//. Fix at the source: harness emits relative URLs (screen.html, stats.html) and the dashboard joins containerBase + '/' + url. The agent page uses the URL directly and relative resolution is now correct in both paths. --- frontend/packages/dashboard/src/tabs.js | 7 ++----- hive-ag3nt/src/web_ui.rs | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/frontend/packages/dashboard/src/tabs.js b/frontend/packages/dashboard/src/tabs.js index c566ca5e..39dbd619 100644 --- a/frontend/packages/dashboard/src/tabs.js +++ b/frontend/packages/dashboard/src/tabs.js @@ -585,10 +585,7 @@ window.marked = marked; // "https://forge.pr1ma.darkest.space"), fall back to // ":3000" for gateway-off / local-dev deploys. const forgeBase = (s && s.forge_public_url) || `http://${hostname}:3000`; - // Container nav-strip links resolve against the same base as the - // primary `name` link — gateway-prefixed when the gateway is in - // front, direct TCP otherwise. Strips the trailing slash so - // `lnk.url` starting with `/` concatenates cleanly. + // Container nav-strip base: gateway prefix or direct TCP. const containerBase = gatewayLinks ? `/agent/${encodeURIComponent(c.name)}` : `http://${hostname}:${c.port}`; @@ -600,7 +597,7 @@ window.marked = marked; for (const lnk of links) { const href = lnk.kind === 'forge' ? forgeBase + (lnk.url || '') : lnk.kind === 'external' ? (lnk.url || '') - : /* container */ containerBase + (lnk.url || ''); + : /* container */ containerBase + '/' + (lnk.url || ''); const a = el('a', { class: 'nav-link', href, diff --git a/hive-ag3nt/src/web_ui.rs b/hive-ag3nt/src/web_ui.rs index b9d8b829..ed3c192c 100644 --- a/hive-ag3nt/src/web_ui.rs +++ b/hive-ag3nt/src/web_ui.rs @@ -607,12 +607,8 @@ async fn api_state(State(state): State) -> axum::Json { fn agent_links(label: &str, gui_enabled: bool) -> Vec { let mut links = Vec::new(); - // URLs are the actual HTML files served out of the frontend dist - // (`stats.html` / `screen.html`); the harness serves them as - // static files via ServeDir rather than via Rust routes, so the - // URL has to be the on-disk filename. links.push(AgentLink { - url: "/stats.html".to_owned(), + url: "stats.html".to_owned(), icon: "📊".to_owned(), label: "stats".to_owned(), kind: AgentLinkKind::Container, @@ -620,7 +616,7 @@ fn agent_links(label: &str, gui_enabled: bool) -> Vec { if gui_enabled { links.push(AgentLink { - url: "/screen.html".to_owned(), + url: "screen.html".to_owned(), icon: "🖥".to_owned(), label: "screen".to_owned(), kind: AgentLinkKind::Container,