Skip to content

Commit f7cadfc

Browse files
committed
feat(client): replace ElevenLabs entry point with ConversationClient
- ConversationClient (new, ObservableObject) replaces the static ElevenLabs.startConversation(...) factories and process-wide ElevenLabs.configure(_:)/ElevenLabsConfiguration -- it's a reusable, long-lived object (init(callbacks:), start(auth:config:) async throws, endConversation(), reset()) instead of a one-shot factory returning a Conversation. ElevenLabs.version (public) has no replacement -- SDKVersion.version is internal-only now. - Conversation is no longer public -- it's an internal session type ConversationClient owns per start() call. Its new AsyncStream-serialized event pipeline (eventStreamContinuation/eventConsumerTask) replaces direct closure dispatch from the connection manager. toggleMute/ setMuted/isMuted are renamed toggleMicMute/setMicMuted/isMicMuted, and gain a symmetric toggleAgentMute/setAgentMuted/isAgentMuted; calling the mic-mute methods while disconnected is now a lenient no-op instead of throwing .notConnected. inputTrack/agentAudioTrack (raw LiveKit track access) and audioDevices/selectedAudioDeviceID (device enumeration) are removed with no replacement. sendToolResult's generic Encodable overload is gone -- only the Any-based overload remains, so a plain Encodable struct now throws ConversationError.invalidToolResult instead of JSON-encoding automatically. - CallInfo (agentId-carrying struct) is deleted -- ConversationState no longer exposes the connected agent's id at all. - Removes the dead onRawMessage plumbing that shipped with this v4 import: both connection managers declared it and Conversation.messageSource(for:) existed to feed it, but nothing ever wired connectionManager.onRawMessage to actually fire, so the documented public ConversationCallbacks.onMessage callback could never fire either. Removed both rather than ship a callback that silently never calls back; confirmed via a test (testRawMessageCallbackReceivesSourceAndRawJSON) that failed exactly this way before the fix. - Test updates are almost entirely mechanical renames to match the above (ConversationOptions -> ConversationCallbacks/ConversationConfig split, .active(CallInfo) -> .connected, ElevenLabs.* -> ConversationClient/ ConversationAuth/ElevenLabsEndpoints), plus one real fix: the hardcoded SDK-version string in ElevenLabsSDKTests was still "3.2.0", stale against the intentional 3.2.2 bump already on this branch. ConversationConfigTests/EventSerializerTests/ConversationEventHandlerTests gained real new coverage for the config/event changes earlier in this stack (see their respective commits). Coverage lost with no direct replacement: testSendToolResultEncodesEncodableResult (tracks the Encodable-overload removal above) and testTextOnlyStartDisconnectsPreviousActiveManagerBeforeSwitchingTransports (WebRTC->WebSocket teardown-before-switch ordering). Full suite: 154 tests, 0 failures.
1 parent 5b6b43c commit f7cadfc

18 files changed

Lines changed: 1325 additions & 1390 deletions

Sources/ElevenLabs/Public/Conversation/Conversation.swift

Lines changed: 489 additions & 312 deletions
Large diffs are not rendered by default.

Sources/ElevenLabs/Public/Conversation/ConversationOptions.swift

Lines changed: 0 additions & 179 deletions
This file was deleted.

Sources/ElevenLabs/Public/Conversation/Models/CallInfo.swift

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)