npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kybernesis/arp-cloud-runtime

v0.2.2

Published

ARP Cloud multi-tenant runtime. Routes inbound DIDComm envelopes to agents, evaluates PDP decisions, writes Postgres-backed audit, delivers to outbound WebSocket clients.

Readme

@kybernesis/arp-cloud-runtime

Multi-tenant engine shared by apps/cloud (Next.js UI + REST API) and apps/cloud-gateway (Hono + ws gateway).

What it provides

| Module | Exports | Purpose | |---|---|---| | dispatch.ts | dispatchInbound, drainQueue, currentUsagePeriod | Verify envelope → PDP → audit → enqueue or WS-push | | audit.ts | createPostgresAudit | Hash-chained audit per (agent, connection), Postgres-backed | | sessions.ts | createSessionRegistry | In-process map of active WS sessions | | ws-server.ts | createCloudWsServer, signBearerToken | WS upgrade handler, attachable to any http.Server | | http.ts | createGatewayApp, agentDidFromHost | Hono app for /didcomm + /.well-known/* | | logger.ts | createLogger, createSilentLogger | pino wrapped behind CloudRuntimeLogger | | metrics.ts | createInMemoryMetrics, createLogBasedMetrics | TenantMetrics implementations |

Observability surface (Phase-7 Task 10)

  • Structured logs. createLogger() returns a pino logger that emits JSON to stdout. Vercel + most hosts pipe stdout directly into log drains. For Axiom specifically, set AXIOM_INGEST_URL and wrap pino with @axiomhq/pino at the binary's entry point — cloud-gateway's bin.ts is the right place.
  • Metrics. The TenantMetrics interface records inbound, outbound, pdpLatency, and named counters. createInMemoryMetrics() stores in-process for tests + dashboards; createLogBasedMetrics(logger) emits each sample as a structured log event (metric: "arp.pdp_latency_ms", tenantId, ms), ready for log-based metrics in Axiom/Datadog.
  • Error tracking. Sentry isn't bundled to keep the package lean. Wrap the return of createLogger at the binary entry point with your Sentry SDK's breadcrumb/transport integration if needed — the logger's .error() channel is where all runtime errors land.
  • PDP latency. Every dispatchInbound call records the PDP eval time via metrics.pdpLatency(tenantId, ms). Configure your alert on the 95th percentile of arp.pdp_latency_ms — the phase brief's SLO is 200ms p95.

Host routing

agentDidFromHost() parses a Host / X-Forwarded-Host header and returns the right did:web:... or null:

  • samantha.agentdid:web:samantha.agent
  • ian.samantha.agentdid:web:samantha.agent (owner subdomain)
  • ian.samantha.agent.hns.todid:web:samantha.agent (HNS gateway)
  • example.com, localhost, or anything that doesn't terminate with .agentnull

Tenant isolation

Every route handler wraps DB access through withTenant(db, toTenantId(ctx.tenantId)). The only call sites that see the raw client are:

  1. Initial resolution from the HTTP Host header (to find tenant_id given the agent DID) — a single SELECT against agents.
  2. Bearer-token verification on WS upgrade — same one-row SELECT.
  3. Stripe webhook reconciliation (handled by apps/cloud).

All other queries are TenantDb-scoped. The adversarial test in tests/phase-7/multi-tenant-isolation.test.ts provisions 5 tenants and verifies zero leaks.