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

@autono/pinbox-core

v0.15.0

Published

Schema, hub logic, and storage adapters. Runs on Bun (local) and workerd / Durable Objects (cloud) from one package.

Readme

@autono/pinbox-core

Schema, hub logic, and storage adapters. Runs on Bun (local) and workerd / Durable Objects (cloud) from one package.

What lives here:

  • SchemaPin, ThreadMessage, SessionRef types + published JSON Schema. Exported at ./schema and ./schema.json.
  • Hub — a fetch-style (Request) => Response handler: Bun.serve({ fetch }) consumes it locally and the Cloudflare Worker mounts the same handler. REST + WebSocket logic (hello → catch-up → events, cursor-based replay), the append-only event log, session registry, delivery adapters (hooks injection, OpenClaw push, resume-spawn via Bun.spawn, signed webhooks), pluggable auth verifier (none / token / jwt{issuer,jwksUrl,audience} / custom). Exported at ./hub. Streaming routes must call server.timeout(req, 0) — Bun's idleTimeout is a total request deadline.
  • Storage adaptersPinStore is an interface with exactly two implementations: bun:sqlite (local file) and DO SQLite (cloud). Same schema: events, pins (incl. due_at), threads, sessions, links. FTS5 works under bun:sqlite and backs pinbox list --search.
  • Broadcaster (src/ws.ts, exported at ./ws) — two-method interface over the split fanout primitives: Bun has pub/sub topics but no connection enumeration; DO has enumeration + tags but no pub/sub. Topics are fixed at connect as project:<id> (DO tags are immutable after acceptWebSocket). Always server.publish, never ws.publish — the latter excludes the sender, which would stall the originating toolbar's cursor and make it replay its own actions on reconnect.
  • WS protocol (src/ws-protocol.ts, exported at ./ws-protocol) — the frozen wire vocabulary: hello → catch-up → events, versioned with a min-protocol handshake. Auth happens at upgrade only; no credential ever appears inside a protocol message. Keepalive is transport-level (Bun sendPings / DO setWebSocketAutoResponse) — protocol 1 has no ping message and exactly one client message, the hello. The local Bun server and the cloud DO server speak this module unchanged.
  • Realtime host layer (src/hub-server.ts) — GET /ws is intercepted before the pure handler, which keeps its one-argument invariant and its bearer gate untouched: a browser cannot set headers on an upgrade, so the token rides Sec-WebSocket-Protocol: pinbox.token.<t>. Events reach sockets through exactly one host-registered listener (store.subscribe(...)Broadcaster.publish); the handler never touches fanout. The host also owns the loopback-origin CORS gate, the /summary connectedToolbars merge, and an idle timer that never fires while sockets are attached. The upgrade calls server.timeout(req, 0) — Bun's idleTimeout is a total request deadline.
  • Attachments (src/attachments.ts) — POST /attachments caps bodies at 5 MB and hands the bytes to an AttachmentSink. HubOptions and PinStore are pinned final with no media member, so the sink is injected as a store-keyed sidecar: the host calls registerAttachmentSink(store, sink)localDirSink writes under .pinbox/media/ locally, and the cloud host registers an R2 sink. An Attachment carries a path or a URL, never bytes, at any schema version: open pins are re-injected into agents every turn, and inline bytes would be re-paid each time.
  • DO glue — the importable Durable Object class/handler consumers mount. Exported at ./do. (The deployable template that uses it lives in packages/cli/templates/worker/.)
  • Connectors — the pinbox link interface (createItem, postComment, onRemoteComment, onRemoteStatus) and the GitHub implementation, wired into the hub. Environment-specific transports are injected by the host: local gh CLI (from the pinbox CLI), GitHub App token (from the worker).

Rules: no imports from sibling packages; minimal runtime deps — Zod v4 (single-source schemas: TS types + trust-boundary validation + JSON Schema via z.toJSONSchema()) and jose (JWT verifier). ./schema and ./do must run on both Bun and workerd; hub pieces that spawn processes (the resume-spawn delivery adapter) are Bun-only by nature. tsdown owns emit (ESM + .d.ts), including the post-build step that emits dist/schema.json for the ./schema.json export. Tests run under bun test.