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

@firefly0621/dsh-remote-protocol

v0.1.0-rc.13

Published

Shared remote-control wire protocol: envelope types, message validation, constants

Readme

@firefly0621/dsh-remote-protocol

English | 中文

Shared wire protocol for the remote-control capability: envelope types, message validation, and timing constants. Zero runtime dependencies — the relay server, the host plugin, and the mobile PWA all consume the same vocabulary through this package, so a message shape can never drift between peers.

Message vocabulary

| Type | Direction | Payload | Purpose | |---|---|---|---| | hello | device → relay | { deviceSecret } | Device authentication on connect | | pair | app → relay | { pairingCode } | App requests a session for a device | | pair-result | relay → app | { token, deviceId, deviceName } | Successful pairing | | pairing.issue | relay → device / device → relay | { code, expiresAt } | Relay asks for a code; device answers | | request | app → device | { token, method, params } | Command invocation | | response | device → app | { result } | Command result | | error | any | { code, message } | Recoverable failure | | ping / pong | any | {} | Heartbeat | | resume | app → relay | { token } | Re-establish a session with a stored token, no new code | | sessions.list | device ↔ relay | request {} / response { sessions } | Bound app sessions of the device | | sessions.revoke | device → relay | { sessionId } | Drop one app session; the phone must pair again | | event | device → relay → app | { event, payload } | One-way push to every app session bound to the device; carries chat stream events (chat/start { sessionId }, chat/chunk { text }, chat/done { text }, chat/error { code, message }) |

parseMessage(text) validates the envelope (JSON shape, known type, present payload) and throws ProtocolError with a stable machine-readable code on malformed input. serializeMessage(envelope) is the inverse.

Constants

  • HEARTBEAT_INTERVAL_MS = 30_000 — peers send ping this often.
  • HEARTBEAT_TIMEOUT_MS = 60_000 — a silent peer is dropped.
  • PAIRING_CODE_LENGTH = 6, PAIRING_CODE_TTL_MS = 600_000, PAIRING_MAX_ATTEMPTS = 5 — pairing-code policy.

Model Experience

None, as this package is pure types, validation, and constants; nothing here reaches a model request.

KV Cache effect

None; the package never assembles or sends a provider request.

Known Limitations and Deferred Work

  • No runtime invariant companion is published; this package is pure types, validation, and constants with no durable runtime relation to check.
  • Payload shape is not schema-validated per type — parseMessage checks the envelope shell, not each payload's fields; peers validate their own payloads. Add per-type schemas here when a consumer needs wire-level validation without duplicating it.