frontend: cut over Rust binaries to ServeDir; delete legacy assets
Phase 4 of #273 — the actual switch. Both axum routers now serve their static surface via `tower_http::services::ServeDir` mounted as a fallback service, reading the dist path from `HIVE_STATIC_DIR` (set by Phase 3's NixOS module wiring). Deletes: - `hive-c0re/assets/{index.html, app.js, dashboard.css}` - `hive-ag3nt/assets/{index.html, app.js, agent.css, stats.html, stats.js, screen.html}` - The whole `hive-fr0nt/` crate (workspace member dropped, both hive-c0re and hive-ag3nt drop their `hive-fr0nt.workspace = true` dep). Its contents now live as `@hive/shared` under `frontend/packages/shared/`. Rust changes: - `hive-c0re/src/dashboard.rs`: remove `serve_index`, `serve_css`, `serve_app_js`, `serve_shared_js`, `serve_marked_js`, `serve_favicon` (all six `include_str!` handlers); replace their routes with a single `.fallback_service(ServeDir::new(static_dir))` on the router. Fail closed (anyhow::bail) if `HIVE_STATIC_DIR` is unset or not a directory at startup. - `hive-ag3nt/src/web_ui.rs`: remove `serve_index`, `serve_css`, `serve_app_js`, `serve_shared_js`, `serve_marked_js`, `serve_stats`, `serve_stats_js`, `serve_screen`; same `fallback_service` pattern. `serve_icon` stays (consumes `/etc/hyperhive/icon.svg` + `branding/hyperhive.svg` fallback, neither of which lives under the frontend dist). - `AgentLink` URLs for stats/screen switched from `/stats` / `/screen` to `/stats.html` / `/screen.html` since ServeDir doesn't auto- append the extension and the on-disk filename is the natural URL post-cutover. - `Cargo.toml` (workspace): drop `hive-fr0nt` member + workspace dep, add `tower-http = { version = "0.6", features = ["fs"] }`. - `hive-c0re/Cargo.toml` + `hive-ag3nt/Cargo.toml`: drop the `hive-fr0nt.workspace = true` dep, add `tower-http.workspace = true`. Docs updated: - `CLAUDE.md`: file map reflects `frontend/` (was `hive-fr0nt/` + `assets/`) and the ServeDir/HIVE_STATIC_DIR shape. - `docs/web-ui.md` 'Shape (shared by both)' section: describes the ServeDir fallback + bundled-by-esbuild surface, no more `include_str!` references. - `docs/terminal-rendering.md`: src paths point at `frontend/packages/{agent,shared}/src/`; marked is the npm dep, not vendored UMD. Validation: - `cargo check --workspace` — clean (5 warnings, all pre-existing in `rebuild_queue.rs`, none on changed files). - `cargo clippy --workspace --all-targets` — clean (11 warnings, same pre-existing source). - `cd frontend && npm run build` from the prior commit's lockfile produces the dist directories the new routers consume: dashboard: `dist/{index.html, static/{app.js, dashboard.css}}` agent: `dist/{index.html, stats.html, screen.html, static/{app.js, stats.js, agent.css}}` (favicon.svg lands in dashboard/ during the nix build — `nix/frontend.nix` install phase copies `branding/hyperhive.svg` there, since it's outside the npm tree.) Refs #273.
This commit is contained in:
parent
2ecf15bb6f
commit
229c4292e9
24 changed files with 143 additions and 10122 deletions
49
CLAUDE.md
49
CLAUDE.md
|
|
@ -87,35 +87,28 @@ hive-c0re/ host daemon + CLI (one binary, subcommand-dispatched)
|
|||
and meta read access; mirrors each applied repo
|
||||
into `agent-configs/<n>` (core-only); agents are
|
||||
read-only collaborators on `core/meta`
|
||||
src/dashboard.rs axum HTTP: static shell + /api/state JSON + actions
|
||||
src/dashboard.rs axum HTTP: /api/state JSON + actions
|
||||
+ journald viewer + bind-with-retry (SO_REUSEADDR)
|
||||
+ deployed_sha chip per container +
|
||||
/dashboard/{stream,history} subscribing to the
|
||||
unified DashboardEvent channel
|
||||
assets/ index.html, dashboard.css, app.js (include_str!)
|
||||
unified DashboardEvent channel. Static assets
|
||||
(HTML/CSS/JS/favicon) served by
|
||||
tower_http::ServeDir from $HIVE_STATIC_DIR
|
||||
(= `${frontend}/dashboard` per the c0re module).
|
||||
|
||||
hive-fr0nt/ shared frontend-assets crate (browser only).
|
||||
src/lib.rs pub const BASE_CSS / TERMINAL_CSS / TERMINAL_JS /
|
||||
MARKED_JS re-exports; both binaries
|
||||
`include_str!` them and prepend to their per-
|
||||
page serving routes.
|
||||
assets/base.css Catppuccin palette + body typography (one source
|
||||
of truth, no per-page redeclaration).
|
||||
assets/terminal.css `.terminal-wrap` + `.live` + `.tail-pill` +
|
||||
`.row` / `details.row` styling for both
|
||||
pages' lit log panes. Unified prefix-column
|
||||
(padding-left + negative text-indent) so glyph
|
||||
alignment is consistent across row kinds + a
|
||||
`.md` block scope for marked-rendered bodies.
|
||||
assets/terminal.js `window.HiveTerminal.create(opts)`: scroll-
|
||||
sticky log + "↓ N new" pill + history
|
||||
backfill + SSE subscribe-buffer-snapshot-
|
||||
dedupe dance. Pages register a kind→renderer
|
||||
map; the terminal owns the lifecycle.
|
||||
assets/marked.umd.js vendored marked v4.0.2 UMD bundle. Per-agent
|
||||
terminal uses the global `marked.parse` for
|
||||
markdown bodies on send / recv / ask / answer
|
||||
/ assistant text rows.
|
||||
frontend/ npm workspaces (esbuild → static dist). Built
|
||||
hermetically by `nix/frontend.nix`
|
||||
(`packages.${system}.frontend`).
|
||||
packages/shared/ @hive/shared: terminal pane + Catppuccin palette
|
||||
+ base typography (was hive-fr0nt). ES module
|
||||
exporting { create, linkify }; pure JS, no IIFE
|
||||
globals; consumed by dashboard + agent.
|
||||
packages/dashboard/ @hive/dashboard SPA: src/{index.html, app.js,
|
||||
dashboard.css} + build.mjs → dist/{index.html,
|
||||
static/{app.js, dashboard.css}}.
|
||||
packages/agent/ @hive/agent default per-container UI: src/
|
||||
{index, stats, screen}.html + {app, stats}.js
|
||||
+ agent.css → dist/{*.html, static/*}.
|
||||
|
||||
hive-ag3nt/ in-container harness crate; produces TWO binaries
|
||||
src/lib.rs re-exports + DEFAULT_SOCKET, DEFAULT_WEB_PORT
|
||||
|
|
@ -139,8 +132,10 @@ hive-ag3nt/ in-container harness crate; produces TWO binaries
|
|||
src/login_session.rs drives `claude auth login` over stdio pipes
|
||||
src/bin/hive-ag3nt.rs sub-agent main (Serve + Mcp subcommands)
|
||||
src/bin/hive-m1nd.rs manager main (Serve + Mcp subcommands)
|
||||
assets/ index.html, agent.css, app.js, stats.html,
|
||||
stats.js, screen.html (include_str!)
|
||||
Static UI assets served by ServeDir from
|
||||
$HIVE_STATIC_DIR (= hyperhive.frontend
|
||||
.mergedDist — default agent dist + per-agent
|
||||
extraFiles, set per the harness-base module).
|
||||
prompts/ static role/tools/settings for claude (include_str!):
|
||||
agent.md — sub-agent system prompt
|
||||
manager.md — manager system prompt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue