feat(sdk-python): AudioMode, AudioFrame, PocketStation.listen() async iterator — spec §12.1 - #3
Merged
Merged
Conversation
… iterator — spec §12.1 Adds spec §12.1 voice agent pattern: AudioMode enum, AudioFrame dataclass with f32-LE samples decoder, and PocketStation session class with listen() async iterator, broadcast(), and stop(). Updates __init__.py exports and migrates test_client.py from respx to unittest.mock to avoid sandbox SSL restrictions.
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
AudioModeenum (VOICE, VOICE_AGENT, MUSIC, BROADCAST) andAudioFramedataclass withsamplesproperty (f32-LE PCM decoder) totypes.pypocketstation/station.pywith newPocketStationclass implementing spec §12.1: constructor-based session,listen()async iterator over WebSocket frames,broadcast(), andstop()__init__.pyto exportPocketStation(new station class),PocketStationClient(renamed old context-manager class),AudioFrame, andAudioModeqr_urlfield toRoomCredentials(with default"")test_client.pyfromrespx.mocktounittest.mock.patch(avoids sandbox SSL cert restriction)tests/test_station.pywith 6 tests covering construction,AudioFrame.samples, credential reuse, and WebSocket unavailabilityTest plan
pytest tests/ -v— 15/15 passedtest_given_voice_agent_mode_when_created_then_fields_settest_given_audio_frame_when_samples_then_correct_counttest_given_room_id_when_ensure_room_then_reuses_credentialstest_given_websocket_unavailable_when_listen_then_yields_nothing