Expand description
Opinionated read-only dashboard for Polaris sessions.
Register DashboardPlugin on a polaris_ai::system::server::Server to
mount the bundled SvelteKit SPA at a configurable base path. The dashboard
is read-only and consumes session, run, and span data exposed by
HttpPlugin and
TracingPlugin.
The SPA is not built by this crate. It must be compiled and built in its own
repository; the build output is dropped into assets/ and embedded at
compile time via rust-embed. With an empty assets/, the crate still
compiles and every dashboard route returns a “bundle missing” notice instead
of the UI.
§Required backend plugins
The SPA calls /v1/sessions/* (mounted by HttpPlugin) and
/v1/tracing/* (mounted by TracingPlugin when its dashboard
feature is active). Per the upstream plugin stack, that requires:
ServerInfoPlugin(foundation)AppPlugin(HTTP router)ModelsPlugin,ToolsPlugin(transitive deps ofTracingPluginwhendashboardis on)SessionsPlugin+HttpPlugin(sessions REST surface)TracingPlugin(the/v1/tracing/*runs / span-tree endpoints)
SpanStorePlugin is optional but recommended for restart-safe run
history. Hosts that omit TracingPlugin will see “Failed to load
runs: 404” in the runs pane — the bundled examples/serve.rs is a
minimal complete wiring.
§Replacing the SPA
This crate is framework-agnostic: it embeds whatever static bundle lives in
assets/ and serves it: index.html at the base path, embedded files for
matching sub-paths, and index.html as the fallback for everything else
(client-side routing). It does no templating and injects no config. Any
framework (React, Vue, Solid, plain HTML, …) works in place of the bundled
SvelteKit SPA as long as the bundle satisfies this contract:
- Client-routed, rooted at
index.html— there is no SSR; unmatched paths under the base returnindex.htmlverbatim. - Asset URLs resolve under the mount base — the SPA’s build-time base
must equal
DashboardPlugin’sbase_path(the bundled SPA is built for/dashboard). A mismatch 404s every asset;DashboardPluginlogs a warning when it can detect one. - Same-origin, relative API calls to the documented contracts:
/v1/sessions/*(fromHttpPlugin) and/v1/tracing/*(fromTracingPluginorOtelTracingPlugin), consuming theRunSummary/SpanTreeJSON shapes. The host supplies no API base — the SPA assumes same origin. - No host-injected configuration — the SPA must self-configure.
§Auth
Authentication is driven by whatever AuthProvider the host server
registers on polaris_ai::app::HttpRouter::set_auth. The dashboard plugin
does not register its own provider — its routes inherit the global
middleware applied by polaris_ai::app::AppPlugin.
§Example
use std::sync::Arc;
use polaris_ai::app::{AppConfig, AppPlugin};
use polaris_ai::sessions::{HttpPlugin, InMemoryStore, SessionsPlugin};
use polaris_ai::system::server::Server;
use polaris_dashboard::DashboardPlugin;
let mut server = Server::new();
server
.add_plugins(AppPlugin::new(AppConfig::new()))
.add_plugins(SessionsPlugin::new(Arc::new(InMemoryStore::new())))
.add_plugins(HttpPlugin::new())
.add_plugins(DashboardPlugin::default());
server.run().await?;Structs§
- Configuring
- Typestate marker: the store is still being configured. Retention knobs
(
with_capacity,with_ttl,with_persistence) are available, but the plugin is not aPluginyet and cannot be mounted untilbuildseals it intoReady. - Dashboard
Plugin - Plugin that serves the bundled Polaris sessions dashboard SPA over HTTP.
- Otel
Tracing Plugin - Turns the dashboard into a standalone OTLP viewer.
- Ready
- Typestate marker: the store is built and the plugin is ready to mount. This
is the default state —
OtelTracingPluginmeansOtelTracingPlugin<Ready>, so every existing reference andadd_pluginscall is unaffected. - RunSummary
- One row in the runs list (
GET /v1/tracing/runs). - Runs
Response - Envelope for the runs list.
- Span
Event - One event nested inside a
SpanNode. - Span
Node - One node in a
SpanTree. - Span
Tree - Hierarchical view of one run (
GET /v1/tracing/runs/{id}). - Trace
Store - Bounded, thread-safe store of
OTeltraces.
Constants§
- DEFAULT_
CAPACITY - Default number of distinct traces retained in memory.
Traits§
- Store
State - Typestate of an
OtelTracingPlugin— whether itsTraceStorehas been built yet. Sealed: the only states areConfiguringandReady.