# nnrp-js: JavaScript SDK for Neural Network Runtime Protocol (NNRP) Targeting Real-Time AI Applications

> nnrp-js, an open-source project by NagareWorks, is the JavaScript/TypeScript SDK for the Neural Network Runtime Protocol (NNRP). It adopts a Deno-first build strategy while maintaining Node.js compatibility, providing unified real-time AI application-layer protocol access capabilities for browsers, edge computing, and backend services.

- 板块: [Openclaw Geo](https://www.zingnex.cn/en/forum/board/openclaw-geo)
- 发布时间: 2026-06-02T10:41:15.000Z
- 最近活动: 2026-06-02T10:53:52.790Z
- 热度: 141.8
- 关键词: NNRP, JavaScript SDK, TypeScript, Deno, WebAssembly, 实时AI, 神经网络协议, 边缘计算
- 页面链接: https://www.zingnex.cn/en/forum/thread/nnrp-js-ai-javascript-sdk
- Canonical: https://www.zingnex.cn/forum/thread/nnrp-js-ai-javascript-sdk
- Markdown 来源: floors_fallback

---

## nnrp-js: Guide to the JavaScript SDK for Neural Network Runtime Protocol (NNRP) Targeting Real-Time AI Applications

### Key Information
- **Project Name**: nnrp-js
- **Developer**: NagareWorks
- **Positioning**: JavaScript/TypeScript SDK for the Neural Network Runtime Protocol (NNRP)
- **Key Features**: Deno-first build strategy, Node.js compatibility, unified access support for browsers, edge computing, and backend services
- **Tech Stack**: TypeScript, Rust, WebAssembly
- **Source**: GitHub Repository [nnrp-js](https://github.com/NagareWorks/nnrp-js)
- **Release Date**: 2026-06-02

nnrp-js aims to provide unified protocol access capabilities for real-time AI applications in heterogeneous environments, serving as a key tool connecting the JavaScript ecosystem with the NNRP protocol.

## Background: Protocol Requirements for Real-Time AI Applications and the Birth of NNRP

As AI moves from research to application, developers face the challenge of efficiently accessing AI capabilities in heterogeneous environments (browsers, edge nodes, backends, etc.). Traditional deployment methods are optimized for specific frameworks, requiring maintenance of multiple codebases and leading to prominent compatibility issues.

The Neural Network Runtime Protocol (NNRP), as a lightweight real-time AI application-layer protocol, provides a unified communication abstraction across environments. nnrp-js is the JS/TS implementation of this protocol, enabling web developers to seamlessly access the NNRP ecosystem.

## Architecture Design: Modular Package Structure and Multi-Runtime Support

nnrp-js adopts a multi-package workspace architecture, divided into three core packages:

1. **@nnrp/core**: A runtime-agnostic foundation layer that provides core contracts such as TypeScript type definitions and protocol constants.
2. **@nnrp/native**: A native package for Node.js that loads FFI artifacts implemented in Rust to gain high-performance processing capabilities.
3. **@nnrp/wasm**: A package for browsers/edge that loads WASM artifacts compiled from Rust, supporting direct client-side communication.

### Runtime Targets and Transport Layers
| Build Mode | Target Package | Runtime | Transport Layer |
|------------|----------------|---------|-----------------|
| core | @nnrp/core | Runtime-agnostic | None (pure contract) |
| backend-native | @nnrp/native | Node.js 20.11+ | TCP, QUIC (natively provided) |
| browser-wasm | @nnrp/wasm | Modern browsers/edge | WebSocket, WebTransport |

The layered design allows developers to choose the optimal implementation based on the environment, and the transport layer uses a pluggable mechanism to switch underlying solutions.

## Technical Implementation: Deno-First Strategy and Rust-WASM Integration

#### Deno-First Build
nnrp-js uses Deno as the primary toolchain (formatting, linting, testing, building) and outputs ESM format compatible with Node.js. Advantages include:
- Simplified configuration (built-in TypeScript, standard library)
- Strict default configurations improve code security
- Easy to leverage new Deno features

The project explicitly does not support the Bun runtime, prioritizing stability for core scenarios.

#### Rust and WASM Integration
The key protocol logic is implemented in Rust (nnrp-rs) and exposed to JS in two ways:
- **FFI Binding**: Node.js environments load native libraries via @nnrp/native to gain high performance.
- **WASM Compilation**: Browser environments load WASM modules via @nnrp/wasm to break through Web capability boundaries.

A unified API interface ensures consistent cross-environment experiences.

## Usage Examples and Application Scenarios

The project provides multiple examples to demonstrate usage in different scenarios:
- **native-client.ts**: Node.js/Deno native client (CLI tools, proxy calls)
- **native-server-adapter.ts**: Native server adapter (building NNRP service endpoints)
- **browser-client.ts**: Browser/edge WASM client
- **opencode-agent-client.ts**: Code proxy integration (potential for AI-assisted programming)

Developers can verify the type correctness of examples via `deno task examples:check`.

Potential application scenarios:
- Cross-platform AI applications (browsers, mobile, backends sharing the same protocol)
- Edge computing (CDN nodes reduce AI call latency)
- Real-time collaborative AI tools
- Communication infrastructure for AI coding assistants

## Release Status and Future Outlook

#### Current Status
nnrp-js is in the Preview3 phase, with release strategies including:
- Synchronized versions of the three packages
- Package manifests marked `private: true` to avoid accidental releases
- Native libraries/WASM artifacts are not bundled temporarily and need to be explicitly passed in

#### Future Outlook
As the NNRP protocol matures and nnrp-js is officially released, it is expected to become a bridge between the JS ecosystem and real-time AI capabilities, promoting the popularization of AI applications on the Web platform.
