feat(voice): add voice mode proof-of-concept with Live API integration#20923
Closed
himanshu748 wants to merge 1 commit intogoogle-gemini:mainfrom
Closed
feat(voice): add voice mode proof-of-concept with Live API integration#20923himanshu748 wants to merge 1 commit intogoogle-gemini:mainfrom
himanshu748 wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
…oice command Implement a proof-of-concept voice mode for the Gemini CLI demonstrating the integration pattern for the Gemini Live API's bidirectional WebSocket streaming. This lays the groundwork for hands-free multimodal voice interaction. Core module (packages/core/src/voice/): - VoiceService class wrapping @google/genai Live API session management - Full client-to-server message support (text, audio, tool responses, interrupts) - Typed event emitter for all server-to-client messages (text, audio, transcriptions, tool calls, cancellations, goAway, state changes) - State machine (IDLE -> CONNECTING -> CONNECTED -> LISTENING/RESPONDING) - 54 unit tests covering lifecycle, messaging, error handling, and events CLI integration (packages/cli/): - VoiceMode Ink component with state display, ASCII waveform, transcriptions - /voice slash command using OpenCustomDialogActionReturn pattern - Wired into BuiltinCommandLoader Related to google-gemini#18067
|
You already have 7 pull requests open. Please work on getting existing PRs merged before opening more. |
anowardear062-svg
approved these changes
Mar 4, 2026
|
Thanks for the update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proof-of-concept implementation of voice mode for Gemini CLI, demonstrating the integration pattern for the Gemini Live API's bidirectional WebSocket streaming. This lays the groundwork for hands-free multimodal voice interaction (GSoC 2026 Project 11).
Related to #18067
What's included
Core module (
packages/core/src/voice/)VoiceServiceclass wrapping@google/genaiLive API (GoogleGenAI.live.connect())sendText(),sendAudio(),sendAudioStreamEnd(),sendToolResponse(),sendInterrupt()IDLE → CONNECTING → CONNECTED → LISTENING ↔ RESPONDINGVoiceConfigwith sensible defaults (model, response modality, voice, VAD, sample rates)buildSpeechConfig()helper for SDK speech configurationCLI integration (
packages/cli/)VoiceModeInk component: state indicator, ASCII waveform visualization, transcription display, keyboard controls (ESC to exit, m to mute, Space to interrupt)/voiceslash command usingOpenCustomDialogActionReturnpattern (same pattern as/hooks)BuiltinCommandLoaderWhat's NOT included (future work)
VoiceServicebackend is fully functional for WebSocket streaming — it just needs audio bytes piped in.TOOL_CALLevents are emitted but not yet routed to the existingToolRegistrysessionResumptionbut it's not wired up yetvoicekey in settings schema yetArchitecture decisions
Live API over REST+STT: Uses the native bidirectional WebSocket API (
BidiGenerateContent) rather than bolting STT/TTS onto the existing HTTP streaming pipeline. This gives us server-side VAD, barge-in support, and lower latency.Typed event emitter: Rather than extending
EventEmitter(which loses type safety),VoiceServiceuses a composition pattern with typedon<E>()/off<E>()methods and aVoiceEventMapinterface.LiveServerMessagetyped parameter:handleServerMessage()accepts the SDK'sLiveServerMessagetype directly (fromonmessagecallback), avoidingascasts andeslint-disablesuppressions.Custom dialog pattern: The
/voicecommand follows the establishedOpenCustomDialogActionReturnpattern (same as/hooks), so it integrates cleanly with the existing command system.Testing