microsoft-agents-hosting-core 0.4.0.dev10__tar.gz → 0.4.0.dev14__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.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/PKG-INFO +2 -2
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/__init__.py +3 -24
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/_oauth/__init__.py +12 -0
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/oauth/flow_state.py → microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/_oauth/_flow_state.py +11 -11
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/oauth/flow_storage_client.py → microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +14 -14
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/oauth/oauth_flow.py → microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +29 -39
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/activity_handler.py +16 -29
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/__init__.py +2 -6
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/agent_application.py +31 -134
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/__init__.py +19 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +9 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +104 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +261 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +181 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +24 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +36 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/auth_handler.py +97 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/app/oauth/authorization.py +386 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +17 -2
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +14 -0
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +35 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/authentication_constants.py +8 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/claims_identity.py +1 -1
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/jwt_token_validator.py +0 -1
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/channel_adapter.py +5 -5
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/channel_service_adapter.py +54 -53
- microsoft_agents_hosting_core-0.4.0.dev14/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +133 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/state/agent_state.py +33 -27
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/turn_context.py +14 -1
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents_hosting_core.egg-info/PKG-INFO +2 -2
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +10 -4
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents_hosting_core.egg-info/requires.txt +1 -1
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -8
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -48
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -398
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -13
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/oauth/__init__.py +0 -12
- microsoft_agents_hosting_core-0.4.0.dev10/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +0 -79
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/agent.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/app_error.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/app_options.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/input_file.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/query.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/route.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/state/state.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/card_factory.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/client/connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/client/user_token_client.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/message_factory.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/middleware_set.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/state/user_state.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/storage.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/transcript_info.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/transcript_logger.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/transcript_memory_store.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents/hosting/core/storage/transcript_store.py +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/pyproject.toml +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/setup.cfg +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/setup.py +0 -0
{microsoft_agents_hosting_core-0.4.0.dev10 → microsoft_agents_hosting_core-0.4.0.dev14}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.4.0.
|
|
3
|
+
Version: 0.4.0.dev14
|
|
4
4
|
Summary: Core library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
@@ -8,7 +8,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.9
|
|
11
|
-
Requires-Dist: microsoft-agents-activity==0.4.0.
|
|
11
|
+
Requires-Dist: microsoft-agents-activity==0.4.0.dev14
|
|
12
12
|
Requires-Dist: pyjwt>=2.10.1
|
|
13
13
|
Requires-Dist: isodate>=0.6.1
|
|
14
14
|
Requires-Dist: azure-core>=1.30.0
|
|
@@ -22,8 +22,8 @@ from .app.typing_indicator import TypingIndicator
|
|
|
22
22
|
# App Auth
|
|
23
23
|
from .app.oauth import (
|
|
24
24
|
Authorization,
|
|
25
|
-
AuthorizationHandlers,
|
|
26
25
|
AuthHandler,
|
|
26
|
+
AgenticUserAuthorization,
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
# App State
|
|
@@ -42,16 +42,6 @@ from .authorization.claims_identity import ClaimsIdentity
|
|
|
42
42
|
from .authorization.jwt_token_validator import JwtTokenValidator
|
|
43
43
|
from .authorization.auth_types import AuthTypes
|
|
44
44
|
|
|
45
|
-
# OAuth
|
|
46
|
-
from .oauth import (
|
|
47
|
-
FlowState,
|
|
48
|
-
FlowStateTag,
|
|
49
|
-
FlowErrorTag,
|
|
50
|
-
FlowResponse,
|
|
51
|
-
FlowStorageClient,
|
|
52
|
-
OAuthFlow,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
45
|
# Client API
|
|
56
46
|
from .client.agent_conversation_reference import AgentConversationReference
|
|
57
47
|
from .client.channel_factory_protocol import ChannelFactoryProtocol
|
|
@@ -105,15 +95,11 @@ __all__ = [
|
|
|
105
95
|
"Middleware",
|
|
106
96
|
"RestChannelServiceClientFactory",
|
|
107
97
|
"TurnContext",
|
|
108
|
-
"ActivityType",
|
|
109
98
|
"AgentApplication",
|
|
110
99
|
"ApplicationError",
|
|
111
100
|
"ApplicationOptions",
|
|
112
|
-
"ConversationUpdateType",
|
|
113
101
|
"InputFile",
|
|
114
102
|
"InputFileDownloader",
|
|
115
|
-
"MessageReactionType",
|
|
116
|
-
"MessageUpdateType",
|
|
117
103
|
"Query",
|
|
118
104
|
"Route",
|
|
119
105
|
"RouteHandler",
|
|
@@ -124,9 +110,7 @@ __all__ = [
|
|
|
124
110
|
"TurnState",
|
|
125
111
|
"TempState",
|
|
126
112
|
"Authorization",
|
|
127
|
-
"AuthorizationHandlers",
|
|
128
113
|
"AuthHandler",
|
|
129
|
-
"SignInState",
|
|
130
114
|
"AccessTokenProviderBase",
|
|
131
115
|
"AuthenticationConstants",
|
|
132
116
|
"AnonymousTokenProvider",
|
|
@@ -134,7 +118,6 @@ __all__ = [
|
|
|
134
118
|
"AgentAuthConfiguration",
|
|
135
119
|
"ClaimsIdentity",
|
|
136
120
|
"JwtTokenValidator",
|
|
137
|
-
"AuthTypes",
|
|
138
121
|
"AgentConversationReference",
|
|
139
122
|
"ChannelFactoryProtocol",
|
|
140
123
|
"ChannelHostProtocol",
|
|
@@ -162,10 +145,6 @@ __all__ = [
|
|
|
162
145
|
"StoreItem",
|
|
163
146
|
"Storage",
|
|
164
147
|
"MemoryStorage",
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"FlowErrorTag",
|
|
168
|
-
"FlowResponse",
|
|
169
|
-
"FlowStorageClient",
|
|
170
|
-
"OAuthFlow",
|
|
148
|
+
"AgenticUserAuthorization",
|
|
149
|
+
"Authorization",
|
|
171
150
|
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from ._flow_state import _FlowState, _FlowStateTag, _FlowErrorTag
|
|
2
|
+
from ._flow_storage_client import _FlowStorageClient
|
|
3
|
+
from ._oauth_flow import _OAuthFlow, _FlowResponse
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"_FlowState",
|
|
7
|
+
"_FlowStateTag",
|
|
8
|
+
"_FlowErrorTag",
|
|
9
|
+
"_FlowResponse",
|
|
10
|
+
"_FlowStorageClient",
|
|
11
|
+
"_OAuthFlow",
|
|
12
|
+
]
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
# Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
4
6
|
from datetime import datetime
|
|
5
7
|
from enum import Enum
|
|
6
8
|
from typing import Optional
|
|
@@ -12,7 +14,7 @@ from microsoft_agents.activity import Activity
|
|
|
12
14
|
from ..storage import StoreItem
|
|
13
15
|
|
|
14
16
|
|
|
15
|
-
class
|
|
17
|
+
class _FlowStateTag(Enum):
|
|
16
18
|
"""Represents the top-level state of an OAuthFlow
|
|
17
19
|
|
|
18
20
|
For instance, a flow can arrive at an error, but its
|
|
@@ -27,7 +29,7 @@ class FlowStateTag(Enum):
|
|
|
27
29
|
COMPLETE = "complete"
|
|
28
30
|
|
|
29
31
|
|
|
30
|
-
class
|
|
32
|
+
class _FlowErrorTag(Enum):
|
|
31
33
|
"""Represents the various error states that can occur during an OAuthFlow"""
|
|
32
34
|
|
|
33
35
|
NONE = "none"
|
|
@@ -36,11 +38,9 @@ class FlowErrorTag(Enum):
|
|
|
36
38
|
OTHER = "other"
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
class
|
|
41
|
+
class _FlowState(BaseModel, StoreItem):
|
|
40
42
|
"""Represents the state of an OAuthFlow"""
|
|
41
43
|
|
|
42
|
-
user_token: str = ""
|
|
43
|
-
|
|
44
44
|
channel_id: str = ""
|
|
45
45
|
user_id: str = ""
|
|
46
46
|
ms_app_id: str = ""
|
|
@@ -50,14 +50,14 @@ class FlowState(BaseModel, StoreItem):
|
|
|
50
50
|
expiration: float = 0
|
|
51
51
|
continuation_activity: Optional[Activity] = None
|
|
52
52
|
attempts_remaining: int = 0
|
|
53
|
-
tag:
|
|
53
|
+
tag: _FlowStateTag = _FlowStateTag.NOT_STARTED
|
|
54
54
|
|
|
55
55
|
def store_item_to_json(self) -> dict:
|
|
56
56
|
return self.model_dump(mode="json", exclude_unset=True, by_alias=True)
|
|
57
57
|
|
|
58
58
|
@staticmethod
|
|
59
|
-
def from_json_to_store_item(json_data: dict) ->
|
|
60
|
-
return
|
|
59
|
+
def from_json_to_store_item(json_data: dict) -> _FlowState:
|
|
60
|
+
return _FlowState.model_validate(json_data)
|
|
61
61
|
|
|
62
62
|
def is_expired(self) -> bool:
|
|
63
63
|
return datetime.now().timestamp() >= self.expiration
|
|
@@ -69,13 +69,13 @@ class FlowState(BaseModel, StoreItem):
|
|
|
69
69
|
return (
|
|
70
70
|
not self.is_expired()
|
|
71
71
|
and not self.reached_max_attempts()
|
|
72
|
-
and self.tag in [
|
|
72
|
+
and self.tag in [_FlowStateTag.BEGIN, _FlowStateTag.CONTINUE]
|
|
73
73
|
)
|
|
74
74
|
|
|
75
75
|
def refresh(self):
|
|
76
76
|
if (
|
|
77
77
|
self.tag
|
|
78
|
-
in [
|
|
78
|
+
in [_FlowStateTag.BEGIN, _FlowStateTag.CONTINUE, _FlowStateTag.COMPLETE]
|
|
79
79
|
and self.is_expired()
|
|
80
80
|
):
|
|
81
|
-
self.tag =
|
|
81
|
+
self.tag = _FlowStateTag.NOT_STARTED
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
from ..storage import Storage
|
|
7
|
-
from .
|
|
7
|
+
from ._flow_state import _FlowState
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class _DummyCache(Storage):
|
|
11
11
|
|
|
12
|
-
async def read(self, keys: list[str], **kwargs) -> dict[str,
|
|
12
|
+
async def read(self, keys: list[str], **kwargs) -> dict[str, _FlowState]:
|
|
13
13
|
return {}
|
|
14
14
|
|
|
15
|
-
async def write(self, changes: dict[str,
|
|
15
|
+
async def write(self, changes: dict[str, _FlowState]) -> None:
|
|
16
16
|
pass
|
|
17
17
|
|
|
18
18
|
async def delete(self, keys: list[str]) -> None:
|
|
@@ -23,7 +23,7 @@ class DummyCache(Storage):
|
|
|
23
23
|
# - CachedStorage class for two-tier storage
|
|
24
24
|
# - Namespaced/PrefixedStorage class for namespacing keying
|
|
25
25
|
# not generally thread or async safe (operations are not atomic)
|
|
26
|
-
class
|
|
26
|
+
class _FlowStorageClient:
|
|
27
27
|
"""Wrapper around Storage that manages sign-in state specific to each user and channel.
|
|
28
28
|
|
|
29
29
|
Uses the activity's channel_id and from.id to create a key prefix for storage operations.
|
|
@@ -34,7 +34,7 @@ class FlowStorageClient:
|
|
|
34
34
|
channel_id: str,
|
|
35
35
|
user_id: str,
|
|
36
36
|
storage: Storage,
|
|
37
|
-
cache_class: type[Storage] = None,
|
|
37
|
+
cache_class: Optional[type[Storage]] = None,
|
|
38
38
|
):
|
|
39
39
|
"""
|
|
40
40
|
Args:
|
|
@@ -53,7 +53,7 @@ class FlowStorageClient:
|
|
|
53
53
|
self._base_key = f"auth/{channel_id}/{user_id}/"
|
|
54
54
|
self._storage = storage
|
|
55
55
|
if cache_class is None:
|
|
56
|
-
cache_class =
|
|
56
|
+
cache_class = _DummyCache
|
|
57
57
|
self._cache = cache_class()
|
|
58
58
|
|
|
59
59
|
@property
|
|
@@ -65,21 +65,21 @@ class FlowStorageClient:
|
|
|
65
65
|
"""Creates a storage key for a specific sign-in handler."""
|
|
66
66
|
return f"{self._base_key}{auth_handler_id}"
|
|
67
67
|
|
|
68
|
-
async def read(self, auth_handler_id: str) -> Optional[
|
|
68
|
+
async def read(self, auth_handler_id: str) -> Optional[_FlowState]:
|
|
69
69
|
"""Reads the flow state for a specific authentication handler."""
|
|
70
70
|
key: str = self.key(auth_handler_id)
|
|
71
|
-
data = await self._cache.read([key], target_cls=
|
|
71
|
+
data = await self._cache.read([key], target_cls=_FlowState)
|
|
72
72
|
if key not in data:
|
|
73
|
-
data = await self._storage.read([key], target_cls=
|
|
73
|
+
data = await self._storage.read([key], target_cls=_FlowState)
|
|
74
74
|
if key not in data:
|
|
75
75
|
return None
|
|
76
76
|
await self._cache.write({key: data[key]})
|
|
77
|
-
return
|
|
77
|
+
return _FlowState.model_validate(data.get(key))
|
|
78
78
|
|
|
79
|
-
async def write(self, value:
|
|
79
|
+
async def write(self, value: _FlowState) -> None:
|
|
80
80
|
"""Saves the flow state for a specific authentication handler."""
|
|
81
81
|
key: str = self.key(value.auth_handler_id)
|
|
82
|
-
cached_state = await self._cache.read([key], target_cls=
|
|
82
|
+
cached_state = await self._cache.read([key], target_cls=_FlowState)
|
|
83
83
|
if not cached_state or cached_state != value:
|
|
84
84
|
await self._cache.write({key: value})
|
|
85
85
|
await self._storage.write({key: value})
|
|
@@ -87,7 +87,7 @@ class FlowStorageClient:
|
|
|
87
87
|
async def delete(self, auth_handler_id: str) -> None:
|
|
88
88
|
"""Deletes the flow state for a specific authentication handler."""
|
|
89
89
|
key: str = self.key(auth_handler_id)
|
|
90
|
-
cached_state = await self._cache.read([key], target_cls=
|
|
90
|
+
cached_state = await self._cache.read([key], target_cls=_FlowState)
|
|
91
91
|
if cached_state:
|
|
92
92
|
await self._cache.delete([key])
|
|
93
93
|
await self._storage.delete([key])
|
|
@@ -18,22 +18,22 @@ from microsoft_agents.activity import (
|
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
from ..connector.client import UserTokenClient
|
|
21
|
-
from .
|
|
21
|
+
from ._flow_state import _FlowState, _FlowStateTag, _FlowErrorTag
|
|
22
22
|
|
|
23
23
|
logger = logging.getLogger(__name__)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
class
|
|
26
|
+
class _FlowResponse(BaseModel):
|
|
27
27
|
"""Represents the response for a flow operation."""
|
|
28
28
|
|
|
29
|
-
flow_state:
|
|
30
|
-
flow_error_tag:
|
|
29
|
+
flow_state: _FlowState = _FlowState()
|
|
30
|
+
flow_error_tag: _FlowErrorTag = _FlowErrorTag.NONE
|
|
31
31
|
token_response: Optional[TokenResponse] = None
|
|
32
32
|
sign_in_resource: Optional[SignInResource] = None
|
|
33
33
|
continuation_activity: Optional[Activity] = None
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
class
|
|
36
|
+
class _OAuthFlow:
|
|
37
37
|
"""
|
|
38
38
|
Manages the OAuth flow.
|
|
39
39
|
|
|
@@ -48,7 +48,7 @@ class OAuthFlow:
|
|
|
48
48
|
"""
|
|
49
49
|
|
|
50
50
|
def __init__(
|
|
51
|
-
self, flow_state:
|
|
51
|
+
self, flow_state: _FlowState, user_token_client: UserTokenClient, **kwargs
|
|
52
52
|
):
|
|
53
53
|
"""
|
|
54
54
|
Arguments:
|
|
@@ -105,7 +105,7 @@ class OAuthFlow:
|
|
|
105
105
|
)
|
|
106
106
|
|
|
107
107
|
@property
|
|
108
|
-
def flow_state(self) ->
|
|
108
|
+
def flow_state(self) -> _FlowState:
|
|
109
109
|
return self._flow_state.model_copy()
|
|
110
110
|
|
|
111
111
|
async def get_user_token(self, magic_code: str = None) -> TokenResponse:
|
|
@@ -136,11 +136,10 @@ class OAuthFlow:
|
|
|
136
136
|
)
|
|
137
137
|
if token_response:
|
|
138
138
|
logger.info("User token obtained successfully: %s", token_response)
|
|
139
|
-
self._flow_state.user_token = token_response.token
|
|
140
139
|
self._flow_state.expiration = (
|
|
141
140
|
datetime.now().timestamp() + self._default_flow_duration
|
|
142
141
|
)
|
|
143
|
-
self._flow_state.tag =
|
|
142
|
+
self._flow_state.tag = _FlowStateTag.COMPLETE
|
|
144
143
|
|
|
145
144
|
return token_response
|
|
146
145
|
|
|
@@ -160,20 +159,19 @@ class OAuthFlow:
|
|
|
160
159
|
connection_name=self._abs_oauth_connection_name,
|
|
161
160
|
channel_id=self._channel_id,
|
|
162
161
|
)
|
|
163
|
-
self._flow_state.
|
|
164
|
-
self._flow_state.tag = FlowStateTag.NOT_STARTED
|
|
162
|
+
self._flow_state.tag = _FlowStateTag.NOT_STARTED
|
|
165
163
|
|
|
166
164
|
def _use_attempt(self) -> None:
|
|
167
165
|
"""Decrements the remaining attempts for the flow, checking for failure."""
|
|
168
166
|
self._flow_state.attempts_remaining -= 1
|
|
169
167
|
if self._flow_state.attempts_remaining <= 0:
|
|
170
|
-
self._flow_state.tag =
|
|
168
|
+
self._flow_state.tag = _FlowStateTag.FAILURE
|
|
171
169
|
logger.debug(
|
|
172
170
|
"Using an attempt for the OAuth flow. Attempts remaining after use: %d",
|
|
173
171
|
self._flow_state.attempts_remaining,
|
|
174
172
|
)
|
|
175
173
|
|
|
176
|
-
async def begin_flow(self, activity: Activity) ->
|
|
174
|
+
async def begin_flow(self, activity: Activity) -> _FlowResponse:
|
|
177
175
|
"""Begins the OAuthFlow.
|
|
178
176
|
|
|
179
177
|
Args:
|
|
@@ -187,18 +185,17 @@ class OAuthFlow:
|
|
|
187
185
|
"""
|
|
188
186
|
token_response = await self.get_user_token()
|
|
189
187
|
if token_response:
|
|
190
|
-
return
|
|
188
|
+
return _FlowResponse(
|
|
191
189
|
flow_state=self._flow_state, token_response=token_response
|
|
192
190
|
)
|
|
193
191
|
|
|
194
192
|
logger.debug("Starting new OAuth flow")
|
|
195
|
-
self._flow_state.tag =
|
|
193
|
+
self._flow_state.tag = _FlowStateTag.BEGIN
|
|
196
194
|
self._flow_state.expiration = (
|
|
197
195
|
datetime.now().timestamp() + self._default_flow_duration
|
|
198
196
|
)
|
|
199
197
|
|
|
200
198
|
self._flow_state.attempts_remaining = self._max_attempts
|
|
201
|
-
self._flow_state.user_token = ""
|
|
202
199
|
self._flow_state.continuation_activity = activity.model_copy()
|
|
203
200
|
|
|
204
201
|
token_exchange_state = TokenExchangeState(
|
|
@@ -216,24 +213,24 @@ class OAuthFlow:
|
|
|
216
213
|
|
|
217
214
|
logger.debug("Sign-in resource obtained successfully: %s", sign_in_resource)
|
|
218
215
|
|
|
219
|
-
return
|
|
216
|
+
return _FlowResponse(
|
|
220
217
|
flow_state=self._flow_state, sign_in_resource=sign_in_resource
|
|
221
218
|
)
|
|
222
219
|
|
|
223
220
|
async def _continue_from_message(
|
|
224
221
|
self, activity: Activity
|
|
225
|
-
) -> tuple[TokenResponse,
|
|
222
|
+
) -> tuple[TokenResponse, _FlowErrorTag]:
|
|
226
223
|
"""Handles the continuation of the flow from a message activity."""
|
|
227
224
|
magic_code: str = activity.text
|
|
228
225
|
if magic_code and magic_code.isdigit() and len(magic_code) == 6:
|
|
229
226
|
token_response: TokenResponse = await self.get_user_token(magic_code)
|
|
230
227
|
|
|
231
228
|
if token_response:
|
|
232
|
-
return token_response,
|
|
229
|
+
return token_response, _FlowErrorTag.NONE
|
|
233
230
|
else:
|
|
234
|
-
return token_response,
|
|
231
|
+
return token_response, _FlowErrorTag.MAGIC_CODE_INCORRECT
|
|
235
232
|
else:
|
|
236
|
-
return TokenResponse(),
|
|
233
|
+
return TokenResponse(), _FlowErrorTag.MAGIC_FORMAT
|
|
237
234
|
|
|
238
235
|
async def _continue_from_invoke_verify_state(
|
|
239
236
|
self, activity: Activity
|
|
@@ -257,7 +254,7 @@ class OAuthFlow:
|
|
|
257
254
|
)
|
|
258
255
|
return token_response
|
|
259
256
|
|
|
260
|
-
async def continue_flow(self, activity: Activity) ->
|
|
257
|
+
async def continue_flow(self, activity: Activity) -> _FlowResponse:
|
|
261
258
|
"""Continues the OAuth flow based on the incoming activity.
|
|
262
259
|
|
|
263
260
|
Args:
|
|
@@ -271,12 +268,12 @@ class OAuthFlow:
|
|
|
271
268
|
|
|
272
269
|
if not self._flow_state.is_active():
|
|
273
270
|
logger.debug("OAuth flow is not active, cannot continue")
|
|
274
|
-
self._flow_state.tag =
|
|
275
|
-
return
|
|
271
|
+
self._flow_state.tag = _FlowStateTag.FAILURE
|
|
272
|
+
return _FlowResponse(
|
|
276
273
|
flow_state=self._flow_state.model_copy(), token_response=None
|
|
277
274
|
)
|
|
278
275
|
|
|
279
|
-
flow_error_tag =
|
|
276
|
+
flow_error_tag = _FlowErrorTag.NONE
|
|
280
277
|
if activity.type == ActivityTypes.message:
|
|
281
278
|
token_response, flow_error_tag = await self._continue_from_message(activity)
|
|
282
279
|
elif (
|
|
@@ -292,32 +289,31 @@ class OAuthFlow:
|
|
|
292
289
|
else:
|
|
293
290
|
raise ValueError(f"Unknown activity type {activity.type}")
|
|
294
291
|
|
|
295
|
-
if not token_response and flow_error_tag ==
|
|
296
|
-
flow_error_tag =
|
|
292
|
+
if not token_response and flow_error_tag == _FlowErrorTag.NONE:
|
|
293
|
+
flow_error_tag = _FlowErrorTag.OTHER
|
|
297
294
|
|
|
298
|
-
if flow_error_tag !=
|
|
295
|
+
if flow_error_tag != _FlowErrorTag.NONE:
|
|
299
296
|
logger.debug("Flow error occurred: %s", flow_error_tag)
|
|
300
|
-
self._flow_state.tag =
|
|
297
|
+
self._flow_state.tag = _FlowStateTag.CONTINUE
|
|
301
298
|
self._use_attempt()
|
|
302
299
|
else:
|
|
303
|
-
self._flow_state.tag =
|
|
300
|
+
self._flow_state.tag = _FlowStateTag.COMPLETE
|
|
304
301
|
self._flow_state.expiration = (
|
|
305
302
|
datetime.now().timestamp() + self._default_flow_duration
|
|
306
303
|
)
|
|
307
|
-
self._flow_state.user_token = token_response.token
|
|
308
304
|
logger.debug(
|
|
309
305
|
"OAuth flow completed successfully, got TokenResponse: %s",
|
|
310
306
|
token_response,
|
|
311
307
|
)
|
|
312
308
|
|
|
313
|
-
return
|
|
309
|
+
return _FlowResponse(
|
|
314
310
|
flow_state=self._flow_state.model_copy(),
|
|
315
311
|
flow_error_tag=flow_error_tag,
|
|
316
312
|
token_response=token_response,
|
|
317
313
|
continuation_activity=self._flow_state.continuation_activity,
|
|
318
314
|
)
|
|
319
315
|
|
|
320
|
-
async def begin_or_continue_flow(self, activity: Activity) ->
|
|
316
|
+
async def begin_or_continue_flow(self, activity: Activity) -> _FlowResponse:
|
|
321
317
|
"""Begins a new OAuth flow or continues an existing one based on the activity.
|
|
322
318
|
|
|
323
319
|
Args:
|
|
@@ -327,12 +323,6 @@ class OAuthFlow:
|
|
|
327
323
|
A FlowResponse object containing the updated flow state and any token response.
|
|
328
324
|
"""
|
|
329
325
|
self._flow_state.refresh()
|
|
330
|
-
if self._flow_state.tag == FlowStateTag.COMPLETE: # robrandao: TODO -> test
|
|
331
|
-
logger.debug("OAuth flow has already been completed, nothing to do")
|
|
332
|
-
return FlowResponse(
|
|
333
|
-
flow_state=self._flow_state.model_copy(),
|
|
334
|
-
token_response=TokenResponse(token=self._flow_state.user_token),
|
|
335
|
-
)
|
|
336
326
|
|
|
337
327
|
if self._flow_state.is_active():
|
|
338
328
|
logger.debug("Active flow, continuing...")
|
|
@@ -105,8 +105,7 @@ class ActivityHandler(Agent):
|
|
|
105
105
|
such as the conversational logic.
|
|
106
106
|
|
|
107
107
|
:param turn_context: The context object for this turn
|
|
108
|
-
:type turn_context: :class:`microsoft_agents.
|
|
109
|
-
|
|
108
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
110
109
|
:returns: A task that represents the work queued to execute
|
|
111
110
|
"""
|
|
112
111
|
return
|
|
@@ -119,8 +118,7 @@ class ActivityHandler(Agent):
|
|
|
119
118
|
such as the conversational logic.
|
|
120
119
|
|
|
121
120
|
:param turn_context: The context object for this turn
|
|
122
|
-
:type turn_context: :class:`microsoft_agents.
|
|
123
|
-
|
|
121
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
124
122
|
:returns: A task that represents the work queued to execute
|
|
125
123
|
"""
|
|
126
124
|
return
|
|
@@ -133,8 +131,7 @@ class ActivityHandler(Agent):
|
|
|
133
131
|
such as the conversational logic.
|
|
134
132
|
|
|
135
133
|
:param turn_context: The context object for this turn
|
|
136
|
-
:type turn_context: :class:`microsoft_agents.
|
|
137
|
-
|
|
134
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
138
135
|
:returns: A task that represents the work queued to execute
|
|
139
136
|
"""
|
|
140
137
|
return
|
|
@@ -146,7 +143,6 @@ class ActivityHandler(Agent):
|
|
|
146
143
|
|
|
147
144
|
:param turn_context: The context object for this turn
|
|
148
145
|
:type turn_context: :class:`microsoft_agents.builder.TurnContext`
|
|
149
|
-
|
|
150
146
|
:returns: A task that represents the work queued to execute
|
|
151
147
|
|
|
152
148
|
.. remarks::
|
|
@@ -179,10 +175,9 @@ class ActivityHandler(Agent):
|
|
|
179
175
|
|
|
180
176
|
:param members_added: A list of all the members added to the conversation, as described by the
|
|
181
177
|
conversation update activity
|
|
182
|
-
:type members_added:
|
|
178
|
+
:type members_added: list[ChannelAccount]
|
|
183
179
|
:param turn_context: The context object for this turn
|
|
184
|
-
:type turn_context: :class:`microsoft_agents.
|
|
185
|
-
|
|
180
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
186
181
|
:returns: A task that represents the work queued to execute
|
|
187
182
|
|
|
188
183
|
.. remarks::
|
|
@@ -201,10 +196,9 @@ class ActivityHandler(Agent):
|
|
|
201
196
|
|
|
202
197
|
:param members_added: A list of all the members removed from the conversation, as described by the
|
|
203
198
|
conversation update activity
|
|
204
|
-
:type members_added:
|
|
199
|
+
:type members_added: list[ChannelAccount]
|
|
205
200
|
:param turn_context: The context object for this turn
|
|
206
|
-
:type turn_context: :class:`microsoft_agents.
|
|
207
|
-
|
|
201
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
208
202
|
:returns: A task that represents the work queued to execute
|
|
209
203
|
|
|
210
204
|
.. remarks::
|
|
@@ -265,10 +259,9 @@ class ActivityHandler(Agent):
|
|
|
265
259
|
are added to the conversation.
|
|
266
260
|
|
|
267
261
|
:param message_reactions: The list of reactions added
|
|
268
|
-
:type message_reactions:
|
|
262
|
+
:type message_reactions: list[MessageReaction]
|
|
269
263
|
:param turn_context: The context object for this turn
|
|
270
|
-
:type turn_context: :class:`microsoft_agents.
|
|
271
|
-
|
|
264
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
272
265
|
:returns: A task that represents the work queued to execute
|
|
273
266
|
|
|
274
267
|
.. remarks::
|
|
@@ -291,9 +284,9 @@ class ActivityHandler(Agent):
|
|
|
291
284
|
are removed from the conversation.
|
|
292
285
|
|
|
293
286
|
:param message_reactions: The list of reactions removed
|
|
294
|
-
:type message_reactions:
|
|
287
|
+
:type message_reactions: list[MessageReaction]
|
|
295
288
|
:param turn_context: The context object for this turn
|
|
296
|
-
:type turn_context: :class:`microsoft_agents.
|
|
289
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
297
290
|
|
|
298
291
|
:returns: A task that represents the work queued to execute
|
|
299
292
|
|
|
@@ -312,8 +305,7 @@ class ActivityHandler(Agent):
|
|
|
312
305
|
:meth:`on_turn()` is used.
|
|
313
306
|
|
|
314
307
|
:param turn_context: The context object for this turn
|
|
315
|
-
:type turn_context: :class:`microsoft_agents.
|
|
316
|
-
|
|
308
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
317
309
|
:returns: A task that represents the work queued to execute
|
|
318
310
|
|
|
319
311
|
.. remarks::
|
|
@@ -343,8 +335,7 @@ class ActivityHandler(Agent):
|
|
|
343
335
|
If using an `oauth_prompt`, override this method to forward this activity to the current dialog.
|
|
344
336
|
|
|
345
337
|
:param turn_context: The context object for this turn
|
|
346
|
-
:type turn_context: :class:`microsoft_agents.
|
|
347
|
-
|
|
338
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
348
339
|
:returns: A task that represents the work queued to execute
|
|
349
340
|
|
|
350
341
|
.. remarks::
|
|
@@ -360,11 +351,8 @@ class ActivityHandler(Agent):
|
|
|
360
351
|
"""
|
|
361
352
|
Invoked when an event other than `tokens/response` is received when the base behavior of
|
|
362
353
|
:meth:`on_event_activity()` is used.
|
|
363
|
-
|
|
364
|
-
|
|
365
354
|
:param turn_context: The context object for this turn
|
|
366
|
-
:type turn_context: :class:`microsoft_agents.
|
|
367
|
-
|
|
355
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
368
356
|
:returns: A task that represents the work queued to execute
|
|
369
357
|
|
|
370
358
|
.. remarks::
|
|
@@ -379,9 +367,8 @@ class ActivityHandler(Agent):
|
|
|
379
367
|
):
|
|
380
368
|
"""
|
|
381
369
|
Invoked when a conversation end activity is received from the channel.
|
|
382
|
-
|
|
383
370
|
:param turn_context: The context object for this turn
|
|
384
|
-
:type turn_context: :class:`microsoft_agents.
|
|
371
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
385
372
|
:returns: A task that represents the work queued to execute
|
|
386
373
|
"""
|
|
387
374
|
return
|
|
@@ -522,7 +509,7 @@ class ActivityHandler(Agent):
|
|
|
522
509
|
:param turn_context: A context object for this turn.
|
|
523
510
|
:type turn_context: :class:`microsoft_agents.builder.TurnContext`
|
|
524
511
|
:param invoke_value: A string-typed object from the incoming activity's value.
|
|
525
|
-
:type invoke_value: :class:`microsoft_agents.activity.
|
|
512
|
+
:type invoke_value: :class:`microsoft_agents.activity.adaptive_card_invoke_value.AdaptiveCardInvokeValue`
|
|
526
513
|
:return: The HealthCheckResponse object
|
|
527
514
|
"""
|
|
528
515
|
raise _InvokeResponseException(HTTPStatus.NOT_IMPLEMENTED)
|
|
@@ -17,7 +17,7 @@ from .typing_indicator import TypingIndicator
|
|
|
17
17
|
from .oauth import (
|
|
18
18
|
Authorization,
|
|
19
19
|
AuthHandler,
|
|
20
|
-
|
|
20
|
+
AgenticUserAuthorization,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
# App State
|
|
@@ -27,15 +27,11 @@ from .state.temp_state import TempState
|
|
|
27
27
|
from .state.turn_state import TurnState
|
|
28
28
|
|
|
29
29
|
__all__ = [
|
|
30
|
-
"ActivityType",
|
|
31
30
|
"AgentApplication",
|
|
32
31
|
"ApplicationError",
|
|
33
32
|
"ApplicationOptions",
|
|
34
|
-
"ConversationUpdateType",
|
|
35
33
|
"InputFile",
|
|
36
34
|
"InputFileDownloader",
|
|
37
|
-
"MessageReactionType",
|
|
38
|
-
"MessageUpdateType",
|
|
39
35
|
"Query",
|
|
40
36
|
"Route",
|
|
41
37
|
"RouteHandler",
|
|
@@ -49,5 +45,5 @@ __all__ = [
|
|
|
49
45
|
"TempState",
|
|
50
46
|
"Authorization",
|
|
51
47
|
"AuthHandler",
|
|
52
|
-
"
|
|
48
|
+
"AgenticUserAuthorization",
|
|
53
49
|
]
|