microsoft-agents-hosting-core 1.4.0.dev13__tar.gz → 1.5.0.dev8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. {microsoft_agents_hosting_core-1.4.0.dev13/microsoft_agents_hosting_core.egg-info → microsoft_agents_hosting_core-1.5.0.dev8}/PKG-INFO +13 -2
  2. microsoft_agents_hosting_core-1.5.0.dev8/VERSION.txt +1 -0
  3. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/__init__.py +2 -0
  4. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_http_adapter_base.py +68 -4
  5. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +4 -6
  6. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +2 -5
  7. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/app/adaptive_card/__init__.py +6 -0
  8. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/app/adaptive_card/_type_defs.py +46 -0
  9. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/app/adaptive_card/adaptive_card.py +275 -0
  10. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/app/adaptive_card/factory.py +99 -0
  11. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/app/adaptive_card/models.py +29 -0
  12. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/agent_application.py +15 -0
  13. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/conversation.py +47 -6
  14. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/conversation_builder.py +35 -34
  15. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/conversation_reference_builder.py +31 -29
  16. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/create_conversation_options.py +6 -7
  17. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/proactive.py +46 -41
  18. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/proactive_options.py +2 -3
  19. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/app/proactive/telemetry/_utils.py +38 -0
  20. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/telemetry/spans.py +20 -4
  21. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +25 -0
  22. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/claims_identity.py +69 -9
  23. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/jwt/jwt_token_validator.py +2 -2
  24. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/channel_service_adapter.py +17 -11
  25. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/outbound_host_validator.py +117 -0
  26. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/core/_agents_telemetry.py +7 -2
  27. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/core/base_span_wrapper.py +4 -4
  28. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/core/simple_span_wrapper.py +22 -3
  29. microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/telemetry/turn_context/__init__.py +0 -0
  30. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents_hosting_core.egg-info}/PKG-INFO +13 -2
  31. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +8 -0
  32. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents_hosting_core.egg-info/requires.txt +3 -1
  33. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/pyproject.toml +4 -1
  34. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/readme.md +9 -0
  35. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/setup.py +2 -0
  36. microsoft_agents_hosting_core-1.4.0.dev13/VERSION.txt +0 -1
  37. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/LICENSE +0 -0
  38. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/MANIFEST.in +0 -0
  39. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_oauth/__init__.py +0 -0
  40. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_oauth/_flow_state.py +0 -0
  41. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_utils/__init__.py +0 -0
  42. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/_utils/_service_set.py +0 -0
  43. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/activity_handler.py +0 -0
  44. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/agent.py +0 -0
  45. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/__init__.py +0 -0
  46. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/_routes/__init__.py +0 -0
  47. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/_routes/_route.py +0 -0
  48. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/_routes/_route_list.py +0 -0
  49. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/_routes/route_rank.py +0 -0
  50. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/_type_defs.py +0 -0
  51. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/app_error.py +0 -0
  52. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/app_options.py +0 -0
  53. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/input_file.py +0 -0
  54. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -0
  55. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +0 -0
  56. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +0 -0
  57. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +0 -0
  58. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +0 -0
  59. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_handlers/connector_user_authorization.py +0 -0
  60. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +0 -0
  61. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +0 -0
  62. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -0
  63. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -0
  64. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/telemetry/__init__.py +0 -0
  65. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/telemetry/constants.py +0 -0
  66. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/oauth/telemetry/spans.py +0 -0
  67. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/__init__.py +0 -0
  68. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/telemetry/__init__.py +0 -0
  69. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/proactive/telemetry/constants.py +0 -0
  70. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/query.py +0 -0
  71. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
  72. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
  73. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/state/state.py +0 -0
  74. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
  75. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
  76. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/streaming/__init__.py +0 -0
  77. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/streaming/citation.py +0 -0
  78. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/streaming/citation_util.py +0 -0
  79. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/streaming/streaming_response.py +0 -0
  80. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/telemetry/__init__.py +0 -0
  81. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/telemetry/constants.py +0 -0
  82. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/telemetry/metrics.py +0 -0
  83. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/telemetry/spans.py +0 -0
  84. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -0
  85. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
  86. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/_entra_issuers.py +0 -0
  87. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/_log_config.py +0 -0
  88. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +0 -0
  89. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -0
  90. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
  91. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/authentication_constants.py +0 -0
  92. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/connection_manager.py +0 -0
  93. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/connection_settings_base.py +0 -0
  94. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
  95. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/jwt/__init__.py +0 -0
  96. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/jwt/_authorize_request.py +0 -0
  97. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/telemetry/__init__.py +0 -0
  98. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/telemetry/constants.py +0 -0
  99. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/telemetry/metrics.py +0 -0
  100. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/authorization/telemetry/spans.py +0 -0
  101. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/card_factory.py +0 -0
  102. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/channel_adapter.py +0 -0
  103. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
  104. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
  105. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/__init__.py +0 -0
  106. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
  107. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
  108. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
  109. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
  110. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
  111. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
  112. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
  113. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
  114. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
  115. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
  116. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
  117. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
  118. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
  119. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
  120. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/_utils.py +0 -0
  121. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
  122. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
  123. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
  124. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/client/_base_client.py +0 -0
  125. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/client/agent_sign_in.py +0 -0
  126. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/client/connector_client.py +0 -0
  127. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/client/user_token.py +0 -0
  128. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/client/user_token_client.py +0 -0
  129. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
  130. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
  131. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
  132. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/mcs/__init__.py +0 -0
  133. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/mcs/mcs_connector_client.py +0 -0
  134. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
  135. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
  136. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/telemetry/__init__.py +0 -0
  137. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/telemetry/_request_span_wrapper.py +0 -0
  138. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/telemetry/connector_spans.py +0 -0
  139. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/telemetry/constants.py +0 -0
  140. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/telemetry/metrics.py +0 -0
  141. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/telemetry/user_token_client_spans.py +0 -0
  142. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
  143. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
  144. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/errors/__init__.py +0 -0
  145. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/errors/error_resources.py +0 -0
  146. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/header_propagation/__init__.py +0 -0
  147. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/header_propagation/agentic_header_provider.py +0 -0
  148. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/header_propagation/header_propagation_context.py +0 -0
  149. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/header_propagation/header_value_provider.py +0 -0
  150. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/http/__init__.py +0 -0
  151. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/http/_channel_service_routes.py +0 -0
  152. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/http/_http_request_protocol.py +0 -0
  153. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/http/_http_response.py +0 -0
  154. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/message_factory.py +0 -0
  155. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/middleware_set.py +0 -0
  156. /microsoft_agents_hosting_core-1.4.0.dev13/microsoft_agents/hosting/core/storage/telemetry/__init__.py → /microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/py.typed +0 -0
  157. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +0 -0
  158. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/state/__init__.py +0 -0
  159. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/state/agent_state.py +0 -0
  160. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
  161. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/state/user_state.py +0 -0
  162. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
  163. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
  164. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
  165. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -0
  166. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/storage.py +0 -0
  167. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
  168. {microsoft_agents_hosting_core-1.4.0.dev13/microsoft_agents/hosting/core/telemetry/adapter → microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/storage/telemetry}/__init__.py +0 -0
  169. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/telemetry/constants.py +0 -0
  170. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/telemetry/metrics.py +0 -0
  171. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/telemetry/spans.py +0 -0
  172. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/transcript/__init__.py +0 -0
  173. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/transcript/transcript_file_store.py +0 -0
  174. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/transcript/transcript_info.py +0 -0
  175. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/transcript/transcript_logger.py +0 -0
  176. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/transcript/transcript_memory_store.py +0 -0
  177. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/storage/transcript/transcript_store.py +0 -0
  178. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/__init__.py +0 -0
  179. {microsoft_agents_hosting_core-1.4.0.dev13/microsoft_agents/hosting/core/telemetry/turn_context → microsoft_agents_hosting_core-1.5.0.dev8/microsoft_agents/hosting/core/telemetry/adapter}/__init__.py +0 -0
  180. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/adapter/constants.py +0 -0
  181. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/adapter/metrics.py +0 -0
  182. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/adapter/spans.py +0 -0
  183. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/attributes.py +0 -0
  184. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/core/__init__.py +0 -0
  185. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/core/resource.py +0 -0
  186. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/core/type_defs.py +0 -0
  187. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/turn_context/constants.py +0 -0
  188. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/turn_context/spans.py +0 -0
  189. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/telemetry/utils.py +0 -0
  190. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents/hosting/core/turn_context.py +0 -0
  191. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
  192. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
  193. {microsoft_agents_hosting_core-1.4.0.dev13 → microsoft_agents_hosting_core-1.5.0.dev8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-hosting-core
3
- Version: 1.4.0.dev13
3
+ Version: 1.5.0.dev8
4
4
  Summary: Core library for Microsoft Agents
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
@@ -15,12 +15,14 @@ Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: microsoft-agents-activity==1.4.0.dev13
18
+ Requires-Dist: microsoft-agents-activity==1.5.0.dev8
19
19
  Requires-Dist: pyjwt>=2.10.1
20
20
  Requires-Dist: isodate>=0.6.1
21
21
  Requires-Dist: python-dotenv>=1.1.1
22
22
  Requires-Dist: opentelemetry-api>=1.27.0
23
23
  Requires-Dist: opentelemetry-sdk>=1.27.0
24
+ Requires-Dist: aiohttp>=3.11.11
25
+ Requires-Dist: yarl<2.0,>=1.17.0
24
26
  Dynamic: license-file
25
27
  Dynamic: requires-dist
26
28
 
@@ -42,6 +44,15 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
42
44
  <th style="width:20%">Date</th>
43
45
  <th style="width:60%">Release Notes</th>
44
46
  </tr>
47
+ <tr>
48
+ <td>1.4.0</td>
49
+ <td>2026-08-18</td>
50
+ <td>
51
+ <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v140">
52
+ 1.4.0 Release Notes
53
+ </a>
54
+ </td>
55
+ </tr>
45
56
  <tr>
46
57
  <td>1.3.0</td>
47
58
  <td>2026-07-30</td>
@@ -0,0 +1 @@
1
+ 1.5.0.dev8
@@ -9,6 +9,7 @@ from .message_factory import MessageFactory
9
9
  from .middleware_set import Middleware, MiddlewareSet
10
10
  from .rest_channel_service_client_factory import RestChannelServiceClientFactory
11
11
  from .turn_context import TurnContext
12
+ from .outbound_host_validator import OutboundHostValidator
12
13
 
13
14
  # HTTP abstractions
14
15
  from .http import (
@@ -122,6 +123,7 @@ __all__ = [
122
123
  "Middleware",
123
124
  "RestChannelServiceClientFactory",
124
125
  "TurnContext",
126
+ "OutboundHostValidator",
125
127
  "HttpRequestProtocol",
126
128
  "HttpResponse",
127
129
  "HttpResponseFactory",
@@ -7,6 +7,8 @@ from abc import ABC
7
7
  from http import HTTPStatus
8
8
  from traceback import format_exc
9
9
 
10
+ import logging
11
+
10
12
  from microsoft_agents.activity import Activity, DeliveryModes
11
13
  from microsoft_agents.hosting.core.telemetry.adapter import spans
12
14
 
@@ -20,6 +22,9 @@ from .http._http_response import HttpResponse, HttpResponseFactory
20
22
  from .message_factory import MessageFactory
21
23
  from .rest_channel_service_client_factory import RestChannelServiceClientFactory
22
24
  from .turn_context import TurnContext
25
+ from .outbound_host_validator import OutboundHostValidator, _try_create_url
26
+
27
+ logger = logging.getLogger(__name__)
23
28
 
24
29
 
25
30
  class HttpAdapterBase(ChannelServiceAdapter, ABC):
@@ -35,6 +40,7 @@ class HttpAdapterBase(ChannelServiceAdapter, ABC):
35
40
  connection_manager: Connections | None = None,
36
41
  channel_service_client_factory: ChannelServiceClientFactoryBase | None = None,
37
42
  channel_service_client_factory_options: dict | None = None,
43
+ host_validator: OutboundHostValidator | None = None,
38
44
  ):
39
45
  """Initialize the HTTP adapter.
40
46
 
@@ -73,6 +79,7 @@ class HttpAdapterBase(ChannelServiceAdapter, ABC):
73
79
  connection_manager,
74
80
  **(channel_service_client_factory_options or {}),
75
81
  )
82
+ self._host_validator = host_validator or OutboundHostValidator()
76
83
 
77
84
  super().__init__(factory)
78
85
 
@@ -112,10 +119,8 @@ class HttpAdapterBase(ChannelServiceAdapter, ABC):
112
119
  span.share(activity=activity)
113
120
 
114
121
  # Get claims identity (default to anonymous if not set by middleware)
115
- claims_identity: (
116
- ClaimsIdentity
117
- ) = request.get_claims_identity() or ClaimsIdentity(
118
- {}, False, authentication_type="Anonymous"
122
+ claims_identity: ClaimsIdentity = (
123
+ request.get_claims_identity() or ClaimsIdentity()
119
124
  )
120
125
 
121
126
  # Validate required activity fields
@@ -128,6 +133,11 @@ class HttpAdapterBase(ChannelServiceAdapter, ABC):
128
133
  "Activity must have type and conversation.id"
129
134
  )
130
135
 
136
+ if not self._validate_service_url(claims_identity, activity):
137
+ return HttpResponseFactory.unauthorized(
138
+ "Service URL is not allowed by the host validator."
139
+ )
140
+
131
141
  try:
132
142
  # Process the inbound activity with the agent
133
143
  invoke_response = await self.process_activity(
@@ -153,3 +163,57 @@ class HttpAdapterBase(ChannelServiceAdapter, ABC):
153
163
 
154
164
  except PermissionError:
155
165
  return HttpResponseFactory.unauthorized()
166
+
167
+ def _validate_service_url(
168
+ self, claims_identity: ClaimsIdentity, activity: Activity
169
+ ) -> bool:
170
+ """Validate the service URL against the claims identity.
171
+
172
+ Args:
173
+ claims_identity: The claims identity to validate against.
174
+ activity: The activity containing the service URL to validate.
175
+
176
+ Returns:
177
+ True if the service URL is valid, False otherwise.
178
+ """
179
+
180
+ if (
181
+ self._host_validator.enabled
182
+ and activity.service_url
183
+ and not self._host_validator.is_allowed(activity.service_url)
184
+ ):
185
+ logger.warning(
186
+ "Service URL %s is not allowed by the host validator.",
187
+ activity.service_url,
188
+ )
189
+ return False
190
+
191
+ if not claims_identity:
192
+ return True
193
+
194
+ claims_service_url = claims_identity.get_claim_value("serviceurl")
195
+ if activity.service_url and claims_service_url:
196
+ claim_url = _try_create_url(claims_service_url)
197
+ activity_url = _try_create_url(activity.service_url)
198
+ claim_url_host = (claim_url.host or "") if claim_url else ""
199
+ activity_url_host = (activity_url.host or "") if activity_url else ""
200
+ if (
201
+ not claim_url
202
+ or not activity_url
203
+ or claim_url_host.casefold() != activity_url_host.casefold()
204
+ ):
205
+ if self._host_validator and self._host_validator.enabled:
206
+ logger.warning(
207
+ "Service URL host mismatch: %s vs %s",
208
+ claim_url_host,
209
+ activity_url_host,
210
+ )
211
+ return False
212
+ else:
213
+ logger.warning(
214
+ "Service URL host mismatch (host validator disabled): %s vs %s",
215
+ claim_url_host,
216
+ activity_url_host,
217
+ )
218
+
219
+ return True
@@ -1,8 +1,6 @@
1
1
  # Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  # Licensed under the MIT License.
3
3
 
4
- from typing import Optional
5
-
6
4
  from ..storage import Storage
7
5
  from ._flow_state import _FlowState
8
6
 
@@ -34,7 +32,7 @@ class _FlowStorageClient:
34
32
  channel_id: str,
35
33
  user_id: str,
36
34
  storage: Storage,
37
- cache_class: Optional[type[Storage]] = None,
35
+ cache_class: type[Storage] | None = None,
38
36
  ):
39
37
  """
40
38
  Args:
@@ -65,7 +63,7 @@ class _FlowStorageClient:
65
63
  """Creates a storage key for a specific sign-in handler."""
66
64
  return f"{self._base_key}{auth_handler_id}"
67
65
 
68
- async def read(self, auth_handler_id: str) -> Optional[_FlowState]:
66
+ async def read(self, auth_handler_id: str) -> _FlowState | None:
69
67
  """Reads the flow state for a specific authentication handler."""
70
68
  key: str = self.key(auth_handler_id)
71
69
  data = await self._cache.read([key], target_cls=_FlowState)
@@ -74,13 +72,13 @@ class _FlowStorageClient:
74
72
  if key not in data:
75
73
  return None
76
74
  await self._cache.write({key: data[key]})
77
- return _FlowState.model_validate(data.get(key))
75
+ return data.get(key)
78
76
 
79
77
  async def write(self, value: _FlowState) -> None:
80
78
  """Saves the flow state for a specific authentication handler."""
81
79
  key: str = self.key(value.auth_handler_id)
82
80
  cached_state = await self._cache.read([key], target_cls=_FlowState)
83
- if not cached_state or cached_state != value:
81
+ if not cached_state or cached_state.get(key, None) != value:
84
82
  await self._cache.write({key: value})
85
83
  await self._storage.write({key: value})
86
84
 
@@ -126,7 +126,7 @@ class _OAuthFlow:
126
126
  magic_code=magic_code,
127
127
  )
128
128
  if token_response:
129
- logger.info("User token obtained successfully: %s", token_response)
129
+ logger.info("User token obtained successfully")
130
130
  self._flow_state.expiration = (
131
131
  datetime.now(timezone.utc).timestamp() + self._default_flow_duration
132
132
  )
@@ -315,10 +315,7 @@ class _OAuthFlow:
315
315
  self._flow_state.expiration = (
316
316
  datetime.now(timezone.utc).timestamp() + self._default_flow_duration
317
317
  )
318
- logger.debug(
319
- "OAuth flow completed successfully, got TokenResponse: %s",
320
- token_response,
321
- )
318
+ logger.debug("OAuth flow completed successfully, got a token response.")
322
319
 
323
320
  return _FlowResponse(
324
321
  flow_state=self._flow_state.model_copy(),
@@ -0,0 +1,6 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .adaptive_card import AdaptiveCard
5
+
6
+ __all__ = ["AdaptiveCard"]
@@ -0,0 +1,46 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from typing import Awaitable, Protocol
5
+
6
+ from microsoft_agents.activity import (
7
+ AdaptiveCardInvokeResponse,
8
+ AdaptiveCardInvokeValue,
9
+ )
10
+
11
+ from microsoft_agents.hosting.core.turn_context import TurnContext
12
+ from microsoft_agents.hosting.core.app.state import TurnState
13
+
14
+ from .models import (
15
+ AdaptiveCardSearchParams,
16
+ AdaptiveCardSearchResult,
17
+ Query,
18
+ )
19
+
20
+
21
+ class ActionExecuteHandler(Protocol):
22
+ def __call__(
23
+ self, context: TurnContext, state: TurnState, data: object, /
24
+ ) -> Awaitable[AdaptiveCardInvokeResponse]: ...
25
+
26
+
27
+ class ActionExecuteValueHandler(Protocol):
28
+ def __call__(
29
+ self, context: TurnContext, state: TurnState, value: AdaptiveCardInvokeValue, /
30
+ ) -> Awaitable[AdaptiveCardInvokeResponse]: ...
31
+
32
+
33
+ class ActionSubmitHandler(Protocol):
34
+ def __call__(
35
+ self, context: TurnContext, state: TurnState, data: object, /
36
+ ) -> Awaitable[None]: ...
37
+
38
+
39
+ class SearchHandler(Protocol):
40
+ def __call__(
41
+ self,
42
+ context: TurnContext,
43
+ state: TurnState,
44
+ query: Query[AdaptiveCardSearchParams],
45
+ /,
46
+ ) -> Awaitable[list[AdaptiveCardSearchResult]]: ...
@@ -0,0 +1,275 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from __future__ import annotations
5
+
6
+ from dataclasses import asdict
7
+ from http import HTTPStatus
8
+ from typing import TYPE_CHECKING, Callable, Pattern
9
+
10
+ import pydantic
11
+
12
+ from microsoft_agents.activity import (
13
+ Activity,
14
+ ActivityTypes,
15
+ AdaptiveCardInvokeResponse,
16
+ AdaptiveCardInvokeValue,
17
+ AdaptiveCardSearchInvokeValue,
18
+ Channels,
19
+ ChannelId,
20
+ InvokeResponse,
21
+ )
22
+ from microsoft_agents.hosting.core.turn_context import TurnContext
23
+
24
+ from ..state import TurnState
25
+ from . import factory
26
+ from ._type_defs import (
27
+ ActionExecuteHandler,
28
+ ActionSubmitHandler,
29
+ SearchHandler,
30
+ )
31
+ from .models import AdaptiveCardSearchParams, Query
32
+
33
+ if TYPE_CHECKING:
34
+ from ..agent_application import AgentApplication
35
+
36
+ _ACTION_EXECUTE_TYPE = "Action.Execute"
37
+ _ACTION_INVOKE_NAME = "adaptiveCard/action"
38
+ _SEARCH_INVOKE_NAME = "application/search"
39
+
40
+
41
+ class AdaptiveCard:
42
+ """Register handlers for Adaptive Card activities."""
43
+
44
+ def __init__(self, app: AgentApplication):
45
+ """Initialize an Adaptive Card route registrar for an application."""
46
+ self._app = app
47
+
48
+ def action_execute(
49
+ self,
50
+ verb: str | Pattern[str],
51
+ *,
52
+ auth_handlers: list[str] | None = None,
53
+ **kwargs,
54
+ ) -> Callable[[ActionExecuteHandler], ActionExecuteHandler]:
55
+ """Register an ``Action.Execute`` handler that receives the action data."""
56
+
57
+ def selector(context: TurnContext) -> bool:
58
+ activity = context.activity
59
+ if (
60
+ activity.type != ActivityTypes.invoke
61
+ or activity.name != _ACTION_INVOKE_NAME
62
+ ):
63
+ return False
64
+
65
+ try:
66
+ invoke_value = AdaptiveCardInvokeValue.model_validate(activity.value)
67
+ except pydantic.ValidationError:
68
+ return False
69
+
70
+ verb_value = (
71
+ invoke_value.action.verb if invoke_value.action is not None else None
72
+ )
73
+ return self._matches(verb, verb_value)
74
+
75
+ def register(func: Callable) -> Callable:
76
+ async def handler(context: TurnContext, state: TurnState) -> None:
77
+ invoke_value, response = self._validate_action_execute_value(context)
78
+
79
+ if invoke_value is not None:
80
+ response = await func(context, state, invoke_value.action.data)
81
+
82
+ response = response or AdaptiveCardInvokeResponse(
83
+ status_code=HTTPStatus.OK
84
+ )
85
+
86
+ await self._send_invoke_response(
87
+ context, response, status_code=HTTPStatus.OK
88
+ )
89
+
90
+ kwargs.pop("is_invoke", None)
91
+ self._app.add_route(
92
+ selector,
93
+ handler,
94
+ is_invoke=True,
95
+ auth_handlers=auth_handlers,
96
+ **kwargs,
97
+ )
98
+ return func
99
+
100
+ return register
101
+
102
+ def action_submit(
103
+ self,
104
+ verb: str | Pattern[str],
105
+ *,
106
+ auth_handlers: list[str] | None = None,
107
+ submit_filter: str = "verb",
108
+ **kwargs,
109
+ ) -> Callable[[ActionSubmitHandler], ActionSubmitHandler]:
110
+ """Register an Adaptive Card ``Action.Submit`` handler."""
111
+
112
+ def selector(context: TurnContext) -> bool:
113
+ activity = context.activity
114
+ if (
115
+ activity.type != ActivityTypes.message
116
+ or activity.text
117
+ or activity.value is None
118
+ ):
119
+ return False
120
+
121
+ verb_value = None
122
+ if isinstance(activity.value, dict):
123
+ verb_value = activity.value.get(submit_filter)
124
+ return self._matches(verb, verb_value)
125
+
126
+ def register(func: ActionSubmitHandler) -> ActionSubmitHandler:
127
+ async def handler(context: TurnContext, state: TurnState) -> None:
128
+ await func(context, state, context.activity.value)
129
+
130
+ self._app.add_route(
131
+ selector,
132
+ handler,
133
+ is_invoke=False,
134
+ auth_handlers=auth_handlers,
135
+ **kwargs,
136
+ )
137
+ return func
138
+
139
+ return register
140
+
141
+ def search(
142
+ self,
143
+ dataset: str | Pattern[str],
144
+ *,
145
+ auth_handlers: list[str] | None = None,
146
+ **kwargs,
147
+ ) -> Callable[[SearchHandler], SearchHandler]:
148
+ """Register an Adaptive Card dynamic-search handler."""
149
+
150
+ def selector(context: TurnContext) -> bool:
151
+ activity = context.activity
152
+ if (
153
+ activity.type != ActivityTypes.invoke
154
+ or activity.name != _SEARCH_INVOKE_NAME
155
+ ):
156
+ return False
157
+
158
+ try:
159
+ invoke_value = AdaptiveCardSearchInvokeValue.model_validate(
160
+ activity.value
161
+ )
162
+ except pydantic.ValidationError:
163
+ return False
164
+
165
+ return self._matches(dataset, invoke_value.dataset)
166
+
167
+ def register(func: SearchHandler) -> SearchHandler:
168
+ async def handler(context: TurnContext, state: TurnState) -> None:
169
+ value, response = self._validate_search_value(context)
170
+ if value is not None:
171
+ options = value.query_options
172
+ query = Query(
173
+ count=options.top,
174
+ skip=options.skip,
175
+ parameters=AdaptiveCardSearchParams(
176
+ query_text=value.query_text,
177
+ dataset=value.dataset or "",
178
+ ),
179
+ )
180
+ results = await func(context, state, query)
181
+ response = factory.search_response(
182
+ {"results": [asdict(result) for result in results]}
183
+ )
184
+
185
+ await self._send_invoke_response(
186
+ context, response, response.status_code or HTTPStatus.OK
187
+ )
188
+
189
+ kwargs.pop("is_invoke", None)
190
+ self._app.add_route(
191
+ selector,
192
+ handler,
193
+ is_invoke=True,
194
+ auth_handlers=auth_handlers,
195
+ **kwargs,
196
+ )
197
+ return func
198
+
199
+ return register
200
+
201
+ def _validate_action_execute_value(
202
+ self, context: TurnContext
203
+ ) -> tuple[AdaptiveCardInvokeValue | None, AdaptiveCardInvokeResponse]:
204
+ if context.activity.value is None:
205
+ return None, factory.bad_request("Missing value property for Invoke Action")
206
+
207
+ try:
208
+ value = AdaptiveCardInvokeValue.model_validate(context.activity.value)
209
+ except pydantic.ValidationError:
210
+ return None, factory.bad_request(
211
+ "Value property is not a properly formed Invoke Action"
212
+ )
213
+
214
+ if value.action is None:
215
+ return None, factory.bad_request("Missing action property")
216
+ if value.action.type != _ACTION_EXECUTE_TYPE:
217
+ return None, factory.not_supported(
218
+ f"The Invoke Action '{value.action.type}' was not expected."
219
+ )
220
+
221
+ return value, AdaptiveCardInvokeResponse()
222
+
223
+ def _validate_search_value(
224
+ self, context: TurnContext
225
+ ) -> tuple[AdaptiveCardSearchInvokeValue | None, AdaptiveCardInvokeResponse]:
226
+ value = context.activity.value
227
+ if value is None:
228
+ return None, factory.bad_request("Missing value property for search")
229
+
230
+ try:
231
+ search_invoke_value = AdaptiveCardSearchInvokeValue.model_validate(value)
232
+ except pydantic.ValidationError:
233
+ return None, factory.bad_request(
234
+ "Value property is not a properly formed search invoke value"
235
+ )
236
+
237
+ missing = []
238
+ if not search_invoke_value.kind:
239
+ if ChannelId.get_channel(context.activity.channel_id) == Channels.ms_teams:
240
+ search_invoke_value.kind = "search"
241
+ else:
242
+ missing.append("kind")
243
+
244
+ if not search_invoke_value.query_text:
245
+ missing.append("queryText")
246
+
247
+ if missing:
248
+ return None, factory.bad_request(
249
+ f"Missing '{', '.join(missing)}' property for search"
250
+ )
251
+ return search_invoke_value, AdaptiveCardInvokeResponse()
252
+
253
+ @staticmethod
254
+ def _matches(selector: str | Pattern[str], value: object) -> bool:
255
+ if not isinstance(value, str):
256
+ return False
257
+ if isinstance(selector, str):
258
+ return selector == value
259
+ return selector.search(value) is not None
260
+
261
+ @staticmethod
262
+ async def _send_invoke_response(
263
+ context: TurnContext,
264
+ body: AdaptiveCardInvokeResponse,
265
+ status_code: int | HTTPStatus = HTTPStatus.OK,
266
+ ) -> None:
267
+ await context.send_activity(
268
+ Activity(
269
+ type=ActivityTypes.invoke_response,
270
+ value=InvokeResponse(
271
+ status=int(status_code),
272
+ body=body.model_dump(mode="json", by_alias=True, exclude_none=True),
273
+ ),
274
+ )
275
+ )
@@ -0,0 +1,99 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from http import HTTPStatus
5
+
6
+ from microsoft_agents.activity import (
7
+ AdaptiveCardInvokeResponse,
8
+ ContentTypes,
9
+ OAuthCard,
10
+ )
11
+
12
+
13
+ def adaptive_card(adaptive_card_json: str) -> AdaptiveCardInvokeResponse:
14
+ return AdaptiveCardInvokeResponse(
15
+ status_code=HTTPStatus.OK,
16
+ type=ContentTypes.adaptive_card,
17
+ value=adaptive_card_json,
18
+ )
19
+
20
+
21
+ def search_response(result: dict | str) -> AdaptiveCardInvokeResponse:
22
+ return AdaptiveCardInvokeResponse(
23
+ status_code=HTTPStatus.OK,
24
+ type=ContentTypes.search_response,
25
+ value=result,
26
+ )
27
+
28
+
29
+ def message(msg: str) -> AdaptiveCardInvokeResponse:
30
+ return AdaptiveCardInvokeResponse(
31
+ status_code=HTTPStatus.OK,
32
+ type=ContentTypes.message,
33
+ value=msg,
34
+ )
35
+
36
+
37
+ def login(card: OAuthCard) -> AdaptiveCardInvokeResponse:
38
+ return AdaptiveCardInvokeResponse(
39
+ status_code=HTTPStatus.UNAUTHORIZED,
40
+ type=ContentTypes.login_request,
41
+ value=card,
42
+ )
43
+
44
+
45
+ def incorrect_auth_code() -> AdaptiveCardInvokeResponse:
46
+ return AdaptiveCardInvokeResponse(
47
+ status_code=HTTPStatus.UNAUTHORIZED,
48
+ type=ContentTypes.incorrect_auth_code,
49
+ )
50
+
51
+
52
+ def precondition_failed(
53
+ message: str, code: str | None = None
54
+ ) -> AdaptiveCardInvokeResponse:
55
+ return AdaptiveCardInvokeResponse(
56
+ status_code=HTTPStatus.PRECONDITION_FAILED,
57
+ type=ContentTypes.precondition_failed,
58
+ value={
59
+ "message": message,
60
+ "code": code or str(HTTPStatus.PRECONDITION_FAILED),
61
+ },
62
+ )
63
+
64
+
65
+ def error(
66
+ status_code: int, message: str, code: str | None = None
67
+ ) -> AdaptiveCardInvokeResponse:
68
+ return AdaptiveCardInvokeResponse(
69
+ status_code=status_code,
70
+ type=ContentTypes.error,
71
+ value={
72
+ "code": code or str(status_code),
73
+ "message": message,
74
+ },
75
+ )
76
+
77
+
78
+ def bad_request(message: str) -> AdaptiveCardInvokeResponse:
79
+ return error(
80
+ HTTPStatus.BAD_REQUEST,
81
+ message,
82
+ "BadRequest",
83
+ )
84
+
85
+
86
+ def not_supported(message: str) -> AdaptiveCardInvokeResponse:
87
+ return error(
88
+ HTTPStatus.NOT_IMPLEMENTED,
89
+ message,
90
+ "NotSupported",
91
+ )
92
+
93
+
94
+ def internal_error(message: str) -> AdaptiveCardInvokeResponse:
95
+ return error(
96
+ HTTPStatus.INTERNAL_SERVER_ERROR,
97
+ message,
98
+ "InternalError",
99
+ )
@@ -0,0 +1,29 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from dataclasses import dataclass
5
+ from typing import Generic, TypeVar
6
+
7
+ ParamsT = TypeVar("ParamsT")
8
+
9
+
10
+ @dataclass
11
+ class AdaptiveCardSearchParams:
12
+
13
+ query_text: str
14
+ dataset: str
15
+
16
+
17
+ @dataclass
18
+ class AdaptiveCardSearchResult:
19
+
20
+ title: str
21
+ value: str
22
+
23
+
24
+ @dataclass
25
+ class Query(Generic[ParamsT]):
26
+
27
+ count: int
28
+ skip: int
29
+ parameters: ParamsT