microsoft-agents-hosting-core 0.9.0.dev10__tar.gz → 0.10.0.dev0__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.
- {microsoft_agents_hosting_core-0.9.0.dev10/microsoft_agents_hosting_core.egg-info → microsoft_agents_hosting_core-0.10.0.dev0}/PKG-INFO +11 -2
- microsoft_agents_hosting_core-0.10.0.dev0/VERSION.txt +1 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/__init__.py +17 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/agent_application.py +28 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/app_options.py +8 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/telemetry/constants.py +2 -2
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/__init__.py +20 -0
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/conversation.py +152 -0
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/conversation_builder.py +237 -0
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/conversation_reference_builder.py +238 -0
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/create_conversation_options.py +61 -0
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/proactive.py +394 -0
- microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/proactive_options.py +35 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/telemetry/spans.py +2 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/telemetry/constants.py +4 -4
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/client/connector_client.py +15 -15
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/telemetry/constants.py +10 -10
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/telemetry/user_token_client_spans.py +5 -8
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/http/_http_adapter_base.py +5 -4
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/state/agent_state.py +5 -1
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/telemetry/spans.py +8 -6
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/adapter/constants.py +1 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/adapter/spans.py +25 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/attributes.py +2 -1
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/core/_agents_telemetry.py +4 -23
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/turn_context/constants.py +1 -1
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/turn_context/spans.py +3 -3
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/turn_context.py +38 -35
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents_hosting_core.egg-info}/PKG-INFO +11 -2
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +7 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents_hosting_core.egg-info/requires.txt +1 -1
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/readme.md +9 -0
- microsoft_agents_hosting_core-0.9.0.dev10/VERSION.txt +0 -1
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/LICENSE +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/MANIFEST.in +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/_oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/_oauth/_flow_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/activity_handler.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/agent.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/_routes/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/_routes/_route.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/_routes/_route_list.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/_routes/route_rank.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/_type_defs.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/app_error.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/input_file.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_handlers/connector_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/oauth/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/query.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/state/state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/streaming/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/streaming/citation.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/streaming/citation_util.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/streaming/streaming_response.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/authentication_constants.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/claims_identity.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/jwt_token_validator.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/authorization/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/card_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/channel_adapter.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/channel_service_adapter.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/client/user_token_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/mcs/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/mcs/mcs_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/telemetry/_request_span_wrapper.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/telemetry/connector_spans.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/errors/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/errors/error_resources.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/http/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/http/_channel_service_routes.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/http/_http_request_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/http/_http_response.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/message_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/middleware_set.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/state/user_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/storage.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/transcript_file_store.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/transcript_info.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/transcript_logger.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/transcript_memory_store.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/storage/transcript_store.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/adapter/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/adapter/metrics.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/core/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/core/base_span_wrapper.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/core/resource.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/core/simple_span_wrapper.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/core/type_defs.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/turn_context/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents/hosting/core/telemetry/utils.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/pyproject.toml +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/setup.cfg +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev10 → microsoft_agents_hosting_core-0.10.0.dev0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0.dev0
|
|
4
4
|
Summary: Core library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,7 +15,7 @@ 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==0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==0.10.0.dev0
|
|
19
19
|
Requires-Dist: pyjwt>=2.10.1
|
|
20
20
|
Requires-Dist: isodate>=0.6.1
|
|
21
21
|
Requires-Dist: azure-core>=1.30.0
|
|
@@ -43,6 +43,15 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
|
|
|
43
43
|
<th style="width:20%">Date</th>
|
|
44
44
|
<th style="width:60%">Release Notes</th>
|
|
45
45
|
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td>0.9.0</td>
|
|
48
|
+
<td>2026-04-15</td>
|
|
49
|
+
<td>
|
|
50
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v090">
|
|
51
|
+
0.9.0 Release Notes
|
|
52
|
+
</a>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
46
55
|
<tr>
|
|
47
56
|
<td>0.8.0</td>
|
|
48
57
|
<td>2026-02-23</td>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.10.0.dev0
|
|
@@ -21,6 +21,16 @@ from .oauth import (
|
|
|
21
21
|
AgenticUserAuthorization,
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
+
# Proactive
|
|
25
|
+
from .proactive import (
|
|
26
|
+
Conversation,
|
|
27
|
+
ConversationBuilder,
|
|
28
|
+
ConversationReferenceBuilder,
|
|
29
|
+
CreateConversationOptions,
|
|
30
|
+
Proactive,
|
|
31
|
+
ProactiveOptions,
|
|
32
|
+
)
|
|
33
|
+
|
|
24
34
|
# App State
|
|
25
35
|
from .state.conversation_state import ConversationState
|
|
26
36
|
from .state.state import State, StatePropertyAccessor, state
|
|
@@ -47,4 +57,11 @@ __all__ = [
|
|
|
47
57
|
"Authorization",
|
|
48
58
|
"AuthHandler",
|
|
49
59
|
"AgenticUserAuthorization",
|
|
60
|
+
# Proactive
|
|
61
|
+
"Conversation",
|
|
62
|
+
"ConversationBuilder",
|
|
63
|
+
"ConversationReferenceBuilder",
|
|
64
|
+
"CreateConversationOptions",
|
|
65
|
+
"Proactive",
|
|
66
|
+
"ProactiveOptions",
|
|
50
67
|
]
|
|
@@ -45,6 +45,7 @@ from .telemetry import spans
|
|
|
45
45
|
|
|
46
46
|
from ._type_defs import RouteHandler, RouteSelector
|
|
47
47
|
from ._routes import _RouteList, _Route, RouteRank, _agentic_selector
|
|
48
|
+
from .proactive import Proactive, ProactiveOptions
|
|
48
49
|
|
|
49
50
|
logger = logging.getLogger(__name__)
|
|
50
51
|
|
|
@@ -69,6 +70,7 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
69
70
|
_options: ApplicationOptions
|
|
70
71
|
_adapter: Optional[ChannelServiceAdapter] = None
|
|
71
72
|
_auth: Optional[Authorization] = None
|
|
73
|
+
_proactive: Optional[Proactive] = None
|
|
72
74
|
_internal_before_turn: list[Callable[[TurnContext, StateT], Awaitable[bool]]] = []
|
|
73
75
|
_internal_after_turn: list[Callable[[TurnContext, StateT], Awaitable[bool]]] = []
|
|
74
76
|
_route_list: _RouteList[StateT] = _RouteList[StateT]()
|
|
@@ -147,6 +149,12 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
147
149
|
or partial(TurnState.with_storage, self._options.storage)
|
|
148
150
|
)
|
|
149
151
|
|
|
152
|
+
if options.proactive:
|
|
153
|
+
proactive_opts = copy(options.proactive)
|
|
154
|
+
if not proactive_opts.storage:
|
|
155
|
+
proactive_opts.storage = self._options.storage
|
|
156
|
+
self._proactive = Proactive(self, proactive_opts)
|
|
157
|
+
|
|
150
158
|
# TODO: decide how to initialize the Authorization (params vs options vs kwargs)
|
|
151
159
|
if authorization:
|
|
152
160
|
self._auth = authorization
|
|
@@ -216,6 +224,26 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
216
224
|
"""
|
|
217
225
|
return self._options
|
|
218
226
|
|
|
227
|
+
@property
|
|
228
|
+
def proactive(self) -> Proactive:
|
|
229
|
+
"""
|
|
230
|
+
The application's proactive messaging manager.
|
|
231
|
+
|
|
232
|
+
:return: The proactive messaging manager.
|
|
233
|
+
:rtype: :class:`microsoft_agents.hosting.core.app.proactive.proactive.Proactive`
|
|
234
|
+
:raises ApplicationError: If proactive options were not configured.
|
|
235
|
+
"""
|
|
236
|
+
if not self._proactive:
|
|
237
|
+
logger.error(
|
|
238
|
+
"AgentApplication.proactive(): proactive options are not configured.",
|
|
239
|
+
stack_info=True,
|
|
240
|
+
)
|
|
241
|
+
raise ApplicationError("""
|
|
242
|
+
The `AgentApplication.proactive` property is unavailable because
|
|
243
|
+
no ProactiveOptions were configured in ApplicationOptions.
|
|
244
|
+
""")
|
|
245
|
+
return self._proactive
|
|
246
|
+
|
|
219
247
|
def add_route(
|
|
220
248
|
self,
|
|
221
249
|
selector: RouteSelector,
|
|
@@ -17,6 +17,7 @@ from .input_file import InputFileDownloader
|
|
|
17
17
|
from ..channel_service_adapter import ChannelServiceAdapter
|
|
18
18
|
|
|
19
19
|
from .state.turn_state import TurnState
|
|
20
|
+
from .proactive.proactive_options import ProactiveOptions
|
|
20
21
|
|
|
21
22
|
# from .teams_adapter import TeamsAdapter
|
|
22
23
|
|
|
@@ -89,3 +90,10 @@ class ApplicationOptions:
|
|
|
89
90
|
Optional. Authorization handler for OAuth flows.
|
|
90
91
|
If not provided, no OAuth flows will be supported.
|
|
91
92
|
"""
|
|
93
|
+
|
|
94
|
+
proactive: Optional[ProactiveOptions] = None
|
|
95
|
+
"""
|
|
96
|
+
Optional. Options for the proactive messaging subsystem.
|
|
97
|
+
When set, :attr:`AgentApplication.proactive` is available for storing
|
|
98
|
+
conversations and initiating proactive turns.
|
|
99
|
+
"""
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
|
|
4
4
|
AGENTIC_TOKEN = "agents.authorization.agentic_token"
|
|
5
5
|
AZURE_BOT_TOKEN = "agents.authorization.azure_bot_token"
|
|
6
|
-
AZURE_BOT_SIGN_OUT = "agents.authorization.
|
|
7
|
-
AZURE_BOT_SIGN_IN = "agents.authorization.
|
|
6
|
+
AZURE_BOT_SIGN_OUT = "agents.authorization.azure_bot_signout"
|
|
7
|
+
AZURE_BOT_SIGN_IN = "agents.authorization.azure_bot_signin"
|
microsoft_agents_hosting_core-0.10.0.dev0/microsoft_agents/hosting/core/app/proactive/__init__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the MIT License.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .conversation import Conversation
|
|
7
|
+
from .conversation_builder import ConversationBuilder
|
|
8
|
+
from .conversation_reference_builder import ConversationReferenceBuilder
|
|
9
|
+
from .create_conversation_options import CreateConversationOptions
|
|
10
|
+
from .proactive import Proactive
|
|
11
|
+
from .proactive_options import ProactiveOptions
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"Conversation",
|
|
15
|
+
"ConversationBuilder",
|
|
16
|
+
"ConversationReferenceBuilder",
|
|
17
|
+
"CreateConversationOptions",
|
|
18
|
+
"Proactive",
|
|
19
|
+
"ProactiveOptions",
|
|
20
|
+
]
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the MIT License.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Optional, TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from microsoft_agents.activity import ConversationReference
|
|
11
|
+
from microsoft_agents.hosting.core.authorization import ClaimsIdentity
|
|
12
|
+
from microsoft_agents.hosting.core.storage.store_item import StoreItem
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from microsoft_agents.hosting.core.turn_context import TurnContext
|
|
16
|
+
from microsoft_agents.hosting.core.channel_adapter import ChannelAdapter
|
|
17
|
+
|
|
18
|
+
# JWT claim keys that are persisted alongside a ConversationReference.
|
|
19
|
+
_PERSISTED_CLAIM_KEYS = frozenset({"aud", "azp", "appid", "idtyp", "ver", "iss", "tid"})
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Conversation(StoreItem):
|
|
23
|
+
"""
|
|
24
|
+
Bundles a :class:`~microsoft_agents.activity.ConversationReference` together
|
|
25
|
+
with a filtered set of JWT claims so that a proactive continuation can be
|
|
26
|
+
performed without holding onto the full :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`.
|
|
27
|
+
|
|
28
|
+
Instances are typically created via
|
|
29
|
+
:meth:`~microsoft_agents.hosting.core.app.proactive.conversation_builder.ConversationBuilder`
|
|
30
|
+
or via :meth:`from_turn_context`.
|
|
31
|
+
|
|
32
|
+
:param claims: Filtered JWT claims (``aud``, ``azp``, ``appid``, ``idtyp``,
|
|
33
|
+
``ver``, ``iss``, ``tid``). May be a raw ``dict`` or a
|
|
34
|
+
:class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`.
|
|
35
|
+
:type claims: dict[str, str] or ClaimsIdentity
|
|
36
|
+
:param conversation_reference: The conversation reference.
|
|
37
|
+
:type conversation_reference: :class:`~microsoft_agents.activity.ConversationReference`
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
claims: "dict[str, str] | ClaimsIdentity",
|
|
43
|
+
conversation_reference: ConversationReference,
|
|
44
|
+
) -> None:
|
|
45
|
+
if isinstance(claims, ClaimsIdentity):
|
|
46
|
+
self.claims: dict[str, str] = Conversation.claims_from_identity(claims)
|
|
47
|
+
else:
|
|
48
|
+
self.claims = {
|
|
49
|
+
k: v for k, v in claims.items() if k in _PERSISTED_CLAIM_KEYS
|
|
50
|
+
}
|
|
51
|
+
self.conversation_reference: ConversationReference = conversation_reference
|
|
52
|
+
|
|
53
|
+
# ------------------------------------------------------------------
|
|
54
|
+
# Factory helpers
|
|
55
|
+
# ------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_turn_context(cls, context: "TurnContext") -> "Conversation":
|
|
59
|
+
"""
|
|
60
|
+
Create a :class:`Conversation` from the current turn context.
|
|
61
|
+
|
|
62
|
+
:param context: The active turn context.
|
|
63
|
+
:type context: :class:`~microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
64
|
+
:return: A new :class:`Conversation` capturing the current turn's identity
|
|
65
|
+
and conversation reference.
|
|
66
|
+
:rtype: :class:`Conversation`
|
|
67
|
+
"""
|
|
68
|
+
from microsoft_agents.hosting.core.channel_adapter import ChannelAdapter
|
|
69
|
+
|
|
70
|
+
identity: Optional[ClaimsIdentity] = context.turn_state.get(
|
|
71
|
+
ChannelAdapter.AGENT_IDENTITY_KEY
|
|
72
|
+
)
|
|
73
|
+
reference = context.activity.get_conversation_reference()
|
|
74
|
+
return cls(identity or {}, reference)
|
|
75
|
+
|
|
76
|
+
# ------------------------------------------------------------------
|
|
77
|
+
# Claims helpers
|
|
78
|
+
# ------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
@staticmethod
|
|
81
|
+
def claims_from_identity(identity: ClaimsIdentity) -> "dict[str, str]":
|
|
82
|
+
"""
|
|
83
|
+
Return the subset of claims from *identity* that are relevant for proactive
|
|
84
|
+
messaging (``aud``, ``azp``, ``appid``, ``idtyp``, ``ver``, ``iss``, ``tid``).
|
|
85
|
+
|
|
86
|
+
:param identity: The full claims identity.
|
|
87
|
+
:type identity: :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`
|
|
88
|
+
:return: Filtered claims dictionary.
|
|
89
|
+
:rtype: dict[str, str]
|
|
90
|
+
"""
|
|
91
|
+
return {k: v for k, v in identity.claims.items() if k in _PERSISTED_CLAIM_KEYS}
|
|
92
|
+
|
|
93
|
+
@staticmethod
|
|
94
|
+
def identity_from_claims(claims: "dict[str, str]") -> ClaimsIdentity:
|
|
95
|
+
"""
|
|
96
|
+
Reconstruct a :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`
|
|
97
|
+
from a previously persisted claims dict.
|
|
98
|
+
|
|
99
|
+
:param claims: Filtered claims dictionary (as produced by :meth:`claims_from_identity`).
|
|
100
|
+
:type claims: dict[str, str]
|
|
101
|
+
:return: Reconstituted claims identity.
|
|
102
|
+
:rtype: :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`
|
|
103
|
+
"""
|
|
104
|
+
return ClaimsIdentity(claims=dict(claims), is_authenticated=True)
|
|
105
|
+
|
|
106
|
+
# ------------------------------------------------------------------
|
|
107
|
+
# Validation
|
|
108
|
+
# ------------------------------------------------------------------
|
|
109
|
+
|
|
110
|
+
def validate(self) -> None:
|
|
111
|
+
"""
|
|
112
|
+
Raise :exc:`ValueError` if required fields are missing.
|
|
113
|
+
|
|
114
|
+
:raises ValueError: If ``conversation_reference``, its nested
|
|
115
|
+
``conversation``, or ``service_url`` are absent.
|
|
116
|
+
"""
|
|
117
|
+
if not self.conversation_reference:
|
|
118
|
+
raise ValueError("Conversation.conversation_reference is required.")
|
|
119
|
+
if not self.conversation_reference.conversation:
|
|
120
|
+
raise ValueError(
|
|
121
|
+
"Conversation.conversation_reference.conversation is required."
|
|
122
|
+
)
|
|
123
|
+
if not self.conversation_reference.conversation.id:
|
|
124
|
+
raise ValueError(
|
|
125
|
+
"Conversation.conversation_reference.conversation.id is required."
|
|
126
|
+
)
|
|
127
|
+
if not self.conversation_reference.service_url:
|
|
128
|
+
raise ValueError(
|
|
129
|
+
"Conversation.conversation_reference.service_url is required."
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# ------------------------------------------------------------------
|
|
133
|
+
# StoreItem serialization
|
|
134
|
+
# ------------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
def store_item_to_json(self) -> dict:
|
|
137
|
+
return {
|
|
138
|
+
"claims": self.claims,
|
|
139
|
+
"conversation_reference": self.conversation_reference.model_dump(
|
|
140
|
+
mode="json", by_alias=True, exclude_unset=True
|
|
141
|
+
),
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@staticmethod
|
|
145
|
+
def from_json_to_store_item(json_data: dict) -> "Conversation":
|
|
146
|
+
reference = ConversationReference.model_validate(
|
|
147
|
+
json_data.get("conversation_reference", {})
|
|
148
|
+
)
|
|
149
|
+
return Conversation(
|
|
150
|
+
claims=json_data.get("claims", {}),
|
|
151
|
+
conversation_reference=reference,
|
|
152
|
+
)
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the MIT License.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from microsoft_agents.activity import (
|
|
11
|
+
ChannelAccount,
|
|
12
|
+
Channels,
|
|
13
|
+
ConversationAccount,
|
|
14
|
+
ConversationReference,
|
|
15
|
+
)
|
|
16
|
+
from microsoft_agents.hosting.core.authorization import ClaimsIdentity
|
|
17
|
+
|
|
18
|
+
from .conversation import Conversation
|
|
19
|
+
from .conversation_reference_builder import _service_url_for_channel
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ConversationBuilder:
|
|
23
|
+
"""
|
|
24
|
+
Fluent builder for :class:`~microsoft_agents.hosting.core.app.proactive.conversation.Conversation`.
|
|
25
|
+
|
|
26
|
+
Typical usage — building from a minimal set of claims::
|
|
27
|
+
|
|
28
|
+
conversation = (
|
|
29
|
+
ConversationBuilder
|
|
30
|
+
.create("agent-app-id", "msteams", service_url="https://smba.trafficmanager.net/teams/")
|
|
31
|
+
.with_user("user-aad-oid", "User Display Name")
|
|
32
|
+
.with_conversation("19:thread-id@thread.v2")
|
|
33
|
+
.build()
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
Or from an existing :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`::
|
|
37
|
+
|
|
38
|
+
conversation = (
|
|
39
|
+
ConversationBuilder
|
|
40
|
+
.create_from_identity(claims_identity, "msteams")
|
|
41
|
+
.with_conversation("19:thread-id@thread.v2")
|
|
42
|
+
.build()
|
|
43
|
+
)
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def __init__(self) -> None:
|
|
47
|
+
self._claims: dict[str, str] = {}
|
|
48
|
+
self._channel_id: Optional[str] = None
|
|
49
|
+
self._service_url: Optional[str] = None
|
|
50
|
+
self._agent_id: Optional[str] = None
|
|
51
|
+
self._agent_name: Optional[str] = None
|
|
52
|
+
self._user_id: Optional[str] = None
|
|
53
|
+
self._user_name: Optional[str] = None
|
|
54
|
+
self._conversation_id: Optional[str] = None
|
|
55
|
+
self._conversation_name: Optional[str] = None
|
|
56
|
+
self._tenant_id: Optional[str] = None
|
|
57
|
+
self._activity_id: Optional[str] = None
|
|
58
|
+
|
|
59
|
+
# ------------------------------------------------------------------
|
|
60
|
+
# Entry-point factories
|
|
61
|
+
# ------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def create(
|
|
65
|
+
cls,
|
|
66
|
+
agent_client_id: str,
|
|
67
|
+
channel_id: str,
|
|
68
|
+
service_url: Optional[str] = None,
|
|
69
|
+
requestor_id: Optional[str] = None,
|
|
70
|
+
) -> "ConversationBuilder":
|
|
71
|
+
"""
|
|
72
|
+
Start building a :class:`~microsoft_agents.hosting.core.app.proactive.conversation.Conversation`
|
|
73
|
+
from a minimal set of claims.
|
|
74
|
+
|
|
75
|
+
:param agent_client_id: The agent's AAD application ID (becomes the ``aud``
|
|
76
|
+
claim and optionally the ``appid`` claim).
|
|
77
|
+
:type agent_client_id: str
|
|
78
|
+
:param channel_id: The channel identifier (e.g. ``"msteams"``).
|
|
79
|
+
:type channel_id: str
|
|
80
|
+
:param service_url: Override the service URL. Defaults to the canonical
|
|
81
|
+
URL for *channel_id*.
|
|
82
|
+
:type service_url: Optional[str]
|
|
83
|
+
:param requestor_id: If provided, stored as the ``appid`` claim (useful
|
|
84
|
+
when the requestor differs from the audience).
|
|
85
|
+
:type requestor_id: Optional[str]
|
|
86
|
+
:return: A builder pre-populated with the supplied claims.
|
|
87
|
+
:rtype: :class:`ConversationBuilder`
|
|
88
|
+
"""
|
|
89
|
+
builder = cls()
|
|
90
|
+
builder._channel_id = channel_id
|
|
91
|
+
builder._service_url = service_url or _service_url_for_channel(channel_id)
|
|
92
|
+
builder._claims["aud"] = agent_client_id
|
|
93
|
+
if requestor_id:
|
|
94
|
+
builder._claims["appid"] = requestor_id
|
|
95
|
+
|
|
96
|
+
# Set agent ID with Teams prefix if needed.
|
|
97
|
+
if channel_id == Channels.ms_teams or channel_id == "msteams":
|
|
98
|
+
builder._agent_id = f"28:{agent_client_id}"
|
|
99
|
+
else:
|
|
100
|
+
builder._agent_id = agent_client_id
|
|
101
|
+
|
|
102
|
+
return builder
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def create_from_identity(
|
|
106
|
+
cls,
|
|
107
|
+
identity: ClaimsIdentity,
|
|
108
|
+
channel_id: str,
|
|
109
|
+
service_url: Optional[str] = None,
|
|
110
|
+
) -> "ConversationBuilder":
|
|
111
|
+
"""
|
|
112
|
+
Start building a :class:`~microsoft_agents.hosting.core.app.proactive.conversation.Conversation`
|
|
113
|
+
from a full :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`.
|
|
114
|
+
|
|
115
|
+
:param identity: The claims identity to extract claims from.
|
|
116
|
+
:type identity: :class:`~microsoft_agents.hosting.core.authorization.ClaimsIdentity`
|
|
117
|
+
:param channel_id: The channel identifier.
|
|
118
|
+
:type channel_id: str
|
|
119
|
+
:param service_url: Override the service URL.
|
|
120
|
+
:type service_url: Optional[str]
|
|
121
|
+
:return: A builder pre-populated with the identity's claims.
|
|
122
|
+
:rtype: :class:`ConversationBuilder`
|
|
123
|
+
"""
|
|
124
|
+
builder = cls()
|
|
125
|
+
builder._channel_id = channel_id
|
|
126
|
+
builder._service_url = service_url or _service_url_for_channel(channel_id)
|
|
127
|
+
builder._claims = Conversation.claims_from_identity(identity)
|
|
128
|
+
|
|
129
|
+
app_id = identity.get_app_id()
|
|
130
|
+
if app_id:
|
|
131
|
+
if channel_id == Channels.ms_teams or channel_id == "msteams":
|
|
132
|
+
builder._agent_id = f"28:{app_id}"
|
|
133
|
+
else:
|
|
134
|
+
builder._agent_id = app_id
|
|
135
|
+
|
|
136
|
+
return builder
|
|
137
|
+
|
|
138
|
+
# ------------------------------------------------------------------
|
|
139
|
+
# Fluent setters
|
|
140
|
+
# ------------------------------------------------------------------
|
|
141
|
+
|
|
142
|
+
def with_user(
|
|
143
|
+
self,
|
|
144
|
+
user_id: str,
|
|
145
|
+
user_name: Optional[str] = None,
|
|
146
|
+
) -> "ConversationBuilder":
|
|
147
|
+
"""
|
|
148
|
+
Set the user account.
|
|
149
|
+
|
|
150
|
+
:param user_id: The user's channel account ID.
|
|
151
|
+
:type user_id: str
|
|
152
|
+
:param user_name: Optional display name.
|
|
153
|
+
:type user_name: Optional[str]
|
|
154
|
+
:return: ``self`` for chaining.
|
|
155
|
+
:rtype: :class:`ConversationBuilder`
|
|
156
|
+
"""
|
|
157
|
+
self._user_id = user_id
|
|
158
|
+
self._user_name = user_name
|
|
159
|
+
return self
|
|
160
|
+
|
|
161
|
+
def with_conversation(
|
|
162
|
+
self,
|
|
163
|
+
conversation_id: str,
|
|
164
|
+
conversation_name: Optional[str] = None,
|
|
165
|
+
tenant_id: Optional[str] = None,
|
|
166
|
+
) -> "ConversationBuilder":
|
|
167
|
+
"""
|
|
168
|
+
Set the conversation account details.
|
|
169
|
+
|
|
170
|
+
:param conversation_id: The conversation ID.
|
|
171
|
+
:type conversation_id: str
|
|
172
|
+
:param conversation_name: Optional conversation name.
|
|
173
|
+
:type conversation_name: Optional[str]
|
|
174
|
+
:param tenant_id: Optional tenant ID.
|
|
175
|
+
:type tenant_id: Optional[str]
|
|
176
|
+
:return: ``self`` for chaining.
|
|
177
|
+
:rtype: :class:`ConversationBuilder`
|
|
178
|
+
"""
|
|
179
|
+
self._conversation_id = conversation_id
|
|
180
|
+
self._conversation_name = conversation_name
|
|
181
|
+
self._tenant_id = tenant_id
|
|
182
|
+
return self
|
|
183
|
+
|
|
184
|
+
def with_activity_id(self, activity_id: str) -> "ConversationBuilder":
|
|
185
|
+
"""
|
|
186
|
+
Set the activity ID on the underlying conversation reference.
|
|
187
|
+
|
|
188
|
+
:param activity_id: The activity ID.
|
|
189
|
+
:type activity_id: str
|
|
190
|
+
:return: ``self`` for chaining.
|
|
191
|
+
:rtype: :class:`ConversationBuilder`
|
|
192
|
+
"""
|
|
193
|
+
self._activity_id = activity_id
|
|
194
|
+
return self
|
|
195
|
+
|
|
196
|
+
# ------------------------------------------------------------------
|
|
197
|
+
# Build
|
|
198
|
+
# ------------------------------------------------------------------
|
|
199
|
+
|
|
200
|
+
def build(self) -> Conversation:
|
|
201
|
+
"""
|
|
202
|
+
Construct the :class:`~microsoft_agents.hosting.core.app.proactive.conversation.Conversation`.
|
|
203
|
+
|
|
204
|
+
:raises ValueError: If required fields (``channel_id``, ``conversation_id``) are missing.
|
|
205
|
+
:return: The built :class:`~microsoft_agents.hosting.core.app.proactive.conversation.Conversation`.
|
|
206
|
+
:rtype: :class:`~microsoft_agents.hosting.core.app.proactive.conversation.Conversation`
|
|
207
|
+
"""
|
|
208
|
+
if not self._channel_id:
|
|
209
|
+
raise ValueError("ConversationBuilder: channel_id is required.")
|
|
210
|
+
if not self._conversation_id:
|
|
211
|
+
raise ValueError("ConversationBuilder: conversation_id is required.")
|
|
212
|
+
|
|
213
|
+
agent = (
|
|
214
|
+
ChannelAccount(id=self._agent_id, name=self._agent_name)
|
|
215
|
+
if self._agent_id
|
|
216
|
+
else None
|
|
217
|
+
)
|
|
218
|
+
user = (
|
|
219
|
+
ChannelAccount(id=self._user_id, name=self._user_name)
|
|
220
|
+
if self._user_id
|
|
221
|
+
else None
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
reference = ConversationReference(
|
|
225
|
+
channel_id=self._channel_id,
|
|
226
|
+
service_url=self._service_url or _service_url_for_channel(self._channel_id),
|
|
227
|
+
conversation=ConversationAccount(
|
|
228
|
+
id=self._conversation_id,
|
|
229
|
+
name=self._conversation_name,
|
|
230
|
+
tenant_id=self._tenant_id,
|
|
231
|
+
),
|
|
232
|
+
bot=agent,
|
|
233
|
+
user=user,
|
|
234
|
+
activity_id=self._activity_id,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
return Conversation(claims=self._claims, conversation_reference=reference)
|