SDK hardening - onError, Callbacks & audio pipeline control - #123
Merged
Conversation
…t tools version to 6.2. Removed dependency on swift-async-algorithms.
…stency. Adjusted indentation and formatting in ci.yml, ensuring uniformity across job definitions and steps.
…config & startup metrics
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive startup state tracking, audio alignment support, and improved testing infrastructure to the ElevenLabs SDK. The changes enable better observability of the conversation initialization process and expose character-level timing information from audio synthesis.
- Added startup state machine tracking with metrics for each initialization phase (token fetch, room connection, agent ready, conversation init)
- Implemented audio alignment support with character-level timing information for TTS output
- Introduced protocol-based dependency injection to enable comprehensive unit testing with mocks
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/ElevenLabs/Conversation.swift | Refactored startup flow to track state transitions and metrics; added audio alignment and callback support; introduced dependency injection pattern |
| Sources/ElevenLabs/Networking/ConnectionManager.swift | Added agent ready wait mechanism with timeout support; exposed publish method; implemented error handler callback |
| Sources/ElevenLabs/Protocol/IncomingEvents.swift | Added AudioAlignment struct to support character-level timing metadata for audio events |
| Sources/ElevenLabs/Protocol/EventParser.swift | Updated audio event parser to handle optional alignment data |
| Sources/ElevenLabs/Models/ConversationConfig.swift | Added multiple event callbacks and configuration options for startup behavior, audio pipeline, and event notifications |
| Sources/ElevenLabs/Models/AudioPipelineConfiguration.swift | New configuration struct for controlling microphone behavior and voice activity detection |
| Sources/ElevenLabs/DI/Dependencies.swift | Introduced protocols for dependency injection (TokenServicing, ConnectionManaging, ConversationDependencyProvider) |
| Tests/ElevenLabsTests/Mocks/*.swift | Created comprehensive mock implementations and test dependency provider for unit testing |
| Tests/ElevenLabsTests/Tests/ConversationTests.swift | Added extensive test coverage for startup flows, error handling, and callback behavior |
| Tests/ElevenLabsTests/Tests/EventParserTests.swift | Added test for parsing audio events with alignment data |
| Sources/ElevenLabs/Protocol/schemas/agent.asyncapi.yaml | Added AudioAlignment schema definition matching the server API specification |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
louisjoecodes
force-pushed
the
feat/sdk-hardening
branch
from
November 4, 2025 18:21
7bdd427 to
921c42f
Compare
…tion options Added documentation for SDK hardening features: - Error handling with onError callback - Startup state monitoring with onStartupStateChange - Event callbacks (onAgentResponse, onUserTranscript, onInterruption, etc.) - Audio alignment for word highlighting - Audio pipeline configuration - Network configuration (ICE/TURN strategies) - Startup configuration (timeouts, retries) - VAD score monitoring - Complete configuration examples Documents all features added in the SDK hardening effort.
louisjoecodes
force-pushed
the
feat/sdk-hardening
branch
from
November 4, 2025 19:00
4d74b27 to
bf15a2d
Compare
…requirement) SwiftFormat's default 'redundantSelf' rule removes self., but Swift 6 strict concurrency REQUIRES explicit self. in closures to make capture semantics clear. This config ensures swiftformat won't break strict concurrency compliance.
renal128
added a commit
that referenced
this pull request
May 17, 2026
The errorHandler hook on ConversationDependencyProvider and ConnectionManaging was a no-op in prod since #123 — Dependencies always returned nil, and 5 of 6 connection-manager call sites already throw the same error. Removed from the provider, both real connection managers, both mocks, and TestDependencyProvider.
renal128
added a commit
that referenced
this pull request
May 18, 2026
The errorHandler hook on ConversationDependencyProvider and ConnectionManaging was a no-op in prod since #123 — Dependencies always returned nil, and 5 of 6 connection-manager call sites already throw the same error. Removed from the provider, both real connection managers, both mocks, and TestDependencyProvider.
renal128
added a commit
that referenced
this pull request
May 19, 2026
The errorHandler hook on ConversationDependencyProvider and ConnectionManaging was a no-op in prod since #123 — Dependencies always returned nil, and 5 of 6 connection-manager call sites already throw the same error. Removed from the provider, both real connection managers, both mocks, and TestDependencyProvider.
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.
Uh oh!
There was an error while loading. Please reload this page.