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

@origin89/km43

v0.8.0

Published

TypeScript bindings for KM43, generated from the protocol registry

Readme

@origin89/km43

The numbers of the KM43 protocol as TypeScript: every message type, outcome, error code, metric kind, capability bit and enum member the registry allocates, generated from protocol.toml by the same tool that generates the Rust crate's bindings. A number lives in one place, so a client and a controller cannot disagree about what 0x8F means.

pnpm add @origin89/km43
import { MessageType, MetricKind, LinkErrorCode, datasetName } from "@origin89/km43";

MessageType.ConcernsResponse; // 0x8f
MetricKind.DC_VOLTAGE;        // 0x0101
LinkErrorCode.BeforeLinkUp;   // 0x102

// The public equipment dataset's name for a reading, by kind, domain and role.
datasetName(MetricKind.DC_VOLTAGE, 0x01, 0x0003); // "battery-voltage"

The root export contains generated protocol identifiers. @origin89/km43/ble adds BleReceiver, BleSender, BleValueLimit and bleValueLength for bounded BLE value fragmentation. It does not decode CBOR or authenticate messages. BLE connection or bonding grants no KM43 permission.

For each connection, create one receiver and sender. Pass the negotiated ATT MTU (23 until exchange completes) to the receiver. For transmission, construct a BleValueLimit with fromMtu(mtu) or fromMtu(mtu, selectedValueLength); the latter rejects a selection above that MTU's value budget. When the platform reports only a value length, use fromValueLength(length) after capping it at BLE_MAX_VALUE. Values include the two KM43 header bytes and must be at least 20 bytes. enqueue(message, limit) freezes the limit for that message, owns a copy and refuses while busy; fragment fills a caller-owned buffer without advancing; call accepted only when the platform accepts those bytes into its ordered FIFO. Retry the same fragment after backpressure. Feed received values and monotonic milliseconds to receive, and call expire from a timer even when no values arrive. Reset both objects on disconnect, notification disable or controller loss, and purge the platform queue and old callbacks. The adapter must close a connection after 5000 ms without transmit progress; these classes do not run platform timers.

Discover the generated BLE_SERVICE_UUID, BLE_RX_UUID and BLE_TX_UUID, then subscribe before sending Discover. Adapters whose APIs expose value length instead of ATT MTU use the value-length constructor; do not invent an MTU. Rust and TypeScript tests consume the same ble action traces in docs/protocol/vectors/v1.json; native phone and radio qualification remains tracked by km43#81 and firmware#96. Host trace agreement is not BLE conformance.

Generated identifiers carry registry documentation and are regenerated together with the Rust bindings. Pin the package version used by the client.

The specification, the registry and the published test vectors are in the km43 repository. Licensed under either MIT or Apache-2.0, at your option; both texts ship in the package.