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

@hearthforge/protocol

v0.2.0

Published

The panel ↔ agent WebSocket message contract, with the runtime guards both sides validate every frame with

Readme

@hearthforge/protocol

The message contract between the HearthForge panel and its agents. The panel owns state and decisions; an agent on each node owns Docker and executes what the panel sends it over one WebSocket. This package defines every frame that crosses that socket — the ProtocolMessage envelope, each panel → agent and agent → panel message type, the protocol version — and the runtime guards both sides run on every inbound frame, so a malformed or unknown frame is dropped at ingress instead of being dispatched on trust. It is game-agnostic: game data crosses only as opaque payloads the plugin owns.

Install

pnpm add @hearthforge/protocol @hearthforge/shared

Node >= 22.

Usage

import { PROTOCOL_VERSION, isAgentMessage, isPanelMessage, protocolAtLeast } from "@hearthforge/protocol";

// On the panel: every frame from an agent is untrusted until proven.
export function onAgentFrame(raw: string): void {
  const frame: unknown = JSON.parse(raw);
  if (!isAgentMessage(frame)) return; // not a well-formed agent → panel message
  if (frame.type === "agent:heartbeat") {
    console.log(frame.payload.nodeId, frame.payload.cpu);
  }
}

// On the agent: the same, the other way round.
export function onPanelFrame(raw: string): boolean {
  return isPanelMessage(JSON.parse(raw));
}

// Capability negotiation is by version.
export const speaksCurrent = (agentVersion: string) => protocolAtLeast(agentVersion, PROTOCOL_VERSION);

isAgentMessage / isPanelMessage narrow to the AgentMessage / PanelMessage unions, so a switch on type is typed from there. Payload-level guards (parseGracefulStopPayload, parseLiveSamplesPayload, …) validate the payloads that carry numbers or nested shapes.

Peer dependencies

| peer | range | |---|---| | @hearthforge/shared | the matching 0.x line |

Versioning

The package follows semver, pre-1.0: a minor release may break the contract; a patch never does. PROTOCOL_VERSION is separate from the package version — it is the wire version a panel and an agent exchange, and runtime compatibility is major-only apart from the capabilities a panel checks with protocolAtLeast. Maintenance lines publish from release/X.Y branches under the release-X.Y npm dist-tag and never move latest — see Maintenance releases.

License

Apache-2.0.

Links