WNSP Protocol — Two-Layer Standard — NexusOS Documentation
NexusOS runs on two distinct runtimes that work in sync, implementing the WNSP (Wavelength-Native Spectral Protocol) standard version 7.1. The protocol replaces cryptographic hashing with electromagnetic wave physics for all communication and addressing.
Overview — Two Operating Runtimes, One Protocol
Runtime 1 — Node.js / TypeScript (port 5000): Main application server. Handles authentication, wallet, P2P media, governance, and all user-facing APIs. Proxies WNSP protocol calls to the Python runtime.
Runtime 2 — Python / Flask (port 5001): Spectral physics engine. Implements the WNSP encoding standards, K1 Orchestration Runtime, and all Lambda Boson physics calculations.
The Node.js server acts as a secure gateway. Every WNSP protocol call is rate-limited, logged, and proxied to the Python engine. Protocol Standard: WNSP/7.1. License: AGPL-3.0.
WNSP-CE v1.0 — Character Encoding Standard (Layer 1)
The semantic layer. Converts human-readable symbols into normalised ordinal tokens. Responsibility: what is being said. Physics knowledge: none — purely numerical.
Encoding process:
- Accept any Unicode symbol
- Compute ordinal value: ord(char) % 256
- Normalise to [0, 1]: ordinal / 255
- Output structured token: { symbol, ordinal, normalised }
Examples: 'A' → ordinal 65 → normalised 0.255 → CE token. 'λ' → ordinal 955 % 256 = 187 → normalised 0.733 → CE token.
API Endpoints: POST /api/wnsp/ce/encode · POST /api/wnsp/ce/char
WNSP-SE v1.0 — Spectral Encoding Standard (Layer 2)
The physical transmission layer. Maps CE tokens into electromagnetic wave frames governed by Λ = hf/c². Responsibility: how information travels through the substrate. Output: photon frames with wavelength, frequency, energy, lambda mass.
Two CE tokens are packed per photon frame (dual-wavelength scheme):
token₁ normalised → wavelength λ₁ (nm) → frequency f₁ = c/λ₁ → energy E₁ = hf₁ → mass Λ₁ = hf₁/c²
token₂ normalised → wavelength λ₂ (nm) → frequency f₂ = c/λ₂ → energy E₂ = hf₂ → mass Λ₂ = hf₂/c²
Frame = (λ₁ → λ₂) oscillation, achieving ≥ 2 chars per photon particle. Efficiency: 2.0 characters per frame (baseline).
API Endpoints: POST /api/wnsp/se/encode · POST /api/wnsp/transmit (CE → SE in one call)
Hilbert Space Channel Model
Each transmission channel is a formal basis vector in a 51,200-dimensional Hilbert space:
Ψ_channel = |λ_i⟩ ⊗ |OAM_j⟩ ⊗ |Pol_k⟩ ⊗ |Dir_l⟩
| Sub-space | Basis | Description | Dim |
| |λ_i⟩ | WDM | Wavelength channels 380–780 nm | 256 |
| |OAM_j⟩ | OAM modes | Orbital angular momentum | 50 |
| |Pol_k⟩ | Polarisation | H and V states | 2 |
| |Dir_l⟩ | Propagation direction | +k̂ forward / −k̂ backward | 2 |
Total Hilbert space dimension: dim(H) = 256 × 50 × 2 × 2 = 51,200. Orthogonality guarantee: ⟨Ψ_i | Ψ_j⟩ = 0 for i ≠ j. All 51,200 channels are simultaneously usable without interference — a mathematical guarantee from the tensor product structure of the Hilbert space.
AI/OS Channel Coordination Layer
Every AI agent in NexusOS is assigned a unique, deterministically allocated Ψ_channel from the 51,200-dimensional Hilbert space. Orthogonality is a mathematical guarantee — agents cannot interfere with each other regardless of how many run simultaneously.
Channel allocation: the system SHA256-hashes the agent ID, maps to a channel index in [0, 51199], increments if occupied, and returns (wdm_i, oam_j, pol_k, dir_l) coordinates.
API Endpoints: POST /api/wnsp/agent/allocate · POST /api/wnsp/agent/map · GET /api/wnsp/agent/status · POST /api/wnsp/agent/release
CE → SE Handoff Contract
CE outputs: { protocol: "WNSP-CE", tokens: [{ symbol, ordinal, normalised }, ...] }
SE receives that and maps to: { protocol: "WNSP-SE", frames: [{ wavelength_start_nm, wavelength_end_nm, frequency_start_hz, frequency_end_hz, energy_joules, lambda_mass_kg }, ...] }
Full transmission envelope (WNSP/7.1) includes: protocol version, CE layer, SE layer, spectral_hash, and summary (characters, ce_tokens, se_frames, total_mass_kg, efficiency).
API: GET /api/wnsp/protocol — returns full spec of both standards
Test Suite — CI Protocol Verification
The WNSP protocol ships with a formal test suite verifying every physics law, encoding contract, and Hilbert space property. All 23 tests must pass before any protocol change is merged.
Coverage: Physical constants (h, c, 555 THz first oscillation, 7.83 Hz Schumann, dim(H)=51,200) · CE layer (single-character encoding, ordinal formula, token count) · SE layer (f=c/λ, E=hf, Λ=hf/c², E/Λ=c²) · CE→SE handoff (2 chars per frame, odd-length padding, visible spectrum bounds) · Hilbert Space integrity (channel index ↔ (wdm,oam,pol) roundtrip, all 51,200 quadruplets unique) · Packing efficiency (chars_per_frame ≤ 2.0, energy and mass positive). Result: 23 passed, 0 failed.
Run: python tests/test_wnsp_protocol.py