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

@vocalbridgeai/react

v0.1.1

Published

React bindings for Vocal Bridge Voice Agent SDK

Downloads

385

Readme

@vocalbridgeai/react

React hooks and provider for Vocal Bridge voice agents.

Installation

npm install @vocalbridgeai/sdk @vocalbridgeai/react

Quick Start

import { VocalBridgeProvider, useVocalBridge, useTranscript } from '@vocalbridgeai/react';
import { ConnectionState } from '@vocalbridgeai/sdk';

function App() {
  return (
    <VocalBridgeProvider options={{ auth: { tokenUrl: '/api/voice-token' } }}>
      <VoiceChat />
    </VocalBridgeProvider>
  );
}

function VoiceChat() {
  const { state, connect, disconnect, isMicrophoneEnabled, toggleMicrophone } = useVocalBridge();
  const { transcript } = useTranscript();

  return (
    <div>
      <p>Status: {state}</p>

      {state === ConnectionState.Disconnected ? (
        <button onClick={connect}>Start</button>
      ) : (
        <>
          <button onClick={disconnect}>End</button>
          <button onClick={toggleMicrophone}>
            {isMicrophoneEnabled ? 'Mute' : 'Unmute'}
          </button>
        </>
      )}

      {transcript.map((entry, i) => (
        <p key={i}>
          <strong>{entry.role}:</strong> {entry.text}
        </p>
      ))}
    </div>
  );
}

API

<VocalBridgeProvider>

Wraps your app and creates the VocalBridge instance.

<VocalBridgeProvider options={{ auth: { tokenUrl: '/api/voice-token' } }}>
  {children}
</VocalBridgeProvider>

useVocalBridge()

Primary hook for connection lifecycle.

const {
  state,              // ConnectionState
  connect,            // () => Promise<void>
  disconnect,         // () => Promise<void>
  isMicrophoneEnabled, // boolean
  toggleMicrophone,    // () => Promise<void>
  setMicrophoneEnabled, // (enabled: boolean) => Promise<void>
  sendAction,          // (action, payload?) => Promise<void>
  agentMode,           // string | undefined
  error,               // VocalBridgeError | null
  client,              // VocalBridge instance
} = useVocalBridge();

useTranscript()

Live conversation transcript.

const { transcript, clear } = useTranscript();
// transcript: Array<{ role: 'user' | 'agent', text: string, timestamp: number }>

useAgentActions()

Bidirectional custom actions.

const { lastAction, sendAction, onAction } = useAgentActions();

// Per-action handler with auto-cleanup
useEffect(() => {
  return onAction('show_product', (payload) => {
    setProduct(payload);
  });
}, [onAction]);

// Send action to agent
sendAction('user_clicked_buy', { productId: '123' });

useAIAgent()

AI Agent integration with automatic or manual response flow.

Automatic (callback):

useAIAgent({
  onQuery: async (query) => {
    return await myAgent.ask(query); // auto-responds
  },
});

Manual:

const { pendingQuery, respond } = useAIAgent();

useEffect(() => {
  if (pendingQuery) {
    myAgent.ask(pendingQuery.query).then(answer => {
      respond(pendingQuery.turnId, answer);
    });
  }
}, [pendingQuery]);

License

Apache-2.0