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

@nmpis/runtime-web

v1.0.0-rc.1

Published

Browser worker transport glue and packaged wasm bridge for NMP web runtimes.

Readme

runtime-web

Worker client for the nmp-browser-runtime byte transport. NOT the NMP browser runtime owner — that is the nmp-browser-runtime Rust crate.

Purpose

This package provides generic TypeScript glue for the worker-based ABI surface:

  • DispatchEnvelope — byte-frame builders for ADR-0071 typed write transport.
  • WasmBridge — FlatBuffers decoder + worker message router.
  • DegradedRuntime — fallback message handler when the wasm bridge is unavailable.
  • Worker shim — postMessage client that routes requests/responses between main thread and worker.
  • Packaged wasm asset — the nmp-browser-runtime wasm-bindgen output staged into dist/wasm during package build.
  • NIP-07 sign broker (fulfilSignRequestViaExtension / installNip07SignBroker) — the main-thread fulfiller for the begin_sign / sign_request round-trip (Web Workers have no window.nostr).
  • decodeUpdateFrame — read-side decode of the NMPU update_bytes wire into the declared projection-key set plus a typed-sidecar lookup, verified against the GENERATED PROJECTION_CONTRACT.
  • KeyedRefCache — the keyed per-row reference cache (refs.profile / refs.event), GENERATED from the same registry as the Swift/Kotlin KeyedRefCache twins (see crates/nmp-codegen/src/ts_keyed_cache.rs), with a typed profile(pubkey) / profiles() accessor.

The keyed-cache and projection-contract modules are GENERATED — regenerate via cargo run -p nmp-codegen -- gen keyed-ref-cache --platform ts --out web/packages/runtime-web/src/keyedRefCache.generated.ts and cargo run -p nmp-codegen -- gen projection-contract --platform ts --out web/packages/runtime-web/src/projectionContract.generated.ts. Never edit *.generated.ts by hand.

No Nostr protocol, signing, or routing policy is implemented here. All such logic lives in Rust (nmp-browser-runtime and lower NMP crates).

Usage

The web worker loads this package and instantiates a WasmBridge or DegradedRuntime to handle incoming WorkerRequest messages and emit WorkerEvent responses.

Split web apps import the worker as a package subpath:

const worker = new Worker(new URL("@nmpis/runtime-web/worker", import.meta.url), {
  type: "module",
});

They should not copy web/packages/runtime-web or manually stage /public/nmp-browser-runtime; the package build owns that artifact.

Product Rule

Web UI must not expose a control unless it is backed by a real Rust/NMP action and projection.

Example violations:

  • Replies wait for Rust-owned NIP-10 action support, never TypeScript tag construction.
  • Reactions must route through the Rust publish path, not raw event signing at the UI boundary.
  • Follow buttons must call the Rust follow action, not construct kind:3 manually.

This rule ensures that every UI control has a corresponding Rust/NMP action owner and cannot drift from the kernel's actual capabilities or event-format evolution. UI-only controls are forbidden.

See docs/wasm-surface.md for the browser runtime ABI contract.