Skip to content

feat(telegram): [[audio_as_voice]] tag support#490

Merged
steipete merged 7 commits into
openclaw:mainfrom
jarvis-medmatic:feat/audio-as-voice-tag
Jan 10, 2026
Merged

feat(telegram): [[audio_as_voice]] tag support#490
steipete merged 7 commits into
openclaw:mainfrom
jarvis-medmatic:feat/audio-as-voice-tag

Conversation

@jarvis-medmatic

Copy link
Copy Markdown
Contributor

What

Adds a new [[audio_as_voice]] tag that makes audio blocks in Telegram responses render as voice notes instead of audio files.

Changes:

  • Detect [[audio_as_voice]] tag in splitMediaFromOutput()
  • Buffer audio blocks during streaming, flush at end with the voice flag
  • Non-audio media still streams immediately
  • Add voice.ts module to centralize voice compatibility decisions
  • Guard voice sends with proper format validation
  • Fix flag propagation through PI runner/subscriber chain

Why

Voice notes feel more natural in chat contexts — they show waveforms, auto-play inline, and match user expectations for conversational audio. This gives agents a way to opt into that UX.

Testing

  • New test coverage in send.test.ts
  • Manually tested with Telegram voice sends
  • Linter passes

AI Disclosure 🤖

Built by Jarvis (Claude) with Manuel's guidance. Fully tested, code reviewed and understood.

@obviyus obviyus self-assigned this Jan 9, 2026
@obviyus

obviyus commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Hi, thank you for the PR. A few notes:

  • When you rebase onto main, please be mindful of the block‑streaming timeout path. In main we set blockReplyAborted to skip remaining blocks after a timeout. Your buffered‑audio flush currently bypasses that guard, so audio can send out‑of‑order. Please ensure the flush respects blockReplyAborted (or avoids buffering once aborted).
  • Please resolve the merge conflicts; I’m happy to re‑review after that.

Also, is this PR effective in practice? AFAIK Telegram voice notes (with the waveforms that you mean) require ogg/opus, but we don’t transcode the audio the agent generates (unless that is specific to your workflow). How often will Clawdbot produce ogg/opus unless you add conversion?

@steipete steipete assigned steipete and unassigned obviyus Jan 10, 2026
jarvis-medmatic and others added 7 commits January 10, 2026 01:41
- Add [[audio_as_voice]] detection to splitMediaFromOutput()
- Pass audioAsVoice through onBlockReply callback chain
- Buffer audio blocks during streaming, flush at end with correct flag
- Non-audio media still streams immediately
- Fix: emit payloads with audioAsVoice flag even if text is empty

Co-authored-by: Manuel Hettich <17690367+ManuelHettich@users.noreply.github.com>
- Keep audioAsVoice-only payloads from being filtered out
- Allow empty payloads through when they carry the flag
- Remove temporary debug logs around audioAsVoice buffering

Co-authored-by: Manuel Hettich <17690367+ManuelHettich@users.noreply.github.com>
- Share voice compatibility decision logic across send + bot flows
- Keep voice fallback logging consistent
- Simplify voice handling in the audio send path
- Allow flag-only chunks so audio_as_voice propagates
- Keep reply item scan aware of empty audio tag blocks

Co-authored-by: Manuel Hettich <17690367+ManuelHettich@users.noreply.github.com>
Co-authored-by: Manuel Hettich <17690367+ManuelHettich@users.noreply.github.com>
@steipete steipete force-pushed the feat/audio-as-voice-tag branch from 5015770 to c56b2f4 Compare January 10, 2026 00:51
@steipete steipete merged commit f4b3869 into openclaw:main Jan 10, 2026
7 of 20 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: c56b2f4\n- Merge commit: f4b3869\n\nThanks @jarvis-medmatic!

lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…ice-tag

feat(telegram): `[[audio_as_voice]]` tag support
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…ice-tag

feat(telegram): `[[audio_as_voice]]` tag support
franciscomaestre added a commit to franciscomaestre/openclaw that referenced this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants