feat(ui): rework router UI with tabs, terminal, SSH keys, and docs #38

Merged
despiegk merged 1 commit from development_rework_router_ui into development 2026-04-21 04:45:28 +00:00
Owner

Summary

Rework the hero_router dashboard around a top-level tab layout (Home, Router, Terminal, Admin, Docs) and add the terminal / SSH-keys / docs features requested in issue #37. The existing dashboard body is preserved verbatim at /router; all deep links continue to resolve through the Router shell.

Closes #37

Changes

  • New top-level tabs (partials/tabs.html) wired into base.html. The standalone Admin pill is removed; OpenRPC / Agent / Router Logs / theme-toggle remain on the navbar.
  • Home page (/): welcome copy, security reminder, services-with-UI grid built from the cache, conditional whitelist-status banner.
  • Router tab (/router): the old dashboard, unchanged in behaviour. /router-logs, /service/:id/*, /agent/play/:id, /fragments/* all render the Router shell.
  • Terminal tab (/terminal):
    • Backend: new src/server/terminal.rs spawns hero_proc jobs (tty: true, is_process: true, script: "nu") named router_term_<uuid>, with a WebSocket PTY proxy adapted from hero_proc_ui.
    • Routes (ui.sock only): GET/POST /api/terminal/sessions, DELETE /api/terminal/sessions/:id, GET /api/terminal/sessions/:id/pty. Matching ui.term.* JSON-RPC methods for parity.
    • Frontend: static/js/terminal.js (IIFE), xterm.js + FitAddon + CSS vendored from hero_proc_ui, session list with rename (localStorage) / delete / create, FitAddon + ResizeObserver + resize control frames, #session=<id> deep-linking.
  • Admin tab: new "SSH authorized keys" card. src/server/ssh_keys.rs provides CRUD against ~/.ssh/authorized_keys with 0700/0600 perms and atomic rewrite on delete. New ui.sshKeys.{list,add,delete} JSON-RPC methods on ui.sock only.
  • Docs tab (/docs): renders crates/hero_router/docs/router_overview.md via pulldown-cmark, cached in a OnceLock. Content covers the dual-socket architecture, discovery, reverse-proxy path convention, reserved names, each tab, securing the router, and an operator FAQ.
  • Reserved-prefix doc-comment above build_ui_router extended to include router, terminal, docs, router-logs, agent, openrpc.json, rpc.
  • scripts/smoke_tabs.sh curls each tab and asserts the nav-link active marker.

Architectural guarantees

  • All new UI routes, WebSocket, and ui.* RPC methods live on ui.sock + TCP only. rpc.sock is unchanged.
  • Dashboard BASE_PATH compatibility preserved (existing <base href> pattern).

Test Results

  • cargo build -p hero_router: PASS.
  • cargo test -p hero_router: 15 total, 14 passed, 1 failed, 0 ignored. The single failure (python_codegen::integration_tests::test_generate_from_router_spec) is pre-existing on development and unrelated to this PR.
  • cargo clippy -p hero_router: 8 warnings, identical to the development baseline. Zero new warnings.
  • Manual browser verification of xterm.js attach / resize / session lifecycle is recommended before release.
## Summary Rework the hero_router dashboard around a top-level tab layout (Home, Router, Terminal, Admin, Docs) and add the terminal / SSH-keys / docs features requested in issue #37. The existing dashboard body is preserved verbatim at `/router`; all deep links continue to resolve through the Router shell. ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_router/issues/37 ## Changes - New top-level tabs (`partials/tabs.html`) wired into `base.html`. The standalone Admin pill is removed; `OpenRPC` / Agent / Router Logs / theme-toggle remain on the navbar. - Home page (`/`): welcome copy, security reminder, services-with-UI grid built from the cache, conditional whitelist-status banner. - Router tab (`/router`): the old dashboard, unchanged in behaviour. `/router-logs`, `/service/:id/*`, `/agent/play/:id`, `/fragments/*` all render the Router shell. - Terminal tab (`/terminal`): - Backend: new `src/server/terminal.rs` spawns hero_proc jobs (`tty: true`, `is_process: true`, `script: "nu"`) named `router_term_<uuid>`, with a WebSocket PTY proxy adapted from `hero_proc_ui`. - Routes (`ui.sock` only): `GET/POST /api/terminal/sessions`, `DELETE /api/terminal/sessions/:id`, `GET /api/terminal/sessions/:id/pty`. Matching `ui.term.*` JSON-RPC methods for parity. - Frontend: `static/js/terminal.js` (IIFE), xterm.js + FitAddon + CSS vendored from hero_proc_ui, session list with rename (localStorage) / delete / create, FitAddon + ResizeObserver + resize control frames, `#session=<id>` deep-linking. - Admin tab: new "SSH authorized keys" card. `src/server/ssh_keys.rs` provides CRUD against `~/.ssh/authorized_keys` with `0700`/`0600` perms and atomic rewrite on delete. New `ui.sshKeys.{list,add,delete}` JSON-RPC methods on `ui.sock` only. - Docs tab (`/docs`): renders `crates/hero_router/docs/router_overview.md` via `pulldown-cmark`, cached in a `OnceLock`. Content covers the dual-socket architecture, discovery, reverse-proxy path convention, reserved names, each tab, securing the router, and an operator FAQ. - Reserved-prefix doc-comment above `build_ui_router` extended to include `router`, `terminal`, `docs`, `router-logs`, `agent`, `openrpc.json`, `rpc`. - `scripts/smoke_tabs.sh` curls each tab and asserts the `nav-link active` marker. ## Architectural guarantees - All new UI routes, WebSocket, and `ui.*` RPC methods live on `ui.sock` + TCP only. `rpc.sock` is unchanged. - Dashboard `BASE_PATH` compatibility preserved (existing `<base href>` pattern). ## Test Results - `cargo build -p hero_router`: PASS. - `cargo test -p hero_router`: 15 total, 14 passed, 1 failed, 0 ignored. The single failure (`python_codegen::integration_tests::test_generate_from_router_spec`) is pre-existing on `development` and unrelated to this PR. - `cargo clippy -p hero_router`: 8 warnings, identical to the `development` baseline. Zero new warnings. - Manual browser verification of xterm.js attach / resize / session lifecycle is recommended before release.
feat(ui): rework router UI with tabs, terminal, ssh keys, and docs
Some checks failed
Build & Test / check (push) Failing after 1m44s
Build & Test / check (pull_request) Failing after 3m34s
dd5d4db27b
Introduce a top-level tab layout (Home, Router, Terminal, Admin, Docs) on
the router dashboard. The existing dashboard body is preserved verbatim
under /router; existing deep links (/router-logs, /service/:id/*,
/agent/play/:id, /fragments/*) continue to render the Router shell.

- Home page lists services with a UI and shows a whitelist-status banner.
- Terminal tab runs nu sessions as hero_proc jobs over a WebSocket PTY
  proxy adapted from hero_proc_ui; xterm.js + FitAddon vendored.
- Admin tab gains a SSH authorized_keys CRUD card backed by new
  ui.sshKeys.{list,add,delete} JSON-RPC methods on ui.sock only.
- Docs tab renders crates/hero_router/docs/router_overview.md through
  pulldown-cmark; content cached in a OnceLock.
- scripts/smoke_tabs.sh curls each tab and asserts the active marker.

All new routes and RPC methods live on ui.sock + TCP only; rpc.sock is
unchanged.

#37
despiegk merged commit 8a6a0ac14f into development 2026-04-21 04:45:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_router!38
No description provided.