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

@yaebal/ai

v0.0.3

Published

yaebal ai — llm superpowers for telegram bots: streamed replies (drafts + edits), conversation memory, provider-agnostic models, plus an mcp server and agent installer for ai-assisted development.

Downloads

480

Readme

@yaebal/ai

llm superpowers for telegram bots. ctx.ai.replyStream() streams a model's answer straight into the chat — with telegram's native draft animation ("Thinking…", live-updating preview) in private chats and throttled edits with a typing cursor everywhere else. conversation memory, per-user limits, and a provider-agnostic model contract are built in.

the same package also ships the yaebal dev tooling for ai coding agents: an mcp server with the full bot api schema and an installer that configures claude code, cursor, codex, opencode and friends — see ai tooling docs.

install

pnpm add @yaebal/ai

usage

import { createBot } from "yaebal";
import { ai, openaiCompatible } from "@yaebal/ai";

const bot = createBot(process.env.BOT_TOKEN!).install(
	ai({
		model: openaiCompatible({ model: "gpt-4o-mini", apiKey: process.env.OPENAI_API_KEY }),
		system: "you are a concise, friendly assistant.",
		limits: { perUser: "20/h" },
	}),
);

bot.on("message:text", async (ctx) => {
	await ctx.ai.replyStream(ctx.text);
});

bot.command("reset", async (ctx) => {
	await ctx.ai.reset();
	await ctx.send("forgotten.");
});

models

any provider works through one of four doors:

// 1. any /chat/completions provider — openai, ollama, openrouter, groq, mistral, deepseek…
openaiCompatible({ model: "llama3.2", baseUrl: "http://localhost:11434/v1" });

// 2. anthropic, natively
anthropicModel({ model: "claude-sonnet-5", apiKey: process.env.ANTHROPIC_API_KEY! });

// 3. the whole vercel ai sdk ecosystem (needs `pnpm add ai` + a provider package)
import { anthropic } from "@ai-sdk/anthropic";
ai({ model: anthropic("claude-sonnet-5") });

// 4. anything that yields strings
customModel(async function* ({ messages }) {
	yield "hello ";
	yield "world";
});

the first two are zero-dependency fetch adapters; the ai sdk bridge lazy-loads ai only when used.

what lands on ctx

| member | does | | --- | --- | | ctx.ai.replyStream(prompt) | stream the answer into the chat (drafts / throttled edits), split across messages past 4096 chars | | ctx.ai.reply(prompt) | generate fully, then send (typing indicator kept alive meanwhile) | | ctx.ai.generate(prompt) | run the model, return { text, usage } — sends nothing | | ctx.ai.stream(prompt) | raw AsyncIterable<string> for custom rendering | | ctx.ai.history() / ctx.ai.reset() | read / forget this conversation's memory | | ctx.ai.model | the resolved adapter (id, direct access) |

behavior

  • streaming — in private chats the answer renders through sendMessageDraft: users see telegram's own "Thinking…" placeholder and an animated draft, finalized into a real message via sendMessage. in groups and channels the answer grows by throttled editMessageText calls with a cursor. answers longer than 4096 chars are split at word boundaries (@yaebal/split) and finalized message-by-message while the stream keeps going.
  • formattingparseMode applies to finalized messages only; in-flight previews stay plain so a half-open **bold can never 400 the stream. if telegram rejects the finished entities, the text is resent plain instead of being lost.
  • memory — on by default, keyed per user per chat, windowed (default 32 turns). pass any @yaebal/sklad StorageAdapter to persist it (redis, file, …), or memory: false for stateless calls.
  • limitslimits: { perUser: "20/h" } gates every model call with a sliding window; exhausted calls throw AiLimitError (with retryAfterMs) for you to catch and answer politely.

options

| option | default | does | | --- | --- | --- | | model | — | AiModel adapter or ai sdk LanguageModel (auto-detected) | | system | — | system prompt, static or (ctx) => string | | memory | true | false, or { storage, key, window } | | limits.perUser | off | "20/h"-style budget per user | | parseMode | plain | "MarkdownV2" / "HTML" for finalized messages | | streaming.intervalMs | 500 draft / 1200 edit | min gap between preview updates | | streaming.drafts | true | opt out of drafts in private chats | | streaming.cursor | "▍" | in-flight cursor for edit mode, "" disables | | typing | true | typing action during non-streamed replies | | temperature, maxTokens | provider defaults | forwarded to the model |

part of yaebal — a type-safe, runtime-agnostic Telegram Bot API framework. MIT.