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

@rustra/types

v0.12.0

Published

Shared types for rustra-bridge

Readme

English | 한국어

@rustra/types

The core types package of rustra-bridge. Provides the EngineClient interface shared by all platform adapters (Node, Bun, Tauri, React Native), error types, the Frame codec, and Tauri-like global invoke.

Public API overview

// Configure the platform engine once
import { configure } from '@rustra/types';
import { createFrameEngine } from '@rustra/react-native';
configure(createFrameEngine(native, registry));

// Type-safe invocations from anywhere (used inside generated clients)
import { addNumbers } from './generated/commands.js';
const result = await addNumbers({ a: 42, b: 58 });

Key exports:

  • EngineClient — the common interface: invoke<T>() (+ optional invokeBatch)
  • configure() / invoke() — global invoke (Tauri-like single entry point)
  • InvokeOptions.signal — AbortSignal — on abort, the promise rejects immediately and the cancellation propagates to the native side (when invokeAsync/invokeCancel are exposed), with error code cancelled
  • invokeBatch() / invokeBatchSettled() — batch invoke. The settled form always runs entries sequentially per-entry (never the atomic wire batch) and reports each as fulfilled / rejected / unexecuted, so a failed entry and the never-dispatched entries after it are distinguishable (see "Timeout, Cancellation, and Retry Semantics" in docs/rust-api-guide.md)
  • withRetry(fn, options?) — exponential-backoff retry limited to retryable failures (retries default 2, baseDelayMs default 100, retryIf replaces the default judgment, signal aborts mid-backoff as CancelledError); the last error is re-thrown as-is
  • configureDebug(sink) / RustraDebugEvent — opt-in structured diagnostics sink. RUSTRA_DEBUG=1|true|verbose additionally logs every event as [rustra:debug] and dumps wire bytes as hex to stderr ([rustra:wire]); on React Native globalThis.__RUSTRA_DEBUG__ = true enables the event log. Diagnostic events carry optional kind/reason (response.shape from the JSON engine, ndjson.unparsed from @rustra/node)
  • RustraCommandError — serializable error + parseRustraErrorString
  • Frame codec — pure-JS encoder/decoder for the Rust invoke_frame round trip
  • contractHash verification — checks that the build-time contract matches the runtime contract
  • FrameEngineOptions — engine options: onContractMismatch (opt-in degraded mode on hash mismatch), schemaVersion/onSchemaStale (warning when JS is staler than native), maxPayloadBytes (size pre-check of the payload right after encoding)
  • invokeLoose() — name-based loose invoke without the generated client (dynamic development tier)
  • registerDeviceStatusProvider() / getDeviceStatus() — fail-open device availability/permission lookup backed by a host-registered provider

Related docs

  • rustra-bridge
  • docs/architecture.md, docs/compatibility-contract.md