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

astack-client-sdk

v1.0.0

Published

JavaScript/TypeScript SDK for AStack video-to-video AI conversations

Readme

AStack Client SDK

JavaScript/TypeScript SDK for integrating AStack's real-time conversational AI into web applications.

Features

  • 🎥 Real-time WebRTC - Low-latency audio/video communication
  • 🤖 AI Conversations - Text, voice, and video input support
  • <1s Latency - Optimized for real-time interactions
  • 🔒 Secure Sessions - Token-based authentication
  • 📊 Usage Tracking - Built-in metrics and analytics
  • ⚛️ React Support - Hooks for easy React integration
  • 🔄 Auto-Reconnect - Resilient connection handling
  • 📱 Cross-Platform - Works in all modern browsers

Installation

npm install @astack/client-sdk

Quick Start

Vanilla JavaScript

import { AStackClient } from '@astack/client-sdk';

// Initialize client
const client = new AStackClient({
  sessionToken: 'your-session-token',
  userId: 'user-id'
});

// Handle events
client.on('message', (message) => {
  console.log('AI response:', message.text);
});

client.on('audio', (audioData) => {
  // Handle audio response
});

// Start conversation
await client.connect();

// Send text message
await client.sendMessage('Hello, AI assistant!');

// Send audio
await client.sendAudio(audioBlob);

// Disconnect when done
await client.disconnect();

React

import { useAStack } from '@astack/client-sdk/react';

function ChatComponent() {
  const {
    isConnected,
    isLoading,
    messages,
    sendMessage,
    sendAudio,
    startRecording,
    stopRecording
  } = useAStack({
    sessionToken: 'your-session-token',
    userId: 'user-id'
  });

  return (
    <div>
      {messages.map((msg) => (
        <div key={msg.id}>
          {msg.role}: {msg.text}
        </div>
      ))}
      
      <button onClick={() => sendMessage('Hello!')}>
        Send Message
      </button>
    </div>
  );
}

API Reference

AStackClient

Main client class for managing AI conversations.

Constructor

new AStackClient(config: AStackClientConfig)

Config Options:

  • sessionToken (string, required) - Authentication token from developer SDK
  • userId (string, required) - Unique user identifier
  • debug (boolean) - Enable debug logging
  • reconnectAttempts (number) - Max reconnection attempts (default: 3)
  • reconnectDelay (number) - Delay between reconnects in ms (default: 1000)

Methods

  • connect() - Establish WebRTC connection
  • disconnect() - Close connection and cleanup
  • sendMessage(text: string) - Send text message
  • sendAudio(audio: Blob | ArrayBuffer) - Send audio data
  • sendVideo(video: Blob) - Send video frame
  • setAudioEnabled(enabled: boolean) - Toggle audio input
  • setVideoEnabled(enabled: boolean) - Toggle video input

Events

  • connected - Connection established
  • disconnected - Connection closed
  • error - Error occurred
  • message - Text response received
  • audio - Audio response received
  • video - Video response received
  • usage - Usage metrics update

React Hook

const {
  // State
  isConnected,
  isLoading,
  error,
  messages,
  usage,
  
  // Methods
  connect,
  disconnect,
  sendMessage,
  sendAudio,
  sendVideo,
  startRecording,
  stopRecording,
  
  // Media controls
  setAudioEnabled,
  setVideoEnabled
} = useAStack(config);

Advanced Usage

Custom Audio Processing

// Configure audio constraints
const client = new AStackClient({
  sessionToken: 'token',
  userId: 'user',
  mediaConstraints: {
    audio: {
      echoCancellation: true,
      noiseSuppression: true,
      sampleRate: 48000
    }
  }
});

// Process audio before sending
client.on('audioInput', (audioData) => {
  const processed = processAudio(audioData);
  client.sendAudio(processed);
});

Usage Monitoring

// Monitor usage in real-time
client.on('usage', (metrics) => {
  console.log('Characters:', metrics.characterCount);
  console.log('Audio minutes:', metrics.audioMinutes);
  console.log('Session duration:', metrics.sessionDuration);
});

// Get cumulative usage
const totalUsage = client.getUsage();

Error Handling

client.on('error', (error) => {
  switch (error.code) {
    case 'CONNECTION_FAILED':
      // Handle connection errors
      break;
    case 'QUOTA_EXCEEDED':
      // Handle usage limits
      break;
    case 'AUTHENTICATION_FAILED':
      // Handle auth errors
      break;
  }
});

Browser Support

  • Chrome/Edge 88+
  • Firefox 78+
  • Safari 14+
  • Mobile browsers with WebRTC support

Development

# Install dependencies
npm install

# Run tests
npm test

# Build SDK
npm run build

# Development mode with watch
npm run dev

# Type checking
npm run typecheck

# Linting
npm run lint

Examples

See the examples/ directory for complete working examples:

  • basic-usage.html - Vanilla JavaScript implementation
  • react-example.tsx - React component with full UI

License

MIT © AStack Team

Support