Skip to content

NagareWorks/nnrp-cs

Repository files navigation

NNRP - Neural Network Runtime Protocol

CI .NET Standard 2.1 Unity 2022 Docs Apache-2.0

nnrp-cs

C# bindings and Unity/.NET host surfaces for NNRP preview3.

The preview3 runtime path is Rust-backed. Nnrp.NativeBridge loads packaged nnrp-rs nnrp_ffi artifacts and probes the ABI/protocol/feature flags. Nnrp.Transport.Tcp and Nnrp.Transport.Quic own the transport-specific native entry surfaces that pin the selected transport before opening native connection, session, server, event polling, control, and cancellation facades. Managed client/server helpers remain diagnostic or unsupported-runtime surfaces for fixture inspection, conformance support, and local host development.

Full protocol and SDK documentation lives at https://nagareworks.github.io/nnrp-doc/.

Packages

Package Role
Nnrp.Core Protocol enums, fixed-layout codecs, state machines, capability negotiation, and conformance-oriented models.
Nnrp.NativeBridge Rust-backed preview3 FFI substrate, artifact loading, ABI probing, and raw native handle facades.
Nnrp.Client Managed diagnostic client helpers for fixture and unsupported-runtime scenarios.
Nnrp.Server Managed diagnostic server helpers for fixture and unsupported-runtime scenarios.
Nnrp.Transport.Tcp TCP native transport entry surface plus managed diagnostic TCP framed transport adapter.
Nnrp.Transport.Quic QUIC native transport entry surface.

Install

NuGet-style package publication is CI owned. When a package is available, install the Rust-backed host facade with:

dotnet add package Nnrp.NativeBridge --version <published-version>
dotnet add package Nnrp.Transport.Tcp --version <published-version>

Unity package generation is also CI owned. The Unity package is expected to contain managed assemblies plus platform-specific native plugins under Unity importer-aware plugin paths.

The common preview3 native platform scope is Windows, macOS, Linux, Android, and iOS across the RIDs represented in the package layout.

Reviewer-facing packaging policy and CI-owned release rules are documented in doc/packaging/ci-first-package-strategy.md.

Native Session Example

using Nnrp.NativeBridge;
using Nnrp.Transport.Tcp;

var options = new NnrpNativeTcpRuntimeSessionHostOptions(
    connectionId: 1,
    connectionGeneration: 1,
    sessionId: 1,
    sessionGeneration: 1,
    profileId: 1,
    schemaId: 1,
    schemaVersion: 1);

using var host = NnrpNativeTcpRuntime.OpenSessionHost(options);
var operation = host.SubmitOperation(operationId: 1, frameId: 1, payload: Array.Empty<byte>());
var result = host.PollResult(operation);

By default the native facade fails fast when the artifact is missing or incompatible. Diagnostic fallback must be explicit:

options.FallbackBackend = diagnosticBackend;
options.FallbackPolicy = NnrpNativeRuntimeFallbackPolicy.UseFallbackForDiagnostics;

Native Server Example

using Nnrp.NativeBridge;
using Nnrp.Transport.Tcp;

var serverOptions = new NnrpNativeTcpRuntimeServerHostOptions(
    serverId: 1,
    serverGeneration: 1);

using var serverHost = NnrpNativeTcpRuntime.OpenServerHost(serverOptions);
serverHost.AcceptSession(new NnrpNativeRuntimeSessionOptions(
    sessionId: 1,
    sessionGeneration: 1,
    profileId: 1,
    schemaId: 1,
    schemaVersion: 1));

var operation = serverHost.ReceiveSubmit(sessionId: 1, operationId: 1, frameId: 1);
serverHost.SendResult(sessionId: 1, operation, payload: Array.Empty<byte>());

Repository Layout

  • src/Nnrp.Core/: protocol models, fixed-width codecs, negotiation, and state machines.
  • src/Nnrp.NativeBridge/: preview3 Rust-backed native runtime substrate and artifact packaging.
  • src/Nnrp.Client/: managed diagnostic client helpers.
  • src/Nnrp.Server/: managed diagnostic server helpers.
  • src/Nnrp.Transport.Tcp/: TCP native transport entry surface and managed diagnostic TCP transport adapter.
  • src/Nnrp.Transport.Quic/: QUIC native transport entry surface.
  • tools/: conformance and benchmark adapters.
  • tests/: xUnit and packaging regression tests.
  • doc/todo/v1-preview3/: preview3 task breakdown and implementation status.

Validation

dotnet test Nnrp.sln --configuration Release
python tests\Packaging.Tests\test_build_upm_package.py
dotnet format Nnrp.sln --verify-no-changes --no-restore

CI enforces test coverage, package boundary checks, conformance adapter behavior, and packaging layout regressions.

Contributors

Contributors

The avatar wall above is updated automatically from the repository contributor list.

About

C# SDK for Neural Network Runtime Protocol

Resources

License

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors