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 🙏

© 2025 – Pkg Stats / Ryan Hefner

voice-agent

v1.1.8

Published

A Vue.js voice agent plugin for real-time voice communication via WebSocket

Readme

Voice Agent

A Vue.js voice and video calling component with WebSocket support, audio/video processing, and pure functional API.

Features

  • 🎤 Real-time audio recording and playback
  • 📹 Video calling with camera support
  • 🔊 Audio visualization effects
  • 📞 Multiple phone number switching
  • 💬 Conversation history
  • 🔄 Automatic reconnection
  • 📱 Mobile-friendly
  • Pure functional API - no component tags needed

Installation

npm install voice-agent

Quick Start

import { startVoiceAgent, stopVoiceAgent, isVoiceAgentRunning, getVoiceAgentStatus } from 'voice-agent'

// Basic configuration
const config = {
  websocket: {
    url: 'ws://your-websocket-server.com',
    token: 'your-auth-token'
  },
  user: {
    phoneId: '0980714296',
    phoneList: ['0987154520', '0980714296']
  },
  callbacks: {
    onConnect: () => console.log('Connected'),
    onDisconnect: () => console.log('Disconnected'),
    onTranscript: (text) => console.log('Transcript:', text),
    onError: (error) => console.error('Error:', error)
  }
}

// Start voice agent
await startVoiceAgent(config)

// Stop voice agent  
await stopVoiceAgent()

// Check status
const isRunning = isVoiceAgentRunning()
const status = getVoiceAgentStatus()

Configuration Options

Required Settings

{
  websocket: {
    url: 'ws://your-server.com',    // WebSocket server URL
    token: 'your-auth-token'        // Authentication token
  },
  user: {
    phoneId: '0980714296',          // Current phone number
    phoneList: ['...']              // Available phone numbers
  }
}

Optional Settings

{
  audio: {
    chunkDuration: 1000,            // Audio chunk duration (ms)
    sampleRate: 16000               // Sample rate
  },
  video: {
    enabled: true,                  // Enable video calls
    frameRate: 2,                   // Video frame rate (FPS)
    quality: 0.8                    // Video quality (0.1-1.0)
  },
  ui: {
    showLogs: true,                 // Show debug logs
    showVisualizer: true            // Show audio visualizer
  }
}

API Methods

| Method | Description | Returns | |--------|-------------|---------| | startVoiceAgent(config) | Start voice agent with config | Promise<{success, message}> | | stopVoiceAgent() | Stop and cleanup | Promise<{success, message}> | | isVoiceAgentRunning() | Check if running | boolean | | getVoiceAgentStatus() | Get detailed status | StatusObject |

Status Object

{
  isModalOpen: boolean,       // UI modal state
  isConnected: boolean,       // WebSocket connection
  isRecording: boolean,       // Audio recording state
  isInitializing: boolean,    // Initialization state
  connectionStatus: string,   // Connection description
  conversationCount: number   // Number of conversations
}

Vue Component Example

<template>
  <div>
    <button @click="start" :disabled="status.isModalOpen">Start</button>
    <button @click="stop" :disabled="!status.isModalOpen">Stop</button>
  </div>
</template>

<script setup>
import { startVoiceAgent, stopVoiceAgent, getVoiceAgentStatus } from 'voice-agent'
import { ref } from 'vue'

const status = ref({})

const start = async () => {
  await startVoiceAgent(config)
  status.value = getVoiceAgentStatus()
}

const stop = async () => {
  await stopVoiceAgent()
  status.value = getVoiceAgentStatus()
}
</script>

Key Advantages

  • No Component Tags - Pure functional API calls
  • Auto DOM Management - Handles UI creation/cleanup
  • Singleton Pattern - Prevents conflicts
  • Full Lifecycle - Complete resource management
  • Video Support - Seamless audio/video switching
  • Mobile Ready - Touch-optimized interface

Browser Requirements

  • Chrome 60+, Firefox 55+, Safari 11+, Edge 79+
  • WebRTC, Web Audio API, WebSocket, getUserMedia support

License

MIT