microsoft-agents-activity 0.4.0.dev10__py3-none-any.whl → 0.4.0.dev14__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.
Potentially problematic release.
This version of microsoft-agents-activity might be problematic. Click here for more details.
- microsoft_agents/activity/_load_configuration.py +7 -2
- microsoft_agents/activity/activity.py +19 -0
- microsoft_agents/activity/adaptive_card_invoke_value.py +2 -2
- microsoft_agents/activity/channel_account.py +3 -0
- microsoft_agents/activity/channels.py +3 -0
- microsoft_agents/activity/role_types.py +2 -0
- microsoft_agents/activity/semantic_action.py +2 -2
- microsoft_agents/activity/token_response.py +18 -0
- {microsoft_agents_activity-0.4.0.dev10.dist-info → microsoft_agents_activity-0.4.0.dev14.dist-info}/METADATA +1 -1
- {microsoft_agents_activity-0.4.0.dev10.dist-info → microsoft_agents_activity-0.4.0.dev14.dist-info}/RECORD +12 -12
- {microsoft_agents_activity-0.4.0.dev10.dist-info → microsoft_agents_activity-0.4.0.dev14.dist-info}/WHEEL +0 -0
- {microsoft_agents_activity-0.4.0.dev10.dist-info → microsoft_agents_activity-0.4.0.dev14.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def load_configuration_from_env(env_vars:
|
|
4
|
+
def load_configuration_from_env(env_vars: dict[str, Any]) -> dict:
|
|
5
5
|
"""
|
|
6
6
|
Parses environment variables and returns a dictionary with the relevant configuration.
|
|
7
7
|
"""
|
|
@@ -18,6 +18,11 @@ def load_configuration_from_env(env_vars: Dict[str, Any]) -> dict:
|
|
|
18
18
|
current_level = current_level[next_level]
|
|
19
19
|
last_level[levels[-1]] = value
|
|
20
20
|
|
|
21
|
+
if result.get("CONNECTIONSMAP") and isinstance(result["CONNECTIONSMAP"], dict):
|
|
22
|
+
result["CONNECTIONSMAP"] = [
|
|
23
|
+
conn for conn in result.get("CONNECTIONSMAP", {}).values()
|
|
24
|
+
]
|
|
25
|
+
|
|
21
26
|
return {
|
|
22
27
|
"AGENTAPPLICATION": result.get("AGENTAPPLICATION", {}),
|
|
23
28
|
"CONNECTIONS": result.get("CONNECTIONS", {}),
|
|
@@ -20,6 +20,7 @@ from .conversation_reference import ConversationReference
|
|
|
20
20
|
from .text_highlight import TextHighlight
|
|
21
21
|
from .semantic_action import SemanticAction
|
|
22
22
|
from .agents_model import AgentsModel
|
|
23
|
+
from .role_types import RoleTypes
|
|
23
24
|
from ._model_utils import pick_model, SkipNone
|
|
24
25
|
from ._type_aliases import NonEmptyString
|
|
25
26
|
|
|
@@ -648,3 +649,21 @@ class Activity(AgentsModel):
|
|
|
648
649
|
self.entities = []
|
|
649
650
|
|
|
650
651
|
self.entities.append(ai_entity)
|
|
652
|
+
|
|
653
|
+
def is_agentic_request(self) -> bool:
|
|
654
|
+
return self.recipient and self.recipient.role in [
|
|
655
|
+
RoleTypes.agentic_identity,
|
|
656
|
+
RoleTypes.agentic_user,
|
|
657
|
+
]
|
|
658
|
+
|
|
659
|
+
def get_agentic_instance_id(self) -> Optional[str]:
|
|
660
|
+
"""Gets the agent instance ID from the context if it's an agentic request."""
|
|
661
|
+
if not self.is_agentic_request() or not self.recipient:
|
|
662
|
+
return None
|
|
663
|
+
return self.recipient.agentic_app_id
|
|
664
|
+
|
|
665
|
+
def get_agentic_user(self) -> Optional[str]:
|
|
666
|
+
"""Gets the agentic user (UPN) from the context if it's an agentic request."""
|
|
667
|
+
if not self.is_agentic_request() or not self.recipient:
|
|
668
|
+
return None
|
|
669
|
+
return self.recipient.id
|
|
@@ -10,9 +10,9 @@ class AdaptiveCardInvokeValue(AgentsModel):
|
|
|
10
10
|
Defines the structure that arrives in the Activity.Value for Invoke activity with Name of 'adaptiveCard/action'.
|
|
11
11
|
|
|
12
12
|
:param action: The action of this adaptive card invoke action value.
|
|
13
|
-
:type action: :class:`microsoft_agents.activity.
|
|
13
|
+
:type action: :class:`microsoft_agents.activity.adaptive_card_invoke_action.AdaptiveCardInvokeAction`
|
|
14
14
|
:param authentication: The TokenExchangeInvokeRequest for this adaptive card invoke action value.
|
|
15
|
-
:type authentication: :class:`microsoft_agents.activity.
|
|
15
|
+
:type authentication: :class:`microsoft_agents.activity.token_exchange_invoke_request.TokenExchangeInvokeRequest`
|
|
16
16
|
:param state: The 'state' or magic code for an OAuth flow.
|
|
17
17
|
:type state: str
|
|
18
18
|
"""
|
|
@@ -26,6 +26,9 @@ class ChannelAccount(AgentsModel):
|
|
|
26
26
|
name: str = None
|
|
27
27
|
aad_object_id: NonEmptyString = None
|
|
28
28
|
role: NonEmptyString = None
|
|
29
|
+
agentic_user_id: NonEmptyString = None
|
|
30
|
+
agentic_app_id: NonEmptyString = None
|
|
31
|
+
tenant_id: NonEmptyString = None
|
|
29
32
|
|
|
30
33
|
@property
|
|
31
34
|
def properties(self) -> dict[str, Any]:
|
|
@@ -8,9 +8,9 @@ class SemanticAction(AgentsModel):
|
|
|
8
8
|
:param id: ID of this action
|
|
9
9
|
:type id: str
|
|
10
10
|
:param entities: Entities associated with this action
|
|
11
|
-
:type entities: dict[str,
|
|
11
|
+
:type entities: dict[str, :class:`microsoft_agents.activity.entity.Entity`]
|
|
12
12
|
:param state: State of this action. Allowed values: `start`, `continue`, `done`
|
|
13
|
-
:type state: str or
|
|
13
|
+
:type state: str or :class:`microsoft_agents.activity.semantic_action_states.SemanticActionStates`
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
id: NonEmptyString
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
# Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import jwt
|
|
5
|
+
|
|
4
6
|
from .agents_model import AgentsModel
|
|
5
7
|
from ._type_aliases import NonEmptyString
|
|
6
8
|
|
|
@@ -26,3 +28,19 @@ class TokenResponse(AgentsModel):
|
|
|
26
28
|
|
|
27
29
|
def __bool__(self):
|
|
28
30
|
return bool(self.token)
|
|
31
|
+
|
|
32
|
+
def is_exchangeable(self) -> bool:
|
|
33
|
+
"""
|
|
34
|
+
Checks if a token is exchangeable (has api:// audience).
|
|
35
|
+
|
|
36
|
+
:param token: The token to check.
|
|
37
|
+
:type token: str
|
|
38
|
+
:return: True if the token is exchangeable, False otherwise.
|
|
39
|
+
"""
|
|
40
|
+
try:
|
|
41
|
+
# Decode without verification to check the audience
|
|
42
|
+
payload = jwt.decode(self.token, options={"verify_signature": False})
|
|
43
|
+
aud = payload.get("aud")
|
|
44
|
+
return isinstance(aud, str) and aud.startswith("api://")
|
|
45
|
+
except Exception:
|
|
46
|
+
return False
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
microsoft_agents/activity/__init__.py,sha256=07QcOO-VhyFua5npkmn19vKzB_cPBixxSFDaDpYgUZA,5978
|
|
2
|
-
microsoft_agents/activity/_load_configuration.py,sha256=
|
|
2
|
+
microsoft_agents/activity/_load_configuration.py,sha256=BBK-0lsTEZPThaEbtPIklWeAXrVDLwsCw_-rQ4NMYYg,1030
|
|
3
3
|
microsoft_agents/activity/_model_utils.py,sha256=2y6TedLAIFGuaj-VWMZgiFHYt39Df10ed5j3aOAPLps,1909
|
|
4
4
|
microsoft_agents/activity/_type_aliases.py,sha256=7kkx_rIxA1B-z2T6HU6OMBm5lgD1t6KGNznJzAX-VgE,135
|
|
5
5
|
microsoft_agents/activity/action_types.py,sha256=DY0RkEFquJ_SjMKJvHsD5Ring4j_HPrchEvIsFunIfI,324
|
|
6
|
-
microsoft_agents/activity/activity.py,sha256=
|
|
6
|
+
microsoft_agents/activity/activity.py,sha256=ystruQkxfbwer-XDaNYzdVGNDkD38Bd9e_ahVAP1G2g,28014
|
|
7
7
|
microsoft_agents/activity/activity_event_names.py,sha256=3X5u4xppN86wY-KpBAwRr4sfYB3-V4MSlB5SsrcI7l0,159
|
|
8
8
|
microsoft_agents/activity/activity_importance.py,sha256=kdwdcVa9fsCEk5hvxOsGhqsE4uu7gpTYKtACEgmva0A,117
|
|
9
9
|
microsoft_agents/activity/activity_types.py,sha256=a9XvGgWsFI1Rur4JC-n5YIDpdSooxqaMNna3VS1CW1s,667
|
|
10
10
|
microsoft_agents/activity/adaptive_card_invoke_action.py,sha256=X4weYdv8uzeNyBPpeTYD4631O19aaQdvvyrYi5PUJdU,779
|
|
11
11
|
microsoft_agents/activity/adaptive_card_invoke_response.py,sha256=lWlB9bL6I7F1Sr2-xV1XFq6ddB2UGi8GRCOOt4kyffs,640
|
|
12
|
-
microsoft_agents/activity/adaptive_card_invoke_value.py,sha256=
|
|
12
|
+
microsoft_agents/activity/adaptive_card_invoke_value.py,sha256=gv75JGisj9qiG3czFbRm7HL7Ir_65N1QlDGH-CbVO8k,1039
|
|
13
13
|
microsoft_agents/activity/agents_model.py,sha256=3v3UOdEvNEGOyYPgk-3IP6cgtHdoYfeK_9x0VVrG6l4,1490
|
|
14
14
|
microsoft_agents/activity/animation_card.py,sha256=Cqpuni9t19PIroPYiLiTSsaS_3o8tUOwTc_98bkuzv0,1994
|
|
15
15
|
microsoft_agents/activity/attachment.py,sha256=Z2FtaHURYHPRDMdVWgeaxMlFENBMHCBCUKoRGEc2bVY,727
|
|
@@ -22,9 +22,9 @@ microsoft_agents/activity/basic_card.py,sha256=dLIGAPrxSwEqCo2tHLhX85Nm61aR5xowY
|
|
|
22
22
|
microsoft_agents/activity/caller_id_constants.py,sha256=9VhHXo0XyTkknm6NTSGpHOLEMZQp7d3A5B5DOX5L0Kk,220
|
|
23
23
|
microsoft_agents/activity/card_action.py,sha256=uVlxGFNE7H-ZIjE2YYESuuMDy24mp7MCvenhp83_xII,1414
|
|
24
24
|
microsoft_agents/activity/card_image.py,sha256=yYyo8RBG3z1Heoorj3zEG32oMkLV_mzJWDJetRnszSg,545
|
|
25
|
-
microsoft_agents/activity/channel_account.py,sha256=
|
|
25
|
+
microsoft_agents/activity/channel_account.py,sha256=1VmdG3YRnAJrYAH67TMMowJ6pHsh_AnegUNUdP_UcW4,1122
|
|
26
26
|
microsoft_agents/activity/channel_adapter_protocol.py,sha256=C-LTxx-EZ8GlRdfuMUx-tCxZrRTcyXQsbINUlM-Fnf0,2040
|
|
27
|
-
microsoft_agents/activity/channels.py,sha256=
|
|
27
|
+
microsoft_agents/activity/channels.py,sha256=irfa5KSKMwVuuZXLczyBDcPU_vzzezyWp8t9AJEckBs,4560
|
|
28
28
|
microsoft_agents/activity/contact_relation_update_action_types.py,sha256=BWDcwhcw2xX2Bn2h_11uWNmcrGa_JV4ANbvmxP3Gqng,113
|
|
29
29
|
microsoft_agents/activity/conversation_account.py,sha256=iFmtRUqPINXNie909SfnlwK0_lFiz8VxMt3old8G6W8,1441
|
|
30
30
|
microsoft_agents/activity/conversation_members.py,sha256=Cw54xRDsZq_wWaXHiivu09chmfUVJbm_nu3lPJY_vjQ,457
|
|
@@ -55,8 +55,8 @@ microsoft_agents/activity/paged_members_result.py,sha256=ABwhTA3znOO0HCam1_-26lm
|
|
|
55
55
|
microsoft_agents/activity/receipt_card.py,sha256=P-FQYuIsGGx9yLjpF8KZO4ZzaFf0rd_ocM5DOk0mRgU,1245
|
|
56
56
|
microsoft_agents/activity/receipt_item.py,sha256=v6d7GBlB7nDGbV6ME8CRCkmzDhGzMRFhFVd5ybvsoLw,1107
|
|
57
57
|
microsoft_agents/activity/resource_response.py,sha256=qTN6C2wXTP_euH5_LDL47DOfMfofe4_o1z7ZO39OEpU,255
|
|
58
|
-
microsoft_agents/activity/role_types.py,sha256=
|
|
59
|
-
microsoft_agents/activity/semantic_action.py,sha256=
|
|
58
|
+
microsoft_agents/activity/role_types.py,sha256=k478TRb4KOW2-c5-u7Yf8YhLAhynq9Mrno2wi-oOX_M,185
|
|
59
|
+
microsoft_agents/activity/semantic_action.py,sha256=a9-1synmnz0uG6MFtUrKfAe5i93-UiwlgtJjA0sG_D4,641
|
|
60
60
|
microsoft_agents/activity/semantic_actions_states.py,sha256=xCcSWGmCKizL9J7lycEBIYPIGeQb2dQmsLLObph7s00,149
|
|
61
61
|
microsoft_agents/activity/sign_in_constants.py,sha256=3juR-nSfP0vr3TvFPhQ2foEivt1lLgWxsG6LQmWhhkc,534
|
|
62
62
|
microsoft_agents/activity/sign_in_resource.py,sha256=Ygy5wjCvyW1fQ5aLf29214_LFeF9zJnd7ZsUxice5JY,446
|
|
@@ -72,7 +72,7 @@ microsoft_agents/activity/token_exchange_resource.py,sha256=U5qptVUUZatpeQjuzFGr
|
|
|
72
72
|
microsoft_agents/activity/token_exchange_state.py,sha256=C9QosBw52qItGhU5wiRUxkuixfni5Krh5BzftyuCzmo,1452
|
|
73
73
|
microsoft_agents/activity/token_post_resource.py,sha256=GG65qizkE1v7VKqlQcKKFJky5XubQslrvAGK-BisCVw,226
|
|
74
74
|
microsoft_agents/activity/token_request.py,sha256=ZXvYDCRaIydyzMuztfa0nQ3HMKURQJpvuTyzKbhukLo,448
|
|
75
|
-
microsoft_agents/activity/token_response.py,sha256=
|
|
75
|
+
microsoft_agents/activity/token_response.py,sha256=Zv-9uZ4UvB4TcS6NPklSoONv8WEbTwAkKROZi3UFglI,1413
|
|
76
76
|
microsoft_agents/activity/token_status.py,sha256=o3pGTKRjuqEndRWClMe91Cmox6cW8aDrOTvE3_k5jFI,1174
|
|
77
77
|
microsoft_agents/activity/transcript.py,sha256=yV5s5rONGC1uM5pKnVv0HbY2SVzQ9qKOBawM0fzJOJc,328
|
|
78
78
|
microsoft_agents/activity/turn_context_protocol.py,sha256=ETR6L5aMoZdPkLUcULmDHfmQo21-_bFF_yzxZmiG_6g,1692
|
|
@@ -191,7 +191,7 @@ microsoft_agents/activity/teams/teams_member.py,sha256=vRcLRHy6wTfH7DP6k6QbrKkOR
|
|
|
191
191
|
microsoft_agents/activity/teams/teams_paged_members_result.py,sha256=cG4eKHjA0u1EMioC2ErVpydnoPJrtTDcdhdzYET9xto,555
|
|
192
192
|
microsoft_agents/activity/teams/tenant_info.py,sha256=h8OxMd6LD5lWVj_LK2ut8z7SB0I7Gx74W1wwEiYOzXk,296
|
|
193
193
|
microsoft_agents/activity/teams/user_meeting_details.py,sha256=tvk2CWYf7Bo-DhK8NSojhanJDXEOGVrKXxJDca03CAo,467
|
|
194
|
-
microsoft_agents_activity-0.4.0.
|
|
195
|
-
microsoft_agents_activity-0.4.0.
|
|
196
|
-
microsoft_agents_activity-0.4.0.
|
|
197
|
-
microsoft_agents_activity-0.4.0.
|
|
194
|
+
microsoft_agents_activity-0.4.0.dev14.dist-info/METADATA,sha256=thb-67BRzcCUdzxcJbLVWEoR5D1KEByi5ElEI-TNK-o,414
|
|
195
|
+
microsoft_agents_activity-0.4.0.dev14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
196
|
+
microsoft_agents_activity-0.4.0.dev14.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
197
|
+
microsoft_agents_activity-0.4.0.dev14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|