systemprompt-api 0.14.2

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
use axum::extract::FromRequestParts;
use axum::response::{IntoResponse, Response};
use http::request::Parts;
use systemprompt_oauth::OAuthState;
use systemprompt_oauth::repository::OAuthRepository;

use super::OAuthHttpError;

#[derive(Debug)]
pub struct OAuthRepo(pub OAuthRepository);

impl FromRequestParts<OAuthState> for OAuthRepo {
    type Rejection = Response;

    #[expect(
        clippy::unused_async_trait_impl,
        reason = "async signature required by the FromRequestParts trait; this \
                  extractor constructs the repository synchronously"
    )]
    async fn from_request_parts(
        _parts: &mut Parts,
        state: &OAuthState,
    ) -> Result<Self, Self::Rejection> {
        OAuthRepository::new(state.db_pool())
            .map(OAuthRepo)
            .map_err(|e| {
                OAuthHttpError::server_error(format!("Repository initialization failed: {e}"))
                    .into_response()
            })
    }
}