// Resolves the host dashboard's origin, ported unchanged from app.js's // `setHeader` — pause/resume are host-side (hive-c0re) actions, not // this agent's own `/api/*`, so they need the *dashboard's* origin, not // a relative path. Behind the gateway this page lives at // `/agent//` on the dashboard's own origin (`location.origin`); // accessed directly, it's the same host on `dashboardPort`. export function resolveDashboardBase(dashboardPort: number): string { return location.pathname.startsWith('/agent/') ? location.origin + '/' : `${location.protocol}//${location.hostname}:${dashboardPort}/`; }