agent page: backend-supplied links list replaces hardcoded stats/screen/forge (closes #189)

This commit is contained in:
damocles 2026-05-21 20:49:34 +02:00
parent a8ab91ecd8
commit 0884a54960
3 changed files with 58 additions and 47 deletions

View file

@ -674,19 +674,14 @@
const s = await resp.json();
if (!headerSet) { setHeader(s.label, s.dashboard_port); headerSet = true; }
currentLabel = s.label;
// Show the screen link when the weston VNC compositor is enabled.
const screenLink = $('screen-link');
if (screenLink) screenLink.style.display = s.gui_enabled ? '' : 'none';
// Forge profile link — the backend hands us the full URL (or
// null when this agent has no forge account).
const forgeLink = $('forge-link');
if (forgeLink) {
if (s.forge_url) {
forgeLink.href = s.forge_url;
forgeLink.style.display = '';
} else {
forgeLink.style.display = 'none';
}
// Render server-supplied navigation links (stats, screen, forge, extras).
const metaLinks = $('meta-links');
if (metaLinks && s.links) {
metaLinks.innerHTML = (s.links || []).map((lnk, i) => {
const margin = i === 0 ? '' : ' margin-left: 1em;';
const target = lnk.url.startsWith('http') ? ' target="_blank" rel="noopener"' : '';
return `<a href="${lnk.url}"${target} style="color: var(--cyan); text-decoration: none;${margin}">${lnk.icon} ${lnk.label} →</a>`;
}).join('');
}
renderTermInput(s.label, s.status === 'online');
renderInbox(s.inbox || []);

View file

@ -12,14 +12,7 @@
<img class="agent-icon" src="/icon" alt="">
<h2 id="title">◆ … ◆</h2>
</div>
<p class="meta">
<a href="/stats" style="color: var(--cyan); text-decoration: none;">📊 stats →</a>
<a id="screen-link" href="/screen" target="_blank" rel="noopener"
style="display:none; color: var(--cyan); text-decoration: none; margin-left: 1em;">🖥 screen →</a>
<a id="forge-link" href="#" target="_blank" rel="noopener"
title="this agent's profile on the hive forge"
style="display:none; color: var(--cyan); text-decoration: none; margin-left: 1em;">⬡ forge ↗</a>
</p>
<p class="meta" id="meta-links"></p>
<div id="status">
<p class="meta">loading…</p>