Expand description
Embedded single-page UI for the nyx-agent daemon.
This crate is published so the nyx-agent binary can be installed
from crates.io with versioned internal dependencies. It is an
implementation detail of Nyx Agent, not a stable public API.
build.rs prepares the asset directory under OUT_DIR:
- release builds from a repository checkout run the Vite pipeline;
- release builds from crates.io use the packaged prebuilt
dist/; - debug builds use a tiny stub page.
Consumers wire spa_handler as the Axum fallback so any path
outside /api/v1/... resolves to either the matching asset or the
SPA’s index.html (for client-side routing).
Structs§
- UiAssets
- UiBootstrap
- Bootstrap context passed into the SPA at request time. Currently
carries the bearer token the API middleware expects on every
non-
/setuprequest. The fallback handler rewritesindex.htmlto embed it before sending the response; the SPA reads it fromwindow.__NYX_AGENT_BOOTSTRAP__. - UiResponse
Functions§
- resolve
- Resolve the given URI path against the embedded asset tree.
Returns
Noneif no asset (includingindex.html) is available for that path. - resolve_
with resolvewith bootstrap context. When the resolved asset isindex.htmlandbootstrap.auth_tokenis set, the response body has a<script>tag injected at the start of<head>so the SPA has the token before any API call fires.- spa_
handler - Axum-compatible fallback handler. Pass to
Router::fallback. - spa_
handler_ stateful - Stateful Axum handler bound to a clonable
UiBootstrap. Used as the daemon’s fallback so every servedindex.htmlcarries the live auth token. - spa_
handler_ with