JSPM

  • Created
  • Published
  • Downloads 389
  • Score
    100M100P100Q114950F
  • 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

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 type /ptt to redirect the model on the fly.

Installation

Add the plugin to your ~/.config/opencode/opencode.json:

{
  "plugin": [
    "opencode-interrupt-plugin"
  ]
}

The plugin handles TTS streaming, voice overlap detection, interrupt injection, and the /ptt walkie-talkie slash command.

Usage

Walkie-Talkie Mode

Type /ptt to toggle recording, speak, then type /ptt again to send:

  1. The model is generating a response — TTS is playing
  2. Type /ptt — generation aborts, TTS stops, mic starts recording
  3. Speak your correction
  4. Type /ptt again — audio is transcribed via Whisper and sent as your next message
  5. The model responds to your correction
[Model speaking]  →  type /ptt → speak correction → type /ptt → 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

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
  • /ptt command: command.execute.before hook intercepts /ptt, toggles recording on/off, transcribes via whisper.cpp, and sends the transcript via session.prompt()