JSPM

  • Created
  • Published
  • Downloads 582
  • Score
    100M100P100Q114878F
  • License SEE LICENSE IN LICENSE

Streaming TTS + voice interruption for OpenCode. Speaks responses as they arrive and detects when you talk over it.

Package Exports

  • opencode-interrupt-plugin
  • opencode-interrupt-plugin/tui

Readme

OpenCode Interrupt Plugin

Streaming TTS + voice interruption for OpenCode. Speaks responses as they arrive and detects when you talk over it. Walkie-talkie mode lets you hold the spacebar to redirect the model on the fly.

Installation

Add both the server plugin and the TUI plugin to your ~/.config/opencode/opencode.json:

{
  "plugin": [
    "opencode-interrupt-plugin",
    "opencode-interrupt-plugin/tui"
  ]
}

The server plugin handles TTS streaming, voice overlap detection, and interrupt injection. The TUI plugin adds the walkie-talkie keybinding (space).

Usage

Walkie-Talkie Mode

Hold down the spacebar while speaking, then release it to redirect the model:

  1. The model is generating a response — TTS is playing
  2. Press and hold spacebar — generation aborts, TTS stops, mic starts recording
  3. Speak your correction while holding spacebar
  4. Release spacebar — audio is transcribed via Whisper and sent as your next message
  5. The model responds to your correction
[Model speaking]  →  hold space → speak correction → release space → model redirects

Requires whisper.cpp with the base model installed. Run the one-command install script:

bash scripts/install-whisper.sh

Or set OPENAI_API_KEY in your environment as a fallback.

Voice Interruption (server plugin)

When TTS is playing, just speak — the plugin detects your voice, stops TTS, and marks the session for correction injection.

Configuration

Setting Type Default Description
licenseKey string none License key (omit for free mode)
micThreshold number 0.008 Voice activation threshold (free mode locked)
timingWindowMs number 3000 How long after interrupt to accept corrections

Environment Variables

  • OPENAI_API_KEY — optional fallback for Whisper transcription (used if whisper CLI is not found)
  • WHISPER_MODEL — path to whisper.cpp model file (default: ~/.local/bin/ggml-base.bin)
  • EDGE_TTS_VOICE — TTS voice (default: en-US-AriaNeural)

How It Works

  • Server plugin: Monitors mic via sox (continuous PCM pipe), detects voice during TTS playback, injects correction context into the next LLM request
  • TUI plugin: Registers a space keybinding in OpenCode's TUI keymap; key repeats while held keep the recording active; 300ms of silence after release triggers transcription and redirect