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

@miadi/hooks-gateway

v0.1.0

Published

Optional event gateway boundary for Miadi hook events: HTTP ingress for hooks-core envelopes, idempotency ledger, stream publishing, and worker dispatch.

Readme

@miadi/hooks-gateway

Optional event gateway boundary for Miadi hook events.

@miadi/hooks-core is the local-first package: it normalizes agent hook events, builds canonical envelopes, and records sessiondata. @miadi/hooks-gateway is the optional service layer above it: it receives canonical hook events, records a durable ledger, routes events to streams, and coordinates workers.

Intent

Miadi remains local-first. Partners can use hooks-core without running a gateway. Use hooks-gateway when events need durable replay, delivery status, external subscribers, or cross-host coordination.

Boundary

hooks-gateway owns:

  • HTTP ingress for HookEventEnvelope events from hooks-core
  • idempotency checks and durable event ledger
  • queue/stream publishing to Redis or NATS JetStream
  • worker dispatch for plan-insight, interpretation, export, and partner delivery
  • delivery status and replay cursors

hooks-gateway does not own:

  • provider-specific hook behavior
  • local JSONL sessiondata writing
  • agent runtime execution

Implemented first slice (0.1.0)

The SPEC's first slice exists as code (jgwill/Miadi#485, lineage jgwill/Miadi#484), with miadi-chronicle episode 128 as its acceptance story — a durable boundary where the same archived event replayed is one run and a revised payload is a new run:

  • createGateway({ ledger, publishers })POST /events validating the @miadi/hooks-core envelope (schema_version, id, idempotency_key, canonical_event).
  • GatewayLedger interface + MemoryLedger — duplicate idempotency_key returns the original event id with a counted attempt and re-runs no side effects; nothing is erased. The Postgres ledger from the SPEC lands behind this interface.
  • StreamPublisher seam + createLogWorker() — the one worker of the slice: it logs received event IDs. Redis/NATS publishers land behind the same seam.
  • httpSink(url) — an opt-in @miadi/hooks-core HookSink delivering envelopes to a gateway; receipts and failures surface through callbacks, never silently dropped. Local capture stays network-free.

Verified end to end in test/gateway.test.ts: an episode 128 _codex_* line processed by the real codexAdapter flows through httpSink into the ledger; its exact replay answers duplicate, attempts: 2.

Not in this slice, by design: Postgres, Redis/NATS, delivery-status workers, replay cursors, Hookdeck perimeter.

  • partner-specific business logic

Infrastructure Shape

  • Redis or NATS: event stream and consumer coordination.
  • Postgres: durable ledger, idempotency keys, subscriptions, delivery attempts.
  • Workers: consume events and perform side effects.
  • Hookdeck: optional perimeter for external webhook delivery, retries, observability, and partner destination management.

Hookdeck Position

Hookdeck is not required for local Miadi hooks. It is useful at the perimeter:

  • Hookdeck CLI for development forwarding and inspection.
  • Managed Hookdeck or Outpost for partner-facing delivery, retries, and destination management.

Short version: hooks-core defines and records local events; hooks-gateway distributes them; Hookdeck supports external delivery.