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

@provable-games/dm-engine

v0.7.1

Published

Death Mountain game rules and commit-reveal protocol, ported from the Cairo contracts. Shared by the client, the indexer and the API.

Downloads

1,112

Readme

@provable-games/dm-engine

The Death Mountain game rules and commit-reveal protocol in TypeScript — a mirror of the Cairo in contracts/src.

Consumed by three places that must agree exactly:

| | | | --- | --- | | death-mountain-client | the board the player acts on | | indexer | off-chain replay of committed transcripts into the event tables | | api | token-id decoding |

Why it has to be shared

Under commit-reveal the chain executes nothing. The client's simulation is not a guess that on-chain events correct a second later — it is the board, and nothing corrects it. If it diverges from the Cairo replay by one point of health, the next committed action is state-invalid, settlement rejects the transcript, and the run is permanently unplayable.

Two copies of the rules would drift. There is one.

Keeping it honest

The rules are hand-maintained, so nothing in Cairo forces them to stay in step. Three things do:

  • test/vectors.scheme.jsonroot, fold, action_entropy and every opcode encoding, printed by the real Cairo. Regenerate with snforge test commit_reveal::test_vectors in contracts/, then paste into the fixture.
  • test/replay.entropy.test.ts — asserts each action is a pure function of (state, action, entropy) and draws zero Math.random(). A missed roll is the bug class that bricks runs.
  • GameSettled cross-check — in production the indexer diffs its replayed adventurer against the contract's packed result and writes a replay_divergences row on mismatch. That is the only genuinely independent check, since the client and the indexer share this code.

Publishing

indexer, api and the client all depend on the published package (^0.1.0), not a workspace link. That is deliberate: both backends deploy via Dockerfiles that build from their own subdirectory, where a workspace:* specifier cannot resolve.

The cost is that a rules change is not picked up by its consumers until it ships:

pnpm test && pnpm build     # vectors must pass before anything goes out
npm version patch           # or minor, if the API changed
npm publish                 # publishConfig already sets public access

then bump the range in indexer, api and the client.

To iterate locally without publishing, point a consumer at the checkout temporarily (pnpm add link:../packages/engine) and put it back before committing.

Layout

src/
  protocol.ts    domains, action codec, root / fold / actionEntropy
  transcript.ts  ActionCommitted decoding, re-folding, chain ordering
  actions.ts     GameAction <-> encoded felt
  replay.ts      applyAction(state, action, entropy)
  packing.ts     unpackAdventurer / unpackBag
  rules/         combat, exploration, loot, market, beast, token ids

applyAction is the client's useGameCore body verbatim; only the wrapper differs. It never themes a beast — the indexer stores raw ids and every reader restyles on read.