Skip to content

feat: hold voice conversations through an app-provided transport - #205

Merged
nozokada merged 38 commits into
adobe:feature/voicefrom
nozokada:feat/voice-transport
Nov 26, 2026
Merged

nozokada merged 38 commits into
adobe:feature/voicefrom
nozokada:feat/voice-transport

Conversation

@nozokada

@nozokada nozokada commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Base: feature/voice, cut from main at 3.10.2. Voice lands there, not in dev, so releases during the restricted change period don't pick it up. The pilot will use a prerelease build from that branch, and the branch goes to dev once a public release is approved.

Stacked on #197 (voice session bootstrap). GitHub can't base a PR on a fork branch, so this targets feature/voice and also shows #197's commit. Please review only these commits:

  • feat: add the voice transport interface and voice session logic
  • feat: hold voice conversations through an app-provided transport
  • docs: describe voice conversations through a voice transport
  • feat: pass a VoiceConnection to the transport and support reconnecting
  • fix: accept only wss and https voice server URLs
  • docs: explain why the voice session checks microphone permission again
  • fix: fail a voice session the transport does not connect within 20 seconds
  • fix: fail a voice session the agent ends because of an error
  • fix: allow one voice conversation at a time across the app
  • fix: keep the microphone muted for an audio interruption that began while connecting
  • docs: explain that a phone call ends a voice conversation on Android
  • build: compile interface members with a body into Java default methods
  • feat: keep a voice conversation running in the background when the transport opts in
  • feat: end every voice conversation 60 minutes after it connects
  • docs: explain how to keep a voice conversation running in the background
  • fix: keep voice replies on screen as they arrive
  • fix: keep the voice conversation when the activity is recreated
  • feat: parse the full voice ui_payload and text_input_error
  • feat: render each voice turn's end like a typed turn
  • feat: send prompt suggestions tapped during voice to the voice agent
  • feat: freeze the held XDM context for a voice conversation
  • Show the thinking indicator while a voice turn waits for its reply
  • Register the voice transport with Concierge.setVoiceTransport
  • Say a voice transport is registered rather than provided
  • List the voice conversation and transport in the identity reset docs

On the new bootstrap shape since #197 merged. This branch now includes #197, so it sends voice: {"action": "start"} with the auth token in data, instead of data: {"type": "livekit-bootstrap"} and xdm.eventType. Stage doesn't accept this shape yet: it needs the Concierge Conversation Service change that adds it, which isn't merged yet. Until that change is on Stage, this revision can be tested only against a local service with that change. The device tests below were run on Stage with the old shape.

Replaces #198. Brand Concierge no longer looks up an IVoicePlugin through Mobile Core (adobe/aepsdk-core-android#844). It now owns the voice session logic, and the app supplies the real-time transport itself, registering it with Concierge.setVoiceTransport (section 7). This is the Android counterpart of adobe/aepsdk-concierge-ios#189.

Description

Brand Concierge can hold a voice conversation over a transport the app provides. BC owns the conversation: credentials, microphone permission, session lifecycle, audio interruptions, data-channel parsing, transcript and UI. The app owns only the audio connection, through a small public VoiceTransport interface. BC takes no LiveKit, voice-extension or Core plugin dependency, and apps that don't use voice ship no WebRTC code. mavenCoreVersion stays at the released 3.5.0.

Concierge.setVoiceTransport(myVoiceTransport)
ConciergeChat(viewModel = viewModel, surfaces = listOf("my-surface")) { showChat -> /* ... */ }

1. Transport interface and voice session logic

  • New public API (VoiceTransport.kt, root package):
    • VoiceTransport: listener, continuesInBackground, connect(connection), setMicrophoneEnabled(enabled), disconnect(), send(data, topic, callback)
    • VoiceSendCallback: onComplete(error), how send reports its outcome (section 4).
    • VoiceConnection: what connect(connection) receives, url and token. Only BC creates it, so new fields can be added later without breaking existing transports.
    • VoiceTransportListener: onStateChanged(transport, state), onDataReceived(transport, data, topic), onAudioInterruptionBegan(transport), onAudioInterruptionEnded(transport)
    • VoiceTransportState: Connected, Reconnecting, Disconnected, Failed(error)
  • Moved in as internal types (voice/), from the voice-extension prototype: VoiceSessionController, VoiceSession, DataChannelMessage and DataChannelMessageParser.
  • Interface decisions (same as iOS unless noted):
    • Lifetime: one reusable transport instance serves every conversation. A session claims it (sets the listener) only while connected, and releases it (clears the listener, then disconnects) before reporting its end. The transport must report nothing about a connection after disconnect(). Callbacks from another sender, or after release, are dropped.
    • Threading: BC calls the transport on the main thread; the transport may call the listener from any thread.
    • Method shape: calls return at once, with outcomes reported to the listener. The exception is send, which reports to its callback; see section 4.
    • Microphone state: the transport has no getter. BC treats the microphone as live once Connected, and changes it only through setMicrophoneEnabled, to mute during audio interruptions.
    • Audio interruptions (Android-specific): the transport reports them through the listener, and BC mutes the microphone through setMicrophoneEnabled until they end. Unlike iOS, Android has no app-wide interruption notification: audio focus changes go only to the focus holder (the transport's audio stack), and watching calls would need READ_PHONE_STATE, which an SDK shouldn't require. Interruptions are tracked apart from the session state, so one that begins while connecting mutes the microphone as soon as Connected arrives. When the audio will not come back (for example, AUDIOFOCUS_LOSS), the transport reports Failed instead, because the chat has no unmute control. A phone call is not handled as an interruption: Android doesn't tell other apps about a ringing call without READ_PHONE_STATE, so the conversation continues while it rings, and answering opens the call screen, which moves the app to the background. Without the background opt-in (section 3) that ends the conversation; with it, the conversation continues and the microphone stays muted until the call ends (both checked on a Galaxy S25).
    • Surface: there is no Connecting state, because BC tracks connecting itself.
    • Reconnecting: a transport reports Reconnecting while it recovers a dropped connection (a network change, for example) and Connected once it is back. BC shows the connecting spinner and keeps the microphone as it was. If the transport is not back within 30 seconds, the session fails and BC calls disconnect().
    • Connect timeout: the transport is app code, so BC doesn't wait forever for it. If neither Connected nor Failed arrives within 20 seconds of connect(connection), the session fails with the usual voice error and BC calls disconnect().

2. Voice in the chat

  • The app registers its transport once with Concierge.setVoiceTransport(transport) (section 7). ConciergeChat and ConciergeChatView don't take it.
  • The UI and ViewModel behaviour come from Integrate the optional voice plugin into the chat UI #198:
    • VoiceSessionButton in the input row, shown only while a transport is registered (or a session is still running).
    • Transcripts render as bubbles that update in place until final.
    • Voice scrolls like a typed turn. Voice doesn't enter the processing state, and the user's bubble arrives before the reply, so the list kept a voice scroll anchor: the latest user bubble, or the agent's first bubble when it speaks first. It scrolls the anchor to the top and reserves space below it while only agent bubbles follow, so the reply shows below it as it grows. Ending voice doesn't scroll back to an earlier message. Same as feat: hold voice conversations through an app-provided transport aepsdk-concierge-ios#189.
    • Without microphone permission, the voice button first runs the same permission flow as dictation and starts the session only once it is granted; a denial starts nothing. VoiceSessionController checks it again, as a safety net for callers that don't go through the view model.
    • The server URL in the credentials must be wss or https, because the token travels on that connection. Any other scheme fails the session before the transport is touched.
    • Failures show the conversation error message and track ErrorOccurred.
    • When the voice agent ends the session, its inactivity and join timeouts end the conversation quietly. error, worker_shutdown, or an unknown or missing reason fails it with the usual voice error and ErrorOccurred.
    • Typed sends, dictation and data handoffs are held off during voice (CHAT_IN_PROGRESS). Prompt suggestion taps go to the voice agent instead (section 4).
    • One voice conversation at a time across the app. A chat in an activity stopped under another activity stays composed and keeps its call, so a chat claims voice when it starts a conversation and releases it when the conversation ends or the chat goes away. Meanwhile the other chats' voice button is disabled, so a second conversation can't take the transport's listener or hang up the first call.
    • Chat reset, identity reset, app background (unless the transport opts in, section 3), chat close and onCleared end the session and cancel a still-open bootstrap.
  • The ViewModel drives the internal VoiceSessionController (through an injectable session factory for tests) instead of a plugin session.
  • Docs: the implementation guide's "Voice conversations (optional)" section describes the transport. The reference LiveKitTransport for the test app is in feat: add a LiveKit voice transport to the test app #206.

3. Background conversations

  • VoiceTransport.continuesInBackground (default false, so existing transports are unaffected) lets a transport opt in to keeping the conversation running when the app goes to the background: screen locked, or another app in front. BC reads it once per conversation, when it calls connect(connection).
  • On backgrounding, a conversation whose transport opted in and was asked to connect keeps running: transcripts and the agent ending the session are applied as they arrive, each turn's cards, sources and suggestions render when the turn ends (section 4), and all of it is visible on return. One without the opt-in, or still asking for microphone permission or fetching credentials, ends as before, since Android doesn't let an app start the microphone from the background.
  • The app provides what Android requires, documented on the property: a microphone foreground service started from connect, its manifest entries, and the Play Console declaration. The test app's service is in feat: add a LiveKit voice transport to the test app #206.
  • Every conversation ends normally 60 minutes after the transport first reports Connected, in the foreground or the background, so a forgotten conversation can't hold a room indefinitely. Reconnects don't restart the count. The cap is fixed.
  • The agent's 60 s inactivity timeout is unchanged, so a silent background conversation still ends after about a minute.
  • Build: the library now compiles with -Xjvm-default=all-compatibility, so a Java class implementing VoiceTransport gets continuesInBackground's default instead of having to implement it, while apps compiled against an earlier release still link.
  • Docs: the implementation guide has a "Background conversations" section.

4. Voice turns: UI payloads, turn states and suggestion taps (second review)

Same as adobe/aepsdk-concierge-ios#189 section 4 unless noted.

  • UI payloads: the parser decodes the agent's whole ui_payload (sources, promptSuggestions, multimodalElements) with typed chat's ConversationResponseParser, into the same models typed chat uses. A suggestion that isn't a string drops the list; a malformed card or source drops only itself. The agent can send several per turn, each a full snapshot, so the latest one is kept. When the turn ends, the reply bubble gets its sources, and cards, carousels, CTAs and prompt suggestions render through typed chat's code. As in typed chat on Android, a reply with CTAs and no product cards drops the suggestions. widgets aren't rendered, as in typed chat.
  • Turn states, matching web's handleTurnDone:
    • The user's transcript decides the current turn (turnId). A new user turn closes the open reply bubble, and messages for another or an already-finished turn are dropped.
    • error or an empty fullText: the reply bubble shows the new voice.turn.failed copy, the payload still renders and the session continues. interrupted counts as completed. A late error after a completed turn (failed playback) is dropped.
    • The view model gets each turn's end through a new internal session callback, onTurnFinished.
  • Suggestion taps during voice, as on web: a tap (welcome suggestions included) is sent to the agent as {"type":"text_prompt","turn_id","text"} on topic bc-text-input, through the new VoiceTransport.send(data, topic, callback). The SDK builds the message, so transports only move bytes. The user's bubble shows at once and the agent's echo of it is not shown again. Taps are ignored while connecting or reconnecting, and from the start of the user's speech until the reply starts. A text_input_error for the tap, or the user speaking before the agent takes it, fails it with voice.turn.failed; a failed send shows voice.turn.messageSendFailed. The tap is tracked as querySubmitted, like a typed send. The composer stays read-only during voice, as on web. After voice ends, taps stream as before.
  • send reports to a callback (Android-specific): send(data: ByteArray, topic: String, callback: VoiceSendCallback) returns at once and calls callback.onComplete(error) exactly once, from any thread: null once the message is accepted, or the error. A send that throws counts as a failure. The rest of VoiceTransport has no suspend functions, so send doesn't tie transports to coroutines (iOS uses async throws). The transport's error text is logged at debug level only.
  • send must deliver reliably. It has no default implementation, so existing transports must add it. The test app's LiveKitTransport implements it in feat: add a LiveKit voice transport to the test app #206.
  • Copy: voice.turn.failed ("Sorry, I couldn't process that. Please try again.") and voice.turn.messageSendFailed ("Sorry, your message couldn't be sent. Please try again."), same keys and defaults as web, in the style guide and the test app's theme. ConciergeChat passes them from the theme to the view model.
  • Docs: the implementation guide covers send (reliable delivery, the callback), each turn's cards and suggestions, and suggestion taps during voice.

5. Held XDM context during voice

Same as adobe/aepsdk-concierge-ios#189 section 5.

  • The voice bootstrap (feat: add voice session bootstrap request #197) sends the held XDM context (updateXDMContext) for the bootstrap's session, and the service uses it for every turn of the conversation. So the context is captured once, when the conversation starts, as on web. Updates made during the conversation apply from the next voice conversation or typed message.
  • A suggestion tapped during voice is tracked as querySubmitted with that captured context, matching what the service sends.
  • Docs: the implementation guide's XDM context section lists voice conversations and says when the context is captured.

6. Thinking indicator during voice

Same as adobe/aepsdk-concierge-ios#189 section 6.

  • While a voice turn waits for its reply, the chat shows the thinking indicator with the theme's loading.message ("Generating response from our knowledge base"), as typed chat does. It appears when the user's final words (or a suggestion tap) show, and the reply's first text replaces it in the same bubble.
  • VoiceSessionController reports the wait to the view model through a new internal listener callback, onAwaitingReplyChanged. It turns off after the reply's first text, at the turn's end (completed, error, text_input_error, a failed send), when a newer turn replaces the turn, and when voice ends. An indicator still empty at that point is removed, so none is left after a stop or a failure.
  • Not shown for an utterance with no final words, or a turn the agent opens. There's no watchdog, unlike web's 20 s one: a failed turn always ends with turn_completed(state=error).
  • Docs: the implementation guide mentions the indicator.

7. One transport for the app, registered with Concierge.setVoiceTransport

Same as adobe/aepsdk-concierge-ios#189 section 7.

  • Replaces the voiceTransport parameter of both ConciergeChat composables and the ConciergeChatView.voiceTransport property. Neither was released, so nothing is deprecated.
  • @JvmStatic Concierge.setVoiceTransport(transport: VoiceTransport?) can be called from any thread, like setAuthTokenProvider. Every chat's view model reads the registered transport, so a new value reaches chats that are already open as well as later ones.
  • A running conversation keeps the transport it started with; a new one is used from the next conversation. After null, 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.
  • Docs: the implementation guide registers the transport once at launch, and its identity reset notes say a reset ends the voice conversation and keeps the transport.

API note

ConciergeChat and ConciergeChatView are unchanged. The only addition to an existing class is Concierge.setVoiceTransport.

How Has This Been Tested?

  • VoiceSessionControllerTest (64): lifecycle, the background opt-in snapshot and the 60-minute cap (started on the first Connected, not restarted by reconnects, cancelled on end), connect and reconnect timeouts, credential validation (including ws / http rejected), permission, transport sharing and foreign callbacks, interruptions (including while connecting), agent-ended sessions by reason, transcript assembly, turn tracking (new user turn, other and finished turn ids, error / empty / interrupted states, late error), suggestion sends (payload and topic, echo, gating, text_input_error, speech before the echo, send failure reported or thrown) and the thinking indicator's on and off signals, all through a FakeVoiceTransport.
  • DataChannelMessageParserTest (25): including the full ui_payload and text_input_error.
  • ConciergeChatViewModelVoiceSessionTest (62, rewritten from Integrate the optional voice plugin into the chat UI #198 for the transport): availability, backgrounding (kept with the opt-in once connecting, ended without it or before connect), start/connect/stop, transcripts and the scroll anchor, errors, exclusivity, one conversation app-wide, each stop trigger, the permission flow, transport changes, each turn's end (reply rewritten with sources, cards and suggestions; CTAs dropping the suggestions; failure copy), suggestion taps to the session during voice and streamed after it, the held XDM context and session sent with the bootstrap, a suggestion tap tracked with that context after it changes, and the thinking indicator (shown, replaced by the reply, removed on stop and on a newer turn).
  • ConciergeChatVoiceLifecycleTest (4): Concierge.setVoiceTransport reaching a chat that is already open, and voice across activity recreation, the chat leaving the screen and the activity finishing.
  • TrailingControlTest (6).
  • MessageListScrollTest (4): which message reserves space and where the list scrolls, with and without voice.
  • make format, make lint and make unit-test pass (full testPhoneDebugUnitTest: 1969 tests, no failures).
  • End to end on a Galaxy S25 (Android 17) with the test app's LiveKitTransport from feat: add a LiveKit voice transport to the test app #206: open the chat, start voice, connect and subscribe to the agent's audio track, hold 10 s, stop cleanly.
  • Background on a Galaxy S25 (Android 17) with the test app from feat: add a LiveKit voice transport to the test app #206 (Stage config and a 3-minute cap in a local build only): screen locked, another app in front, locking while connecting, a product card while locked, an incoming call while locked (continues, muted during the call), Wi-Fi ↔ cellular, Bluetooth, removing the app from recent apps, the notification and its End action, notifications denied, the cap ending the conversation, and 60 s of silence in the background. No room was left open.
  • Scrolling on a Galaxy S25: before the fix, a voice reply grew below the screen once the conversation was longer than the screen. With it, each user utterance moves to the top and the reply stays on screen as it arrives. An agent-first greeting also moves to the top, ending voice doesn't jump back, and typed chat scrolls as before.
  • On a Galaxy S25 again with section 4 and feat: add a LiveKit voice transport to the test app #206's LiveKitTransport.send (Stage config in a local build only): a product card arriving while the screen is locked renders with the reply, its sources and suggestions after unlocking. A suggestion tapped during voice shows the user's bubble at once (not twice with the echo) and reaches the agent, which answers by voice. Taps while connecting, while the user speaks or before the reply starts are ignored, and after voice ends a tap streams as typed chat.
  • On a Galaxy S25 with section 6 (Stage config in a local build only): the thinking indicator shows after speaking and after a suggestion tap, turns into the reply when its text starts, and is removed when voice stops while it shows.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

nozokada and others added 3 commits October 27, 2026 15:48
Add a public VoiceTransport interface that an app implements to carry
voice conversation audio and data, so Brand Concierge has no real-time
media dependency. A transport also reports audio interruptions, and the
session mutes the microphone until they end.

Add the internal voice session: it validates the credentials, checks
the microphone permission, claims the shared transport while connected
and releases it before disconnecting, drops callbacks it no longer
owns, and turns the voice agent's data messages into transcript
updates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a voice button to the composer when the app passes a VoiceTransport
to ConciergeChat or sets it on ConciergeChatView. The view model fetches
the voice credentials, starts a voice session over the transport,
renders the live transcript, and holds off typed turns, dictation and
data handoffs while the conversation runs. A transport cleared mid-
conversation keeps the running conversation stoppable; a new transport
applies to the next one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nozokada and others added 16 commits October 27, 2026 17:32
…docs

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>
connect(url, token) becomes connect(connection: VoiceConnection), a class
Brand Concierge creates, so connection details can be added later without
breaking app transports.

VoiceTransportState gains Reconnecting. The conversation stays open with the
connecting indicator, the microphone is left as it was, and the session fails
if the transport does not report Connected again within 30 seconds.

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>
…conds

The transport is app code, so a connect that never reports back used to leave the conversation connecting forever. The connect and reconnect timeouts now share one timer; on expiry the session fails, which disconnects the transport and shows the usual error message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The agent's session_ended notice used to end the session normally whatever its reason. Only the agent's timeouts end it normally now; an error, a worker shutdown, or an unknown or missing reason fails it, so the chat shows the error message and tracks it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Chats have their own view models and usually share one transport, so a second chat could start voice while another chat's conversation was still running, take the transport, and hang up each other's call. A chat now claims voice before requesting credentials and releases it once its conversation ends; other chats' voice buttons are disabled meanwhile.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hile connecting

Track the interruption apart from the session state, so a Connected that arrives during it mutes the microphone right away, and document that a transport reports Failed when the audio will not come back.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Android doesn't tell other apps about a ringing call without READ_PHONE_STATE, and answering opens the call screen, which moves the app to the background. Audio interruptions cover other apps taking the audio for a while.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Without -Xjvm-default, Kotlin puts an interface member's body in a DefaultImpls class, so a Java class implementing a public interface such as VoiceTransport must still implement every member, and adding one with a default breaks it. all-compatibility also generates Java default methods while keeping the DefaultImpls classes, so apps compiled against an earlier release still link. The @JvmDefaultWithCompatibility and @JvmDefaultWithoutCompatibility annotations only take effect with the flag set, and the deprecated @JvmDefault needs a deprecated mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ansport opts in

Add VoiceTransport.continuesInBackground, false by default, documenting what the app must provide for it: a microphone foreground service started from connect, its manifest permissions and the Play Console declaration. The session reads it when it calls connect. Moving the app to the background now stops a conversation only when its transport has not opted in or the session has not connected it yet, because Android does not let an app start the microphone from the background. A phone call answered during an opted-in conversation mutes the microphone instead of ending it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A forgotten conversation, especially one running in the background, could otherwise hold the room indefinitely: the voice agent's inactivity timeout is reset by nearby voices or a TV, not only by the user. The limit starts when the conversation first reports Connected, is not restarted by a reconnect, applies with or without background conversations, and ends the conversation normally, disconnecting the transport, as when the user stops it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe continuesInBackground, the microphone foreground service and manifest entries the app provides, the notification and its End action, ending the conversation in onTaskRemoved, the Play Console declaration, and the 60-minute limit on every conversation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The list reserved space only for an assistant reply right after the latest
user message, and scrolled to each user message once. In voice the user's
bubble arrives alone, so the scroll to it stopped near the bottom, and the
reply that followed grew below the screen. Keep a voice scroll anchor (the
latest user bubble, or the agent's first bubble when it speaks first),
reserve space below it while only agent bubbles follow it, and scroll to it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada changed the base branch from dev to feature/voice November 10, 2026 02:31
@nozokada nozokada mentioned this pull request Nov 10, 2026
1 of 3 tasks
@nozokada
nozokada marked this pull request as ready for review November 10, 2026 03:31
nozokada and others added 13 commits November 18, 2026 15:55
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>
A voice bubble has no interactionId and its text changes on every
transcript update, so its content-based list key changed too. Compose
then treated each update as a new item, resetting its remembered state
and losing key-based scroll anchoring.

Voice bubbles now get a localId when created, and the message list keys
by interactionId, then localId, then the existing content fallback.
Typed chat messages are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
If the transport threw while muting or unmuting, the session only logged
it, though it had already recorded the interruption. The microphone could
then stay live during an interruption, or stay muted while the chat shows
Listening, and nothing retried. The session now fails with
TransportFailed, which disconnects the transport.

VoiceTransport now also says that a transport whose microphone change
fails after setMicrophoneEnabled returns reports Failed, since that
failure never reaches the session as an exception.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Recreating the activity for a configuration change (e.g. rotation) disposed
ConciergeChat and stopped voice, even though ConciergeChatViewModel survives.
Skip the stop when the activity is changing configurations; leaving the
screen, finishing the activity and clearing the view model still end it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Parse ui_payload sources, prompt suggestions and multimodal elements
with typed chat's response parsing, so a voice turn can render what the
same response renders in typed chat. A malformed card or source is
dropped on its own, and a suggestion list with a non-string entry is
dropped, as in typed chat. Widgets are not parsed because the SDK has
no widget support.

Parse the worker's text_input_error, which rejects a text prompt sent
during a voice session.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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. ConciergeChat pushes the theme's copy into the view
model, as it does for the rest of the theme.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add VoiceTransport.send(data, topic, callback), which the app implements
with reliable delivery and completes once, from any thread. 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 with the held XDM context. 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 fails or throws fails it with voice.turn.messageSendFailed.

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 repository'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>
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>
ConciergeChat and ConciergeChatView no longer take a voice transport.
The app registers one 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 null, the voice control 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>
@nozokada

Copy link
Copy Markdown
Member Author

@rymorale A question about the voice public API on both platforms. Instead of passing the voice transport to each chat (ConciergeChat(voiceTransport:) and ConciergeChatView.voiceTransport here, show/present/wrap in iOS adobe/aepsdk-concierge-ios#189), the app registers it once with Concierge.setVoiceTransport(transport), like setAuthTokenProvider. I've already implemented this in both PRs (section 7). None of it is released, so nothing is deprecated. The transport is one long-lived instance and only one conversation runs at a time, so a per-chat argument adds nothing; what we lose is per-chat control, which no one has asked for. Are you OK with this shape? If you'd rather have a shared options object for the chat arguments, I can change it; for the arguments that are already released, that would be a separate PR on both platforms.

nozokada and others added 2 commits November 23, 2026 14:14
The voice button shows while a transport is registered with
Concierge.setVoiceTransport or a conversation is still running.

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>
private fun handleUserTranscript(delta: TranscriptDeltaData) {
val text = delta.delta.trim()
val echoing = turn
if (delta.final && echoing?.echoText != null && text == echoing.echoText) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The echo of a text prompt only matches when it's a final user transcript whose trimmed text equals echoText exactly. If the worker sends interim echo chunks or normalizes the text (casing, punctuation, whitespace), the echo goes through startsNewTurn. That fails the prompt with TURN_FAILED and adds a duplicate user bubble. Does the worker echo the turn_id we send (txt-…)? If so, matching on that would be more robust.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the worker. It echoes a text prompt as a single user transcript: final: true, sequence: 0, with the text stripped withstrip() (the SDK already sends it trimmed), and no interim chunks. It doesn't echo our txt-… id: the echo carries the worker's own new turn id, and our id comes back only in text_input_error. So we can't match on the id today, and the exact match holds for what the worker sends. iOS matches the same way. I'd leave it as is; if the worker starts normalizing the text or echoing our id, we can switch to the id.

nozokada and others added 3 commits November 25, 2026 11:09
A transport may come back from a reconnect with the microphone live, so
reapply the interruption mute when the session returns to listening.
Document that setMicrophoneEnabled can be called while reconnecting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada requested a review from rymorale November 25, 2026 22:46
@rymorale

Copy link
Copy Markdown
Contributor

@rymorale A question about the voice public API on both platforms. Instead of passing the voice transport to each chat (ConciergeChat(voiceTransport:) and ConciergeChatView.voiceTransport here, show/present/wrap in iOS adobe/aepsdk-concierge-ios#189), the app registers it once with Concierge.setVoiceTransport(transport), like setAuthTokenProvider. I've already implemented this in both PRs (section 7). None of it is released, so nothing is deprecated. The transport is one long-lived instance and only one conversation runs at a time, so a per-chat argument adds nothing; what we lose is per-chat control, which no one has asked for. Are you OK with this shape? If you'd rather have a shared options object for the chat arguments, I can change it; for the arguments that are already released, that would be a separate PR on both platforms.

sorry for missing this question earlier. I think app-wide registration is fine given the single-conversation constraint. we can revisit this in the future if multiple conversation support is added.

@rymorale rymorale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Still on #197’s previous shape” note looks out of date after the bootstrap merge. The current head sends voice: {"action": "start"} and resolves the auth token, rather than the old livekit-bootstrap discriminator.

Could you update the rollout note and confirm whether Stage now accepts this shape? The existing note says it does not, so it is hard to tell which environment the current revision can be tested against.

val errorNetwork: String? = null,

// Voice
val voiceTurnFailed: String? = null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (non-blocking): Adding these parameters changes the JVM constructor and copy signatures of this public data class. I checked this on an emulator with a library compiled against the previous SDK. Calling ConciergeTextStrings(...) (named or positional) or .copy(...) from that library throws NoSuchMethodError on this branch. Property reads, destructuring and ConciergeThemeLoader.load(...) all still work, and anything rebuilt against this version is fine.

Since the documented path is theme JSON, and v3.8.0 already added inputAiChatIconTooltip to this class the same way, I don't think this needs to block. It might be worth a line in the release notes, or a decision on whether we want a binary-compatibility policy for the public theme models going forward.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking this on an emulator. Agreed it's not blocking: theme JSON is the documented path, and v3.8.0 added inputAiChatIconTooltip the same way. I'll add a line to the 3.11.0 release notes saying the constructor and copy of ConciergeTextStrings changed, so code compiled against an earlier version must be rebuilt. A binary-compatibility policy for the public theme models is a good question for the SDK team; I'd keep it separate from this PR.

@nozokada
nozokada merged commit 8e0c381 into adobe:feature/voice Nov 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants