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

@netweave/core

v0.1.0

Published

AI-friendly, event-driven gameplay runtime with snapshots, deterministic rules, and dynamic bindings.

Downloads

9

Readme

@netweave/core

Logic-first gameplay runtime for event-driven games.

This package intentionally only contains the generic runtime layer:

  • state tree and snapshots
  • event pipelines and ordered handlers
  • transactional execution and rollback
  • dynamic bind / unbind
  • Lua script runtime (sandboxed)

It does not include any concrete game rules. STS-style battle flow and other game-specific code live in examples.

Public API

import { createEngine } from '@netweave/core';

createEngine() returns { use, load, getState, state, close }.

state exposes the five primitives shared by JS and Lua:

| Method | Description | |--------|-------------| | state.get(...parts) | Read a value from the state tree | | state.set(...partsAndValue) | Write a value (or null to delete) | | state.emit(event, payload) | Fire an event synchronously | | state.bind({ key, kind, id, ctx, slot }) | Dynamically attach a def's hooks | | state.unbind(key) | Remove a dynamic binding |

Concept boundaries

  • engine.use(module) means install a gameplay module during assembly time. It is not a runtime gameplay command.
  • repeated engine.use(...) calls are compositional: module defs/rules/events are accumulated, and context conventions are merged.
  • snapshot means a full serializable state returned by getState() and accepted by load().
  • phase is purely game-layer state (e.g. a string like battle or reward). Core has no phase concept; State.set('phase', ...) is an ordinary state write.
  • concrete phase vocabularies, lifecycle rules, and transition side-effects remain entirely in game-layer code.
  • engine.close() releases the runtime when the engine is no longer needed.

Minimal example

import { createEngine } from '@netweave/core';

const engine = await createEngine();

engine.use({
  events: {
    'counter:add': { action: 'COUNTER_ADD' },
  },
  rules: [{
    id: 'core:counter:add',
    hooks: {
      'event:counter:add': `
local current = State.get('count') or 0
State.set('count', current + (Event.amount or 1))
`,
    },
  }],
});

engine.load({ count: 0 });
engine.state.emit('counter:add', { amount: 2 });

console.log(engine.getState());