Reorganize some files - #223
Conversation
| disconnectReason: DisconnectionReason = .user, | ||
| endReason: EndReason = .userEnded |
There was a problem hiding this comment.
redundant, just one reason is enough
| switch await waitForAgentReady(timeout: agentTimeout) { | ||
| case let .success(elapsed): | ||
| metrics.agentReady = elapsed | ||
| onStartupStateChange(.agentReady(ConversationAgentReadyReport(elapsed: elapsed))) |
There was a problem hiding this comment.
unnecessary wrapper class with a single field
|
|
||
| /// Configuration for event-based agent state management using VAD and client events. | ||
| /// Pass `nil` to use the default LiveKit-based behaviour. | ||
| public struct AgentStateConfiguration: Sendable { |
There was a problem hiding this comment.
Moved to ConfigurationConfig.swift
| @@ -1,16 +0,0 @@ | |||
| import Foundation | |||
|
|
|||
| public struct ConversationStartupConfiguration: Sendable, Equatable { | |||
There was a problem hiding this comment.
Moved to ConfigurationConfig.swift
| import Foundation | ||
|
|
||
| /// Configures microphone pipeline and voice activity reporting exposed by the SDK. | ||
| public struct AudioPipelineConfiguration: Sendable { |
There was a problem hiding this comment.
Moved to ConfigurationConfig.swift
| @@ -1,6 +0,0 @@ | |||
| import Foundation | |||
|
|
|||
| public enum EndReason: Equatable, Sendable { | |||
There was a problem hiding this comment.
Moved to ConversationState.swift
| @@ -1,6 +0,0 @@ | |||
| import Foundation | |||
|
|
|||
| public struct CallInfo: Equatable, Sendable { | |||
There was a problem hiding this comment.
Moved to ConversationState.swift
| @@ -1,9 +0,0 @@ | |||
| import Foundation | |||
|
|
|||
| public struct ConversationAgentReadyReport: Sendable, Equatable { | |||
There was a problem hiding this comment.
Deleted the wrapper class in favor of using elapsed directly
| @@ -1,4 +0,0 @@ | |||
| public struct ConversationStartResult: Equatable, Sendable { | |||
There was a problem hiding this comment.
Moved to ConversationStartup.swift
| import Foundation | ||
|
|
||
| /// In-flight startup stage while `ConversationState` is `.connecting`. | ||
| public enum ConversationStartupState: Sendable, Equatable { |
There was a problem hiding this comment.
Moved to ConversationStartup.swift
9d934e6 to
194d47d
Compare
194d47d to
0a9e852
Compare
cbe68ec to
e548d7c
Compare
e548d7c to
57cc551
Compare
| import Foundation | ||
|
|
||
| /// Agent state indicating what the agent is currently doing. | ||
| public enum AgentState: Sendable, Equatable { |
There was a problem hiding this comment.
moved to Sources/ElevenLabs/Public/Conversation/Models/AgentState.swift
57cc551 to
a9b4019
Compare
a9b4019 to
23ac1e2
Compare
23ac1e2 to
5896c38
Compare
5896c38 to
07e4acc
Compare
07e4acc to
c2aa348
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Use a single EndReason for ConversationState.ended and onDisconnect, and give endConversation one reason parameter. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the one-field wrapper with agentReady(elapsed:) on ConversationStartupState. Co-authored-by: Cursor <cursoragent@cursor.com>
These types only exist as associated values of ConversationState; keep them in the same file and drop the Models junk-drawer entries. Co-authored-by: Cursor <cursoragent@cursor.com>
Move audio, WebRTC, startup, and agent-state configuration into ConversationConfig.swift so session knobs live in one file. Leave AgentState as a separate runtime type. Co-authored-by: Cursor <cursoragent@cursor.com>
Colocate ConversationStartupState, ConversationStartupMetrics, and ConversationStartResult in one file. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
c2aa348 to
1f1ad8d
Compare
Summary
TokenService→ Internal, audio/networking internals,ConversationClient/LogLevelup toPublic/, models underConversation/ModelsDisconnectionReasonintoEndReasonand collapseConversationAgentReadyReportintoagentReady(elapsed:)CallInfo/EndReasonwithConversationState, and session config knobs withConversationConfigConversationStartup.swiftTest plan
swift buildswift testNote
Medium Risk
Breaking changes for SDK consumers (
onDisconnecttype,endConversationsignature, startup state shape, and file/type locations), though behavior is largely preserved and tests were updated accordingly.Overview
This PR reorganizes the ElevenLabs Swift SDK’s conversation surface area and simplifies a few overlapping public types, with matching test updates.
Public API / type model
onDisconnectnow receivesEndReasoninstead ofDisconnectionReason;DisconnectionReasonis removed.endConversationtakes a singlereason: EndReason(no separate disconnect vs end reason).ConversationStartupState.agentReadycarrieselapsed: TimeIntervaldirectly instead of wrappingConversationAgentReadyReport(that struct is removed).CallInfoandEndReasonlive alongsideConversationState; startup types (ConversationStartupState, metrics,ConversationStartResult) are merged intoConversationStartup.swift.WebRTCConfiguration,AgentStateConfiguration,AudioPipelineConfiguration,MicrophoneMuteMode,ConversationStartupConfiguration) are colocated inConversationConfig.swiftinstead of scattered files.AgentStatemoves underConversation/Models/; several small standalone public files are deleted as part of the consolidation.Internal visibility
TokenServiceis no longerpublic(internal SDK use only).Tests
EndReason.remoteDisconnectedinstead ofDisconnectionReason.agent.Reviewed by Cursor Bugbot for commit 1f1ad8d. Bugbot is set up for automated code reviews on this repo. Configure here.