microsoft-agents-hosting-core 0.4.0.dev18__py3-none-any.whl → 0.5.0.dev3__py3-none-any.whl
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/_oauth/_flow_state.py +2 -2
- microsoft_agents/hosting/core/_oauth/_oauth_flow.py +26 -23
- microsoft_agents/hosting/core/activity_handler.py +11 -11
- microsoft_agents/hosting/core/app/agent_application.py +4 -4
- microsoft_agents/hosting/core/app/input_file.py +15 -11
- microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +4 -4
- microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +2 -2
- microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +3 -3
- microsoft_agents/hosting/core/app/oauth/authorization.py +1 -1
- microsoft_agents/hosting/core/channel_adapter.py +9 -9
- microsoft_agents/hosting/core/connector/client/user_token_client.py +40 -43
- microsoft_agents/hosting/core/connector/user_token_base.py +77 -1
- microsoft_agents/hosting/core/connector/user_token_client_base.py +3 -0
- microsoft_agents/hosting/core/state/agent_state.py +16 -20
- {microsoft_agents_hosting_core-0.4.0.dev18.dist-info → microsoft_agents_hosting_core-0.5.0.dev3.dist-info}/METADATA +2 -2
- {microsoft_agents_hosting_core-0.4.0.dev18.dist-info → microsoft_agents_hosting_core-0.5.0.dev3.dist-info}/RECORD +18 -18
- {microsoft_agents_hosting_core-0.4.0.dev18.dist-info → microsoft_agents_hosting_core-0.5.0.dev3.dist-info}/WHEEL +0 -0
- {microsoft_agents_hosting_core-0.4.0.dev18.dist-info → microsoft_agents_hosting_core-0.5.0.dev3.dist-info}/top_level.txt +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
-
from datetime import datetime
|
|
6
|
+
from datetime import datetime, timezone
|
|
7
7
|
from enum import Enum
|
|
8
8
|
from typing import Optional
|
|
9
9
|
|
|
@@ -60,7 +60,7 @@ class _FlowState(BaseModel, StoreItem):
|
|
|
60
60
|
return _FlowState.model_validate(json_data)
|
|
61
61
|
|
|
62
62
|
def is_expired(self) -> bool:
|
|
63
|
-
return datetime.now().timestamp() >= self.expiration
|
|
63
|
+
return datetime.now(timezone.utc).timestamp() >= self.expiration
|
|
64
64
|
|
|
65
65
|
def reached_max_attempts(self) -> bool:
|
|
66
66
|
return self.attempts_remaining <= 0
|
|
@@ -6,7 +6,7 @@ from __future__ import annotations
|
|
|
6
6
|
import logging
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel
|
|
9
|
-
from datetime import datetime
|
|
9
|
+
from datetime import datetime, timezone
|
|
10
10
|
from typing import Optional
|
|
11
11
|
|
|
12
12
|
from microsoft_agents.activity import (
|
|
@@ -30,7 +30,6 @@ class _FlowResponse(BaseModel):
|
|
|
30
30
|
flow_error_tag: _FlowErrorTag = _FlowErrorTag.NONE
|
|
31
31
|
token_response: Optional[TokenResponse] = None
|
|
32
32
|
sign_in_resource: Optional[SignInResource] = None
|
|
33
|
-
continuation_activity: Optional[Activity] = None
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
class _OAuthFlow:
|
|
@@ -112,7 +111,7 @@ class _OAuthFlow:
|
|
|
112
111
|
"""Get the user token based on the context.
|
|
113
112
|
|
|
114
113
|
Args:
|
|
115
|
-
magic_code (str,
|
|
114
|
+
magic_code (str, Optional): Defaults to None. The magic code for user authentication.
|
|
116
115
|
|
|
117
116
|
Returns:
|
|
118
117
|
TokenResponse
|
|
@@ -137,7 +136,7 @@ class _OAuthFlow:
|
|
|
137
136
|
if token_response:
|
|
138
137
|
logger.info("User token obtained successfully: %s", token_response)
|
|
139
138
|
self._flow_state.expiration = (
|
|
140
|
-
datetime.now().timestamp() + self._default_flow_duration
|
|
139
|
+
datetime.now(timezone.utc).timestamp() + self._default_flow_duration
|
|
141
140
|
)
|
|
142
141
|
self._flow_state.tag = _FlowStateTag.COMPLETE
|
|
143
142
|
|
|
@@ -183,20 +182,8 @@ class _OAuthFlow:
|
|
|
183
182
|
Notes:
|
|
184
183
|
The flow state is reset if a token is not obtained from cache.
|
|
185
184
|
"""
|
|
186
|
-
token_response = await self.get_user_token()
|
|
187
|
-
if token_response:
|
|
188
|
-
return _FlowResponse(
|
|
189
|
-
flow_state=self._flow_state, token_response=token_response
|
|
190
|
-
)
|
|
191
185
|
|
|
192
186
|
logger.debug("Starting new OAuth flow")
|
|
193
|
-
self._flow_state.tag = _FlowStateTag.BEGIN
|
|
194
|
-
self._flow_state.expiration = (
|
|
195
|
-
datetime.now().timestamp() + self._default_flow_duration
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
self._flow_state.attempts_remaining = self._max_attempts
|
|
199
|
-
self._flow_state.continuation_activity = activity.model_copy()
|
|
200
187
|
|
|
201
188
|
token_exchange_state = TokenExchangeState(
|
|
202
189
|
connection_name=self._abs_oauth_connection_name,
|
|
@@ -205,16 +192,33 @@ class _OAuthFlow:
|
|
|
205
192
|
ms_app_id=self._ms_app_id,
|
|
206
193
|
)
|
|
207
194
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
res = await self._user_token_client.user_token._get_token_or_sign_in_resource(
|
|
196
|
+
activity.from_property.id,
|
|
197
|
+
self._abs_oauth_connection_name,
|
|
198
|
+
activity.channel_id,
|
|
199
|
+
token_exchange_state.get_encoded_state(),
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
if res.token_response:
|
|
203
|
+
logger.info("Skipping flow, user token obtained.")
|
|
204
|
+
self._flow_state.tag = _FlowStateTag.COMPLETE
|
|
205
|
+
self._flow_state.expiration = (
|
|
206
|
+
datetime.now(timezone.utc).timestamp() + self._default_flow_duration
|
|
207
|
+
)
|
|
208
|
+
return _FlowResponse(
|
|
209
|
+
flow_state=self._flow_state, token_response=res.token_response
|
|
211
210
|
)
|
|
211
|
+
|
|
212
|
+
self._flow_state.tag = _FlowStateTag.BEGIN
|
|
213
|
+
self._flow_state.expiration = (
|
|
214
|
+
datetime.now(timezone.utc).timestamp() + self._default_flow_duration
|
|
212
215
|
)
|
|
216
|
+
self._flow_state.attempts_remaining = self._max_attempts
|
|
213
217
|
|
|
214
|
-
logger.debug("Sign-in resource obtained successfully: %s", sign_in_resource)
|
|
218
|
+
logger.debug("Sign-in resource obtained successfully: %s", res.sign_in_resource)
|
|
215
219
|
|
|
216
220
|
return _FlowResponse(
|
|
217
|
-
flow_state=self._flow_state, sign_in_resource=sign_in_resource
|
|
221
|
+
flow_state=self._flow_state, sign_in_resource=res.sign_in_resource
|
|
218
222
|
)
|
|
219
223
|
|
|
220
224
|
async def _continue_from_message(
|
|
@@ -299,7 +303,7 @@ class _OAuthFlow:
|
|
|
299
303
|
else:
|
|
300
304
|
self._flow_state.tag = _FlowStateTag.COMPLETE
|
|
301
305
|
self._flow_state.expiration = (
|
|
302
|
-
datetime.now().timestamp() + self._default_flow_duration
|
|
306
|
+
datetime.now(timezone.utc).timestamp() + self._default_flow_duration
|
|
303
307
|
)
|
|
304
308
|
logger.debug(
|
|
305
309
|
"OAuth flow completed successfully, got TokenResponse: %s",
|
|
@@ -310,7 +314,6 @@ class _OAuthFlow:
|
|
|
310
314
|
flow_state=self._flow_state.model_copy(),
|
|
311
315
|
flow_error_tag=flow_error_tag,
|
|
312
316
|
token_response=token_response,
|
|
313
|
-
continuation_activity=self._flow_state.continuation_activity,
|
|
314
317
|
)
|
|
315
318
|
|
|
316
319
|
async def begin_or_continue_flow(self, activity: Activity) -> _FlowResponse:
|
|
@@ -38,7 +38,7 @@ class ActivityHandler(Agent):
|
|
|
38
38
|
in order to process an inbound :class:`microsoft_agents.activity.Activity`.
|
|
39
39
|
|
|
40
40
|
:param turn_context: The context object for this turn
|
|
41
|
-
:type turn_context: :class:`microsoft_agents.
|
|
41
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
42
42
|
|
|
43
43
|
:returns: A task that represents the work queued to execute
|
|
44
44
|
|
|
@@ -143,7 +143,7 @@ class ActivityHandler(Agent):
|
|
|
143
143
|
:meth:`on_turn()` is used.
|
|
144
144
|
|
|
145
145
|
:param turn_context: The context object for this turn
|
|
146
|
-
:type turn_context: :class:`microsoft_agents.
|
|
146
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
147
147
|
:returns: A task that represents the work queued to execute
|
|
148
148
|
|
|
149
149
|
.. remarks::
|
|
@@ -216,7 +216,7 @@ class ActivityHandler(Agent):
|
|
|
216
216
|
:meth:`on_turn()` is used.
|
|
217
217
|
|
|
218
218
|
:param turn_context: The context object for this turn
|
|
219
|
-
:type turn_context: :class:`microsoft_agents.
|
|
219
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
220
220
|
|
|
221
221
|
:returns: A task that represents the work queued to execute
|
|
222
222
|
|
|
@@ -382,7 +382,7 @@ class ActivityHandler(Agent):
|
|
|
382
382
|
ActivityTypes.typing activities, such as the conversational logic.
|
|
383
383
|
|
|
384
384
|
:param turn_context: The context object for this turn
|
|
385
|
-
:type turn_context: :class:`microsoft_agents.
|
|
385
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
386
386
|
:returns: A task that represents the work queued to execute
|
|
387
387
|
"""
|
|
388
388
|
return
|
|
@@ -395,7 +395,7 @@ class ActivityHandler(Agent):
|
|
|
395
395
|
ActivityTypes.InstallationUpdate activities.
|
|
396
396
|
|
|
397
397
|
:param turn_context: The context object for this turn
|
|
398
|
-
:type turn_context: :class:`microsoft_agents.
|
|
398
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
399
399
|
:returns: A task that represents the work queued to execute
|
|
400
400
|
"""
|
|
401
401
|
if turn_context.activity.action in ("add", "add-upgrade"):
|
|
@@ -412,7 +412,7 @@ class ActivityHandler(Agent):
|
|
|
412
412
|
ActivityTypes.InstallationUpdate activities with 'action' set to 'add'.
|
|
413
413
|
|
|
414
414
|
:param turn_context: The context object for this turn
|
|
415
|
-
:type turn_context: :class:`microsoft_agents.
|
|
415
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
416
416
|
:returns: A task that represents the work queued to execute
|
|
417
417
|
"""
|
|
418
418
|
return
|
|
@@ -425,7 +425,7 @@ class ActivityHandler(Agent):
|
|
|
425
425
|
ActivityTypes.InstallationUpdate activities with 'action' set to 'remove'.
|
|
426
426
|
|
|
427
427
|
:param turn_context: The context object for this turn
|
|
428
|
-
:type turn_context: :class:`microsoft_agents.
|
|
428
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
429
429
|
:returns: A task that represents the work queued to execute
|
|
430
430
|
"""
|
|
431
431
|
return
|
|
@@ -439,7 +439,7 @@ class ActivityHandler(Agent):
|
|
|
439
439
|
If overridden, this method could potentially respond to any of the other activity types.
|
|
440
440
|
|
|
441
441
|
:param turn_context: The context object for this turn
|
|
442
|
-
:type turn_context: :class:`microsoft_agents.
|
|
442
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
443
443
|
|
|
444
444
|
:returns: A task that represents the work queued to execute
|
|
445
445
|
|
|
@@ -456,7 +456,7 @@ class ActivityHandler(Agent):
|
|
|
456
456
|
Registers an activity event handler for the _invoke_ event, emitted for every incoming event activity.
|
|
457
457
|
|
|
458
458
|
:param turn_context: The context object for this turn
|
|
459
|
-
:type turn_context: :class:`microsoft_agents.
|
|
459
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
460
460
|
|
|
461
461
|
:returns: A task that represents the work queued to execute
|
|
462
462
|
"""
|
|
@@ -492,7 +492,7 @@ class ActivityHandler(Agent):
|
|
|
492
492
|
By default, this method does nothing.
|
|
493
493
|
|
|
494
494
|
:param turn_context: The context object for this turn
|
|
495
|
-
:type turn_context: :class:`microsoft_agents.
|
|
495
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
496
496
|
|
|
497
497
|
:returns: A task that represents the work queued to execute
|
|
498
498
|
"""
|
|
@@ -508,7 +508,7 @@ class ActivityHandler(Agent):
|
|
|
508
508
|
calls this method.
|
|
509
509
|
|
|
510
510
|
:param turn_context: A context object for this turn.
|
|
511
|
-
:type turn_context: :class:`microsoft_agents.
|
|
511
|
+
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
512
512
|
:param invoke_value: A string-typed object from the incoming activity's value.
|
|
513
513
|
:type invoke_value: :class:`microsoft_agents.activity.adaptive_card_invoke_value.AdaptiveCardInvokeValue`
|
|
514
514
|
:return: The HealthCheckResponse object
|
|
@@ -221,14 +221,14 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
221
221
|
:param handler: A function that takes a TurnContext and a TurnState and returns an Awaitable.
|
|
222
222
|
:type handler: RouteHandler[StateT]
|
|
223
223
|
:param is_invoke: Whether the route is for an invoke activity, defaults to False
|
|
224
|
-
:type is_invoke: bool,
|
|
224
|
+
:type is_invoke: bool, Optional
|
|
225
225
|
:param is_agentic: Whether the route is for an agentic request, defaults to False. For agentic requests
|
|
226
226
|
the selector will include a new check for `context.activity.is_agentic_request()`.
|
|
227
|
-
:type is_agentic: bool,
|
|
227
|
+
:type is_agentic: bool, Optional
|
|
228
228
|
:param rank: The rank of the route, defaults to RouteRank.DEFAULT
|
|
229
|
-
:type rank: RouteRank,
|
|
229
|
+
:type rank: RouteRank, Optional
|
|
230
230
|
:param auth_handlers: A list of authentication handler IDs to use for this route, defaults to None
|
|
231
|
-
:type auth_handlers: Optional[list[str]],
|
|
231
|
+
:type auth_handlers: Optional[list[str]], Optional
|
|
232
232
|
:raises ApplicationError: If the selector or handler are not valid.
|
|
233
233
|
"""
|
|
234
234
|
if not selector or not handler:
|
|
@@ -16,10 +16,12 @@ from microsoft_agents.hosting.core import TurnContext
|
|
|
16
16
|
class InputFile:
|
|
17
17
|
"""A file sent by the user to the bot.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
:param content: The downloaded content of the file.
|
|
20
|
+
:type content: bytes
|
|
21
|
+
:param content_type: The content type of the file.
|
|
22
|
+
:type content_type: str
|
|
23
|
+
:param content_url: Optional. URL to the content of the file.
|
|
24
|
+
:type content_url: Optional[str]
|
|
23
25
|
"""
|
|
24
26
|
|
|
25
27
|
content: bytes
|
|
@@ -29,17 +31,19 @@ class InputFile:
|
|
|
29
31
|
|
|
30
32
|
class InputFileDownloader(ABC):
|
|
31
33
|
"""
|
|
32
|
-
|
|
34
|
+
Abstract base class for a plugin responsible for downloading files provided by the user.
|
|
35
|
+
|
|
36
|
+
Implementations should download any files referenced by the incoming activity and return a
|
|
37
|
+
list of :class:`InputFile` instances representing the downloaded content.
|
|
33
38
|
"""
|
|
34
39
|
|
|
35
40
|
@abstractmethod
|
|
36
41
|
async def download_files(self, context: TurnContext) -> List[InputFile]:
|
|
37
42
|
"""
|
|
38
|
-
Download any files
|
|
39
|
-
|
|
40
|
-
Args:
|
|
41
|
-
context (TurnContext): Context for the current turn of conversation.
|
|
43
|
+
Download any files referenced by the incoming activity for the current turn.
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
:param context: The turn context for the current request.
|
|
46
|
+
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
47
|
+
:return: A list of downloaded :class:`InputFile` objects.
|
|
48
|
+
:rtype: list[:class:`microsoft_agents.hosting.core.app.input_file.InputFile`]
|
|
45
49
|
"""
|
|
@@ -43,7 +43,7 @@ class _AuthorizationHandler(ABC):
|
|
|
43
43
|
:param connection_manager: The connection manager for OAuth providers.
|
|
44
44
|
:type connection_manager: Connections
|
|
45
45
|
:param auth_handlers: Configuration for OAuth providers.
|
|
46
|
-
:type auth_handlers: dict[str, AuthHandler],
|
|
46
|
+
:type auth_handlers: dict[str, AuthHandler], Optional
|
|
47
47
|
:raises ValueError: When storage is None or no auth handlers provided.
|
|
48
48
|
"""
|
|
49
49
|
if not storage:
|
|
@@ -75,7 +75,7 @@ class _AuthorizationHandler(ABC):
|
|
|
75
75
|
:param context: The turn context for the current turn of conversation.
|
|
76
76
|
:type context: TurnContext
|
|
77
77
|
:param scopes: Optional list of scopes to request during sign-in. If None, default scopes will be used.
|
|
78
|
-
:type scopes: Optional[list[str]],
|
|
78
|
+
:type scopes: Optional[list[str]], Optional
|
|
79
79
|
:return: A SignInResponse indicating the result of the sign-in attempt.
|
|
80
80
|
:rtype: SignInResponse
|
|
81
81
|
"""
|
|
@@ -92,9 +92,9 @@ class _AuthorizationHandler(ABC):
|
|
|
92
92
|
:param context: The turn context for the current turn of conversation.
|
|
93
93
|
:type context: TurnContext
|
|
94
94
|
:param exchange_connection: Optional name of the connection to use for token exchange. If None, default connection will be used.
|
|
95
|
-
:type exchange_connection: Optional[str],
|
|
95
|
+
:type exchange_connection: Optional[str], Optional
|
|
96
96
|
:param exchange_scopes: Optional list of scopes to request during token exchange. If None, default scopes will be used.
|
|
97
|
-
:type exchange_scopes: Optional[list[str]],
|
|
97
|
+
:type exchange_scopes: Optional[list[str]], Optional
|
|
98
98
|
"""
|
|
99
99
|
raise NotImplementedError()
|
|
100
100
|
|
|
@@ -249,9 +249,9 @@ class _UserAuthorization(_AuthorizationHandler):
|
|
|
249
249
|
:param context: The turn context for the current turn of conversation.
|
|
250
250
|
:type context: TurnContext
|
|
251
251
|
:param exchange_connection: Optional name of the connection to use for token exchange. If None, default connection will be used.
|
|
252
|
-
:type exchange_connection: Optional[str],
|
|
252
|
+
:type exchange_connection: Optional[str], Optional
|
|
253
253
|
:param exchange_scopes: Optional list of scopes to request during token exchange. If None, default scopes will be used.
|
|
254
|
-
:type exchange_scopes: Optional[list[str]],
|
|
254
|
+
:type exchange_scopes: Optional[list[str]], Optional
|
|
255
255
|
"""
|
|
256
256
|
flow, _ = await self._load_flow(context)
|
|
257
257
|
input_token_response = await flow.get_user_token()
|
|
@@ -41,7 +41,7 @@ class AgenticUserAuthorization(_AuthorizationHandler):
|
|
|
41
41
|
:param connection_manager: The connection manager for OAuth providers.
|
|
42
42
|
:type connection_manager: Connections
|
|
43
43
|
:param auth_handlers: Configuration for OAuth providers.
|
|
44
|
-
:type auth_handlers: dict[str, AuthHandler],
|
|
44
|
+
:type auth_handlers: dict[str, AuthHandler], Optional
|
|
45
45
|
:raises ValueError: When storage is None or no auth handlers provided.
|
|
46
46
|
"""
|
|
47
47
|
super().__init__(
|
|
@@ -172,9 +172,9 @@ class AgenticUserAuthorization(_AuthorizationHandler):
|
|
|
172
172
|
:param context: The turn context for the current turn of conversation.
|
|
173
173
|
:type context: TurnContext
|
|
174
174
|
:param exchange_connection: Optional name of the connection to use for token exchange. If None, default connection will be used.
|
|
175
|
-
:type exchange_connection: Optional[str],
|
|
175
|
+
:type exchange_connection: Optional[str], Optional
|
|
176
176
|
:param exchange_scopes: Optional list of scopes to request during token exchange. If None, default scopes will be used.
|
|
177
|
-
:type exchange_scopes: Optional[list[str]],
|
|
177
|
+
:type exchange_scopes: Optional[list[str]], Optional
|
|
178
178
|
"""
|
|
179
179
|
if not exchange_scopes:
|
|
180
180
|
exchange_scopes = self._handler.scopes or []
|
|
@@ -59,7 +59,7 @@ class Authorization:
|
|
|
59
59
|
:param connection_manager: The connection manager for OAuth providers.
|
|
60
60
|
:type connection_manager: Connections
|
|
61
61
|
:param auth_handlers: Configuration for OAuth providers.
|
|
62
|
-
:type auth_handlers: dict[str, AuthHandler],
|
|
62
|
+
:type auth_handlers: dict[str, AuthHandler], Optional
|
|
63
63
|
:raises ValueError: When storage is None or no auth handlers provided.
|
|
64
64
|
"""
|
|
65
65
|
if not storage:
|
|
@@ -40,7 +40,7 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
40
40
|
Sends a set of activities to the user. An array of responses from the server will be returned.
|
|
41
41
|
|
|
42
42
|
:param context: The context object for the turn.
|
|
43
|
-
:type context: :class:`TurnContext`
|
|
43
|
+
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
44
44
|
:param activities: The activities to send.
|
|
45
45
|
:type activities: list[Activity]
|
|
46
46
|
:return:
|
|
@@ -53,7 +53,7 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
53
53
|
Replaces an existing activity.
|
|
54
54
|
|
|
55
55
|
:param context: The context object for the turn.
|
|
56
|
-
:type context: :class:`TurnContext`
|
|
56
|
+
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
57
57
|
:param activity: New replacement activity.
|
|
58
58
|
:type activity: :class:`microsoft_agents.activity.Activity`
|
|
59
59
|
:return:
|
|
@@ -68,7 +68,7 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
68
68
|
Deletes an existing activity.
|
|
69
69
|
|
|
70
70
|
:param context: The context object for the turn.
|
|
71
|
-
:type context: :class:`TurnContext`
|
|
71
|
+
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
72
72
|
:param reference: Conversation reference for the activity to delete.
|
|
73
73
|
:type reference: :class:`microsoft_agents.activity.ConversationReference`
|
|
74
74
|
:return:
|
|
@@ -102,7 +102,7 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
102
102
|
:param reference: A reference to the conversation to continue.
|
|
103
103
|
:type reference: :class:`microsoft_agents.activity.ConversationReference`
|
|
104
104
|
:param callback: The method to call for the resulting agent turn.
|
|
105
|
-
:type callback: Callable[[TurnContext], Awaitable]
|
|
105
|
+
:type callback: Callable[[microsoft_agents.hosting.core.turn_context.TurnContext], Awaitable]
|
|
106
106
|
:param claims_identity: A :class:`microsoft_agents.hosting.core.ClaimsIdentity` for the conversation.
|
|
107
107
|
:type claims_identity: :class:`microsoft_agents.hosting.core.ClaimsIdentity`
|
|
108
108
|
:param audience:A value signifying the recipient of the proactive message.
|
|
@@ -124,11 +124,11 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
124
124
|
to the user.
|
|
125
125
|
|
|
126
126
|
:param claims_identity: A :class:`microsoft_agents.hosting.core.ClaimsIdentity` for the conversation.
|
|
127
|
-
:type claims_identity: :class:`microsoft_agents.hosting.core.ClaimsIdentity`
|
|
127
|
+
:type claims_identity: :class:`microsoft_agents.hosting.core.authorization.ClaimsIdentity`
|
|
128
128
|
:param continuation_activity: The activity to send.
|
|
129
129
|
:type continuation_activity: :class:`microsoft_agents.activity.Activity`
|
|
130
130
|
:param callback: The method to call for the resulting agent turn.
|
|
131
|
-
:type callback: Callable[[TurnContext], Awaitable]
|
|
131
|
+
:type callback: Callable[[microsoft_agents.hosting.core.turn_context.TurnContext], Awaitable]
|
|
132
132
|
:param audience: A value signifying the recipient of the proactive message.
|
|
133
133
|
:type audience: str
|
|
134
134
|
"""
|
|
@@ -155,9 +155,9 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
155
155
|
:param audience: A value signifying the recipient of the proactive message.
|
|
156
156
|
:type audience: str
|
|
157
157
|
:param conversation_parameters: The information to use to create the conversation
|
|
158
|
-
:type conversation_parameters: :class:`microsoft_agents.activity.
|
|
158
|
+
:type conversation_parameters: :class:`microsoft_agents.activity.ConversationParameters`
|
|
159
159
|
:param callback: The method to call for the resulting agent turn.
|
|
160
|
-
:type callback: Callable[[TurnContext], Awaitable]
|
|
160
|
+
:type callback: Callable[[microsoft_agents.hosting.core.turn_context.TurnContext], Awaitable]
|
|
161
161
|
|
|
162
162
|
:raises: Exception - Not implemented or when the implementation fails.
|
|
163
163
|
|
|
@@ -222,7 +222,7 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
222
222
|
the end of the chain.
|
|
223
223
|
|
|
224
224
|
:param context: The context object for the turn.
|
|
225
|
-
:type context: :class:`TurnContext`
|
|
225
|
+
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
226
226
|
:param callback: A callback method to run at the end of the pipeline.
|
|
227
227
|
:type callback: Callable[[TurnContext], Awaitable]
|
|
228
228
|
:return:
|
|
@@ -8,7 +8,12 @@ from typing import Optional
|
|
|
8
8
|
from aiohttp import ClientSession
|
|
9
9
|
|
|
10
10
|
from microsoft_agents.hosting.core.connector import UserTokenClientBase
|
|
11
|
-
from microsoft_agents.activity import
|
|
11
|
+
from microsoft_agents.activity import (
|
|
12
|
+
TokenOrSignInResourceResponse,
|
|
13
|
+
TokenResponse,
|
|
14
|
+
TokenStatus,
|
|
15
|
+
SignInResource,
|
|
16
|
+
)
|
|
12
17
|
from ..get_product_info import get_product_info
|
|
13
18
|
from ..user_token_base import UserTokenBase
|
|
14
19
|
from ..agent_sign_in_base import AgentSignInBase
|
|
@@ -110,15 +115,6 @@ class UserToken(UserTokenBase):
|
|
|
110
115
|
channel_id: Optional[str] = None,
|
|
111
116
|
code: Optional[str] = None,
|
|
112
117
|
) -> TokenResponse:
|
|
113
|
-
"""
|
|
114
|
-
Gets a token for a user and connection.
|
|
115
|
-
|
|
116
|
-
:param user_id: ID of the user.
|
|
117
|
-
:param connection_name: Name of the connection to use.
|
|
118
|
-
:param channel_id: ID of the channel.
|
|
119
|
-
:param code: Optional authorization code.
|
|
120
|
-
:return: A token response.
|
|
121
|
-
"""
|
|
122
118
|
params = {"userId": user_id, "connectionName": connection_name}
|
|
123
119
|
|
|
124
120
|
if channel_id:
|
|
@@ -137,6 +133,40 @@ class UserToken(UserTokenBase):
|
|
|
137
133
|
data = await response.json()
|
|
138
134
|
return TokenResponse.model_validate(data)
|
|
139
135
|
|
|
136
|
+
async def _get_token_or_sign_in_resource(
|
|
137
|
+
self,
|
|
138
|
+
user_id: str,
|
|
139
|
+
connection_name: str,
|
|
140
|
+
channel_id: str,
|
|
141
|
+
state: str,
|
|
142
|
+
code: str = "",
|
|
143
|
+
final_redirect: str = "",
|
|
144
|
+
fwd_url: str = "",
|
|
145
|
+
) -> TokenOrSignInResourceResponse:
|
|
146
|
+
|
|
147
|
+
params = {
|
|
148
|
+
"userId": user_id,
|
|
149
|
+
"connectionName": connection_name,
|
|
150
|
+
"channelId": channel_id,
|
|
151
|
+
"state": state,
|
|
152
|
+
"code": code,
|
|
153
|
+
"finalRedirect": final_redirect,
|
|
154
|
+
"fwdUrl": fwd_url,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
logger.info("Getting token or sign-in resource with params: %s", params)
|
|
158
|
+
async with self.client.get(
|
|
159
|
+
"/api/usertoken/GetTokenOrSignInResource", params=params
|
|
160
|
+
) as response:
|
|
161
|
+
if response.status != 200:
|
|
162
|
+
logger.error(
|
|
163
|
+
"Error getting token or sign-in resource: %s", response.status
|
|
164
|
+
)
|
|
165
|
+
response.raise_for_status()
|
|
166
|
+
|
|
167
|
+
data = await response.json()
|
|
168
|
+
return TokenOrSignInResourceResponse.model_validate(data)
|
|
169
|
+
|
|
140
170
|
async def get_aad_tokens(
|
|
141
171
|
self,
|
|
142
172
|
user_id: str,
|
|
@@ -144,15 +174,6 @@ class UserToken(UserTokenBase):
|
|
|
144
174
|
channel_id: Optional[str] = None,
|
|
145
175
|
body: Optional[dict] = None,
|
|
146
176
|
) -> dict[str, TokenResponse]:
|
|
147
|
-
"""
|
|
148
|
-
Gets Azure Active Directory tokens for a user and connection.
|
|
149
|
-
|
|
150
|
-
:param user_id: ID of the user.
|
|
151
|
-
:param connection_name: Name of the connection to use.
|
|
152
|
-
:param channel_id: ID of the channel.
|
|
153
|
-
:param body: An optional dictionary containing resource URLs.
|
|
154
|
-
:return: A dictionary of tokens.
|
|
155
|
-
"""
|
|
156
177
|
params = {"userId": user_id, "connectionName": connection_name}
|
|
157
178
|
|
|
158
179
|
if channel_id:
|
|
@@ -175,13 +196,6 @@ class UserToken(UserTokenBase):
|
|
|
175
196
|
connection_name: Optional[str] = None,
|
|
176
197
|
channel_id: Optional[str] = None,
|
|
177
198
|
) -> None:
|
|
178
|
-
"""
|
|
179
|
-
Signs the user out from the specified connection.
|
|
180
|
-
|
|
181
|
-
:param user_id: ID of the user.
|
|
182
|
-
:param connection_name: Name of the connection to use.
|
|
183
|
-
:param channel_id: ID of the channel.
|
|
184
|
-
"""
|
|
185
199
|
params = {"userId": user_id}
|
|
186
200
|
|
|
187
201
|
if connection_name:
|
|
@@ -203,14 +217,6 @@ class UserToken(UserTokenBase):
|
|
|
203
217
|
channel_id: Optional[str] = None,
|
|
204
218
|
include: Optional[str] = None,
|
|
205
219
|
) -> list[TokenStatus]:
|
|
206
|
-
"""
|
|
207
|
-
Gets token status for the user.
|
|
208
|
-
|
|
209
|
-
:param user_id: ID of the user.
|
|
210
|
-
:param channel_id: ID of the channel.
|
|
211
|
-
:param include: Optional filter.
|
|
212
|
-
:return: A list of token status objects.
|
|
213
|
-
"""
|
|
214
220
|
params = {"userId": user_id}
|
|
215
221
|
|
|
216
222
|
if channel_id:
|
|
@@ -236,15 +242,6 @@ class UserToken(UserTokenBase):
|
|
|
236
242
|
channel_id: str,
|
|
237
243
|
body: Optional[dict] = None,
|
|
238
244
|
) -> TokenResponse:
|
|
239
|
-
"""
|
|
240
|
-
Exchanges a token.
|
|
241
|
-
|
|
242
|
-
:param user_id: ID of the user.
|
|
243
|
-
:param connection_name: Name of the connection to use.
|
|
244
|
-
:param channel_id: ID of the channel.
|
|
245
|
-
:param body: An optional token exchange request body.
|
|
246
|
-
:return: A token response.
|
|
247
|
-
"""
|
|
248
245
|
params = {
|
|
249
246
|
"userId": user_id,
|
|
250
247
|
"connectionName": connection_name,
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
1
4
|
from abc import abstractmethod
|
|
2
5
|
from typing import Protocol
|
|
3
6
|
|
|
4
|
-
from microsoft_agents.activity import
|
|
7
|
+
from microsoft_agents.activity import (
|
|
8
|
+
TokenResponse,
|
|
9
|
+
TokenStatus,
|
|
10
|
+
TokenOrSignInResourceResponse,
|
|
11
|
+
)
|
|
5
12
|
|
|
6
13
|
|
|
7
14
|
class UserTokenBase(Protocol):
|
|
15
|
+
"""Base class for user token operations."""
|
|
16
|
+
|
|
8
17
|
@abstractmethod
|
|
9
18
|
async def get_token(
|
|
10
19
|
self,
|
|
@@ -13,6 +22,40 @@ class UserTokenBase(Protocol):
|
|
|
13
22
|
channel_id: str = None,
|
|
14
23
|
code: str = None,
|
|
15
24
|
) -> TokenResponse:
|
|
25
|
+
"""
|
|
26
|
+
Get sign-in URL.
|
|
27
|
+
|
|
28
|
+
:param state: State parameter for OAuth flow.
|
|
29
|
+
:param code_challenge: Code challenge for PKCE.
|
|
30
|
+
:param emulator_url: Emulator URL if used.
|
|
31
|
+
:param final_redirect: Final redirect URL.
|
|
32
|
+
:return: The sign-in URL.
|
|
33
|
+
"""
|
|
34
|
+
raise NotImplementedError()
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
async def _get_token_or_sign_in_resource(
|
|
38
|
+
self,
|
|
39
|
+
user_id: str,
|
|
40
|
+
connection_name: str,
|
|
41
|
+
channel_id: str,
|
|
42
|
+
state: str,
|
|
43
|
+
code: str = "",
|
|
44
|
+
final_redirect: str = "",
|
|
45
|
+
fwd_url: str = "",
|
|
46
|
+
) -> TokenOrSignInResourceResponse:
|
|
47
|
+
"""
|
|
48
|
+
Gets a token or a sign-in resource for a user and connection.
|
|
49
|
+
|
|
50
|
+
:param user_id: ID of the user.
|
|
51
|
+
:param connection_name: Name of the connection to use.
|
|
52
|
+
:param channel_id: ID of the channel.
|
|
53
|
+
:param state: State parameter for OAuth flow.
|
|
54
|
+
:param code: Optional authorization code.
|
|
55
|
+
:param final_redirect: Final redirect URL.
|
|
56
|
+
:param fwd_url: Forward URL.
|
|
57
|
+
:return: A token or sign-in resource response.
|
|
58
|
+
"""
|
|
16
59
|
raise NotImplementedError()
|
|
17
60
|
|
|
18
61
|
@abstractmethod
|
|
@@ -23,22 +66,55 @@ class UserTokenBase(Protocol):
|
|
|
23
66
|
channel_id: str = None,
|
|
24
67
|
body: dict = None,
|
|
25
68
|
) -> dict[str, TokenResponse]:
|
|
69
|
+
"""
|
|
70
|
+
Gets Azure Active Directory tokens for a user and connection.
|
|
71
|
+
|
|
72
|
+
:param user_id: ID of the user.
|
|
73
|
+
:param connection_name: Name of the connection to use.
|
|
74
|
+
:param channel_id: ID of the channel.
|
|
75
|
+
:param body: An optional dictionary containing resource URLs.
|
|
76
|
+
:return: A dictionary of tokens.
|
|
77
|
+
"""
|
|
26
78
|
raise NotImplementedError()
|
|
27
79
|
|
|
28
80
|
@abstractmethod
|
|
29
81
|
async def sign_out(
|
|
30
82
|
self, user_id: str, connection_name: str = None, channel_id: str = None
|
|
31
83
|
) -> None:
|
|
84
|
+
"""
|
|
85
|
+
Signs the user out from the specified connection.
|
|
86
|
+
|
|
87
|
+
:param user_id: ID of the user.
|
|
88
|
+
:param connection_name: Name of the connection to use.
|
|
89
|
+
:param channel_id: ID of the channel.
|
|
90
|
+
"""
|
|
32
91
|
raise NotImplementedError()
|
|
33
92
|
|
|
34
93
|
@abstractmethod
|
|
35
94
|
async def get_token_status(
|
|
36
95
|
self, user_id: str, channel_id: str = None, include: str = None
|
|
37
96
|
) -> list[TokenStatus]:
|
|
97
|
+
"""
|
|
98
|
+
Gets token status for the user.
|
|
99
|
+
|
|
100
|
+
:param user_id: ID of the user.
|
|
101
|
+
:param channel_id: ID of the channel.
|
|
102
|
+
:param include: Optional filter.
|
|
103
|
+
:return: A list of token status objects.
|
|
104
|
+
"""
|
|
38
105
|
raise NotImplementedError()
|
|
39
106
|
|
|
40
107
|
@abstractmethod
|
|
41
108
|
async def exchange_token(
|
|
42
109
|
self, user_id: str, connection_name: str, channel_id: str, body: dict = None
|
|
43
110
|
) -> TokenResponse:
|
|
111
|
+
"""
|
|
112
|
+
Exchanges a token.
|
|
113
|
+
|
|
114
|
+
:param user_id: ID of the user.
|
|
115
|
+
:param connection_name: Name of the connection to use.
|
|
116
|
+
:param channel_id: ID of the channel.
|
|
117
|
+
:param body: An optional token exchange request body.
|
|
118
|
+
:return: A token response.
|
|
119
|
+
"""
|
|
44
120
|
raise NotImplementedError()
|
|
@@ -68,11 +68,11 @@ class AgentState:
|
|
|
68
68
|
|
|
69
69
|
def __init__(self, storage: Storage, context_service_key: str):
|
|
70
70
|
"""
|
|
71
|
-
Initializes a new instance of the :class:`AgentState` class.
|
|
71
|
+
Initializes a new instance of the :class:`microsoft_agents.hosting.core.state.agent_state.AgentState` class.
|
|
72
72
|
|
|
73
73
|
:param storage: The storage layer this state management object will use to store and retrieve state
|
|
74
74
|
:type storage: :class:`microsoft_agents.hosting.core.storage.Storage`
|
|
75
|
-
:param context_service_key: The key for the state cache for this :class:`AgentState`
|
|
75
|
+
:param context_service_key: The key for the state cache for this :class:`microsoft_agents.hosting.core.state.agent_state.AgentState`
|
|
76
76
|
:type context_service_key: str
|
|
77
77
|
|
|
78
78
|
.. remarks::
|
|
@@ -93,19 +93,19 @@ class AgentState:
|
|
|
93
93
|
from the turn context.
|
|
94
94
|
|
|
95
95
|
:param turn_context: The context object for this turn.
|
|
96
|
-
:type turn_context: :class:`TurnContext`
|
|
96
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
97
97
|
:return: The cached agent state instance.
|
|
98
98
|
"""
|
|
99
99
|
return turn_context.turn_state.get(self._context_service_key)
|
|
100
100
|
|
|
101
101
|
def create_property(self, name: str) -> StatePropertyAccessor:
|
|
102
102
|
"""
|
|
103
|
-
Creates a property definition and registers it with this :class:`AgentState`.
|
|
103
|
+
Creates a property definition and registers it with this :class:`microsoft_agents.hosting.core.state.agent_state.AgentState`.
|
|
104
104
|
|
|
105
105
|
:param name: The name of the property
|
|
106
106
|
:type name: str
|
|
107
107
|
:return: If successful, the state property accessor created
|
|
108
|
-
:rtype: :class:`StatePropertyAccessor`
|
|
108
|
+
:rtype: :class:`microsoft_agents.hosting.core.state.state_property_accessor.StatePropertyAccessor`
|
|
109
109
|
"""
|
|
110
110
|
if not name or not name.strip():
|
|
111
111
|
raise ValueError(
|
|
@@ -123,7 +123,7 @@ class AgentState:
|
|
|
123
123
|
Reads the current state object and caches it in the context object for this turn.
|
|
124
124
|
|
|
125
125
|
:param turn_context: The context object for this turn
|
|
126
|
-
:type turn_context: :class:`TurnContext`
|
|
126
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
127
127
|
:param force: Optional, true to bypass the cache
|
|
128
128
|
:type force: bool
|
|
129
129
|
"""
|
|
@@ -141,7 +141,7 @@ class AgentState:
|
|
|
141
141
|
If the state has changed, it saves the state cached in the current context for this turn.
|
|
142
142
|
|
|
143
143
|
:param turn_context: The context object for this turn
|
|
144
|
-
:type turn_context: :class:`TurnContext`
|
|
144
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
145
145
|
:param force: Optional, true to save state to storage whether or not there are changes
|
|
146
146
|
:type force: bool
|
|
147
147
|
"""
|
|
@@ -157,7 +157,7 @@ class AgentState:
|
|
|
157
157
|
Clears any state currently stored in this state scope.
|
|
158
158
|
|
|
159
159
|
:param turn_context: The context object for this turn
|
|
160
|
-
:type turn_context: :class:`TurnContext`
|
|
160
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
161
161
|
|
|
162
162
|
:return: None
|
|
163
163
|
|
|
@@ -174,7 +174,7 @@ class AgentState:
|
|
|
174
174
|
Deletes any state currently stored in this state scope.
|
|
175
175
|
|
|
176
176
|
:param turn_context: The context object for this turn
|
|
177
|
-
:type turn_context: :class:`TurnContext`
|
|
177
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
178
178
|
|
|
179
179
|
:return: None
|
|
180
180
|
"""
|
|
@@ -200,7 +200,7 @@ class AgentState:
|
|
|
200
200
|
Gets the value of the specified property in the turn context.
|
|
201
201
|
|
|
202
202
|
:param turn_context: The context object for this turn
|
|
203
|
-
:type turn_context: :class:`TurnContext`
|
|
203
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
204
204
|
:param property_name: The property name
|
|
205
205
|
:type property_name: str
|
|
206
206
|
|
|
@@ -235,8 +235,6 @@ class AgentState:
|
|
|
235
235
|
"""
|
|
236
236
|
Deletes a property from the state cache in the turn context.
|
|
237
237
|
|
|
238
|
-
:param turn_context: The context object for this turn
|
|
239
|
-
:type turn_context: :class:`TurnContext`
|
|
240
238
|
:param property_name: The name of the property to delete
|
|
241
239
|
:type property_name: str
|
|
242
240
|
|
|
@@ -254,8 +252,6 @@ class AgentState:
|
|
|
254
252
|
"""
|
|
255
253
|
Sets a property to the specified value in the turn context.
|
|
256
254
|
|
|
257
|
-
:param turn_context: The context object for this turn
|
|
258
|
-
:type turn_context: :class:`TurnContext`
|
|
259
255
|
:param property_name: The property name
|
|
260
256
|
:type property_name: str
|
|
261
257
|
:param value: The value to assign to the property
|
|
@@ -272,15 +268,15 @@ class AgentState:
|
|
|
272
268
|
|
|
273
269
|
class BotStatePropertyAccessor(StatePropertyAccessor):
|
|
274
270
|
"""
|
|
275
|
-
Defines methods for accessing a state property created in a :class:`AgentState` object.
|
|
271
|
+
Defines methods for accessing a state property created in a :class:`microsoft_agents.hosting.core.state.agent_state.AgentState` object.
|
|
276
272
|
"""
|
|
277
273
|
|
|
278
274
|
def __init__(self, agent_state: AgentState, name: str):
|
|
279
275
|
"""
|
|
280
|
-
Initializes a new instance of the :class:`BotStatePropertyAccessor` class.
|
|
276
|
+
Initializes a new instance of the :class:`microsoft_agents.hosting.core.state.agent_state.BotStatePropertyAccessor` class.
|
|
281
277
|
|
|
282
278
|
:param agent_state: The state object to access
|
|
283
|
-
:type agent_state: :class:`AgentState`
|
|
279
|
+
:type agent_state: :class:`microsoft_agents.hosting.core.state.agent_state.AgentState`
|
|
284
280
|
:param name: The name of the state property to access
|
|
285
281
|
:type name: str
|
|
286
282
|
|
|
@@ -304,7 +300,7 @@ class BotStatePropertyAccessor(StatePropertyAccessor):
|
|
|
304
300
|
Deletes the property.
|
|
305
301
|
|
|
306
302
|
:param turn_context: The context object for this turn
|
|
307
|
-
:type turn_context: :class:`TurnContext`
|
|
303
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
308
304
|
"""
|
|
309
305
|
await self._agent_state.load(turn_context, False)
|
|
310
306
|
self._agent_state.delete_value(self._name)
|
|
@@ -320,7 +316,7 @@ class BotStatePropertyAccessor(StatePropertyAccessor):
|
|
|
320
316
|
Gets the property value.
|
|
321
317
|
|
|
322
318
|
:param turn_context: The context object for this turn
|
|
323
|
-
:type turn_context: :class:`TurnContext`
|
|
319
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
324
320
|
:param default_value_or_factory: Defines the default value for the property
|
|
325
321
|
"""
|
|
326
322
|
await self._agent_state.load(turn_context, False)
|
|
@@ -355,7 +351,7 @@ class BotStatePropertyAccessor(StatePropertyAccessor):
|
|
|
355
351
|
Sets the property value.
|
|
356
352
|
|
|
357
353
|
:param turn_context: The context object for this turn
|
|
358
|
-
:type turn_context: :class:`TurnContext`
|
|
354
|
+
:type turn_context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
359
355
|
|
|
360
356
|
:param value: The value to assign to the property
|
|
361
357
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0.dev3
|
|
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.
|
|
11
|
+
Requires-Dist: microsoft-agents-activity==0.5.0.dev3
|
|
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
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
microsoft_agents/hosting/core/__init__.py,sha256=EN6Et-e7n5n_nhXy5ZKNiRtjMfEgWkoNri_gk8KEYLw,4862
|
|
2
|
-
microsoft_agents/hosting/core/activity_handler.py,sha256=
|
|
2
|
+
microsoft_agents/hosting/core/activity_handler.py,sha256=aXNtqHuxXdkIYUylWohRZwmBd4Kw0aSc3a1PTdDdXDA,26811
|
|
3
3
|
microsoft_agents/hosting/core/agent.py,sha256=K8v84y8ULP7rbcMKg8LxaM3haAq7f1oHFCLy3AAphQE,574
|
|
4
4
|
microsoft_agents/hosting/core/card_factory.py,sha256=UDmPEpOk2SpEr9ShN9Q0CiaI_GTD3qjHgkDMOWinW9I,6926
|
|
5
|
-
microsoft_agents/hosting/core/channel_adapter.py,sha256=
|
|
5
|
+
microsoft_agents/hosting/core/channel_adapter.py,sha256=LVHSueET6kzv-N_OCdl3F0yL4-OvZCMKMsj5tpPzZD0,10396
|
|
6
6
|
microsoft_agents/hosting/core/channel_api_handler_protocol.py,sha256=RO59hiOYx7flQVWhX6VGvfpFPoKVkdT_la-7WhUl8UM,4506
|
|
7
7
|
microsoft_agents/hosting/core/channel_service_adapter.py,sha256=pLhHJ86HP_6z8V5HJW9vvE8u98MP028HOYkPmvtUESA,17263
|
|
8
8
|
microsoft_agents/hosting/core/channel_service_client_factory_base.py,sha256=ArMAUt84Kzq17Oyqz6o8HZrc01UqAAmNCSBTShv3rgk,1704
|
|
@@ -11,15 +11,15 @@ microsoft_agents/hosting/core/middleware_set.py,sha256=TBsBs4KwAfKyHlQTlG4bl1y5U
|
|
|
11
11
|
microsoft_agents/hosting/core/rest_channel_service_client_factory.py,sha256=afLeWgLz9N417Egc_6LBfnYNiuuwTEcSBefeOvTQ_H4,6217
|
|
12
12
|
microsoft_agents/hosting/core/turn_context.py,sha256=df7TB1uXurgoAk338OF6taVfVgS58v662A9D9-GLP64,14794
|
|
13
13
|
microsoft_agents/hosting/core/_oauth/__init__.py,sha256=sU1HsIXbETRYwnudtFc6GrNbM6C3oYjmruqXc6kIAFw,405
|
|
14
|
-
microsoft_agents/hosting/core/_oauth/_flow_state.py,sha256=
|
|
14
|
+
microsoft_agents/hosting/core/_oauth/_flow_state.py,sha256=BQbXn0a3Fw4aozS-WSjL0Y7vEdb4eua1ZitSr0qZ6bE,2207
|
|
15
15
|
microsoft_agents/hosting/core/_oauth/_flow_storage_client.py,sha256=1MLD8m_qw0jSLqsyNaaWHm7aFkdjNWOE7xhV1rfbU64,3413
|
|
16
|
-
microsoft_agents/hosting/core/_oauth/_oauth_flow.py,sha256=
|
|
16
|
+
microsoft_agents/hosting/core/_oauth/_oauth_flow.py,sha256=vgg_sQLYr83YA0F7aQ1K5j8vEATw7ZS151ODkpCGYAM,12211
|
|
17
17
|
microsoft_agents/hosting/core/app/__init__.py,sha256=GZQdog7BBMA8uD9iaRMNeRJf12rJZB3bAKFAD8Y8dVo,1228
|
|
18
18
|
microsoft_agents/hosting/core/app/_type_defs.py,sha256=b5VZFWnQ5ONUZMtFxw7Q-mbbxIUSJ7RXcCXjqdHwSQw,438
|
|
19
|
-
microsoft_agents/hosting/core/app/agent_application.py,sha256=
|
|
19
|
+
microsoft_agents/hosting/core/app/agent_application.py,sha256=81oMh9En7wtuZdsP_6tj0eEu05LYDuRp9ko9TJ1x-aw,30014
|
|
20
20
|
microsoft_agents/hosting/core/app/app_error.py,sha256=JgYBgv2EKe9Q2TFi5FeG_RneulBEa5SyBpWSF-duBzE,301
|
|
21
21
|
microsoft_agents/hosting/core/app/app_options.py,sha256=P3XTFFuQCnEcHixfdmr5RPG-Wli4c1VSmCMRKVBBLsw,2792
|
|
22
|
-
microsoft_agents/hosting/core/app/input_file.py,sha256=
|
|
22
|
+
microsoft_agents/hosting/core/app/input_file.py,sha256=AEzVAnAPO1V7MWDI_uoZfcYY8Oog3XgvEpAeO-tATeY,1546
|
|
23
23
|
microsoft_agents/hosting/core/app/query.py,sha256=lToDWFG7exUyPC5zxvna89013fDPKrUGOI8jyWFoUYk,328
|
|
24
24
|
microsoft_agents/hosting/core/app/typing_indicator.py,sha256=CxLtgDTr6a8ELqUujHMvAh_CYpm3mwhomH-tfTQGSe8,1558
|
|
25
25
|
microsoft_agents/hosting/core/app/_routes/__init__.py,sha256=faz05Hk5Z1IGIXUwXljohym0lzE8nW3CbTpXlE-VcB0,300
|
|
@@ -30,11 +30,11 @@ microsoft_agents/hosting/core/app/oauth/__init__.py,sha256=eHx-vmW2Ew8HULSfvAmV8
|
|
|
30
30
|
microsoft_agents/hosting/core/app/oauth/_sign_in_response.py,sha256=H5VBX69WiYXGALzCDVnF_-Y0brbafbJgfF4mS2wZSr0,851
|
|
31
31
|
microsoft_agents/hosting/core/app/oauth/_sign_in_state.py,sha256=lC2otIFcQthAZ8kqkYxV3wLBPOqzW9MRVUbdqQPtEdM,1159
|
|
32
32
|
microsoft_agents/hosting/core/app/oauth/auth_handler.py,sha256=KyhEfpKtoVKcapOt4szpDdbgk_KSwXF46GGOeJrmsRI,3464
|
|
33
|
-
microsoft_agents/hosting/core/app/oauth/authorization.py,sha256=
|
|
33
|
+
microsoft_agents/hosting/core/app/oauth/authorization.py,sha256=TFKibquBybHbCnmnmcMYkL79CQrcOZrpaci26MtseoI,16115
|
|
34
34
|
microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py,sha256=ZQuXF-IZrJv_hOgt-sdRFAUyIpRXaYqYBuyEJWJRcfU,376
|
|
35
|
-
microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py,sha256=
|
|
36
|
-
microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py,sha256=
|
|
37
|
-
microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py,sha256=
|
|
35
|
+
microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py,sha256=W36Y1m0zFaRmdt-cL3ZKoHxx95y0O7YJF9D0cXx_s24,4185
|
|
36
|
+
microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py,sha256=o_pn5ZO7O-YvcC5NGlUgcCmVLD-f6KwQ5CRIsPp8zQE,10186
|
|
37
|
+
microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py,sha256=7rGzYRLOzcy9vGAwnzjyImEaCy0G_bRUwufuXp3xiwk,7145
|
|
38
38
|
microsoft_agents/hosting/core/app/state/__init__.py,sha256=aL_8GB7_de8LUSEOgTJQFRx1kvgvJHHJVv7nWAoRPmU,331
|
|
39
39
|
microsoft_agents/hosting/core/app/state/conversation_state.py,sha256=LfcSwvhaU0JeAahwg9YA9uz0kKHa9c6Y3XBAWqwuMg0,1593
|
|
40
40
|
microsoft_agents/hosting/core/app/state/state.py,sha256=-2vN8MIYs4d2PAEGGlxV-dgBRZG0BT_eHfgvt59zyow,5353
|
|
@@ -69,15 +69,15 @@ microsoft_agents/hosting/core/connector/attachments_base.py,sha256=eqr5dbrc7oE77
|
|
|
69
69
|
microsoft_agents/hosting/core/connector/connector_client_base.py,sha256=DKog6C1Z8V9r_Lp-IvXUiAbJN_iJMFary5FvejjHlaw,583
|
|
70
70
|
microsoft_agents/hosting/core/connector/conversations_base.py,sha256=fM5PCDaSkxMPatNo4WTcbjxLfrHydd51WX9_2_2F-DM,3754
|
|
71
71
|
microsoft_agents/hosting/core/connector/get_product_info.py,sha256=SDxPqBCzzQLEUsaZ4S9lB95ibo9LMGd1-K5Uf7vcAwo,962
|
|
72
|
-
microsoft_agents/hosting/core/connector/user_token_base.py,sha256=
|
|
73
|
-
microsoft_agents/hosting/core/connector/user_token_client_base.py,sha256=
|
|
72
|
+
microsoft_agents/hosting/core/connector/user_token_base.py,sha256=h_l5D1SghN2RrUkFcKWQhCHlO9r7akMbzsm2x8MvomI,3639
|
|
73
|
+
microsoft_agents/hosting/core/connector/user_token_client_base.py,sha256=dfUTUsBNOzWze9_JldAeLe73sydSDzlKyMKMvj48g2E,471
|
|
74
74
|
microsoft_agents/hosting/core/connector/client/__init__.py,sha256=6JdKhmm7btmo0omxMBd8PJbtGFk0cnMwVUoStyW7Ft0,143
|
|
75
75
|
microsoft_agents/hosting/core/connector/client/connector_client.py,sha256=UsvQrWROhrFQxyBu6TY9ej3wUS__VpcdpNZG8fu4-Tc,23398
|
|
76
|
-
microsoft_agents/hosting/core/connector/client/user_token_client.py,sha256=
|
|
76
|
+
microsoft_agents/hosting/core/connector/client/user_token_client.py,sha256=1ey1mqV7pkC94Xl36PVrx5TOyumJQbpscbm2W9uvpHs,10609
|
|
77
77
|
microsoft_agents/hosting/core/connector/teams/__init__.py,sha256=3ZMPGYyZ15EwvfQzfJJQy1J58oIt4InSxibl3BN6R54,100
|
|
78
78
|
microsoft_agents/hosting/core/connector/teams/teams_connector_client.py,sha256=XGQDTYHrA_I9n9JlxGST5eesjsFhz2dnSaMSuyoFnKU,12676
|
|
79
79
|
microsoft_agents/hosting/core/state/__init__.py,sha256=yckKi1wg_86ng-DL9Q3R49QiWKvNjPkVNk6HClWgVrY,208
|
|
80
|
-
microsoft_agents/hosting/core/state/agent_state.py,sha256=
|
|
80
|
+
microsoft_agents/hosting/core/state/agent_state.py,sha256=uboptWaC3VrSGTnXIzaO38XUqOT-ITW6EhJxuGMtKWs,13724
|
|
81
81
|
microsoft_agents/hosting/core/state/state_property_accessor.py,sha256=kpiNnzkZ6el-oRITRbRkk1Faa_CPFxpJQdvSGxIJP70,1392
|
|
82
82
|
microsoft_agents/hosting/core/state/user_state.py,sha256=zEigX-sroNAyoQAxQjG1OgmJQKjk1zOkdeqylFg7M2E,1484
|
|
83
83
|
microsoft_agents/hosting/core/storage/__init__.py,sha256=Df_clI0uMRgcr4Td-xkP83bU_mGae7_gRMhtVDPZDmE,729
|
|
@@ -91,7 +91,7 @@ microsoft_agents/hosting/core/storage/transcript_info.py,sha256=5VN32j99tshChAff
|
|
|
91
91
|
microsoft_agents/hosting/core/storage/transcript_logger.py,sha256=_atDk3CJ05fIVMhlWGNa91IiM9bGLmOhasFko8Lxjhk,8237
|
|
92
92
|
microsoft_agents/hosting/core/storage/transcript_memory_store.py,sha256=v1Ud9LSs8m5c9_Fa8i49SuAjw80dX1hDciqbRduDEOE,6444
|
|
93
93
|
microsoft_agents/hosting/core/storage/transcript_store.py,sha256=ka74o0WvI5GhMZcFqSxVdamBhGzZcDZe6VNkG-sMy74,1944
|
|
94
|
-
microsoft_agents_hosting_core-0.
|
|
95
|
-
microsoft_agents_hosting_core-0.
|
|
96
|
-
microsoft_agents_hosting_core-0.
|
|
97
|
-
microsoft_agents_hosting_core-0.
|
|
94
|
+
microsoft_agents_hosting_core-0.5.0.dev3.dist-info/METADATA,sha256=TyD_JZidNIMbh1vaGa7POTFfFSsDOnAxAEaHxgKZhZc,584
|
|
95
|
+
microsoft_agents_hosting_core-0.5.0.dev3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
96
|
+
microsoft_agents_hosting_core-0.5.0.dev3.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
97
|
+
microsoft_agents_hosting_core-0.5.0.dev3.dist-info/RECORD,,
|
|
File without changes
|