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

slack-streamer

v0.0.2

Published

Stream text updates into Slack with throttling and session modes.

Readme


Minimal Slack streaming library for AI/LLM responses. Perfect for streaming ChatGPT, Claude, or any LLM output to Slack in real-time with automatic throttling and graceful rate-limit handling.

Why

Slack APIs are easy to call but easy to over-call. slack-streamer gives you a minimal session abstraction that handles update cadence, thread switching, and rate-limit backoff without pulling in heavy abstractions.

Install

npm install slack-streamer
pnpm add slack-streamer
yarn add slack-streamer
bun add slack-streamer

Features

  • Stream text in real-time — Perfect for LLM/AI responses
  • Three session modesedit, thread, and hybrid
  • Smart throttling — Batches updates to avoid rate limits
  • Automatic retry — Handles 429s and transient errors gracefully
  • Rotating status — Sims-style "Thinking...", "Pondering..." animations
  • Works with Bolt — Drop-in compatible with @slack/bolt
  • Zero config — Sensible defaults, customize when needed
  • Fully tested — 43 tests across all modules

Documentation

Quick Start

import { SlackStreamer } from "slack-streamer";
import { WebClient } from "@slack/web-api";

const client = new WebClient(process.env.SLACK_TOKEN);
const streamer = new SlackStreamer({ client });

const session = streamer.startSession({
  channel: "C123",
  mode: "edit",
});

session.setStatus("Thinking...");
session.append("Hello");
session.append(" world");
await session.finalize();

Session modes

  • edit: post once, then update the same message
  • thread: post diffs as thread replies (no updates)
  • hybrid: start in edit mode, switch to thread based on size or 429

API

new SlackStreamer(options)

type SlackStreamerOptions = {
  client: SlackWebClient;
  transport?: SlackTransportOptions;
  scheduler?: SchedulerOptions;
};

streamer.startSession(options)

type SessionOptions = {
  channel: string;
  threadTs?: string;
  mode?: "edit" | "thread" | "hybrid";
  hybridSwitchChars?: number;
  hybridSwitchOn429?: boolean;
  scheduler?: SchedulerOptions;
};

session.append(text)

Append a chunk of text and let the scheduler decide when to flush.

session.setStatus(text)

Prepends a status line to the rendered message (_Thinking..._).

session.finalize()

Flush any pending output and stop the scheduler.

session.cancel()

Stop without flushing.

session.startRotatingStatus(options?)

Start cycling through status messages (Sims/Claude-style "Thinking...", "Pondering...").

// Use fun defaults
session.startRotatingStatus();

// Or provide your own messages
session.startRotatingStatus({
  messages: ["Analyzing...", "Computing...", "Almost there..."],
  intervalMs: 2000,  // rotate every 2 seconds
  shuffle: true,     // randomize order
});

session.stopRotatingStatus()

Stop the rotating status animation. Also called automatically by finalize().

Using with Bolt

Works seamlessly with Bolt apps:

import { App } from "@slack/bolt";
import { SlackStreamer } from "slack-streamer";

const app = new App({ token: "xoxb-...", signingSecret: "..." });
const streamer = new SlackStreamer({ client: app.client });

app.message("ask", async ({ message }) => {
  const session = streamer.startSession({
    channel: message.channel,
    threadTs: message.ts,
    mode: "edit",
  });
  
  session.startRotatingStatus(); // "Thinking...", "Pondering..."
  for await (const chunk of someAIStream()) {
    session.append(chunk);
  }
  await session.finalize();
});
type SchedulerOptions = {
  flushIntervalMs?: number; // default 500
  minCharsDelta?: number;   // default 24
  maxUpdatesPerMinute?: number; // default 80
};

Transport options

type SlackTransportOptions = {
  maxRetries?: number;      // default 5
  baseRetryDelayMs?: number; // default 500
  maxRetryDelayMs?: number;  // default 8000
  onRateLimit?: (retryAfterMs: number) => void;
};

Local testing (no Slack needed)

npm install
npm test

Local testing (with Slack)

A runnable example is in examples/local-test.ts.

npm install
npm install -D ts-node
SLACK_TOKEN=xoxb-your-token SLACK_CHANNEL=C12345678 \
  npx ts-node examples/local-test.ts

Development

npm run build

License

MIT