microsoft-agents-hosting-core 1.2.0.dev16__tar.gz → 1.2.0.dev20__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-1.2.0.dev16/microsoft_agents_hosting_core.egg-info → microsoft_agents_hosting_core-1.2.0.dev20}/PKG-INFO +2 -2
- microsoft_agents_hosting_core-1.2.0.dev20/VERSION.txt +1 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/__init__.py +2 -1
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/channel_adapter.py +2 -4
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/client/user_token_client.py +22 -0
- microsoft_agents_hosting_core-1.2.0.dev20/microsoft_agents/hosting/core/middleware_set.py +99 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/state/agent_state.py +65 -17
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/transcript_logger.py +2 -2
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20/microsoft_agents_hosting_core.egg-info}/PKG-INFO +2 -2
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents_hosting_core.egg-info/requires.txt +1 -1
- microsoft_agents_hosting_core-1.2.0.dev16/VERSION.txt +0 -1
- microsoft_agents_hosting_core-1.2.0.dev16/microsoft_agents/hosting/core/middleware_set.py +0 -78
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/LICENSE +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/MANIFEST.in +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/_oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/_oauth/_flow_state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/activity_handler.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/agent.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/_routes/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/_routes/_route.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/_routes/_route_list.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/_routes/route_rank.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/_type_defs.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/agent_application.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/app_error.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/app_options.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/input_file.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_handlers/connector_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/oauth/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/conversation.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/conversation_builder.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/conversation_reference_builder.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/create_conversation_options.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/proactive.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/proactive_options.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/proactive/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/query.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/state/state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/streaming/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/streaming/citation.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/streaming/citation_util.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/streaming/streaming_response.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/authentication_constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/claims_identity.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/jwt_token_validator.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/authorization/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/card_factory.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/channel_service_adapter.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/client/connector_client.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/mcs/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/mcs/mcs_connector_client.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/telemetry/_request_span_wrapper.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/telemetry/connector_spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/telemetry/user_token_client_spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/errors/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/errors/error_resources.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/http/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/http/_channel_service_routes.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/http/_http_adapter_base.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/http/_http_request_protocol.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/http/_http_response.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/message_factory.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/state/user_state.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/storage.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/telemetry/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/telemetry/metrics.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/telemetry/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/transcript_file_store.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/transcript_info.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/transcript_memory_store.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/storage/transcript_store.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/adapter/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/adapter/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/adapter/metrics.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/adapter/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/attributes.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/core/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/core/_agents_telemetry.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/core/base_span_wrapper.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/core/resource.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/core/simple_span_wrapper.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/core/type_defs.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/turn_context/__init__.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/turn_context/constants.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/turn_context/spans.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/telemetry/utils.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents/hosting/core/turn_context.py +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/pyproject.toml +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/readme.md +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/setup.cfg +0 -0
- {microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev20
|
|
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==1.2.0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==1.2.0.dev20
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.2.0.dev20
|
|
@@ -6,7 +6,7 @@ from .channel_api_handler_protocol import ChannelApiHandlerProtocol
|
|
|
6
6
|
from .channel_service_adapter import ChannelServiceAdapter
|
|
7
7
|
from .channel_service_client_factory_base import ChannelServiceClientFactoryBase
|
|
8
8
|
from .message_factory import MessageFactory
|
|
9
|
-
from .middleware_set import Middleware
|
|
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
12
|
|
|
@@ -174,6 +174,7 @@ __all__ = [
|
|
|
174
174
|
"MemoryStorage",
|
|
175
175
|
"AgenticUserAuthorization",
|
|
176
176
|
"Authorization",
|
|
177
|
+
"MiddlewareSet",
|
|
177
178
|
"error_resources",
|
|
178
179
|
"ErrorMessage",
|
|
179
180
|
"ErrorResources",
|
|
@@ -232,16 +232,14 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
232
232
|
:param context: The context object for the turn.
|
|
233
233
|
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
234
234
|
:param callback: A callback method to run at the end of the pipeline.
|
|
235
|
-
:type callback: Callable[[TurnContext], Awaitable]
|
|
236
|
-
:return: Result produced by the middleware pipeline.
|
|
237
|
-
:rtype: typing.Any
|
|
235
|
+
:type callback: Callable[[TurnContext], Awaitable] | None
|
|
238
236
|
"""
|
|
239
237
|
if context is None:
|
|
240
238
|
raise TypeError(context.__class__.__name__)
|
|
241
239
|
|
|
242
240
|
if context.activity is not None:
|
|
243
241
|
try:
|
|
244
|
-
|
|
242
|
+
await self.middleware_set.receive_activity_with_status(
|
|
245
243
|
context, callback
|
|
246
244
|
)
|
|
247
245
|
except Exception as error:
|
|
@@ -9,6 +9,7 @@ from aiohttp import ClientResponseError, ClientSession
|
|
|
9
9
|
|
|
10
10
|
from microsoft_agents.hosting.core.connector import UserTokenClientBase
|
|
11
11
|
from microsoft_agents.activity import (
|
|
12
|
+
ChannelId,
|
|
12
13
|
TokenOrSignInResourceResponse,
|
|
13
14
|
TokenResponse,
|
|
14
15
|
TokenStatus,
|
|
@@ -112,6 +113,15 @@ class UserToken(UserTokenBase):
|
|
|
112
113
|
def __init__(self, client: ClientSession):
|
|
113
114
|
self.client = client
|
|
114
115
|
|
|
116
|
+
@staticmethod
|
|
117
|
+
def _base_channel_id(channel_id: Optional[str]) -> Optional[str]:
|
|
118
|
+
"""Return the Bot Framework channel without an optional sub-channel."""
|
|
119
|
+
if not channel_id or not channel_id.strip():
|
|
120
|
+
return channel_id
|
|
121
|
+
|
|
122
|
+
base_channel_id = ChannelId(channel_id).channel
|
|
123
|
+
return base_channel_id or channel_id
|
|
124
|
+
|
|
115
125
|
async def get_token(
|
|
116
126
|
self,
|
|
117
127
|
user_id: str,
|
|
@@ -120,6 +130,8 @@ class UserToken(UserTokenBase):
|
|
|
120
130
|
code: Optional[str] = None,
|
|
121
131
|
) -> TokenResponse:
|
|
122
132
|
|
|
133
|
+
channel_id = self._base_channel_id(channel_id)
|
|
134
|
+
|
|
123
135
|
with spans.GetUserToken(
|
|
124
136
|
connection_name=connection_name, user_id=user_id, channel_id=channel_id
|
|
125
137
|
) as span:
|
|
@@ -155,6 +167,8 @@ class UserToken(UserTokenBase):
|
|
|
155
167
|
) -> TokenOrSignInResourceResponse:
|
|
156
168
|
"""Get token or sign-in resource for a user."""
|
|
157
169
|
|
|
170
|
+
channel_id = self._base_channel_id(channel_id)
|
|
171
|
+
|
|
158
172
|
with spans.GetTokenOrSignInResource(
|
|
159
173
|
connection_name=connection_name, user_id=user_id, channel_id=channel_id
|
|
160
174
|
) as span:
|
|
@@ -192,6 +206,8 @@ class UserToken(UserTokenBase):
|
|
|
192
206
|
) -> dict[str, TokenResponse]:
|
|
193
207
|
"""Get AAD tokens for a user."""
|
|
194
208
|
|
|
209
|
+
channel_id = self._base_channel_id(channel_id)
|
|
210
|
+
|
|
195
211
|
with spans.GetAadTokens(
|
|
196
212
|
connection_name=connection_name, user_id=user_id, channel_id=channel_id
|
|
197
213
|
) as span:
|
|
@@ -221,6 +237,8 @@ class UserToken(UserTokenBase):
|
|
|
221
237
|
) -> None:
|
|
222
238
|
"""Sign out user from a connection."""
|
|
223
239
|
|
|
240
|
+
channel_id = self._base_channel_id(channel_id)
|
|
241
|
+
|
|
224
242
|
with spans.SignOut(
|
|
225
243
|
user_id=user_id, connection_name=connection_name, channel_id=channel_id
|
|
226
244
|
) as span:
|
|
@@ -249,6 +267,8 @@ class UserToken(UserTokenBase):
|
|
|
249
267
|
) -> list[TokenStatus]:
|
|
250
268
|
"""Get token status for a user."""
|
|
251
269
|
|
|
270
|
+
channel_id = self._base_channel_id(channel_id)
|
|
271
|
+
|
|
252
272
|
with spans.GetTokenStatus(user_id=user_id, channel_id=channel_id) as span:
|
|
253
273
|
params = {"userId": user_id}
|
|
254
274
|
|
|
@@ -281,6 +301,8 @@ class UserToken(UserTokenBase):
|
|
|
281
301
|
) -> TokenResponse:
|
|
282
302
|
"""Exchange token for a user."""
|
|
283
303
|
|
|
304
|
+
channel_id = self._base_channel_id(channel_id)
|
|
305
|
+
|
|
284
306
|
with spans.ExchangeToken(
|
|
285
307
|
connection_name=connection_name, user_id=user_id, channel_id=channel_id
|
|
286
308
|
) as span:
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from abc import abstractmethod
|
|
5
|
+
from typing import Awaitable, Callable, Protocol
|
|
6
|
+
from typing_extensions import Self
|
|
7
|
+
|
|
8
|
+
from .turn_context import TurnContext
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Middleware(Protocol):
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
async def on_turn(
|
|
15
|
+
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable]
|
|
16
|
+
):
|
|
17
|
+
"""
|
|
18
|
+
Called for each turn of the conversation.
|
|
19
|
+
|
|
20
|
+
:param context: The turn context.
|
|
21
|
+
:param logic: The next middleware in the pipeline or the final logic to be executed.
|
|
22
|
+
"""
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class MiddlewareSet(Middleware):
|
|
27
|
+
"""
|
|
28
|
+
A set of `Middleware` plugins. The set itself is middleware so you can easily package up a set
|
|
29
|
+
of middleware that can be composed into an agent with a single `agent.use(mySet)` call or even into
|
|
30
|
+
another middleware set using `set.use(mySet)`.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(self):
|
|
34
|
+
super().__init__()
|
|
35
|
+
self._middleware: list[Middleware] = []
|
|
36
|
+
|
|
37
|
+
def use(self, *middleware: Middleware) -> Self:
|
|
38
|
+
"""
|
|
39
|
+
Registers middleware plugin(s) with the agent or set.
|
|
40
|
+
:param middleware : The middleware plugin(s) to register.
|
|
41
|
+
:return: The `MiddlewareSet` instance to allow chaining of `use` calls.
|
|
42
|
+
:rtype: Self
|
|
43
|
+
"""
|
|
44
|
+
for idx, mid in enumerate(middleware):
|
|
45
|
+
if hasattr(mid, "on_turn") and callable(mid.on_turn):
|
|
46
|
+
self._middleware.append(mid)
|
|
47
|
+
else:
|
|
48
|
+
raise TypeError(
|
|
49
|
+
'MiddlewareSet.use(): invalid middleware at index "%s" being added.'
|
|
50
|
+
% idx
|
|
51
|
+
)
|
|
52
|
+
return self
|
|
53
|
+
|
|
54
|
+
async def _receive_activity_internal(
|
|
55
|
+
self,
|
|
56
|
+
context: TurnContext,
|
|
57
|
+
callback: Callable[[TurnContext], Awaitable] | None,
|
|
58
|
+
next_middleware_index: int = 0,
|
|
59
|
+
):
|
|
60
|
+
"""Recursively invokes middleware in the set, passing the context and callback through the pipeline.
|
|
61
|
+
|
|
62
|
+
:param context: The turn context.
|
|
63
|
+
:param callback: The final logic to be executed after the middleware pipeline.
|
|
64
|
+
:param next_middleware_index: The index of the next middleware to invoke.
|
|
65
|
+
"""
|
|
66
|
+
if next_middleware_index == len(self._middleware):
|
|
67
|
+
if callback is not None:
|
|
68
|
+
await callback(context)
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
next_middleware = self._middleware[next_middleware_index]
|
|
72
|
+
|
|
73
|
+
async def call_next_middleware(ctx: TurnContext):
|
|
74
|
+
await self._receive_activity_internal(
|
|
75
|
+
ctx, callback, next_middleware_index + 1
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
await next_middleware.on_turn(context, call_next_middleware)
|
|
79
|
+
|
|
80
|
+
async def receive_activity_with_status(
|
|
81
|
+
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable] | None
|
|
82
|
+
):
|
|
83
|
+
"""Handles an incoming activity by passing it through the middleware pipeline and then to the final logic.
|
|
84
|
+
|
|
85
|
+
:param context: The turn context.
|
|
86
|
+
:param logic: The final logic to be executed after the middleware pipeline.
|
|
87
|
+
"""
|
|
88
|
+
await self._receive_activity_internal(context, logic)
|
|
89
|
+
|
|
90
|
+
async def on_turn(
|
|
91
|
+
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable]
|
|
92
|
+
):
|
|
93
|
+
"""Handles an incoming activity by passing it through the middleware pipeline and then to the final logic.
|
|
94
|
+
|
|
95
|
+
:param context: The turn context.
|
|
96
|
+
:param logic: The final logic to be executed after the middleware pipeline.
|
|
97
|
+
"""
|
|
98
|
+
await self._receive_activity_internal(context, None)
|
|
99
|
+
await logic(context)
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
|
|
6
6
|
from abc import abstractmethod
|
|
7
7
|
from copy import deepcopy
|
|
8
|
+
import logging
|
|
8
9
|
from typing import Callable, Type
|
|
9
10
|
|
|
10
11
|
from microsoft_agents.hosting.core.storage import Storage, StoreItem
|
|
@@ -12,6 +13,8 @@ from microsoft_agents.hosting.core.storage import Storage, StoreItem
|
|
|
12
13
|
from .state_property_accessor import StatePropertyAccessor
|
|
13
14
|
from ..turn_context import TurnContext
|
|
14
15
|
|
|
16
|
+
logger = logging.getLogger(__name__)
|
|
17
|
+
|
|
15
18
|
|
|
16
19
|
class CachedAgentState(StoreItem):
|
|
17
20
|
"""
|
|
@@ -47,6 +50,10 @@ class CachedAgentState(StoreItem):
|
|
|
47
50
|
}
|
|
48
51
|
return serialized
|
|
49
52
|
|
|
53
|
+
def clear(self) -> None:
|
|
54
|
+
self.state = {}
|
|
55
|
+
self.hash = ""
|
|
56
|
+
|
|
50
57
|
@staticmethod
|
|
51
58
|
def from_json_to_store_item(json_data: dict) -> StoreItem:
|
|
52
59
|
return CachedAgentState(json_data)
|
|
@@ -87,16 +94,23 @@ class AgentState:
|
|
|
87
94
|
self._context_service_key = context_service_key
|
|
88
95
|
self._cached_state: CachedAgentState | None = None
|
|
89
96
|
|
|
90
|
-
def get_cached_state(
|
|
97
|
+
def get_cached_state(
|
|
98
|
+
self, turn_context: TurnContext | None = None
|
|
99
|
+
) -> CachedAgentState:
|
|
91
100
|
"""
|
|
92
101
|
Gets the cached agent state instance that wraps the raw cached data for this "AgentState"
|
|
93
102
|
from the turn context.
|
|
94
103
|
|
|
95
|
-
:param turn_context: The context object for this turn.
|
|
104
|
+
:param turn_context: Deprecated. The context object for this turn. This parameter is no
|
|
105
|
+
longer required and will be removed in a future release.
|
|
96
106
|
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
97
107
|
:return: The cached agent state instance.
|
|
98
108
|
"""
|
|
99
|
-
|
|
109
|
+
if turn_context:
|
|
110
|
+
logger.warning(
|
|
111
|
+
"AgentState.get_cached_state(): turn_context is deprecated and no longer required for get_cached_state(); it will be removed in a future release"
|
|
112
|
+
)
|
|
113
|
+
return self._cached_state
|
|
100
114
|
|
|
101
115
|
def create_property(self, name: str) -> StatePropertyAccessor:
|
|
102
116
|
"""
|
|
@@ -113,10 +127,20 @@ class AgentState:
|
|
|
113
127
|
)
|
|
114
128
|
return BotStatePropertyAccessor(self, name)
|
|
115
129
|
|
|
116
|
-
def get(self, turn_context: TurnContext) -> dict[str, StoreItem]:
|
|
117
|
-
|
|
130
|
+
def get(self, turn_context: TurnContext | None = None) -> dict[str, StoreItem]:
|
|
131
|
+
"""
|
|
132
|
+
Gets the raw cached state dictionary for this "AgentState".
|
|
118
133
|
|
|
119
|
-
|
|
134
|
+
:param turn_context: Deprecated. The context object for this turn. This parameter is no
|
|
135
|
+
longer required and will be removed in a future release.
|
|
136
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
137
|
+
:return: The cached state dictionary.
|
|
138
|
+
"""
|
|
139
|
+
if turn_context:
|
|
140
|
+
logger.warning(
|
|
141
|
+
"AgentState.get(): turn_context is deprecated and no longer required for get(); it will be removed in a future release"
|
|
142
|
+
)
|
|
143
|
+
return getattr(self._cached_state, "state", None)
|
|
120
144
|
|
|
121
145
|
async def load(self, turn_context: TurnContext, force: bool = False) -> None:
|
|
122
146
|
"""
|
|
@@ -129,12 +153,27 @@ class AgentState:
|
|
|
129
153
|
"""
|
|
130
154
|
storage_key = self.get_storage_key(turn_context)
|
|
131
155
|
|
|
132
|
-
if
|
|
156
|
+
if self._should_load(turn_context, force):
|
|
133
157
|
items = await self._storage.read([storage_key], target_cls=CachedAgentState)
|
|
134
158
|
val = items.get(storage_key, CachedAgentState())
|
|
135
159
|
self._cached_state = val
|
|
136
160
|
turn_context.turn_state[self._context_service_key] = val
|
|
137
161
|
|
|
162
|
+
def _should_load(self, turn_context: TurnContext, force: bool = False) -> bool:
|
|
163
|
+
"""
|
|
164
|
+
Determines whether the state should be loaded from storage.
|
|
165
|
+
|
|
166
|
+
:param turn_context: The context object for this turn
|
|
167
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
168
|
+
:param force: Optional, true to bypass the cache
|
|
169
|
+
:type force: bool
|
|
170
|
+
:return: True if the state should be loaded from storage, False otherwise
|
|
171
|
+
:rtype: bool
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
self._cached_state = turn_context.turn_state.get(self._context_service_key)
|
|
175
|
+
return force or self._cached_state is None
|
|
176
|
+
|
|
138
177
|
async def save(self, turn_context: TurnContext, force: bool = False) -> None:
|
|
139
178
|
"""
|
|
140
179
|
Saves the state cached in the current context for this turn.
|
|
@@ -146,17 +185,21 @@ class AgentState:
|
|
|
146
185
|
:type force: bool
|
|
147
186
|
"""
|
|
148
187
|
|
|
149
|
-
|
|
188
|
+
# Avoid self._cached_state updating during the save operation
|
|
189
|
+
cached_state = self._cached_state
|
|
190
|
+
|
|
191
|
+
if force or (cached_state is not None and cached_state.is_changed):
|
|
150
192
|
storage_key = self.get_storage_key(turn_context)
|
|
151
|
-
changes: dict[str, StoreItem] = {storage_key:
|
|
193
|
+
changes: dict[str, StoreItem] = {storage_key: cached_state}
|
|
152
194
|
await self._storage.write(changes)
|
|
153
|
-
|
|
195
|
+
cached_state.hash = cached_state.compute_hash()
|
|
154
196
|
|
|
155
|
-
def clear(self, turn_context: TurnContext):
|
|
197
|
+
def clear(self, turn_context: TurnContext | None = None) -> None:
|
|
156
198
|
"""
|
|
157
199
|
Clears any state currently stored in this state scope.
|
|
158
200
|
|
|
159
|
-
:param turn_context: The context object for this turn
|
|
201
|
+
:param turn_context: Deprecated. The context object for this turn. This parameter is no
|
|
202
|
+
longer required and will be removed in a future release.
|
|
160
203
|
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
161
204
|
|
|
162
205
|
:return: None
|
|
@@ -165,9 +208,14 @@ class AgentState:
|
|
|
165
208
|
This function must be called in order for the cleared state to be persisted to the underlying store.
|
|
166
209
|
"""
|
|
167
210
|
# Explicitly setting the hash will mean IsChanged is always true. And that will force a Save.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
211
|
+
if turn_context:
|
|
212
|
+
logger.warning(
|
|
213
|
+
"AgentState.clear(): turn_context is deprecated and no longer required for clear(); it will be removed in a future release"
|
|
214
|
+
)
|
|
215
|
+
if self._cached_state is None:
|
|
216
|
+
logger.warning("AgentState.clear(): No cached state to clear.")
|
|
217
|
+
return
|
|
218
|
+
self._cached_state.clear()
|
|
171
219
|
|
|
172
220
|
async def delete(self, turn_context: TurnContext) -> None:
|
|
173
221
|
"""
|
|
@@ -246,7 +294,7 @@ class AgentState:
|
|
|
246
294
|
"""
|
|
247
295
|
if not property_name:
|
|
248
296
|
raise TypeError(
|
|
249
|
-
"AgentState.
|
|
297
|
+
"AgentState.delete_value(): property_name cannot be None or empty."
|
|
250
298
|
)
|
|
251
299
|
|
|
252
300
|
if self._cached_state.state.get(property_name):
|
|
@@ -265,7 +313,7 @@ class AgentState:
|
|
|
265
313
|
"""
|
|
266
314
|
if not property_name:
|
|
267
315
|
raise TypeError(
|
|
268
|
-
"AgentState.
|
|
316
|
+
"AgentState.set_value(): property_name cannot be None or empty."
|
|
269
317
|
)
|
|
270
318
|
self._cached_state.state[property_name] = value
|
|
271
319
|
|
|
@@ -112,7 +112,7 @@ class TranscriptLoggerMiddleware(Middleware):
|
|
|
112
112
|
self.logger = logger
|
|
113
113
|
|
|
114
114
|
async def on_turn(
|
|
115
|
-
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable]
|
|
115
|
+
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable] | None
|
|
116
116
|
):
|
|
117
117
|
"""Initialization for middleware.
|
|
118
118
|
:param context: Context for the current turn of conversation with the user.
|
|
@@ -201,7 +201,7 @@ class TranscriptLoggerMiddleware(Middleware):
|
|
|
201
201
|
context.on_delete_activity(delete_activity_handler)
|
|
202
202
|
|
|
203
203
|
if logic:
|
|
204
|
-
await logic()
|
|
204
|
+
await logic(context)
|
|
205
205
|
|
|
206
206
|
# Flush transcript at end of turn
|
|
207
207
|
while not transcript.empty():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev20
|
|
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==1.2.0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==1.2.0.dev20
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.2.0.dev16
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
# Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
from abc import abstractmethod
|
|
5
|
-
from typing import Awaitable, Callable, Protocol
|
|
6
|
-
|
|
7
|
-
from .turn_context import TurnContext
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Middleware(Protocol):
|
|
11
|
-
@abstractmethod
|
|
12
|
-
async def on_turn(
|
|
13
|
-
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable]
|
|
14
|
-
):
|
|
15
|
-
pass
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class MiddlewareSet(Middleware):
|
|
19
|
-
"""
|
|
20
|
-
A set of `Middleware` plugins. The set itself is middleware so you can easily package up a set
|
|
21
|
-
of middleware that can be composed into an agent with a single `agent.use(mySet)` call or even into
|
|
22
|
-
another middleware set using `set.use(mySet)`.
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
def __init__(self):
|
|
26
|
-
super(MiddlewareSet, self).__init__()
|
|
27
|
-
self._middleware: list[Middleware] = []
|
|
28
|
-
|
|
29
|
-
def use(self, *middleware: Middleware):
|
|
30
|
-
"""
|
|
31
|
-
Registers middleware plugin(s) with the agent or set.
|
|
32
|
-
:param middleware :
|
|
33
|
-
:return:
|
|
34
|
-
"""
|
|
35
|
-
for idx, mid in enumerate(middleware):
|
|
36
|
-
if hasattr(mid, "on_turn") and callable(mid.on_turn):
|
|
37
|
-
self._middleware.append(mid)
|
|
38
|
-
return self
|
|
39
|
-
raise TypeError(
|
|
40
|
-
'MiddlewareSet.use(): invalid middleware at index "%s" being added.'
|
|
41
|
-
% idx
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
async def receive_activity(self, context: TurnContext):
|
|
45
|
-
await self.receive_activity_internal(context, None)
|
|
46
|
-
|
|
47
|
-
async def on_turn(
|
|
48
|
-
self, context: TurnContext, logic: Callable[[TurnContext], Awaitable]
|
|
49
|
-
):
|
|
50
|
-
await self.receive_activity_internal(context, None)
|
|
51
|
-
await logic()
|
|
52
|
-
|
|
53
|
-
async def receive_activity_with_status(
|
|
54
|
-
self, context: TurnContext, callback: Callable[[TurnContext], Awaitable]
|
|
55
|
-
):
|
|
56
|
-
return await self.receive_activity_internal(context, callback)
|
|
57
|
-
|
|
58
|
-
async def receive_activity_internal(
|
|
59
|
-
self,
|
|
60
|
-
context: TurnContext,
|
|
61
|
-
callback: Callable[[TurnContext], Awaitable],
|
|
62
|
-
next_middleware_index: int = 0,
|
|
63
|
-
):
|
|
64
|
-
if next_middleware_index == len(self._middleware):
|
|
65
|
-
if callback is not None:
|
|
66
|
-
return await callback(context)
|
|
67
|
-
return None
|
|
68
|
-
next_middleware = self._middleware[next_middleware_index]
|
|
69
|
-
|
|
70
|
-
async def call_next_middleware():
|
|
71
|
-
return await self.receive_activity_internal(
|
|
72
|
-
context, callback, next_middleware_index + 1
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
try:
|
|
76
|
-
return await next_middleware.on_turn(context, call_next_middleware)
|
|
77
|
-
except Exception as error:
|
|
78
|
-
raise error
|
{microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/LICENSE
RENAMED
|
File without changes
|
{microsoft_agents_hosting_core-1.2.0.dev16 → microsoft_agents_hosting_core-1.2.0.dev20}/MANIFEST.in
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|