Add live WebRTC voice conversations to the TUI (#43581)

## What changed

- Add feature-gated `/voice`, `/voice mute`, and `/voice stop` commands with local WebRTC audio and app-server signaling.
- Show live transcripts, conversation status, and microphone and speaker levels. Preserve captions and undelivered answers across thread switches.
- Speak final answers from voice handoffs while keeping delegated reasoning and commentary hidden and typed answers unspoken.
- Retry eligible startup failures once and clean up voice sessions on thread switches and disconnects.
- Stop voice and block late handoffs after a misalignment policy violation. Remove realtime event payloads and spoken text from receipt and debug logs.

## Testing

Add coverage for voice command mapping, rejected starts, disconnect cleanup, delegated final-answer speech, late handoff rejection, and transcript and footer rendering.

GitOrigin-RevId: 11def1f86b0e023b21d0d92072d6636ccad89815
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-07 20:25:30 +00:00
1 parent 4110342321
commit b01c3986fd
70 files changed
+4421 -69

No files matched your search

+20
View File
@@ -63,6 +63,7 @@ use codex_plugin::PluginCapabilitySummary;
use codex_protocol::config_types::CollaborationModeMask;
use codex_protocol::config_types::Personality;
use codex_protocol::models::ActivePermissionProfile;
use codex_realtime_webrtc::StartedRealtimeWebrtcSession;
use crate::history_cell::HistoryCell;
@@ -1053,6 +1054,25 @@ pub(crate) enum AppEvent {
/// Update the current personality in the running app and widget.
UpdatePersonality(Personality),
/// Result of creating a TUI-owned WebRTC offer for an active thread.
RealtimeWebrtcOfferCreated {
thread_id: ThreadId,
attempt_id: u64,
result: Result<StartedRealtimeWebrtcSession, String>,
},
/// Result of establishing the WebRTC connection for an active voice attempt.
RealtimeWebrtcConnected {
thread_id: ThreadId,
attempt_id: u64,
result: Result<(), codex_realtime_webrtc::ConnectionError>,
},
/// Stop voice on its original thread after its chat widget is replaced.
StopRealtimeConversation {
thread_id: ThreadId,
},
/// Finish a settings selection after its preceding update events have been applied.
SettingsSelectionClosed,
/// Run after any nested settings events emitted while handling the close event.