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

@workadventure/livekit-agent-plugin-fake-stt

v0.2.8

Published

Deterministic fake STT provider for LiveKit Agents tests

Readme

@workadventure/livekit-agent-plugin-fake-stt

Deterministic fake STT provider for @livekit/agents.

This plugin is designed for tests and local development where you need predictable streaming STT events without calling external APIs.

Features

  • deterministic streaming event sequence
  • no network calls, no credentials
  • configurable scripts with interim/final steps
  • per-step delays and deterministic jitter
  • stable seed + offset controls
  • optional RECOGNITION_USAGE events

Install

npm install @workadventure/livekit-agent-plugin-fake-stt

Runtime requirement: Node.js 22+.

Peer requirements:

  • @livekit/agents
  • @livekit/rtc-node

Quick Start

import { stt } from '@livekit/agents';
import type { AudioFrame } from '@livekit/rtc-node';
import { STT } from '@workadventure/livekit-agent-plugin-fake-stt';

const fakeStt = new STT({
  emitRecognitionUsage: true,
  script: [['hello partial', 'hello final']],
});

const stream = fakeStt.stream();
const frame = {
  data: new Int16Array(1600),
  sampleRate: 16000,
  channels: 1,
  samplesPerChannel: 1600,
} as unknown as AudioFrame;

stream.pushFrame(frame);
stream.endInput();

for await (const event of stream) {
  switch (event.type) {
    case stt.SpeechEventType.INTERIM_TRANSCRIPT:
    case stt.SpeechEventType.FINAL_TRANSCRIPT:
      console.log(event.alternatives?.[0]?.text ?? '');
      break;
  }
}

Event Model

For each utterance (audio frames up to flush() or endInput()), the stream emits:

  1. START_OF_SPEECH
  2. one or more INTERIM_TRANSCRIPT / FINAL_TRANSCRIPT steps from the configured script
  3. END_OF_SPEECH
  4. optional RECOGNITION_USAGE

Default script:

  • Segment A: interim, interim, final
  • Segment B: interim, final

Segments are reused in deterministic round-robin order.

Configuration

import { STT } from '@workadventure/livekit-agent-plugin-fake-stt';

const fakeStt = new STT({
  language: 'en-US',
  defaultStepDelayMs: 10,
  jitterMs: 2,
  seed: 1234,
  offset: 1,
  emitRecognitionUsage: true,
  script: [
    [
      { text: 'segment-1 partial', final: false, delayMs: 20 },
      { text: 'segment-1 final', final: true },
    ],
    {
      emitUsage: false,
      steps: ['segment-2 partial', 'segment-2 final'],
    },
  ],
});

FakeSTTOptions

  • script: deterministic transcript script. Array of segments.
  • language: default language on transcript alternatives.
  • defaultStepDelayMs: delay used when a step has no explicit delayMs.
  • jitterMs: deterministic signed jitter added to each step delay.
  • seed: stable seed used for script offset and jitter generation.
  • offset: deterministic script cursor offset.
  • emitRecognitionUsage: emit usage events for each utterance.
  • sampleRate: expected input sample rate for stream resampling behavior.

Deterministic Testing Recipes

Stable transcript snapshots

  • set defaultStepDelayMs: 0
  • set jitterMs: 0
  • use explicit script text values

Seeded timing simulation

  • set defaultStepDelayMs and jitterMs
  • pin seed so delay jitter stays reproducible in CI

Script partitioning by utterance

  • call flush() between user turns
  • each flush/end advances to the next script segment

Examples

  • examples/basic-stream.mjs
  • examples/seeded-script.mjs

Build first, then run:

npm run build
node examples/basic-stream.mjs

Development

npm install
npm run lint
npm run typecheck
npm test
npm run build

License

MIT