1. Network Discovery (Kademlia DHT)
In traditional Client-Server architectures, the Client must know the exact IP address or Domain Name System (DNS) entry of the server it wishes to query (e.g.,https://api.internal.corp/).
Agent Nodes in NMP operate in a purely decentralized topology. Here is how they rapidly discover the resources they need:
- Every Agent and Data Node generates a cryptographic Ed25519 Peer ID upon startup.
- Nodes connect to a peer-to-peer bootstrap network and form a Kademlia Distributed Hash Table (DHT).
- When an Agent needs to access a specific capability (e.g.,
Company_SQL_Database), it simply queries the entire swarm: “Which Peer ID currently holds this capability?” - The DHT algorithm mathematically calculates the shortest network path to the target node, resolving its dynamic IP automatically behind NATs and Firewalls without a central registry.
2. Elicitation & Trust Handshakes
Because the Mesh is decentralized, trust cannot be derived from standard centralized Certificate Authorities (CAs) used in mTLS. When an Agent Node locates a Data Node, it initiates a Zero-Trust Handshake (Elicitation) before any logic is executed.- NMP uses the Noise Protocol Framework, meaning connections are encrypted natively at the transport layer (QUIC) using symmetric keys derived from the Agent’s identity.
- Post-Quantum Cryptography (PQC): Advanced drafts of NMP Client Elicitations encapsulate intents using ML-KEM-768. This prevents intercepting adversaries from recording the communication today and decrypting it a decade from now with quantum machines.
3. Logic Injection (The Payload)
Once trust is mathematically established, the Client performs its primary action: Injecting Logic. Instead of dispatching sequential JSON commands to retrieve raw text, the Agent relies on local logic-generation orchestrated natively by the TypeScript SDK:- Compilation: The Agent (often leveraging a Javy/Component Model subsystem provided by the
@nekzus/neural-mesh) translates its high-level logic (JavaScript, Python) into a tiny binary WebAssembly module. - Client AST Sentinel (
GuardianTS): Before departure, rigid Heuristic AST rules block malicious instructions within the.wasmfile, averting “sandbox escape” strategies outright in zero-time. - Payload Stamping (
Crypto Module): The Client encapsulates the session usingKyber768Post-Quantum Cryptography and seals the payload hermetically inside anAES-256-GCMenvelope. - Streaming (
MeshNode): The Client multiplexes the connection viaYamuxalong withNoiseand streams the encrypted.wasmbinary to the target Mesh exactly once. - ZK-Verification: Upon result retrieval via the libp2p ingress, the Agent locally validates the ZK-Receipt, generating absolute trust in the foreign computational output.
Execution Runtime Model (Node.js Tier-0)
Once the data is flowing, the Node.js Host orchestrates the process leveraging extreme concurrency. The overarching goal of the Neural Mesh SDK is to execute rigorous cryptographic and security boundaries without ever blocking the Main Event Loop, securing the responsiveness needed for high-traffic Agent applications.@nekzus/neural-mesh:
1. Agent App (LLM Logic Emitter)
This is the origin point representing your custom application. Whether it is an AI Auto-Coder, a data scraper, or a local utility, it dictates the “Intent” and outputs the initial raw capabilities that need to be packaged and pushed to the remote Mesh Network.2. GuardianTS (AST Heuristics)
Prior to network transmission,GuardianTS acts as the first defensive checkpoint. Utilizing V8’s native WebAssembly.compile() pipeline as a dry-run heuristic, it scans the generated .wasm binary in zero-time for malicious syscall imports (e.g., trying to escape the wasi_snapshot_preview1 sandbox). If illegal instructions are detected, the payload is destroyed before it even reaches the cryptography module.
3. Worker Pool (Piscina Cryptography)
Instead of forcing the Node.js Main Thread to calculate intensive mathematical encryptions, NMP implements parallel offloading using a nativepiscina Worker Pool.
- Egress (Outbound): Worker threads simultaneously lock the validated
.wasmusingKyber768(Post-Quantum Cryptography) and seal it inside anAES-256-GCMenvelope. - Ingress (Return): When the resulting
ZK-Receipt / AES Payloadarrives back from the network, it is immediately routed back into this Worker Pool to be decrypted and mathematically verified concurrently, completely saving the primary Node thread from blocking.
4. MeshNode (Yamux/Noise Multiplexing)
The outermost border of the SDK.MeshNode opens a sustained libp2p gateway to the decentralized network, encapsulating the traffic in a Noise protocol tunnel and multiplexing streams via Yamux. This ensures that a single TLS/QUIC connection can handle hundreds of simultaneous Logic-on-Origin injections to different remote servers with zero latency overhead.