Repository navigation
feat: add voice to the demo app through a LiveKit transport - #191
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
7 of 10 tasks
Adds the public VoiceTransport protocol, through which an app supplies the real-time audio and data connection for voice conversations, and brings the voice session logic into Brand Concierge as internal types: the session controller, the data-channel message parser and the session state. The session claims the app's single transport only while connected, and releases it (clearing the delegate, then disconnecting) before reporting its end, so the transport can be reused by the next conversation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Concierge.show(...) and Concierge.present(...) take an optional voiceTransport, kept across re-shows like textSpeaker. When one is passed, the composer shows a voice button in the send slot; tapping it fetches session credentials from the Concierge service and runs the conversation over the app's transport. The transcript renders in the chat, and typed turns, dictation and data handoffs are held off until the conversation ends. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # AEPBrandConcierge/Sources/Controllers/ChatController.swift
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # AEPBrandConcierge/Tests/UnitTests/ConciergeChatServiceTests.swift
The demo app adds the LiveKit Swift SDK to its own target and implements Brand Concierge's VoiceTransport in LiveKitTransport.swift, a reference for apps to copy. One transport instance is passed to every Concierge.show and Concierge.present call, since a reopened chat keeps the transport it was first shown with. The SDK itself still has no third-party dependency. The getting-started guide now links to the reference transport. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The voice section of the getting-started guide now covers adding LiveKit with Swift Package Manager (also from CocoaPods projects), the microphone usage description, copying the reference transport, passing one instance to every show and present call, and audio quality: voice processing, speaker output, interruptions and the device checks to repeat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nozokada
force-pushed
the
feat/demo-app-voice
branch
from
October 28, 2026 22:42
1af3aab to
f1fb0bf
Compare
…stops LiveKit's preconnect capture starts the shared audio stack's microphone input but never stops it when the room fails to connect, which left the system microphone indicator on after a failed voice start. Disconnecting now stops the microphone input right away, and again once a cancelled join settles. A new connection waits for that teardown. The plain-connect fallback now runs only when preconnect capture could not start, so a failed connection is no longer retried with a second timeout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…talled one LiveKit keeps a cancelled connection attempt going until it times out, and the next connection used to wait for it, so restarting voice right after stopping could take up to 15 seconds. Teardown now only releases the microphone and disconnects the room. The cancelled join gives up as soon as its capture starts, and when a superseded join does end, it releases the microphone only if no newer connection is using it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…redentials Only the voice session itself watched for the app entering the background, and it exists only once the credentials arrive. Going to the background while they were still being fetched left the request running, and the session then connected and opened the microphone. The chat controller now stops voice on background in every phase, cancelling a pending credentials request, so the session no longer watches for it separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nozokada
force-pushed
the
feat/demo-app-voice
branch
from
October 30, 2026 00:12
e66439b to
0d9ab4f
Compare
…re a voice session Track a running voice conversation with ChatController.isVoiceSessionActive instead of a new public ChatState case, so exhaustive switches in host apps keep compiling. Ask for microphone permission before requesting voice credentials. A denial starts nothing and shows the Settings dialog worded for voice conversations, matching Android. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/getting-started.md
Name the reasons the reference transport treats as a normal end, the same set as the Android reference transport. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
ishwetansh
reviewed
Nov 2, 2026
Track the current voice turn the way web's handleTurnDone does. The user's transcript decides the turn; a new user turn closes the open reply, and messages for any other or already finished turn are dropped. The latest ui_payload snapshot is held for the turn. When the turn ends, the reply bubble gets the authoritative text and the sources, followed by the cards, CTAs and suggestions, through the same code typed chat uses. An error or an empty reply replaces the bubble with the new voice.turn.failed copy, still renders the payload and keeps the conversation open. An interrupted turn counts as completed. Add the voice.turn.failed and voice.turn.messageSendFailed copy with web's defaults. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add VoiceTransport.send(_:topic:), which the app implements with reliable delivery. During a voice conversation, a tapped prompt suggestion (including a welcome one) goes to the worker as a text_prompt on the bc-text-input topic, like on web, and is tracked as a submitted query. The user's bubble shows at once and the worker's echo of it is dropped. After the conversation ends, taps stream over SSE as before; the composer stays read-only during voice, as on web. Taps are dropped while connecting or reconnecting, and from the start of the user's speech until the reply starts. A rejected prompt (text_input_error) fails the turn with voice.turn.failed, and a send that throws fails it with voice.turn.messageSendFailed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement VoiceTransport.send in the demo app's LiveKitTransport with reliable delivery, so suggestion taps during voice reach the agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A voice session failure now carries a typed reason with a fixed message. Errors from the app's transport and the bootstrap call can include URLs, tokens or server responses, so their text only goes to the debug log and never to Edge or the warning and error logs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When the final transcript for a turn has no text, the open bubble is removed instead of being left empty, and the next bubble becomes the scroll anchor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
setMicrophoneEnabled returns immediately and can't throw, so a transport whose mute or unmute fails is the only one that knows. Brand Concierge can't tell whether the microphone is live then, so the transport now reports .failed and the conversation ends. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LiveKitTransport changed the microphone in a task and only logged a failure, so Brand Concierge kept the conversation going while the microphone could be live during an interruption or muted while the chat shows Listening. A mute or unmute that throws now leaves the room and reports .failed, as VoiceTransport asks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The voice bootstrap now carries the held XDM context, resolved for the same session as the bootstrap request. The service replays it on every voice turn, so a tapped prompt suggestion's Query Submitted event uses that snapshot rather than the store's current context. Updates made during a voice conversation apply from the next conversation or typed message; the implementation guide says so. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/Implementation/implementation-guide.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The session reports when the current turn starts and stops waiting for its reply: from the user's final transcript, spoken or sent as text, until the reply's first text, the turn's end, a newer turn or the end of the session. The chat shows the wait the way a typed turn does, as an empty reply bubble with the theme's loading message, and the reply fills that bubble. An empty bubble left behind is removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/getting-started.md
show, present and wrap no longer take a voiceTransport. The app registers one transport with Concierge.setVoiceTransport(_:), from any thread, and every chat reads it, so a new value reaches chats that are already open as well as later ones. A running conversation keeps the transport it started with. After nil, the voice button stays while a conversation runs, so the user can stop it, and disappears once it ends. Resetting identities keeps the registered transport. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/getting-started.md
The demo app registers its LiveKit transport once with Concierge.setVoiceTransport when it starts, instead of passing it to every show, present and wrap call. The style guide says the voice button appears while a transport is registered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Say a transport is registered rather than provided in the composer comments, and note in the getting-started guide that taps are ignored while connecting and that setVoiceTransport can be called from any thread. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/getting-started.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resetting identities ends a running voice conversation and keeps the transport registered with Concierge.setVoiceTransport. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cdhoffmann
approved these changes
Nov 24, 2026
The voice bootstrap now takes the app's auth token, as a chat turn does. Resolve it after the microphone check and before the bootstrap request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8 of 10 tasks
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.
The follow-up #189 mentions: the reference
LiveKitTransport, now inConciergeDemoAppso the demo app can hold voice conversations.Summary
ConciergeDemoAppgets voice through an app-side transport, the way a customer app would. LiveKit is added to the demo app target only.Package.swift, the podspec and theAEPBrandConciergetarget are unchanged, so the SDK still ships no third-party dependency.Changes
ConciergeDemoApp/LiveKitTransport.swift(new, ~160 lines): implementsVoiceTransporton the LiveKit Swift SDK, for apps to copy..reconnecting, then.connectedonce the room is back.AudioManager.shared.isSpeakerOutputPreferred) while connected. That setting is LiveKit-wide, so the transport saves the app's value and restores it once it is idle again.disconnect()..disconnected; any other disconnect reports.failed, the same set as the Android test app's transport.send(_:topic:)(added in feat: hold voice conversations through an app-provided transport #189) withpublish(data:options:)andreliable: true, since LiveKit's default is lossy. It throws when there is no room, so Brand Concierge shows its send-failed message.continuesInBackgroundtrue, so a conversation keeps running with the screen locked or in another app (see feat: hold voice conversations through an app-provided transport #189). It already starts the microphone inconnect(_:)with the preconnect recording, as iOS requires for background audio.DemoVoice.transport), registered once withConcierge.setVoiceTransportinConciergeDemoApp.init()(feat: hold voice conversations through an app-provided transport #189 section 7). EveryConcierge.show/Concierge.presentcall (SwiftUI, UIKit and Testing tabs) and the Magic tab'sConcierge.wrap, whose floating button opens the chat, get voice without passing it.Info.plist: declares theaudiobackground mode (UIBackgroundModes).https://github.com/livekit/client-sdk-swift, exact 2.17.0) is linked toConciergeDemoApp.Package.resolvedgains LiveKit and its WebRTC and uniffi binaries.getting-started.mdbecomes a walkthrough:NSMicrophoneUsageDescriptionand theaudiobackground mode.LiveKitTransport.swift.Concierge.setVoiceTransport(_:)at launch.send(_:topic:)must use reliable delivery and throw on failure, and the conversation notes say the thinking indicator shows until the reply starts, each reply's cards, sources and suggestions appear when it finishes, and suggestion taps go to the agent. The limitations say a conversation uses the XDM context captured when it starts (feat: hold voice conversations through an app-provided transport #189 section 5).setVoiceTransport(section 7): step 4 registers the transport instead of passing it to every call and says it can be called from any thread, the conversation notes say suggestion taps are ignored while connecting, and the style guide says the voice button appears while a transport is registered.The same transport is in the standalone reference app (Adobe-AI-Core-Services/voice_demo-app-ios#2); the demo app here becomes the primary reference.
Test plan
ConciergeDemoAppbuilds; SwiftLint is clean on the changed files.Audio Engine Error -4010after the preconnect path times out. The standalone reference app shows the same today, so this is Simulator audio, not this change.send(_:topic:)and gets a voice reply.