Porting Dialogs system from BotFramework#372
Conversation
There was a problem hiding this comment.
Pull request overview
Ports the BotFramework Dialogs system into the Microsoft Agents SDK Python repo by introducing a new microsoft-agents-hosting-dialogs package (dialogs, prompts, choices, memory scopes) plus a dialogs sample app and extensive test coverage to validate core dialog behaviors.
Changes:
- Added a new
microsoft-agents-hosting-dialogslibrary implementing dialogs (Waterfall/DialogSet/DialogContext), prompts, choice recognition, and memory scopes/path resolvers. - Added a dialogs sample (
test_samples/dialogs) showing a multi-stepUserProfileDialogrunning on aiohttp. - Added a broad set of unit/integration-style tests for dialogs, prompts, and choices; updated a few core/activity types for compatibility.
Reviewed changes
Copilot reviewed 136 out of 142 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/hosting_dialogs/test_waterfall_step_context.py | Tests WaterfallStepContext behavior (next(), properties). |
| tests/hosting_dialogs/test_waterfall_dialog.py | Validates WaterfallDialog argument handling + non-message continuation. |
| tests/hosting_dialogs/test_text_prompt.py | End-to-end TextPrompt flows (validator/retry). |
| tests/hosting_dialogs/test_skill_dialog.py | Placeholder/skip for skill dialog tests not supported yet. |
| tests/hosting_dialogs/test_replace_dialog.py | Tests replace_dialog behavior across component dialogs/waterfalls. |
| tests/hosting_dialogs/test_prompt_validator_context.py | Minimal PromptValidatorContext test scaffolding. |
| tests/hosting_dialogs/test_prompt_culture_models.py | Tests locale normalization + supported cultures. |
| tests/hosting_dialogs/test_object_path.py | Tests ObjectPath assign/get/set/remove path utilities. |
| tests/hosting_dialogs/test_dialog_set.py | Tests DialogSet construction + telemetry propagation. |
| tests/hosting_dialogs/test_dialog_extensions.py | Tests DialogExtensions run + reprompt event handling. |
| tests/hosting_dialogs/test_dialog_context.py | Tests DialogContext validation + basic stack operations. |
| tests/hosting_dialogs/test_dialog.py | Tests Dialog base class default behaviors. |
| tests/hosting_dialogs/test_date_time_prompt.py | End-to-end DateTimePrompt scenario using recognizers. |
| tests/hosting_dialogs/memory/scopes/test_settings.py | Test config object for settings scope tests. |
| tests/hosting_dialogs/memory/scopes/init.py | Package init for memory scope tests. |
| tests/hosting_dialogs/memory/init.py | Package init for memory tests. |
| tests/hosting_dialogs/choices/test_choice_tokenizer.py | Tests default tokenizer token boundaries + normalization. |
| tests/hosting_dialogs/choices/test_choice_recognizers.py | Tests choice/value recognition behaviors. |
| tests/hosting_dialogs/choices/test_choice_factory_options.py | Tests ChoiceFactoryOptions round-trips. |
| tests/hosting_dialogs/choices/test_choice_factory.py | Tests ChoiceFactory rendering (inline/list/suggested/hero). |
| tests/hosting_dialogs/choices/test_choice.py | Tests Choice model properties. |
| tests/hosting_dialogs/choices/test_channel.py | Tests channel capability helpers. |
| tests/hosting_dialogs/choices/init.py | Package init for choices tests. |
| tests/hosting_dialogs/init.py | Package init for dialogs tests. |
| test_samples/dialogs/src/user_profile_dialog.py | Sample ComponentDialog implementing a profile wizard flow. |
| test_samples/dialogs/src/user_profile.py | Sample state model for the dialog. |
| test_samples/dialogs/src/main.py | aiohttp entrypoint wiring adapter/state/dialog agent. |
| test_samples/dialogs/src/dialog_helper.py | Helper to run a dialog from a bot turn. |
| test_samples/dialogs/src/agent.py | Sample ActivityHandler-based agent hosting dialogs. |
| test_samples/dialogs/src/init.py | Package init for sample. |
| test_samples/dialogs/requirements.txt | Sample dependencies list. |
| test_samples/dialogs/env.TEMPLATE | Sample env template for auth/logging. |
| libraries/microsoft-agents-hosting-dialogs/setup.py | Packaging/install requirements for hosting-dialogs. |
| libraries/microsoft-agents-hosting-dialogs/readme.md | Package README + quickstart. |
| libraries/microsoft-agents-hosting-dialogs/pyproject.toml | Project metadata for hosting-dialogs package. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/waterfall_step_context.py | Implements WaterfallStepContext over DialogContext. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/waterfall_dialog.py | Implements WaterfallDialog execution + telemetry. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/skills/skill_dialog_options.py | Options model for SkillDialog configuration. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/skills/begin_skill_dialog_options.py | Helper model for begin-skill options extraction. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/skills/init.py | Skills exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/text_prompt.py | Implements TextPrompt prompt/recognize. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/prompt_validator_context.py | Implements PromptValidatorContext (incl. attempt_count). |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/prompt_validator.py | Prompt validator type/module placeholder. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/prompt_recognizer_result.py | Recognizer result model for prompts. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/prompt_options.py | PromptOptions container for prompt configuration. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/prompt_culture_models.py | Locale/culture models + normalization helper. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/prompt.py | Core Prompt base class (prompting/validation/choices). |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/oauth_prompt_settings.py | OAuthPrompt settings container. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/number_prompt.py | Implements NumberPrompt via recognizers + babel parsing. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/datetime_resolution.py | DateTime resolution model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/datetime_prompt.py | Implements DateTimePrompt via recognizers-date-time. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/confirm_prompt.py | Implements ConfirmPrompt with locale-aware yes/no. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/choice_prompt.py | Implements ChoicePrompt with recognition + rendering. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/attachment_prompt.py | Implements AttachmentPrompt. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/activity_prompt.py | Implements ActivityPrompt for non-message waits. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/init.py | Prompts exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/persisted_state_keys.py | PersistedStateKeys container. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/persisted_state.py | PersistedState container. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/dialog_turn_status.py | DialogTurnStatus enum. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/dialog_turn_result.py | DialogTurnResult model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/dialog_reason.py | DialogReason enum. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/dialog_instance.py | DialogInstance model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/dialog_events.py | DialogEvents constants. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/dialog_event.py | DialogEvent model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/models/init.py | Models exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/user_memory_scope.py | User memory scope binding to UserState. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/turn_memory_scope.py | Turn scope + case-insensitive dict. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/this_memory_scope.py | “this” memory scope for active dialog state. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/settings_memory_scope.py | Read-only settings scope. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/memory_scope.py | Base MemoryScope abstraction. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/dialog_memory_scope.py | Dialog scope binding behavior for container/parent. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/dialog_context_memory_scope.py | Dialog context scope snapshot (stack/active/parent). |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/dialog_class_memory_scope.py | Dialog class scope returns deepcopy of active/parent dialog. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/conversation_memory_scope.py | Conversation memory scope binding to ConversationState. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/class_memory_scope.py | Class scope binding for dialog-bound properties. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/bot_state_memory_scope.py | BotStateMemoryScope for AgentState/CachedAgentState. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/init.py | Memory scopes exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scope_path.py | Scope path constants. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/percent_path_resolver.py | “%” alias path resolver. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/hash_path_resolver.py | “#” alias path resolver. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/dollar_path_resolver.py | “$” alias path resolver. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/at_path_resolver.py | “@” entity alias path resolver. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/at_at_path_resolver.py | “@@” entity alias path resolver. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/alias_path_resolver.py | Base alias path resolver. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolvers/init.py | Path resolvers exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/path_resolver_base.py | PathResolverBase abstraction. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/dialog_state_manager_configuration.py | DialogStateManager configuration model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/dialog_path.py | DialogPath constants + helper. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/component_path_resolvers_base.py | Component path resolver registration base. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/component_memory_scopes_base.py | Component memory scopes registration base. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/init.py | Memory exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_state.py | DialogState model for dialog stack. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_set.py | DialogSet container + telemetry propagation + create_context. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_manager_result.py | DialogManagerResult model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_manager.py | DialogManager orchestration + expire_after logic. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_extensions.py | Dialog run loop + skill EoC/reprompt handling. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_container.py | Abstract base for container dialogs. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_component_registration.py | Registers default memory scopes + path resolvers. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog.py | Dialog base type + event bubbling hooks. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/tokenizer.py | Default tokenizer implementation. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/token.py | Token model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/sorted_value.py | SortedValue model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/model_result.py | ModelResult model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/list_style.py | ListStyle enum. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/found_value.py | FoundValue model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/found_choice.py | FoundChoice model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/find_values_options.py | FindValuesOptions model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/find_choices_options.py | FindChoicesOptions model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/choice_factory_options.py | ChoiceFactoryOptions model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/choice.py | Choice model. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/models/init.py | Choice models exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/choice_recognizer.py | ChoiceRecognizers implementation (name/ordinal/number). |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/channel.py | Channel capability helpers for rendering choices/actions. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/choices/init.py | Choices exports. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/_user_token_access.py | Internal helper for OAuth token operations via adapter. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/_telemetry_client.py | Telemetry client interface + null implementation. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/_component_registration.py | ComponentRegistration registry for scopes/resolvers. |
| libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/init.py | Package exports for dialogs library. |
| libraries/microsoft-agents-hosting-dialogs/LICENSE | License for the new package. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/state/agent_state.py | Ensures default factories persist into cached state. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/message_factory.py | Expands typing to allow None for text/speak/input_hint. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/connector/user_token_base.py | Improves typing for optional token params. |
| libraries/microsoft-agents-activity/microsoft_agents/activity/suggested_actions.py | Adds default_factory for to field (empty list by default). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 147 out of 155 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 166 out of 208 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 168 out of 210 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 169 out of 211 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 174 out of 215 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 174 out of 215 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (8)
libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/confirm_prompt.py:1
- ConfirmPrompt should return a boolean result, but
recognize_boolean()typically yields a string value (e.g., 'true'/'false') inresolution['value']. Returning a non-empty string will evaluate truthy and can break downstream code likeif step.result:. Convert the recognized value to a real bool (e.g., map strings to True/False, or handle already-boolean values) before assigningresult.value.
libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/prompts/confirm_prompt.py:1 - This exception is raised from
on_recognize()but the message saysConfirmPrompt.on_prompt(). Update the message to referenceConfirmPrompt.on_recognize()so errors are easier to diagnose.
libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/memory/scopes/dialog_memory_scope.py:1 - Using
parent_state or dc_statewill incorrectly fall back todc_statewhenparent_stateis a valid but falsy value (e.g., an empty dict). This changes binding semantics for container dialogs. Prefer an explicitNonecheck (returnparent_statewhen it is not None, otherwise returndc_state).
libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_set.py:1 - The constructor uses
inspect.currentframe()and only deletesframe, but keepscurrent_framealive. Frame objects can participate in reference cycles; to avoid leaking references, also deletecurrent_framein thefinallyblock (along withframe).
libraries/microsoft-agents-hosting-dialogs/microsoft_agents/hosting/dialogs/dialog_extensions.py:1 - This sends a full memory snapshot trace on every turn unconditionally. Depending on channel behavior, trace activities (and their payloads) may be logged or surfaced, which can leak PII/state and adds operational noise (larger payloads per turn). Consider gating this behind an explicit debug flag/config, limiting it to emulator/dev channels, or using a dedicated trace helper that is known to be suppressed outside dev tooling.
libraries/microsoft-agents-hosting-dialogs/setup.py:1 - If
VERSION.txtis missing andPackageVersionisn't set, this falls back to0.0.0and will emit an invalid dependency pin (microsoft-agents-hosting-core==0.0.0). Instead of silently defaulting, consider failing the build with a clear error when the version cannot be determined, or avoid exact-version pinning in this fallback path.
test_samples/activity_handler/dialogs/custom_dialogs/src/root_dialog.py:1 - Correct 'show sizes' to 'shoe sizes' in the comment.
test_samples/activity_handler/dialogs/multi_turn/src/agent.py:1 - Correct 'ocurred' to 'occurred' in the comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 168 out of 209 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 191 out of 231 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 189 out of 229 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (5)
test_samples/compat/teams_agent/app.py:17
- These imports reference
test_samples.activity_handler..., but there is notest_samples/activity_handlerpackage in the repo (the code is undertest_samples/compat/...). As-is, running the sample will fail withModuleNotFoundError. Either update the imports to match the actual folder structure (e.g., relative imports withincompat/teams_agent) or add the missing package/module path.
test_samples/compat/teams_agent/teams_sso.py:11 - This import points at
test_samples.activity_handler..., but that package path doesn't exist in the repo (the module is intest_samples/compat/teams_agent/graph_client.py). Update the import to the correct location or add the missing package structure so this sample runs.
test_samples/compat/teams_agent/teams_multi_feature.py:19 - These imports reference
test_samples.activity_handler..., but the referenced package path doesn't exist in the repo (the helpers live undertest_samples/compat/teams_agent/helpers). Update to the correct import path (or add the missing package) to avoid runtimeModuleNotFoundError.
test_samples/compat/agent_to_agent/agent_1/app.py:25 - These imports reference
test_samples.activity_handler..., but there is notest_samples/activity_handlerpackage in the repo. This will raiseModuleNotFoundErrorwhen running the sample. Either revert to local/relative imports withintest_samples/compat/agent_to_agent/agent_1or add the missing package structure.
test_samples/compat/agent_to_agent/agent_2/app.py:17 - These imports reference
test_samples.activity_handler..., but there is notest_samples/activity_handlerpackage in the repo. This will raiseModuleNotFoundErrorwhen running the sample. Either revert to local/relative imports withintest_samples/compat/agent_to_agent/agent_2or add the missing package structure.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if inner_dc.context.activity.type == ActivityTypes.message: | ||
| text = inner_dc.context.activity.text.lower() | ||
| if text == "logout": | ||
| user_token_client: UserTokenClient = inner_dc.context.turn_state.get( | ||
| UserTokenClient.__name__, None | ||
| ) | ||
| await user_token_client.user_token.sign_out( | ||
| inner_dc.context.activity.from_property.id, | ||
| self.connection_name, | ||
| inner_dc.context.activity.channel_id, | ||
| ) | ||
| await inner_dc.context.send_activity("You have been signed out.") |
There was a problem hiding this comment.
activity.text can be None for message activities; calling .lower() will raise. Also UserTokenClient can be missing from turn_state, so user_token_client.user_token can raise. Guard for None (e.g., default to "" for text; check user_token_client before calling sign_out and return a helpful message if not available).
| # Save any state changes that might have ocurred during the turn. | ||
| await self.conversation_state.save(turn_context) | ||
| await self.user_state.save(turn_context) |
There was a problem hiding this comment.
Typo in comment: "ocurred" → "occurred".
| from microsoft_agents.hosting.dialogs import ( | ||
| WaterfallDialog, | ||
| WaterfallStepContext, | ||
| DialogSet, | ||
| DialogTurnStatus, | ||
| ) | ||
| from microsoft_agents.hosting.dialogs.prompts import TextPrompt, PromptOptions | ||
| from microsoft_agents.hosting.core import ConversationState, MemoryStorage | ||
|
|
There was a problem hiding this comment.
The Quick Start snippet calls MessageFactory.text(...) but doesn't import MessageFactory, so the example will fail if copied. Add the missing import (or adjust the snippet to be self-contained).
PR Description
Port BotFramework Dialogs Package and Sample Restructuring
** Dialogs Package**
** Additional Changes**
fic/,mi/,bizchat-sso/) for better discoverabilityActivityHandlerScenarioto the testing package for scenario-based test validationPrimary focus is porting the dialogs system with supporting changes to improve developer experience and testing infrastructure.