Split the feature graph so consumers pulling only the import adapters (from_openapi / from_jsonschema / from_mcp) no longer compile the axum / hyper server stack, and server-only deployments no longer compile reqwest. One crate, one import path — sides cut by features, not by a crate split. Feature graph: - server (default): axum host, gateway, WS upgrade, to_openapi, to_mcp - client (default): client host, forward, from_jsonschema, from_openapi - openapi: shared OpenAPISpec model (implied by both sides) - mcp: from_mcp needs client, to_mcp needs server - wss: tungstenite transport (from_wss); tungstenite half of the shared WS↔byte-stream adapter - h2/http1: hyper protocol features; imply server Wire-contract neutral: gateway endpoints, ALPNs, and all public API shapes unchanged; defaults keep both sides on. Supporting changes: - forward.rs drops its axum::body::Bytes type leak (bytes crate types) - bounded_join + error-echo caps move to input_validation (usable by both sides; openapi_spec no longer imports from forward) - byte_adapter: axum flavor compiles under server, tungstenite under wss; the generic pumps stay shared (WS-11) - input_validation / openapi_spec import-only internals gated to the side that consumes them - http-body-util moves to dev-dependencies (was test-only) - integration-test required-features updated for the new sides - from_wss unit tests (axum producer harness) gated to server Verified: cargo test (defaults, 453) and --all-features (575) pass; lean side builds (client / server / client,mcp / client,wss / server,wss / openapi-only) build clean with zero warnings; clippy -D warnings clean across all feature combinations; fmt clean.
55 lines
2.3 KiB
Rust
55 lines
2.3 KiB
Rust
//! alkhttp: HTTP interface for the alk stack — serves HTTP/1.1 + HTTP/2 on
|
|
//! standard ALPNs (with WebSocket upgrade carrying the channels protocol)
|
|
//! and hosts the HTTP-backed call-protocol adapters.
|
|
//!
|
|
//! # Feature sides
|
|
//!
|
|
//! The crate serves two independent use cases, selectable via features:
|
|
//!
|
|
//! - `server` — the producer side: the axum `Router` host
|
|
//! ([`server`]), the gateway routes ([`gateway`]), the WebSocket
|
|
//! upgrade path ([`websocket`]), `to_openapi`, and `to_mcp` (with
|
|
//! `mcp`).
|
|
//! - `client` — the consumer side: the shared outbound client host
|
|
//! ([`client`]) and the import adapters (`from_jsonschema`,
|
|
//! `from_openapi`, `from_mcp` with `mcp`).
|
|
//!
|
|
//! Both default on; lean builds take `default-features = false` with
|
|
//! the side they need. The shared OpenAPI document model rides behind
|
|
//! `openapi` (implied by both sides); `openapi_spec` and `to_openapi`
|
|
//! compile with it alone.
|
|
//!
|
|
//! # Documentation gate (HY-02)
|
|
//!
|
|
//! Public-API items must be documented: this crate is pre-crates.io and
|
|
//! docs.rs renders straight from the rustdoc. The deny below keeps the
|
|
//! gate from regressing.
|
|
|
|
#![deny(missing_docs)]
|
|
|
|
/// The HTTP-backed call-protocol adapters: `from_openapi` /
|
|
/// `from_jsonschema` / `from_mcp` (credential-injecting consumers) and
|
|
/// `to_openapi` / `to_mcp` (gateway projections of local operations).
|
|
pub mod adapters;
|
|
/// The shared outbound client host: hot-reloadable reqwest stack with
|
|
/// same-host-only redirects, idempotent-only retries, and TLS config.
|
|
#[cfg(feature = "client")]
|
|
pub mod client;
|
|
/// The 6 fixed gateway endpoints and their shared dispatch spine —
|
|
/// the sole HTTP invoke path.
|
|
#[cfg(feature = "server")]
|
|
pub mod gateway;
|
|
/// The HTTP server host: the `HttpAdapter` router, auth, stealth decoy,
|
|
/// `/healthz`, `/openapi.json`.
|
|
#[cfg(feature = "server")]
|
|
pub mod server;
|
|
/// The WebSocket upgrade path carrying the native call-protocol
|
|
/// session (browsers; ADR-044, ADR-048). The `upgrade` submodule
|
|
/// compiles under `server`; the shared byte-stream adapter also under
|
|
/// `wss` (the `from_wss` consumer seam).
|
|
#[cfg(any(feature = "server", feature = "wss", test))]
|
|
pub mod websocket;
|
|
|
|
#[cfg(feature = "server")]
|
|
pub use server::{decoy_fallback, decoy_method_not_allowed, healthz, DecoyConfig};
|