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

sluicify-native

v0.4.0

Published

Native Node.js addon for sluicify (AF_UNIX command broker).

Readme

sluicify-native

Native Node.js addon for sluicify. Same wire protocol as the Python and Rust clients; calls sendmsg + SCM_RIGHTS directly from the Node process — no fork+exec of a helper binary per call.

Build

cd sluicify/node
npm install
npm run build

This produces sluicify-native.linux-<arch>-gnu.node in this directory.

Without npm install, vanilla cargo also works:

cd sluicify/node
cargo build --release
cp target/release/libsluicify_node.so sluicify-native.node

The loader (index.js) finds either form automatically.

Usage

const sluice = require('sluicify-native');

const status = sluice.call('/run/agent.sock', ['echo', 'hello']);
// Negative = broker error (see index.d.ts); map like the sluicify binary.
process.exit(status >= 0 ? status : status === -7 ? 124 : 128 - status);

call is synchronous and blocks the calling JS thread until the broker replies. The spawned child inherits this Node process's stdio fds, so the JS event loop continues serving other I/O while the child runs against the terminal/pipes — but the calling function awaits the reply.

To keep the calling thread free (e.g. UI server doing background sluice calls), invoke call from a worker_threads Worker:

const { Worker } = require('node:worker_threads');
const w = new Worker(`
  const sluice = require('sluicify-native');
  parentPort.postMessage(sluice.call(workerData.sock, workerData.argv));
`, { eval: true, workerData: { sock: '/run/agent.sock', argv: ['echo','hi'] } });
w.on('message', (status) => console.log('done', status));

Why a native addon

Compared to spawning the sluicify binary:

| approach | distribution | per-call cost | |-------------------|------------------------|--------------------| | native addon | npm install or cargo | one syscall pair | | spawn sluicify | ship binary on PATH | fork+exec per call |

For agents making frequent sluice calls, the native addon is meaningfully faster. For occasional calls, the helper binary is simpler to deploy.

Smoke test

test/smoke.js spawns sluice serve in a tempdir and round-trips a call through the addon. Run it after every build:

cd sluicify/node
node test/smoke.js
# OK: native addon round-trip succeeded

It expects target/release/sluice to exist (produced by cargo build --release from the parent dir). Override with SLUICE_BIN=/path/to/sluice node test/smoke.js.

Constraints

  • Linux only. The wire protocol uses SOCK_SEQPACKET, which macOS doesn't support. Same as the broker.
  • Synchronous API. Use worker_threads for concurrency.