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

@avelor/dth

v1.0.0

Published

RFC 9401 compliant process termination with ceremonial dignity

Readme

@avelor/dth

RFC 9401 compliant process termination with ceremonial dignity.

dth ceremony demo


Abstract

This document describes the reference implementation of RFC 9401, "The Addition of the Death (DTH) Flag to TCP" (IETF, April 2023), as a POSIX-compatible command-line interface for process lifecycle termination.

RFC 9401 introduces a reserved control bit in the TCP header — the DTH flag — to signal imminent session termination. The selection of the fourth control bit is not arbitrary: in Mandarin Chinese, (四, four) is phonetically indistinguishable from (死, death). This etymological precision is preserved throughout this implementation.

@avelor/dth extends the semantics of RFC 9401 from the TCP layer to the operating system process model. A process that receives a DTH-compliant termination signal MUST be afforded the full ceremony described herein, as specified in §3 of this document.


Background

Prior to RFC 9401, process termination in POSIX systems consisted of two primitives:

  • SIGTERM — a polite but ambiguous request with no defined ceremony
  • SIGKILL — immediate destruction with no opportunity for last statements

Neither mechanism addressed the need for formal acknowledgment of a process's service record, resource contributions, or final communications. This implementation resolves that gap.

The RFC draws its conceptual framework from the narrative convention of death flags in Japanese manga and animation: observable behavioral signals that reliably precede a character's termination. RFC 9401 formalizes this pattern for TCP sessions. @avelor/dth applies it to Unix processes.


RFC 9401 Compliance

This implementation is fully compliant with RFC 9401. The following behaviors are guaranteed:

| Requirement | Implementation | |-------------|----------------| | DTH flag MUST precede actual termination | Countdown sequence issued before SIGTERM | | Recipient SHOULD be notified of the signal | Process metadata displayed prior to signal delivery | | Systems MAY safely ignore the flag | --help exits without side effects | | DTH SHOULD NOT be combined with FIN prematurely | SIGKILL only issued after SIGTERM grace period expires | | Bit 4 significance (四/死) acknowledged | Encoded in ceremony output and last words pool |

Full specification: https://datatracker.ietf.org/doc/html/rfc9401


Installation

npm install -g @avelor/dth

Node.js ≥ 18 required. No runtime dependencies.


Usage

Terminate by PID

dth <pid>

Terminate by port

Resolves the occupying process via lsof(8) and initiates the ceremony.

dth --port <port>

Configuration

dth config set <key> <value>   # Persist a value
dth config get <key>           # Read a value
dth config                     # List all stored configuration

Configuration Reference

Configuration is stored at ~/.config/dth/config.json.

| Key | Default | Description | |-----|---------|-------------| | locale | auto-detected from $LANG | Language for ceremony output |

Locale selection

On first invocation without explicit configuration, the locale is inferred from the LANG or LC_ALL environment variable. To override permanently:

dth config set locale es

Supported locales: en, es. Additional locales can be added by placing a file at locales/<code>.js following the structure of the existing locale files.


Ceremony Protocol

Upon invocation, @avelor/dth executes the following sequence. Each phase is temporally separated to ensure the operator acknowledges the gravity of the action being performed.

Phase 1  —  Process identification and vital statistics
Phase 2  ��  Issuance of last words (randomized, process-aware)
Phase 3  —  Countdown with DTH flag pre-notification
Phase 4  —  SIGTERM delivery with grace period monitoring
Phase 4b —  SIGKILL escalation (conditional; only if Phase 4 fails)
Phase 5  —  Epitaph rendering
Phase 6  —  Mandatory moment of silence

Last words are selected from a pool of over 100 entries. When the target process is a recognized runtime (node, python, nginx, postgres, redis, docker), process-specific entries are weighted into the selection pool. All entries are available in all supported locales.


Termination Behavior

dth issues SIGTERM and monitors the process for up to 5 seconds. If the process does not exit within the grace period, it is considered non-compliant and SIGKILL is delivered. This behavior mirrors the intent of RFC 9401 §3.2, which notes that the DTH flag is informational and that recipients are not required to act on it immediately.

The distinction is preserved in the ceremony output:

  • Graceful exit → "Departed peacefully."
  • Forced exit → "Executed."

Security Considerations

This implementation does not modify TCP headers, intercept network traffic, or require elevated privileges beyond standard POSIX kill(2) permissions. The operator MUST have sufficient authority over the target process.

Attempting to terminate a process owned by another user without the appropriate permissions will result in an EPERM error, reported with appropriate solemnity.


IANA Considerations

This document has no IANA actions. The DTH bit assignment is governed by RFC 9401 and the IANA TCP Header Flags registry. @avelor/dth does not transmit TCP packets.


See Also

  • RFC 9401 — The Addition of the Death (DTH) Flag to TCP
  • RFC 2119 — Key words for use in RFCs (MUST, SHOULD, MAY)
  • kill(1), lsof(8), ps(1)

License

MIT © Avelor