#protocols #nnrp #run-time #streaming

nnrp-transport-quic

Default Quinn/Rustls QUIC transport provider plus injection helpers for NNRP

10 releases

new 1.0.0-preview.4.0 Jun 10, 2026
1.0.0-preview.3.8 Jun 5, 2026
1.0.0-preview.3.6 May 28, 2026

#7 in #nnrp


Used in nnrp-conformance

Apache-2.0

440KB
10K SLoC

NNRP - Neural Network Runtime Protocol

CI Rust 1.82+ Docs Apache-2.0 Native FFI WASM primitives

nnrp-rs

nnrp-rs is the Rust canonical SDK workspace for NNRP/1 Preview4. NNRP is a domain-level application-layer protocol for long-lived, real-time AI model runtime communication: session lifecycle, flow control, runtime control frames, runtime object references, cache/schema negotiation, recovery, transport selection, and typed payload exchange live above TCP, QUIC, IPC, and WebSocket transports.

This repository is intended to be the implementation source for Rust users and for downstream language bindings.

What Ships Here

Package Purpose
nnrp-core Wire codecs, strict validation, protocol enums/errors, lifecycle state machines, runtime control frames, runtime object descriptors, cache/schema semantics, recovery, and conformance-facing core types.
nnrp-runtime Transport-neutral async client/server session runtime over framed transport slots.
nnrp-transport-provider Provider registry, local/remote capability intersection, native library discovery, policy resolution, and probe-score selection.
nnrp-transport-tcp TCP provider package for runtime transport/listener slots.
nnrp-transport-quic Default Quinn/Rustls QUIC provider, certificate config helpers, and injection hooks for custom backends.
nnrp-transport-ipc Local IPC provider for same-node schedulers, local agents, and host-side runtime services.
nnrp-transport-websocket Native WebSocket provider for browser-compatible edge paths and WebSocket service endpoints.
nnrp-ffi C-compatible ABI facade, handle/event model, header surface, and transport-scoped native link-library packaging.
nnrp-wasm Browser WASM primitives and TypeScript declarations for WebSocket-substrate JS/TS wrappers.
nnrp-conformance Suite-facing adapter wrapper, wire conformance dry-runner, fixture-backed validation, and protocol regression helpers.

Install

For a Rust client/server application using the runtime plus TCP transport:

cargo add nnrp-core@1.0.0-preview.4.0 nnrp-runtime@1.0.0-preview.4.0 nnrp-transport-tcp@1.0.0-preview.4.0
cargo add tokio --features macros,rt-multi-thread,net,io-util,time

Add optional packages only when your application needs them:

cargo add nnrp-transport-quic@1.0.0-preview.4.0
cargo add nnrp-transport-ipc@1.0.0-preview.4.0
cargo add nnrp-transport-websocket@1.0.0-preview.4.0
cargo add nnrp-transport-provider@1.0.0-preview.4.0
cargo add nnrp-ffi@1.0.0-preview.4.0
cargo add nnrp-wasm@1.0.0-preview.4.0

Equivalent Cargo.toml form:

[dependencies]
nnrp-core = "1.0.0-preview.4.0"
nnrp-runtime = "1.0.0-preview.4.0"
nnrp-transport-tcp = "1.0.0-preview.4.0"

# Optional packages
nnrp-transport-provider = "1.0.0-preview.4.0"
nnrp-transport-quic = "1.0.0-preview.4.0"
nnrp-transport-ipc = "1.0.0-preview.4.0"
nnrp-transport-websocket = "1.0.0-preview.4.0"
nnrp-ffi = "1.0.0-preview.4.0"
nnrp-wasm = "1.0.0-preview.4.0"

For repository builds before publishing:

[dependencies]
nnrp-runtime = { git = "https://github.com/NagareWorks/nnrp-rs", package = "nnrp-runtime" }
nnrp-transport-tcp = { git = "https://github.com/NagareWorks/nnrp-rs", package = "nnrp-transport-tcp" }

Runtime Shape

use nnrp_runtime::{NnrpClient, NnrpClientConfig, RuntimeTransportKind};

# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let config = NnrpClientConfig::default().with_transport(RuntimeTransportKind::Tcp);
let client = NnrpClient::connect_tcp("127.0.0.1:4433", config).await?;
let session = client.open_session().await?;
# let _ = session;
# Ok(())
# }

TCP, QUIC, IPC, and WebSocket are provider packages. Install only the transports the host needs; when multiple transports are present, the provider registry can probe and select from the claimed transport capabilities instead of treating the packages as configuration flags over hidden implementation elsewhere.

Preview4 adds runtime control and object-reference surfaces for workloads where cancellation, priority changes, progress, partial results, cache references, route hints, trace context, and result drop reasons need protocol-level representation.

Native And WASM Artifacts

Native link libraries are for C#/Python/Unity and Node.js backend native-addon scenarios:

python scripts\package_native_artifacts.py --out artifacts\native

Native artifacts are transport-scoped. The default packaging script emits tcp, quic, ipc, and websocket package directories, each with a manifest that declares one transport slot and its enabled Rust feature set. Release CI rejects native artifacts that collapse every transport into one hidden package.

Each native artifact includes include/nnrp/nnrp.h as the C/C++ umbrella header, plus the FFI/runtime/error/version headers. Release CI packages Windows, Linux, macOS, Android, and iOS targets, including 32-bit x86/ARM variants where Rust and the platform toolchain expose supported targets. Desktop and Android packages ship dynamic libraries; iOS packages ship static libraries for app/toolchain linking.

Browser WASM artifacts are browser-scoped and WebSocket-substrate only. Native TCP, QUIC, and IPC libraries are not packaged into browser artifacts. Node.js should probe native transport packages first and fall back only when the host intentionally chooses a WASM-capable path.

rustup target add wasm32-unknown-unknown
python scripts\package_wasm_primitives.py --out artifacts\wasm

Workspace Layout

  • crates/: Rust crates listed above.
  • include/nnrp/: C ABI headers for native consumers.
  • scripts/: native and WASM packaging helpers.
  • doc/todo/: Preview implementation planning and rollout checklists.

Quality Gates

Before commits, the Rust workspace is expected to pass:

cargo fmt --all --check
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo llvm-cov --workspace --lcov --output-path target\llvm-cov\lcov.info

The current project rule is 90%+ total line coverage and 90%+ incremental line coverage for every commit.

Preview4 release validation can also run the Rust-owned benchmark entrypoint:

cargo run -p nnrp-conformance --bin nnrp-preview4-benchmarks -- --iterations 100000 --transport-iterations 1000

The benchmark report covers control-frame encode/decode, runtime object declare/ref/release metadata, IPC loopback, and WebSocket loopback.

Documentation

License

Apache-2.0. See LICENSE.

Contributors

Thanks to everyone shaping NNRP. See the contributors graph for individual GitHub profiles and contribution history.

Dependencies

~17–30MB
~432K SLoC