The swarm lives in the swarm UI; this tab lists the hive's agents. The tab is 4G3NTS at #agents, its pane and count pill follow, and the module that renders the containers is agents.js. Comments and docs that named SW4RM or swarm.js follow.
38 lines
1.6 KiB
Markdown
38 lines
1.6 KiB
Markdown
# hyperhive frontend
|
|
|
|
npm workspaces project for the hyperhive browser-facing assets:
|
|
|
|
- `packages/shared/` — shared modules used by every surface (terminal
|
|
pane, Catppuccin palette + body typography).
|
|
- `packages/dashboard/` — the hive-c0re dashboard SPA.
|
|
- `packages/agent/` — the per-container web UI (default agent page,
|
|
stats, screen).
|
|
- `packages/swarm-ui/` — the swarm-level operator UI shell (hives,
|
|
agents, jobs, issue-report pages).
|
|
|
|
## Build
|
|
|
|
```
|
|
npm install # one-off; uses the checked-in package-lock.json
|
|
npm run build # builds every workspace into packages/*/dist/
|
|
```
|
|
|
|
The Rust binaries serve `packages/dashboard/dist/` and
|
|
`packages/agent/dist/` via `tower_http::ServeDir` at runtime;
|
|
`nix/packages/frontend.nix` wires up the build derivation. The
|
|
`services.hyperhive.agent.frontend.extraFiles` option in `agent.nix`
|
|
layers per-agent additions on top of the default agent dist.
|
|
|
|
## Why npm + esbuild
|
|
|
|
- **Hermetic**: dependencies vendored via the checked-in lockfile;
|
|
`buildNpmPackage` in nix uses it as the source-of-truth so the
|
|
output is reproducible without network access at build time.
|
|
- **esbuild**: `agent` and `swarm-ui` are Preact apps; `dashboard` is a
|
|
vanilla-JS + custom-element MPA with a few Preact-rendered pages
|
|
(`builds.js`, `agents.js`, imported by the dashboard entry); `shared` holds both kinds of module. No
|
|
framework runtime beyond Preact where it's used. Each workspace's
|
|
`build.mjs` is a short esbuild script.
|
|
- **Single-PR migration**: see the tracked design proposal and
|
|
the four-commit shape (npm scaffold → nix derivations → container
|
|
plumbing → Rust cutover).
|