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

@sonoba/pipeline

v0.1.4

Published

Voice Pipeline orchestration server — STT/LLM/TTS adapters, WebSocket session management, browser-driven and agent-driven flows

Downloads

729

Readme

@sonoba/pipeline

npm license

Voice Pipeline orchestration server for the sonoba WebSocket voice protocol. Turns swappable STT / LLM / TTS providers into a session-managed pipeline that talks to @sonoba/voice-client browsers.

Looking for the frontend SDK? See @sonoba/voice-client and @sonoba/voice-client-react. This package is the server side of the same protocol.


Install

npm install @sonoba/pipeline @sonoba/shared

@sonoba/shared is a peer of the protocol surface and a hard dependency — install it explicitly so your TypeScript types resolve to the same version the server emits.


What's in the box

Two entry shapes for two integration styles:

| Entry | Use when... | |---|---| | startServer / createOwnershipHandler (ws-handler.ts) | You're building a new app on the protocol and want the canonical session:startsession:ack → typed-message flow with built-in ownership / grace / factory_failed envelopes. | | BrowserWSServer + BrowserVoicePipeline (browser-ws-server.ts, browser-voice-pipeline.ts) | You're lifting a host that already drives the agent push-style (e.g. a Minecraft AI), where TTS/STT are wired through TTSAdapter / STTAdapter factories per session. |

Both honour the same @sonoba/shared envelope shape; both emit session:ack so the SDK's resume gate releases promptly.

Provider adapters

Pull-style providers (used by the LLM-driven VoicePipeline):

  • STT: DeepgramSTTProvider, OpenAISTTProvider
  • LLM: ExternalAgentLLMProvider (and AnthropicLLMProvider if you install the optional @anthropic-ai/sdk)
  • TTS: AivisSpeechTTSProvider, ElevenLabsTTSProvider, AivisCloudTTSProvider

Push-style adapters (used by BrowserVoicePipeline):

  • TTS: AivisSpeechAdapter, ElevenLabsAdapter, AivisCloudAdapter
  • STT: PipelineSTTAdapter

Adapters / providers are constructed lazily per session via the factory you supply to createPipeline / startServer, so per-tenant configuration (API keys, voice IDs, locale, prompts) stays isolated.


Quickstart — startServer

import { startServer } from '@sonoba/pipeline';
import { OpenAISTTProvider } from '@sonoba/pipeline';
import { AivisSpeechTTSProvider } from '@sonoba/pipeline';

const server = await startServer({
  port: 8080,
  // Per-session factories — called once per session:start envelope.
  sttFactory: (sessionId, config) => new OpenAISTTProvider({
    apiKey: process.env.OPENAI_API_KEY!,
    model: 'gpt-4o-mini-transcribe',
    language: config.language ?? 'ja',
  }),
  ttsFactory: (sessionId, config) => new AivisSpeechTTSProvider({
    baseUrl: process.env.AIVISSPEECH_URL ?? 'http://localhost:10101',
    voiceId: config.voiceId ?? 1999504576,
  }),
  // LLM factory wires whatever agent you have. Use `ExternalAgentLLMProvider`
  // to bridge to a separate agent process via WebSocket.
  llmFactory: (sessionId, config, transport) =>
    new ExternalAgentLLMProvider({ transport, sessionId }),
});

The server now accepts SDK clients on ws://localhost:8080/. See packages/pipeline/src/ws-handler.ts:32 for the full options surface (verifyClient, transcriptGraceMs, ownership grace ms, ping interval, etc.).


Protocol parity

This package implements the server side of the protocol declared in @sonoba/shared protocol.ts:

  • Accepts: session:start, audio:vad_start, audio:vad_end, audio:vad_cancel, audio:barge_in, text:input, plus binary mic frames between VAD envelopes.
  • Emits: session:ack, transcript:user, transcript:agent (delta — see below), audio:tts_start, audio:tts_end, plus binary TTS frames.

transcript:agent.text is a delta (per the @sonoba/shared 0.2.0 contract) — server emits each LLM token / inject chunk as the slice produced since the last emission for the same streamId, then a final { text: '', isFinal: true, streamId } marker. Consumers must accumulate; the React Provider in @sonoba/voice-client-react does this for you.


License

MIT © sonoba