# Gitea agent-run view Untracked reference copies — deploy by hand onto the gitea container. Renders inside Gitea's own Actions page (real `base/head` / `repo/header` / `base/footer`, real `.Repository`/`.CurWorkflow` context) via the `body_inner_post.tmpl` hook — no full-file template override needed. Confirmed 2026-07-22 that this hook receives the same per-page context as `templates/repo/actions/list.tmpl`. ## Files → destinations | file | destination on gitea container | role | | --- | --- | --- | | `extra_tabs.tmpl` | `$GITEA_CUSTOM/templates/custom/extra_tabs.tmpl` | adds the "Agent Run" repo tab | | `body_inner_post.tmpl` | `$GITEA_CUSTOM/templates/custom/body_inner_post.tmpl` | loads the CDN CSS/JS + agent-monitor.js, gated on the sentinel | | `agent-monitor.js` | `$GITEA_CUSTOM/public/assets/agent-monitor.js` | swaps the runs-list segment's content for the terminal, opens the SSE connection | `$GITEA_CUSTOM` is usually `/data/gitea` in the container — confirm via Site Administration > Configuration, or `gitea help`. Restart Gitea after copying either file (custom/templates is only read at startup unless `RUN_MODE = dev`). ## How it fits together `extra_tabs.tmpl` links to the real `/actions` route with a sentinel `?workflow=__agent_monitor__`. Gitea's Actions handler happily sets `.CurWorkflow` to that string (it doesn't validate it matches a real workflow file) and renders the stock page as normal — sidebar, run-count bar, "0 workflow runs" panel, all real Gitea markup. `body_inner_post.tmpl` then fires on that same page, sees the sentinel, and loads `agent-monitor.js`, which: 1. finds the real `.ui.attached.segment` inside `.flex-container-main` — the element list.tmpl already sizes correctly to hold the runs list — and swaps its content for the terminal, rather than hiding or duplicating anything 2. hides the run-count/filter bar directly above that segment (nothing to filter once the terminal's showing) 3. styles the segment as a floating rounded card (border radius, shadow) 4. mounts the xterm.js terminal inside it and opens the SSE connection The sidebar is deliberately left alone — it's real, always-current Gitea markup (actual workflow files, actual routes). An earlier version tried hiding it and hardcoding a lookalike sidebar instead; that goes stale the moment a workflow is added/renamed, so it was dropped in favor of this. Nesting the terminal inside other stock wrapper classes (e.g. `.ui.top.attached.header`, meant for the slim counter bar) also produced a tiny clipped box in testing — reason `.ui.attached.segment` specifically is the target now. **Why the terminal logic is a separate `.js` file, not inline in the template:** Gitea's CSP requires a per-request nonce for inline `