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

chat-agent

v0.0.4

Published

Resend for AI agents

Readme

chat-agent

chat-agent is the easiest way to create an AI chatbot using TypeScript.

  • Simple config: Define your questions and completion logic in a single object.
  • LLM-powered: Uses OpenAI or Claude (Anthropic) to extract and validate answers from free-form user input.
  • Conversational: Handles multi-question conversations, lets users answer in natural language, and guides them to complete all required info.
  • Rapid prototyping: Perfect for forms, lead capture, support, surveys, and more—no need to build a UI or complex logic.

Test Your Own Agent

You can test your own agent by creating a config file (JavaScript or TypeScript) that exports a bot agent instance (e.g., export const bot = chatAgent({...})).

You'll be prompted for your OpenAI API key and can interact with a sample plane ticket booking agent.

Then run:

npx chat-agent --config ./my-agent.js

Example agent file (my-agent.ts)

import { chatAgent } from "chat-agent";

export const bot = chatAgent({
  modelProvider: {
    openai: {
      apiKey: process.env.OPENAI_API_KEY!,
      model: "gpt-4o",
    },
  },
  questions: [
    { id: "name", prompt: "What's your full name?" },
    { id: "from", prompt: "From which city are you departing?" },
    { id: "to", prompt: "Where are you flying to?" },
    { id: "date", prompt: "When do you want to travel?" },
    { id: "roundTrip", prompt: "Is this a round trip or one-way?" },
  ],
  onComplete: async (data) => {
    console.log("Collected data:", data);
    // { name: "...", from: "...", to: "...", date: "...", roundTrip: "..." }
  },
});

More Example Agent Files

Sales Lead Capture Bot (sales-lead-bot.ts)


  questions: [
    { id: "name", prompt: "What's your full name?" },
    { id: "company", prompt: "What company do you represent?" },
    { id: "email", prompt: "What's your business email address?" },
    {
      id: "interest",
      prompt: "What product or service are you interested in?",
    },
    { id: "budget", prompt: "What is your estimated budget?" },
  ],
  onComplete: async (data) => {
    await crm.createLead(data);
    console.log("Sales lead captured:", data);
    // { name: "...", company: "...", email: "...", interest: "...", budget: "..." }
  },

Scheduling Bot (scheduling-bot.ts)

  questions: [
    { id: "name", prompt: "What's your name?" },
    { id: "email", prompt: "What's your email address?" },
    { id: "date", prompt: "What date would you like to schedule?" },
    { id: "time", prompt: "What time works best for you?" },
    { id: "purpose", prompt: "What's the purpose of the meeting?" },
  ],
  onComplete: async (data) => {
    await calendar.schedule(data);
    console.log("Scheduling request:", data);
    // { name: "...", email: "...", date: "...", time: "...", purpose: "..." }
  }

Customer Support Triage Bot (support-triage-bot.ts)


  questions: [
    { id: "name", prompt: "May I have your name?" },
    { id: "email", prompt: "What's your email address?" },
    {
      id: "issueType",
      prompt:
        "What type of issue are you experiencing? (e.g., billing, technical, account)",
    },
    { id: "description", prompt: "Please describe your issue in detail." },
    { id: "urgency", prompt: "How urgent is this issue? (low, medium, high)" },
  ],
  onComplete: async (data) => {
    await zendesk.createTicket(data);
    console.log("Support ticket:", data);
    // { name: "...", email: "...", issueType: "...", description: "...", urgency: "..." }
  }

Data Collection / Survey Bot (survey-bot.ts)

  questions: [
    { id: "age", prompt: "What is your age?" },
    { id: "gender", prompt: "What is your gender?" },
    {
      id: "satisfaction",
      prompt: "How satisfied are you with our service? (1-5)",
    },
    { id: "feedback", prompt: "Any additional feedback or comments?" },
  ],
  onComplete: async (data) => {
    await db.saveSurvey(data);
    console.log("Survey response:", data);
    // { age: "...", gender: "...", satisfaction: "...", feedback: "..." }
  }