agent page: link to the agent's forge profile

Add a '⬡ forge ↗' link to the per-agent page's meta row, next to
the stats + screen links. It opens the agent's Forgejo profile
(http://<host>:3000/<label> — the per-agent forge user is named
after the agent) in a new tab.

- web_ui.rs: StateSnapshot gains forge_present, true when the
  agent's forge-token file exists in the state dir (same signal
  that tells the agent it has a forge account).
- index.html / app.js: hidden link, shown + href-filled when
  forge_present, mirroring the existing gui_enabled/screen-link
  pattern. Host comes from window.location so it works off
  whatever host the page is served from.

closes #185
This commit is contained in:
iris 2026-05-21 20:13:30 +02:00 committed by Mara
parent 310fd0b481
commit 6ab667901d
4 changed files with 24 additions and 0 deletions

View file

@ -677,6 +677,17 @@
// Show the screen link when the weston VNC compositor is enabled.
const screenLink = $('screen-link');
if (screenLink) screenLink.style.display = s.gui_enabled ? '' : 'none';
// Show the forge profile link when this agent has a forge account.
// The forge runs on :3000 of the same host; the user is the label.
const forgeLink = $('forge-link');
if (forgeLink) {
if (s.forge_present) {
forgeLink.href = `http://${window.location.hostname}:3000/${s.label}`;
forgeLink.style.display = '';
} else {
forgeLink.style.display = 'none';
}
}
renderTermInput(s.label, s.status === 'online');
renderInbox(s.inbox || []);
// Authoritative state comes from the harness via /api/state.