Skip to main content

Crate alkhttp

Crate alkhttp 

Source
Expand description

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.

Re-exports§

pub use server::decoy_fallback;
pub use server::decoy_method_not_allowed;
pub use server::healthz;
pub use server::healthz;
pub use server::DecoyConfig;

Modules§

adapters
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). HTTP-backed call-protocol adapters: from_openapi / from_jsonschema (import external HTTP APIs as operations), to_openapi / to_mcp (project local operations onto HTTP surfaces), from_mcp, and from_wss (feature wss).
client
The shared outbound client host: hot-reloadable reqwest stack with same-host-only redirects, idempotent-only retries, and TLS config. Shared HTTP client (ClientWithMiddleware): reqwest + retry middleware stack, used by from_openapi/from_mcp forwarding handlers.
gateway
The 6 fixed gateway endpoints and their shared dispatch spine — the sole HTTP invoke path.
server
The HTTP server host: the HttpAdapter router, auth, stealth decoy, /healthz, /openapi.json.
websocket
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). WebSocket subsystem: the browser bidirectional path (ADR-067, docs/architecture/decisions).