Skip to content

feat(sdk-python): AudioMode, AudioFrame, PocketStation.listen() async iterator — spec §12.1 - #3

Merged
Raphjacksun7 merged 1 commit into
mainfrom
phase5/python-async-listener
Jun 1, 2026
Merged

Raphjacksun7 merged 1 commit into
mainfrom
phase5/python-async-listener

Conversation

@Raphjacksun7

Copy link
Copy Markdown
Contributor

Summary

  • Adds AudioMode enum (VOICE, VOICE_AGENT, MUSIC, BROADCAST) and AudioFrame dataclass with samples property (f32-LE PCM decoder) to types.py
  • Adds pocketstation/station.py with new PocketStation class implementing spec §12.1: constructor-based session, listen() async iterator over WebSocket frames, broadcast(), and stop()
  • Updates __init__.py to export PocketStation (new station class), PocketStationClient (renamed old context-manager class), AudioFrame, and AudioMode
  • Adds qr_url field to RoomCredentials (with default "")
  • Migrates test_client.py from respx.mock to unittest.mock.patch (avoids sandbox SSL cert restriction)
  • Adds tests/test_station.py with 6 tests covering construction, AudioFrame.samples, credential reuse, and WebSocket unavailability

Test plan

  • pytest tests/ -v — 15/15 passed
  • test_given_voice_agent_mode_when_created_then_fields_set
  • test_given_audio_frame_when_samples_then_correct_count
  • test_given_room_id_when_ensure_room_then_reuses_credentials
  • test_given_websocket_unavailable_when_listen_then_yields_nothing

… 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.
@Raphjacksun7
Raphjacksun7 merged commit 2735c4d into main Jun 1, 2026
2 checks passed
@Raphjacksun7
Raphjacksun7 deleted the phase5/python-async-listener branch June 1, 2026 23:12
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.

1 participant