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

@lacspace/postbandit

v1.0.0

Published

A tiny Thompson-sampling multi-armed bandit to learn the best option per platform — posting time, format (video/image/carousel/text), thumbnail or title variant — from engagement rewards. Beta posteriors per arm, deterministic when seeded, persistable to

Readme

@lacspace/postbandit

Learn the best option per platform from real engagement — posting time, format, thumbnail or title variant. A tiny Thompson-sampling multi-armed bandit: each arm keeps a Beta posterior, choose() samples and picks, update() folds in a reward. Deterministic when seeded, persistable to JSON. Designed to plug into @lacspace/postplan.

npm i @lacspace/postbandit
import { createBandit } from "@lacspace/postbandit";

const bandit = createBandit(["09:00", "13:00", "19:00"], { seed: 1 });

const slot = bandit.choose();            // which posting time to try next
// …post at `slot`, later measure engagement (0..1)…
bandit.update(slot, 0.42);               // normalized engagement rate

bandit.best();                            // the current winner (exploit)
bandit.stats();                           // [{ id, alpha, beta, pulls, mean }], best first
const state = bandit.toJSON();            // persist; restore with Bandit.fromJSON(state)

Why

A/B-testing post timing/format/variants by hand never converges. A bandit balances exploring new options against exploiting the winner, and improves every time you feed it a result — no model, no tokens.

API

  • createBandit(ids?, { priorAlpha?, priorBeta?, seed? }) — Beta(1,1) priors by default; pass a seed for reproducible sampling (tests/replay).
  • choose() → the arm id to try next (Thompson sample). rank() → all arms ordered by one sample each (for an ordered lineup).
  • update(id, reward) — reward in [0,1] (booleans map to 1/0). Unknown ids are added on the fly.
  • stats() → { id, alpha, beta, pulls, mean }[] (best mean first). best() → top arm id.
  • toJSON() / Bandit.fromJSON(state, opts) — persist and restore across runs.
  • describe() → machine-readable command schema for an AI "conductor".

Use one bandit per (platform × decision) — e.g. a format bandit whose arms are video|image|carousel|text, fed back from @lacspace/postplan's choices and their engagement.

Licence

Lacspace Free Licence v1.0 — free for personal and commercial use.