Pull based capabilities from adapter #5679
Open
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.
Changelog Entry
Description
Introduces a Capabilities system that enables WebChat to dynamically discover and consume capabilities from chat adapters at runtime.
This allows adapters(directline, ccv2 etc..) to expose configuration such as voice settings without requiring WebChat to have compile-time knowledge of specific adapter implementations. The system follows a pull-based model where adapters expose getter functions and emit events when capabilities change.
Design
Pull-Based Architecture
getVoiceConfiguration()) to provide capability valuescapabilitiesChangedevents as a "nudge" to signal WebChat should re-fetch capabilitiesPure Derivation Pattern
useReduceMemoto derive capabilities from the activity streamcapabilitiesChangedevent is detected in activitiesReference Stability
Specific Changes
CapabilitiesComposercomponent that provides capabilities contextuseCapabilities(selector)hook for consuming capabilities with selector patternfetchCapabilitiesFromAdapterutility to pull capabilities from adapter getterscapabilityRegistryto map capability keys to adapter getter namesCapabilitiesandVoiceConfigurationtypescapabilitiesChangedeventsuseCapabilitieshook frombotframework-webchat/hooksetCapability(getterName, value, options)helper to test emulatoruseCapabilities.htmltest covering initial fetch, event-driven updates, and reference stabilityCAPABILITIES.mddocumentationCHANGELOG.mdReview Checklist
z-index)package.jsonandpackage-lock.jsonreviewed