microsoft-agents-hosting-core 0.6.0.dev8__py3-none-any.whl → 0.6.0.dev10__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.
@@ -82,6 +82,9 @@ from .storage.store_item import StoreItem
82
82
  from .storage import Storage
83
83
  from .storage.memory_storage import MemoryStorage
84
84
 
85
+ # Error Resources
86
+ from .errors import error_resources, ErrorMessage, ErrorResources
87
+
85
88
 
86
89
  # Define the package's public interface
87
90
  __all__ = [
@@ -148,4 +151,7 @@ __all__ = [
148
151
  "MemoryStorage",
149
152
  "AgenticUserAuthorization",
150
153
  "Authorization",
154
+ "error_resources",
155
+ "ErrorMessage",
156
+ "ErrorResources",
151
157
  ]
@@ -0,0 +1,17 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ """
5
+ Error resources for Microsoft Agents SDK.
6
+
7
+ This module provides centralized error messages with error codes and help URLs
8
+ following the pattern established in the C# SDK.
9
+ """
10
+
11
+ from .error_message import ErrorMessage
12
+ from .error_resources import ErrorResources
13
+
14
+ # Singleton instance
15
+ error_resources = ErrorResources()
16
+
17
+ __all__ = ["ErrorMessage", "ErrorResources", "error_resources"]
@@ -0,0 +1,68 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ """
5
+ ErrorMessage class for formatting error messages with error codes and help URLs.
6
+ """
7
+
8
+
9
+ class ErrorMessage:
10
+ """
11
+ Represents a formatted error message with error code and help URL.
12
+
13
+ This class formats error messages according to the Microsoft Agents SDK pattern:
14
+ - Original error message
15
+ - Error Code: [negative number]
16
+ - Help URL: https://aka.ms/M365AgentsErrorCodes/#anchor
17
+ """
18
+
19
+ def __init__(
20
+ self,
21
+ message_template: str,
22
+ error_code: int,
23
+ help_url_anchor: str = "agentic-identity-with-the-m365-agents-sdk",
24
+ ):
25
+ """
26
+ Initialize an ErrorMessage.
27
+
28
+ :param message_template: The error message template (may include format placeholders)
29
+ :type message_template: str
30
+ :param error_code: The error code (should be negative)
31
+ :type error_code: int
32
+ :param help_url_anchor: The anchor for the help URL (defaults to agentic identity)
33
+ :type help_url_anchor: str
34
+ """
35
+ self.message_template = message_template
36
+ self.error_code = error_code
37
+ self.help_url_anchor = help_url_anchor
38
+ self.base_url = "https://aka.ms/M365AgentsErrorCodes"
39
+
40
+ def format(self, *args, **kwargs) -> str:
41
+ """
42
+ Format the error message with the provided arguments.
43
+
44
+ :param args: Positional arguments for string formatting
45
+ :param kwargs: Keyword arguments for string formatting
46
+ :return: Formatted error message with error code and help URL
47
+ :rtype: str
48
+ """
49
+ # Format the main message
50
+ if args or kwargs:
51
+ message = self.message_template.format(*args, **kwargs)
52
+ else:
53
+ message = self.message_template
54
+
55
+ # Append error code and help URL
56
+ return (
57
+ f"{message}\n\n"
58
+ f"Error Code: {self.error_code}\n"
59
+ f"Help URL: {self.base_url}/#{self.help_url_anchor}"
60
+ )
61
+
62
+ def __str__(self) -> str:
63
+ """Return the formatted error message without any arguments."""
64
+ return self.format()
65
+
66
+ def __repr__(self) -> str:
67
+ """Return a representation of the ErrorMessage."""
68
+ return f"ErrorMessage(code={self.error_code}, message='{self.message_template[:50]}...')"
@@ -0,0 +1,202 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ """
5
+ Hosting core error resources for Microsoft Agents SDK.
6
+
7
+ This module contains error messages for hosting operations.
8
+ Error codes are in the range -63000 to -63999 for hosting errors.
9
+ General/validation errors are in the range -66000 to -66999.
10
+ """
11
+
12
+ from .error_message import ErrorMessage
13
+
14
+
15
+ class ErrorResources:
16
+ """
17
+ Error messages for hosting core operations.
18
+
19
+ Error codes are organized by range:
20
+ - -63000 to -63999: Hosting errors
21
+ - -66000 to -66999: General/validation errors
22
+ """
23
+
24
+ # Hosting Errors (-63000 to -63999)
25
+ AdapterRequired = ErrorMessage(
26
+ "start_agent_process: adapter can't be None",
27
+ -63000,
28
+ "hosting-configuration",
29
+ )
30
+
31
+ AgentApplicationRequired = ErrorMessage(
32
+ "start_agent_process: agent_application can't be None",
33
+ -63001,
34
+ "hosting-configuration",
35
+ )
36
+
37
+ RequestRequired = ErrorMessage(
38
+ "CloudAdapter.process: request can't be None",
39
+ -63002,
40
+ "hosting-configuration",
41
+ )
42
+
43
+ AgentRequired = ErrorMessage(
44
+ "CloudAdapter.process: agent can't be None",
45
+ -63003,
46
+ "hosting-configuration",
47
+ )
48
+
49
+ StreamAlreadyEnded = ErrorMessage(
50
+ "The stream has already ended.",
51
+ -63004,
52
+ "streaming",
53
+ )
54
+
55
+ TurnContextRequired = ErrorMessage(
56
+ "TurnContext cannot be None.",
57
+ -63005,
58
+ "hosting-configuration",
59
+ )
60
+
61
+ ActivityRequired = ErrorMessage(
62
+ "Activity cannot be None.",
63
+ -63006,
64
+ "hosting-configuration",
65
+ )
66
+
67
+ AppIdRequired = ErrorMessage(
68
+ "AppId cannot be empty or None.",
69
+ -63007,
70
+ "hosting-configuration",
71
+ )
72
+
73
+ InvalidActivityType = ErrorMessage(
74
+ "Invalid or missing activity type.",
75
+ -63008,
76
+ "hosting-configuration",
77
+ )
78
+
79
+ ConversationIdRequired = ErrorMessage(
80
+ "Conversation ID cannot be empty or None.",
81
+ -63009,
82
+ "hosting-configuration",
83
+ )
84
+
85
+ AuthHeaderRequired = ErrorMessage(
86
+ "Authorization header is required.",
87
+ -63010,
88
+ "hosting-configuration",
89
+ )
90
+
91
+ InvalidAuthHeader = ErrorMessage(
92
+ "Invalid authorization header format.",
93
+ -63011,
94
+ "hosting-configuration",
95
+ )
96
+
97
+ ClaimsIdentityRequired = ErrorMessage(
98
+ "ClaimsIdentity is required.",
99
+ -63012,
100
+ "hosting-configuration",
101
+ )
102
+
103
+ ChannelServiceRouteNotFound = ErrorMessage(
104
+ "Channel service route not found for: {0}",
105
+ -63013,
106
+ "hosting-configuration",
107
+ )
108
+
109
+ TokenExchangeRequired = ErrorMessage(
110
+ "Token exchange requires a token exchange resource.",
111
+ -63014,
112
+ "hosting-configuration",
113
+ )
114
+
115
+ MissingHttpClient = ErrorMessage(
116
+ "HTTP client is required.",
117
+ -63015,
118
+ "hosting-configuration",
119
+ )
120
+
121
+ InvalidBotFrameworkActivity = ErrorMessage(
122
+ "Invalid Bot Framework Activity format.",
123
+ -63016,
124
+ "hosting-configuration",
125
+ )
126
+
127
+ CredentialsRequired = ErrorMessage(
128
+ "Credentials are required for authentication.",
129
+ -63017,
130
+ "hosting-configuration",
131
+ )
132
+
133
+ # General/Validation Errors (-66000 to -66999)
134
+ InvalidConfiguration = ErrorMessage(
135
+ "Invalid configuration: {0}",
136
+ -66000,
137
+ "configuration",
138
+ )
139
+
140
+ RequiredParameterMissing = ErrorMessage(
141
+ "Required parameter missing: {0}",
142
+ -66001,
143
+ "configuration",
144
+ )
145
+
146
+ InvalidParameterValue = ErrorMessage(
147
+ "Invalid parameter value for {0}: {1}",
148
+ -66002,
149
+ "configuration",
150
+ )
151
+
152
+ OperationNotSupported = ErrorMessage(
153
+ "Operation not supported: {0}",
154
+ -66003,
155
+ "configuration",
156
+ )
157
+
158
+ ResourceNotFound = ErrorMessage(
159
+ "Resource not found: {0}",
160
+ -66004,
161
+ "configuration",
162
+ )
163
+
164
+ UnexpectedError = ErrorMessage(
165
+ "An unexpected error occurred: {0}",
166
+ -66005,
167
+ "configuration",
168
+ )
169
+
170
+ InvalidStateObject = ErrorMessage(
171
+ "Invalid state object: {0}",
172
+ -66006,
173
+ "configuration",
174
+ )
175
+
176
+ SerializationError = ErrorMessage(
177
+ "Serialization error: {0}",
178
+ -66007,
179
+ "configuration",
180
+ )
181
+
182
+ DeserializationError = ErrorMessage(
183
+ "Deserialization error: {0}",
184
+ -66008,
185
+ "configuration",
186
+ )
187
+
188
+ TimeoutError = ErrorMessage(
189
+ "Operation timed out: {0}",
190
+ -66009,
191
+ "configuration",
192
+ )
193
+
194
+ NetworkError = ErrorMessage(
195
+ "Network error occurred: {0}",
196
+ -66010,
197
+ "configuration",
198
+ )
199
+
200
+ def __init__(self):
201
+ """Initialize ErrorResources singleton."""
202
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-hosting-core
3
- Version: 0.6.0.dev8
3
+ Version: 0.6.0.dev10
4
4
  Summary: Core library for Microsoft Agents
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
@@ -15,7 +15,7 @@ Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: microsoft-agents-activity==0.6.0.dev8
18
+ Requires-Dist: microsoft-agents-activity==0.6.0.dev10
19
19
  Requires-Dist: pyjwt>=2.10.1
20
20
  Requires-Dist: isodate>=0.6.1
21
21
  Requires-Dist: azure-core>=1.30.0
@@ -1,4 +1,4 @@
1
- microsoft_agents/hosting/core/__init__.py,sha256=EN6Et-e7n5n_nhXy5ZKNiRtjMfEgWkoNri_gk8KEYLw,4862
1
+ microsoft_agents/hosting/core/__init__.py,sha256=jZ0551xg2RnMtHpAMD1AtXyDh0oPUSDYPe_S9QNdbtA,5012
2
2
  microsoft_agents/hosting/core/activity_handler.py,sha256=1hsSmVCnQLS44RK05v8j6mlmV38_JGmJTPR9LkogQuc,27779
3
3
  microsoft_agents/hosting/core/agent.py,sha256=K8v84y8ULP7rbcMKg8LxaM3haAq7f1oHFCLy3AAphQE,574
4
4
  microsoft_agents/hosting/core/card_factory.py,sha256=UDmPEpOk2SpEr9ShN9Q0CiaI_GTD3qjHgkDMOWinW9I,6926
@@ -76,6 +76,9 @@ microsoft_agents/hosting/core/connector/client/connector_client.py,sha256=9oF_x_
76
76
  microsoft_agents/hosting/core/connector/client/user_token_client.py,sha256=qxYxvdUcvYinCzaR4YiIucEEAb8TjYYtPsmXKZRbxv4,10536
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
+ microsoft_agents/hosting/core/errors/__init__.py,sha256=2BiNgN84UxPl1Q1kZuQ_a36S7sIwvHE4H6MTmgp6cCk,481
80
+ microsoft_agents/hosting/core/errors/error_message.py,sha256=CPpzP-wkU6z8yz-d_hC0YyRriBQAyVqXczXPkDf95oo,2350
81
+ microsoft_agents/hosting/core/errors/error_resources.py,sha256=ar1YoU65eH1OJnE_n6J2YG23UjO-a0cuY4XSUzzK_kU,4761
79
82
  microsoft_agents/hosting/core/state/__init__.py,sha256=yckKi1wg_86ng-DL9Q3R49QiWKvNjPkVNk6HClWgVrY,208
80
83
  microsoft_agents/hosting/core/state/agent_state.py,sha256=uboptWaC3VrSGTnXIzaO38XUqOT-ITW6EhJxuGMtKWs,13724
81
84
  microsoft_agents/hosting/core/state/state_property_accessor.py,sha256=kpiNnzkZ6el-oRITRbRkk1Faa_CPFxpJQdvSGxIJP70,1392
@@ -91,8 +94,8 @@ microsoft_agents/hosting/core/storage/transcript_info.py,sha256=5VN32j99tshChAff
91
94
  microsoft_agents/hosting/core/storage/transcript_logger.py,sha256=_atDk3CJ05fIVMhlWGNa91IiM9bGLmOhasFko8Lxjhk,8237
92
95
  microsoft_agents/hosting/core/storage/transcript_memory_store.py,sha256=v1Ud9LSs8m5c9_Fa8i49SuAjw80dX1hDciqbRduDEOE,6444
93
96
  microsoft_agents/hosting/core/storage/transcript_store.py,sha256=ka74o0WvI5GhMZcFqSxVdamBhGzZcDZe6VNkG-sMy74,1944
94
- microsoft_agents_hosting_core-0.6.0.dev8.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
95
- microsoft_agents_hosting_core-0.6.0.dev8.dist-info/METADATA,sha256=knnVIH8NGvVcCJvdg4ZwO-_ePNZe31XYplXWIIvQKD4,9242
96
- microsoft_agents_hosting_core-0.6.0.dev8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
- microsoft_agents_hosting_core-0.6.0.dev8.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
98
- microsoft_agents_hosting_core-0.6.0.dev8.dist-info/RECORD,,
97
+ microsoft_agents_hosting_core-0.6.0.dev10.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
98
+ microsoft_agents_hosting_core-0.6.0.dev10.dist-info/METADATA,sha256=bE1qzB2ZWcgIf-dJojy8Y3e4nImcPJQH1mBW9xvwUl4,9244
99
+ microsoft_agents_hosting_core-0.6.0.dev10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
+ microsoft_agents_hosting_core-0.6.0.dev10.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
101
+ microsoft_agents_hosting_core-0.6.0.dev10.dist-info/RECORD,,