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

@hazel-chat/bot-sdk

v0.1.0

Published

Official SDK for building bots for Hazel Chat. Built with Effect-TS.

Readme

@hazel-chat/bot-sdk

Official SDK for building bots for Hazel Chat. Built with Effect-TS for type-safe, composable bot development with Electric SQL real-time event streaming.

Requirements

  • Bun runtime (>=1.2.0)
  • Effect-TS ecosystem

Installation

bun add @hazel-chat/bot-sdk

Install required peer dependencies:

bun add effect @effect/platform @effect/platform-bun @effect/rpc @effect/experimental @electric-sql/client

Optional peer dependencies (for specific features):

# For OpenTelemetry tracing
bun add @effect/opentelemetry

# For real-time streaming via actors
bun add rivetkit jose

Quick Start

import { createHazelBot, HazelBotClient } from "@hazel-chat/bot-sdk"
import { Effect } from "effect"

const program = Effect.gen(function* () {
	const bot = yield* HazelBotClient

	// Register message handler
	yield* bot.onMessage((message) =>
		Effect.gen(function* () {
			yield* Effect.log(`Received message: ${message.content}`)
		}),
	)

	// Start the bot
	yield* bot.start
})

// Create and run the bot
createHazelBot({
	botToken: process.env.BOT_TOKEN!,
}).runMain(Effect.scoped(program))

Features

  • Real-time Events: Subscribe to database changes via Electric SQL shape streams
  • Event Queue: Built-in Effect.Queue for efficient event processing
  • Event Handlers: onMessage, onMessageUpdate, onMessageDelete, and more
  • Slash Commands: Register type-safe slash commands with argument parsing
  • @Mention Handling: Respond to bot mentions in messages
  • Message Operations: Send, reply, update, delete, and react to messages
  • AI Streaming: Built-in support for real-time AI response streaming
  • Integration Tools: Dynamic tool building based on enabled integrations (Linear, GitHub, etc.)
  • Secure Auth: Bearer token authentication
  • Effect-TS: Fully Effect-based for composability and error handling

Slash Commands

import { Command, CommandGroup, createHazelBot, HazelBotClient } from "@hazel-chat/bot-sdk"
import { Effect, Schema } from "effect"

const EchoCommand = Command.make("echo", {
	description: "Echo text back",
	args: { text: Schema.String },
})

const commands = CommandGroup.make(EchoCommand)

const program = Effect.gen(function* () {
	const bot = yield* HazelBotClient

	yield* bot.onCommand(EchoCommand, (ctx) =>
		Effect.gen(function* () {
			yield* bot.message.send(ctx.channelId, `Echo: ${ctx.args.text}`)
		}),
	)

	yield* bot.start
})

createHazelBot({
	botToken: process.env.BOT_TOKEN!,
	commands,
}).runMain(Effect.scoped(program))

Message Operations

const program = Effect.gen(function* () {
	const bot = yield* HazelBotClient

	yield* bot.onMessage((message) =>
		Effect.gen(function* () {
			// Send a message
			yield* bot.message.send(message.channelId, "Hello!")

			// Reply to a message
			yield* bot.message.reply(message, "This is a reply")

			// React to a message
			yield* bot.message.react(message, "👍")

			// Update a message
			yield* bot.message.update(message, "Updated content")

			// Delete a message
			yield* bot.message.delete(message.id)

			// List messages with pagination
			const page = yield* bot.message.list(message.channelId, { limit: 25 })
		}),
	)

	yield* bot.start
})

@Mention Handling

createHazelBot({
	botToken: process.env.BOT_TOKEN!,
	mentionable: true,
})

// In your program:
yield* bot.onMention((message) =>
	Effect.gen(function* () {
		yield* bot.message.reply(message, "You mentioned me! How can I help?")
	}),
)

Error Handling

The SDK provides typed errors for different failure scenarios:

import {
	AuthenticationError,
	ShapeStreamCreateError,
	MessageSendError,
	CommandHandlerError,
} from "@hazel-chat/bot-sdk"

yield* bot.start.pipe(
	Effect.catchTags({
		AuthenticationError: (error) => Effect.logError(`Auth failed: ${error.message}`),
		ShapeStreamCreateError: (error) => Effect.logError(`Stream failed: ${error.message}`),
	}),
)

Architecture

Database Changes → Electric SQL → Shape Stream → Event Queue → Your Handlers

The bot SDK is composed of several Effect services:

  • ElectricEventQueue: Manages Effect.Queue instances for each event type
  • ShapeStreamSubscriber: Subscribes to Electric SQL shape streams
  • EventDispatcher: Dispatches events to registered handlers
  • SseCommandListener: Listens for slash command invocations
  • BotAuth: Manages bot authentication context
  • HazelBotClient: Main public API for bot developers

License

MIT