Skip to content

Add UIDelegate bridge for SDK UI event forwarding#88

Open
robertson-waweru wants to merge 2 commits into
salesforce:devfrom
robertson-waweru:add-UIDelegate-changes
Open

Add UIDelegate bridge for SDK UI event forwarding#88
robertson-waweru wants to merge 2 commits into
salesforce:devfrom
robertson-waweru:add-UIDelegate-changes

Conversation

@robertson-waweru
Copy link
Copy Markdown
Contributor

Summary

  • Implements AgentforceUIDelegate on iOS and Android native bridges to forward conversation lifecycle events to JavaScript
  • Surfaces didSendUtterance, userDidSwitchAgents, and modifyUtteranceBeforeSending callbacks via a new UIDelegate interface in the TypeScript layer
  • didReceiveResponse is active on Android only — iOS SDK 260.5 does not expose AgentforceMessage properties publicly (noted with comment for future enablement)
  • Adds setUIDelegate() / clearUIDelegate() API to AgentforceService

Test plan

  • iOS Service Agent: verified conversation launches correctly
  • Android Service Agent: verify delegate events fire (onUtteranceSent, onAgentSwitch)
  • Android: verify modifyUtterance round-trip (JS modifies text, agent receives modified version)
  • iOS: verify modifyUtterance round-trip
  • Verify clearUIDelegate stops forwarding
  • Verify delegate can be set before or after launching conversation

Implements AgentforceUIDelegate on both platforms to surface conversation
lifecycle events (utterance sent, agent switch, modify-utterance) to JS.
The didReceiveResponse callback is active on Android only — iOS SDK 260.5
does not expose AgentforceMessage properties publicly.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (dev@b90909a). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             dev       #88   +/-   ##
=======================================
  Coverage       ?   100.00%           
=======================================
  Files          ?         1           
  Lines          ?         7           
  Branches       ?         0           
=======================================
  Hits           ?         7           
  Misses         ?         0           
  Partials       ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@robertson-waweru robertson-waweru requested a review from tsaarva May 21, 2026 13:49
- Align modify-utterance timeout to 10s on both platforms (was 5s on Android)
- iOS: always emit hasAttachment and timestamp in event payloads
- iOS: fix race in awaitModifiedUtterance — register continuation before sending event
- iOS: drain pending continuations when forwarding is disabled to prevent leaks
- iOS: remove undeclared attachment field from UtteranceSentEvent payload
- Android: log timeout and exceptions in modifyUtteranceBeforeSending
- Android: replace misleading val getter with isoTimestamp() function
- TS: make onAgentResponse optional (iOS SDK limitation)
- TS: guard against non-string returns from modifyUtterance handler
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