appendTranscriptSegment (lib/webSpeechRecognizer.ts)

opencode-manager · frontend/src/lib/webSpeechRecognizer.ts · typescript · MIT
voice

TypeScript class wrapping Web Speech API to capture, process, and emit speech recognition results.

// Source: https://github.com/chriswritescode-dev/opencode-manager | License: MIT | Copyright 2025 Chris Scott
// Provided via justclaw.it.com; keep this notice with the code.
export interface SpeechRecognitionResult {
  transcript: string;
  isFinal: boolean;
  confidence: number;
}

/**
 * Why a capture session ended without the caller stopping it.
 */
export type SttEndOfSpeechReason = 'pause' | 'no-speech';

/**
 * Client-side endpointing budget for one capture session.
 */
export interface SttEndpointingOptions {
  /** Silence after speech, in milliseconds, that ends the session. */
  pauseMs: number;
  /** Silence from capture start, in milliseconds, before any speech is heard. */
  noSpeechTimeoutMs: number;
}

export interface SpeechRecognitionOptions {
  language?: string;
  inter

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key