Skip to content

Commit 1e35f76

Browse files
committed
chore: fix agent state
1 parent 66b39a7 commit 1e35f76

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
),
2020
],
2121
dependencies: [
22-
.package(url: "https://github.com/livekit/client-sdk-swift.git", exact: "2.6.1"),
22+
.package(url: "https://github.com/livekit/client-sdk-swift.git", from: "2.6.1"),
2323
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.3"),
2424
],
2525
targets: [

Sources/ElevenLabs/Conversation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ public final class Conversation: ObservableObject, RoomDelegate {
633633
appendAgentMessage(e.response)
634634
lastAgentEventId = e.eventId
635635
options.onAgentResponse?(e.response, e.eventId)
636-
if lastFeedbackSubmittedEventId == nil || e.eventId > (lastFeedbackSubmittedEventId ?? 0) {
636+
if lastFeedbackSubmittedEventId.map({ e.eventId > $0 }) ?? true {
637637
options.onCanSendFeedbackChange?(true)
638638
}
639639

Sources/ElevenLabs/ElevenLabs.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ public enum ElevenLabs {
192192
// MARK: - Re-exports
193193

194194
// Protocol event types are already public from their respective files
195-
// Re-export AgentState from LiveKit for SDK users
196-
public typealias AgentState = LiveKit.AgentState
197195
public typealias SpeechActivityEvent = LiveKit.SpeechActivityEvent
198196
public typealias MicrophoneMuteMode = LiveKit.MicrophoneMuteMode
199197
public typealias IceTransportPolicy = LiveKit.IceTransportPolicy
@@ -256,4 +254,12 @@ public extension ElevenLabs {
256254
case debug
257255
case trace
258256
}
257+
258+
/// Agent state indicating what the agent is currently doing.
259+
public enum AgentState: Sendable, Equatable {
260+
/// Agent is listening to the user
261+
case listening
262+
/// Agent is speaking
263+
case speaking
264+
}
259265
}

Tests/ElevenLabsTests/Mocks/MockTokenService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@testable import ElevenLabs
22
import Foundation
33

4-
final class MockTokenService: @unchecked Sendable {
4+
@MainActor
5+
final class MockTokenService {
56
enum Scenario {
67
case success
78
case authenticationFailed(String)

0 commit comments

Comments
 (0)