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

@shardworks/lattice-discord-kit

v0.1.310

Published

Discord webhook channel for the Lattice — delivers pulses as rich embeds.

Readme

@shardworks/lattice-discord-kit

A Lattice channel kit that delivers pulses to a Discord channel via an incoming webhook. Contributes one latticeChannels factory (type: 'discord-webhook') which the Lattice materializes from lattice.channels at startup.

See also: docs/architecture/apparatus/lattice.md.


Installation

pnpm add @shardworks/lattice-discord-kit

Register the kit in guild.json alongside the Lattice, and point a channel entry at the factory:

{
  "plugins": [
    "@shardworks/lattice-apparatus",
    "@shardworks/lattice-discord-kit"
  ],
  "lattice": {
    "channels": [
      { "type": "discord-webhook", "webhookUrlEnvVar": "DISCORD_WEBHOOK_URL" }
    ]
  }
}

Set the named environment variable to the full webhook URL:

export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/XXX/YYY"

The URL is never written to guild.json; the kit reads it from process.env at send time.


Kit Contributions

The kit's default export is a plugin shaped as:

{
  kit: {
    requires: ['lattice'],
    latticeChannels: [discordWebhookFactory],
  },
}

discord-webhook factory

| Instance config field | Required | Description | |---|---|---| | type | yes | Must be "discord-webhook". | | webhookUrlEnvVar | no | Name of the env var holding the URL. Default DISCORD_WEBHOOK_URL. | | username | no | Override the displayed username on posts. |

Payload shape

Each pulse is posted as a single Discord embed:

{
  "embeds": [
    {
      "title": "<pulse.title>",
      "description": "<pulse.summary>",
      "color": "<per-triggerType>",
      "timestamp": "<pulse.createdAt>",
      "fields": [
        { "name": "Trigger", "value": "<pulse.triggerType>", "inline": true }
        // …trigger-specific fields
      ]
    }
  ]
}

Colors are distinct per trigger type:

| Trigger | Color | Notes | |---|---|---| | reckoner.writ-stuck | orange | Includes Type, Cause, Retryable, Detail fields when present. | | reckoner.writ-failed | red | Includes Type, Resolution, Child failures fields. When the pulse's context carries an engineFailure block (engine retry-budget exhaustion), the embed also surfaces Engine (engine id), Engine design (engineDesignId), Attempts (attemptCount), and Last error fields. Pulses without engineFailure render as before. | | reckoner.queue-drained | green | Includes Drained at, Last terminal fields. | | other | Discord blurple (neutral fallback) | Unknown trigger types render raw context keys generically. |

Delivery policy

  • 2xx response → { ok: true }.
  • Non-2xx response → { ok: false, error: "Discord webhook returned NNN: …" }.
  • Network error or thrown exception → { ok: false, error: "network error: …" }.
  • Env var unset → { ok: false, error: "environment variable X is not set" } without hitting the network.

Failures are surfaced on the pulse's deliveryState / deliveryError and stay visible via nsg pulse list / nsg pulse show. There are no automatic retries (per the Lattice's best-effort one-shot policy).


Exports

  • . — default export is the plugin descriptor. Named exports include the factory (createDiscordWebhookFactory) and pure helpers (buildPayload, embedColorForTrigger, contextFields) for programmatic callers and tests.