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

convo-ai-sdk

v1.1.9

Published

SDK for Convo AI

Readme

convo-ai-sdk

This SDK provides a client for interacting with the Convo AI chat service, enabling real-time conversational AI experiences in your applications.

Installation

To install dependencies:

bun install

Usage

Initialization

First, import the ChatClient and initialize it with your ClientOptions. You can provide either an apiKey for production or a testAgentId for development.

import { ChatClient } from './src/index'; // Adjust path as needed

const chatClient = new ChatClient({
  apiKey: 'YOUR_API_KEY', // Or testAgentId: 'YOUR_TEST_AGENT_ID'
  identifier: 'user-123', // Optional: A unique identifier for the user
  dynamicVariables: {
    userName: 'John Doe',
    // ... other dynamic variables
  }
});

Connecting to the Chat Service

Connect to the chat service. If you have an existing sessionToken, you can pass it to connect to resume a conversation.

await chatClient.connect();
// Or to resume a session:
// await chatClient.connect('YOUR_SESSION_TOKEN');

Sending Messages

Send messages to the chat service using the sendMessage method.

await chatClient.sendMessage('Hello, how are you?');

Handling Events

The ChatClient emits various events that you can listen to:

  • statusChange: Notifies when the connection status changes (disconnected, connecting, connected, error).
  • message: Emitted for every new message (user, assistant, system, tool).
  • messageStart: When a new assistant message starts streaming.
  • messageData: For streaming chunks of assistant message content.
  • messageDone: When an assistant message has finished streaming.
  • toolCall: When the assistant requests a tool to be called.
  • thought: When the assistant provides a thought process.
  • historyLoaded: When conversation history is loaded.
  • configLoaded: When chat configuration is loaded.
  • reset: When the chat is reset.
chatClient.on('statusChange', (status) => {
  console.log('Connection status:', status);
});

chatClient.on('message', (message) => {
  console.log('New message:', message);
});

chatClient.on('messageData', (chunk) => {
  process.stdout.write(chunk); // For streaming output
});

chatClient.on('toolCall', (toolCall) => {
  console.log('Tool call requested:', toolCall);
  // Implement logic to execute the tool and send the result
  // chatClient.sendToolResult(toolCall.id, toolCall.name, 'Tool execution result');
});

Sending Tool Results

If the AI requests a tool call, you can execute the tool and send its result back to the chat service using sendToolResult.

// Example of handling a tool call
chatClient.on('toolCall', async (toolCall) => {
  console.log('Tool call requested:', toolCall);
  // Simulate tool execution
  const toolResult = `Executed tool ${toolCall.name} with args ${JSON.stringify(toolCall.args)}`;
  await chatClient.sendToolResult(toolCall.id, toolCall.name, toolResult);
});

Disconnecting and Resetting

chatClient.disconnect();
chatClient.resetChat(); // Disconnects, clears messages, and reconnects

Building the SDK

To build the TypeScript source files into JavaScript:

bun run build

This project was created using bun init in bun v1.2.16. Bun is a fast all-in-one JavaScript runtime.