|
| 1 | +/* |
| 2 | + * Copyright 2025 LiveKit |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import Foundation |
| 18 | + |
| 19 | +// Quicktype cannot generate both at the same time |
| 20 | +extension AgentAttributes: Hashable {} |
| 21 | +extension AgentAttributes: Equatable {} |
| 22 | + |
| 23 | +// MARK: - AgentAttributes |
| 24 | + |
| 25 | +struct AgentAttributes: Codable, Sendable { |
| 26 | + let lkAgentInputs: [AgentInput]? |
| 27 | + let lkAgentOutputs: [AgentOutput]? |
| 28 | + let lkAgentState: AgentState? |
| 29 | + let lkPublishOnBehalf: String? |
| 30 | + |
| 31 | + enum CodingKeys: String, CodingKey { |
| 32 | + case lkAgentInputs = "lk.agent.inputs" |
| 33 | + case lkAgentOutputs = "lk.agent.outputs" |
| 34 | + case lkAgentState = "lk.agent.state" |
| 35 | + case lkPublishOnBehalf = "lk.publish_on_behalf" |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +enum AgentInput: String, Codable, Sendable { |
| 40 | + case audio |
| 41 | + case text |
| 42 | + case video |
| 43 | +} |
| 44 | + |
| 45 | +enum AgentOutput: String, Codable, Sendable { |
| 46 | + case audio |
| 47 | + case transcription |
| 48 | +} |
| 49 | + |
| 50 | +public enum AgentState: String, Codable, Sendable { |
| 51 | + case idle |
| 52 | + case initializing |
| 53 | + case listening |
| 54 | + case speaking |
| 55 | + case thinking |
| 56 | +} |
| 57 | + |
| 58 | +/// Schema for transcription-related attributes |
| 59 | + |
| 60 | +// MARK: - TranscriptionAttributes |
| 61 | + |
| 62 | +struct TranscriptionAttributes: Codable, Sendable { |
| 63 | + /// The segment id of the transcription |
| 64 | + let lkSegmentID: String? |
| 65 | + /// The associated track id of the transcription |
| 66 | + let lkTranscribedTrackID: String? |
| 67 | + /// Whether the transcription is final |
| 68 | + let lkTranscriptionFinal: Bool? |
| 69 | + |
| 70 | + enum CodingKeys: String, CodingKey { |
| 71 | + case lkSegmentID = "lk.segment_id" |
| 72 | + case lkTranscribedTrackID = "lk.transcribed_track_id" |
| 73 | + case lkTranscriptionFinal = "lk.transcription_final" |
| 74 | + } |
| 75 | +} |
0 commit comments