LabAcacia.NPS.Core
1.0.0-alpha.16
dotnet add package LabAcacia.NPS.Core --version 1.0.0-alpha.16
NuGet\Install-Package LabAcacia.NPS.Core -Version 1.0.0-alpha.16
<PackageReference Include="LabAcacia.NPS.Core" Version="1.0.0-alpha.16" />
<PackageVersion Include="LabAcacia.NPS.Core" Version="1.0.0-alpha.16" />
<PackageReference Include="LabAcacia.NPS.Core" />
paket add LabAcacia.NPS.Core --version 1.0.0-alpha.16
#r "nuget: LabAcacia.NPS.Core, 1.0.0-alpha.16"
#:package LabAcacia.NPS.Core@1.0.0-alpha.16
#addin nuget:?package=LabAcacia.NPS.Core&version=1.0.0-alpha.16&prerelease
#tool nuget:?package=LabAcacia.NPS.Core&version=1.0.0-alpha.16&prerelease
English | 中文版
NPS .NET Reference Implementation
C# / .NET 10 reference implementation for the Neural Protocol Suite.
NuGet Packages
| Package | Version | Description |
|---|---|---|
LabAcacia.NPS.Core |
1.0.0-alpha.16 | Shared frame types (AnchorFrame, DiffFrame, StreamFrame, CapsFrame, HelloFrame, ErrorFrame), JSON/MsgPack codecs, AnchorFrame cache, frame registry |
LabAcacia.NPS.NWP |
1.0.0-alpha.16 | Neural Web Protocol — NWM manifest, Query/Action/Subscribe/Diff frames, typed Action/frame payload helpers including llm.complete, Memory/Action/Complex/Anchor/Bridge Node middleware plus native-mode serving |
LabAcacia.NPS.NWP.Anchor |
1.0.0-alpha.16 | NWP Anchor Node: stateless AaaS entry point translating ActionFrames to NOP TaskFrames; AnchorNodeClient for topology.snapshot / topology.stream queries |
LabAcacia.NPS.NWP.Bridge |
1.0.0-alpha.16 | NWP Bridge Node: outbound dispatchers from NPS frames to non-NPS protocols plus inbound MCP/A2A server bridges |
LabAcacia.NPS.NIP |
1.0.0-alpha.16 | Neural Identity Protocol — CA, Ed25519 key generation, IdentFrame issuance/revocation, typed remote CA client, OCSP, CRL; X.509 + ACME agent-01 challenge (RFC-0002 prototype) |
LabAcacia.NPS.NIP.Storage.Sqlite |
1.0.0-alpha.16 | SQLite storage backend for embedded/self-hosted NIP CA deployments |
LabAcacia.NPS.NIP.Storage.Postgres |
1.0.0-alpha.16 | PostgreSQL storage backend for service NIP CA deployments |
LabAcacia.NPS.NDP |
1.0.0-alpha.16 | Neural Discovery Protocol — announce/resolve frames, in-memory registry, Ed25519 validation |
LabAcacia.NPS.NOP |
1.0.0-alpha.16 | Neural Orchestration Protocol — Task/Delegate/Sync/AlignStream frames, DAG validator, orchestration engine |
LabAcacia.NPS.Daemon.Observability |
1.0.0-alpha.16 | JSON logging, transport-neutral health/readiness renderers, ASP.NET endpoint helpers, Prometheus metrics, graceful shutdown |
LabAcacia.NPS.Conformance |
1.0.0-alpha.16 | Node L1/L2 conformance case catalog, run manifest model, and CI validation helpers |
Open vs NPS Cloud
| Area | Open package support | NPS Cloud / commercial support |
|---|---|---|
| NCP/NWP/NDP/NOP frame codecs and in-process services | Included | Managed hosting and operations |
| NIP CA, IdentFrame issuance, revocation, OCSP/CRL, X.509 prototype | Included | Managed CA operations and policy automation |
| TrustFrame parsing and basic validation | Included via TrustFrame and TrustFrameValidator for explicitly pinned grantor anchors |
Hosted multi-CA federation, managed trust-anchor discovery, revocation feeds, and commercial trust-chain policy |
| Daemon observability | Included as transport-neutral renderers plus ASP.NET mapping helpers | Hosted monitoring/SLO integration |
Quickstarts
Core Codec
using NPS.Core.Codecs;
using NPS.Core.Frames.Ncp;
var codec = NpsFrameCodec.CreateDefault();
var frame = new HelloFrame { Version = "1.0", NodeId = "urn:nps:demo", Capabilities = ["ncp"] };
var wire = codec.Encode(frame);
var header = codec.Peek(wire);
var decoded = codec.Decode(wire);
LabAcacia.NPS.Core uses MessagePack-CSharp for the built-in Tier-2 codec.
Hosts that need a different binary codec can supply their own IFrameCodec
implementation by constructing NpsFrameCodec with custom codec instances;
the DI helper wires the default JSON + MessagePack pair.
Dependency Injection
using Microsoft.Extensions.DependencyInjection;
using NPS.Core.Extensions;
var services = new ServiceCollection()
.AddNpsCore(options => options.EnableExtendedFrameHeader = true);
NIP Basic TrustFrame Validation
using NPS.NIP.Verification;
var result = TrustFrameValidator.Validate(trustFrame, new TrustFrameValidationContext
{
TrustedGrantors = new HashSet<string> { "urn:nps:org-a:ca" },
ExpectedGranteeCa = "urn:nps:org-b:ca",
RequiredCapabilities = ["nwp:query"],
TargetNodePath = "nwp://api.example.com/products",
});
Observability Without Kestrel
using NPS.Daemon.Observability.HealthChecks;
var health = HealthProbeRenderer.RenderHealthz();
var ready = await HealthProbeRenderer.RenderReadyzAsync(readinessProbes, cancellationToken);
ASP.NET Observability Endpoints
using NPS.Daemon.Observability;
builder.Services.AddNpsObservability();
app.MapNpsObservability();
Storage Packages
using NPS.NIP.Extensions;
services.AddNipCaWithSqlite(
options => ConfigureCa(options),
"Data Source=nip-ca.db");
services.AddNipCaWithPostgres(options =>
{
ConfigureCa(options);
options.ConnectionString = postgresConnectionString;
});
Bridge and Ingress Packages
LabAcacia.NPS.NWP.Bridge models both Bridge Node directions. BridgeNode
and IBridgeDispatcher handle outbound NPS-to-external calls with built-in
HTTP/HTTPS, gRPC JSON unary, MCP JSON-RPC, and A2A JSON-RPC dispatchers.
McpServerBridge and A2aServerBridge expose local NPS actions to external
MCP/A2A clients; inbound Bridge server dispatch requires a valid
X-NWP-Agent NID plus a configured VerifyAgentAsync hook by default, binding
the header to deployment NIP/capability policy. Request bodies and dispatches
are bounded by MaxRequestBodyBytes and DispatchTimeoutMs; set
RequireAuth = false only for local/dev-only ingress. The standalone
LabAcacia.McpIngress,
LabAcacia.A2aIngress, and LabAcacia.GrpcIngress compatibility edges are
packed by the release workflow and become consumable after the NuGet publish
step for that release.
using System.Text.Json;
using NPS.NWP.Bridge;
using NPS.NWP.Frames;
var registry = BridgeDispatcherRegistry.CreateDefault(new HttpClient());
var bridge = new BridgeNode(registry);
using var parameters = JsonDocument.Parse("""
{
"bridge_target": {
"protocol": "http",
"endpoint": "https://api.example.test/run",
"extras": {
"method": "POST",
"allowed_prefixes": [ "https://api.example.test/" ],
"headers": { "x-agent": "nps" }
}
},
"body": { "task": "sync" }
}
""");
var response = await bridge.DispatchAsync(new ActionFrame
{
ActionId = "bridge.dispatch",
Params = parameters.RootElement.Clone(),
TimeoutMs = 5000
});
ASP.NET hosts can expose the same Bridge Node over NWP endpoints:
builder.Services.AddBridgeNode(
options =>
{
options.NodeId = "bridge-1";
options.PathPrefix = "/bridge";
},
dispatchers =>
{
// Optional: dispatchers.Register(new GrpcBridgeDispatcher(...));
});
app.UseBridgeNode(); // GET /bridge/.nwm, GET /bridge/actions, POST /bridge/invoke
ASP.NET hosts can also expose local NPS actions as inbound MCP/A2A servers:
builder.Services.AddBridgeServer(options =>
{
options.NodeId = "bridge-server-1";
options.ServerName = "orders-bridge";
options.PathPrefix = "/bridge-server";
options.AddAction("orders.lookup", "Lookup an order by id.");
options.DispatchAsync = async (frame, ct) =>
{
// Dispatch to your local Action Node / service boundary here.
return await InvokeLocalActionAsync(frame, ct);
};
});
app.UseBridgeServer();
// POST /bridge-server/mcp (MCP tools/list + tools/call, JSON-RPC or SSE)
// POST /bridge-server/a2a (A2A tasks/send)
// GET /bridge-server/.well-known/agent.json
The hosted Bridge Node uses the named HttpClient nps-bridge; configure it
through IHttpClientFactory when you need custom timeout, proxy, TLS, or retry
policy:
builder.Services.AddHttpClient(BridgeServiceExtensions.HttpClientName, client =>
{
client.Timeout = TimeSpan.FromSeconds(30);
});
Bridge dispatchers reject private and loopback endpoint hosts by default
(reject_private=true). Set reject_private=false only for trusted local
development targets.
Native NCP and Revocation
Native-mode NCP listeners can require an authenticated stream before the
NPS/1.0\n preamble is read. Use the hook to install SslStream for TLS/mTLS:
var server = new NcpServer(port, NpsFrameCodec.CreateDefault(), new NcpServerOptions
{
RequireAuthenticatedStream = true,
HandshakeReadTimeout = TimeSpan.FromSeconds(10),
MaxHelloPayload = 16 * 1024,
AuthenticateStreamAsync = async (_, stream, ct) =>
{
var tls = new SslStream(stream, leaveInnerStreamOpen: false);
await tls.AuthenticateAsServerAsync(serverOptions, ct);
return tls;
}
});
NipIdentVerifier supports static CRLs, live callbacks, CA stores, and OCSP.
OCSP transport failures fail closed by default; set OcspFailOpen=true only
when the host policy explicitly accepts that risk.
var verifier = new NipIdentVerifier(new NipVerifierOptions
{
TrustedIssuers = trustedIssuers,
RevocationStore = await SqliteNipCaStore.OpenAsync("Data Source=nip-ca.db"),
RevocationCheck = (frame, ct) => ValueTask.FromResult<NipIdentVerifyResult?>(null),
OcspUrl = "https://ca.example.test/v1/agents"
}, httpClientFactory);
Remote NIP CA Client
using NPS.NIP.Client;
httpClient.BaseAddress = new Uri("https://ca.example.test/");
var ca = new NipCaClient(httpClient);
var discovery = await ca.GetDiscoveryAsync(cancellationToken);
var issued = await ca.RegisterAgentAsync(new NipCaRegisterRequest(
Identifier: "agent-1",
PubKey: publicKeyBase64Url,
Capabilities: ["nwp:query"],
ScopeJson: "{}"),
bearerToken,
cancellationToken);
Native NWP Serving
using NPS.Core.Codecs;
using NPS.Core.Ncp;
using NPS.NWP.Native;
var nativeNode = new NwpNativeNodeServer(
NpsFrameCodec.CreateDefault(),
new NwpNativeNodeOptions { MemoryOptions = memoryOptions, ActionOptions = actionOptions },
memoryProvider,
actionProvider);
await nativeNode.ServeAsync(ncpSession, cancellationToken);
Conformance Manifests
using NPS.Conformance;
var manifest = NpsConformanceManifest.Create(
NpsConformanceProfiles.NodeL1,
iutName: "my-node",
iutVersion: "0.1.0",
iutNid: "urn:nps:node:example.test:node-1",
peerName: "nps-dotnet-reference",
peerVersion: "1.0.0-alpha.16",
results: caseResults);
var validation = NpsConformanceValidator.Validate(manifest);
Build
dotnet build NPS.sln
Test
dotnet test
Status
Active development (v1.0.0-alpha.16). 696 tests passing.
Alpha.15 highlights: official llm.complete Action/Caps/Stream DTO contracts; typed frame payload helpers for CapsFrame, StreamFrame, async task results, and ErrorFrame.Details; Bridge bridge_target canonical wire shape aligned on extras; warning-clean .NET package family with SourceLink symbols; native NCP TLS hook and bounded Hello reads; live NIP revocation checks and signed CRL artifacts; NipCaClient; NwpNativeNodeServer; built-in Bridge dispatchers for HTTP/HTTPS, gRPC JSON unary, MCP JSON-RPC, and A2A JSON-RPC; transport-neutral observability renderers; LabAcacia.NPS.Conformance; loopback dev stack.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MessagePack (>= 3.1.7)
- Microsoft.Extensions.Caching.Memory (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on LabAcacia.NPS.Core:
| Package | Downloads |
|---|---|
|
LabAcacia.NPS.NIP
NPS — Neural Identity Protocol CA Server library. Issues, renews, revokes, and verifies NID certificates (Ed25519). Embeddable in any ASP.NET Core app or deployed standalone via Docker. |
|
|
LabAcacia.NPS.NWP
NPS — Neural Web Protocol frame types, NWM manifest model, and ASP.NET Core integration. |
|
|
LabAcacia.NPS.NOP
NPS — Neural Orchestration Protocol frame types, DAG validation, and multi-Agent task orchestration. |
|
|
LabAcacia.NPS.NWP.Anchor
NPS — NWP Anchor Node: stateless AaaS entry point that translates inbound ActionFrames into NOP TaskFrames (NPS-AaaS §2). |
|
|
LabAcacia.NPS.NDP
NPS — Neural Discovery Protocol library. Announce, resolve and graph-sync NWP nodes and Agents. Embeddable in any ASP.NET Core app. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.16 | 62 | 7/23/2026 |
| 1.0.0-alpha.15 | 449 | 6/28/2026 |
| 1.0.0-alpha.14 | 94 | 6/26/2026 |
| 1.0.0-alpha.13 | 97 | 6/13/2026 |
| 1.0.0-alpha.11 | 95 | 5/28/2026 |
| 1.0.0-alpha.10 | 107 | 5/28/2026 |
| 1.0.0-alpha.9 | 98 | 5/28/2026 |
| 1.0.0-alpha.8 | 89 | 5/28/2026 |
| 1.0.0-alpha.7 | 92 | 5/18/2026 |
| 1.0.0-alpha.6 | 107 | 5/13/2026 |
| 1.0.0-alpha.5 | 428 | 5/1/2026 |
| 1.0.0-alpha.4 | 84 | 4/30/2026 |
| 1.0.0-alpha.3 | 103 | 4/26/2026 |
| 1.0.0-alpha.2 | 84 | 4/19/2026 |
| 1.0.0-alpha.1 | 66 | 4/17/2026 |
1.0.0-alpha.16: official llm.complete Action/Caps/Stream DTO contracts; typed frame payload helpers for CapsFrame, StreamFrame, async task results, and ErrorFrame.Details; Bridge bridge_target canonical wire shape aligned on extras; warning-clean .NET package family with SourceLink symbols; native NCP TLS hook and bounded Hello reads; live NIP revocation checks and signed CRL artifacts; NipCaClient; NwpNativeNodeServer; built-in Bridge dispatchers; transport-neutral observability renderers; LabAcacia.NPS.Conformance.