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

@ -383,6 +383,11 @@ struct StateSnapshot {
/// (i.e. `/etc/hyperhive/gui.json` was present at harness startup).
/// When true, the UI may render a `🖥 screen` link to `/screen`.
gui_enabled: bool,
/// Whether this agent has a Forgejo account wired — its
/// `forge-token` file exists in the state dir. When true the UI
/// links to the agent's forge profile at `<host>:3000/<label>`
/// (the per-agent forge user is named after the agent).
forge_present: bool,
}
#[derive(Serialize)]
@ -485,6 +490,7 @@ async fn api_state(State(state): State<AppState>) -> axum::Json<StateSnapshot> {
ctx_usage,
cost_usage,
gui_enabled: state.gui_vnc_port.is_some(),
forge_present: crate::paths::state_dir().join("forge-token").is_file(),
})
}