lean-ctx 3.9.13

Context Runtime for AI Agents with CCP. 71 MCP tools, 10 read modes, 95+ compression patterns, cross-session memory (CCP), persistent AI knowledge with temporal facts + contradiction detection, multi-agent context sharing, LITM-aware positioning, AAAK compact format, adaptive compression with Thompson Sampling bandits. Supports 24+ AI tools. Reduces LLM token consumption by up to 99%.
Documentation
use axum::extract::Request;
use axum::middleware::Next;
use axum::response::Response;

#[derive(Clone, Debug)]
#[allow(dead_code)] // Read by forward-path handlers in E13
pub(crate) struct DetectedWebApp(pub(crate) super::web_app::WebAppProvider);

pub(crate) async fn detect_web_app(request: Request, next: Next) -> Response {
    let detected = request
        .headers()
        .get("host")
        .and_then(|header| header.to_str().ok())
        .and_then(|host| super::web_app::detect_web_provider(host, request.uri().path()));

    if let Some(provider) = detected {
        let mut request = request;
        request.extensions_mut().insert(DetectedWebApp(provider));
        next.run(request).await
    } else {
        next.run(request).await
    }
}