systemprompt-api 0.63.1

Axum-based HTTP server and API gateway for systemprompt.io AI governance infrastructure. Exposes governed agents, MCP, A2A, and admin endpoints with rate limiting and RBAC.
Documentation
//! Gateway route mount: the inference router plus its public session routes.
//! A gateway that cannot be built fails startup.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.

use super::RouteMountError;
use axum::Router;
use systemprompt_models::modules::ApiPaths;

use super::protocol::MountCtx;
use crate::services::middleware::RouterExt;
use crate::services::middleware::authz::AuthzPolicy;

pub(super) fn mount_gateway(
    mut router: Router,
    mount: &MountCtx<'_>,
) -> Result<Router, RouteMountError> {
    let ctx = mount.ctx;
    let gateway = crate::routes::gateway::gateway_mount_router(ctx, mount.limits)
        .map_err(|source| RouteMountError::initialization("gateway", source))?;
    router = router.nest(ApiPaths::GATEWAY_BASE, gateway);
    router = router.nest(
        ApiPaths::GATEWAY_PUBLIC_BASE,
        crate::routes::gateway::sessions::public_router(ctx)
            .with_rate_limit(
                mount.limits,
                ctx.config().rate_limits.oauth_public_per_second,
                "oauth_public",
            )?
            .with_auth(*mount.public_middleware, AuthzPolicy::public()),
    );
    Ok(router)
}