microsoft-agents-hosting-core 0.6.0.dev9__py3-none-any.whl → 0.6.0.dev11__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/__init__.py +6 -0
- microsoft_agents/hosting/core/errors/__init__.py +17 -0
- microsoft_agents/hosting/core/errors/error_message.py +64 -0
- microsoft_agents/hosting/core/errors/error_resources.py +173 -0
- {microsoft_agents_hosting_core-0.6.0.dev9.dist-info → microsoft_agents_hosting_core-0.6.0.dev11.dist-info}/METADATA +2 -2
- {microsoft_agents_hosting_core-0.6.0.dev9.dist-info → microsoft_agents_hosting_core-0.6.0.dev11.dist-info}/RECORD +9 -6
- {microsoft_agents_hosting_core-0.6.0.dev9.dist-info → microsoft_agents_hosting_core-0.6.0.dev11.dist-info}/WHEEL +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev9.dist-info → microsoft_agents_hosting_core-0.6.0.dev11.dist-info}/licenses/LICENSE +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev9.dist-info → microsoft_agents_hosting_core-0.6.0.dev11.dist-info}/top_level.txt +0 -0
|
@@ -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,64 @@
|
|
|
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/#[error_code]
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
message_template: str,
|
|
22
|
+
error_code: int,
|
|
23
|
+
):
|
|
24
|
+
"""
|
|
25
|
+
Initialize an ErrorMessage.
|
|
26
|
+
|
|
27
|
+
:param message_template: The error message template (may include format placeholders)
|
|
28
|
+
:type message_template: str
|
|
29
|
+
:param error_code: The error code (should be negative)
|
|
30
|
+
:type error_code: int
|
|
31
|
+
"""
|
|
32
|
+
self.message_template = message_template
|
|
33
|
+
self.error_code = error_code
|
|
34
|
+
self.base_url = "https://aka.ms/M365AgentsErrorCodes"
|
|
35
|
+
|
|
36
|
+
def format(self, *args, **kwargs) -> str:
|
|
37
|
+
"""
|
|
38
|
+
Format the error message with the provided arguments.
|
|
39
|
+
|
|
40
|
+
:param args: Positional arguments for string formatting
|
|
41
|
+
:param kwargs: Keyword arguments for string formatting
|
|
42
|
+
:return: Formatted error message with error code and help URL
|
|
43
|
+
:rtype: str
|
|
44
|
+
"""
|
|
45
|
+
# Format the main message
|
|
46
|
+
if args or kwargs:
|
|
47
|
+
message = self.message_template.format(*args, **kwargs)
|
|
48
|
+
else:
|
|
49
|
+
message = self.message_template
|
|
50
|
+
|
|
51
|
+
# Append error code and help URL
|
|
52
|
+
return (
|
|
53
|
+
f"{message}\n\n"
|
|
54
|
+
f"Error Code: {self.error_code}\n"
|
|
55
|
+
f"Help URL: {self.base_url}/#{self.error_code}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def __str__(self) -> str:
|
|
59
|
+
"""Return the formatted error message without any arguments."""
|
|
60
|
+
return self.format()
|
|
61
|
+
|
|
62
|
+
def __repr__(self) -> str:
|
|
63
|
+
"""Return a representation of the ErrorMessage."""
|
|
64
|
+
return f"ErrorMessage(code={self.error_code}, message='{self.message_template[:50]}...')"
|
|
@@ -0,0 +1,173 @@
|
|
|
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
|
+
)
|
|
29
|
+
|
|
30
|
+
AgentApplicationRequired = ErrorMessage(
|
|
31
|
+
"start_agent_process: agent_application can't be None",
|
|
32
|
+
-63001,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
RequestRequired = ErrorMessage(
|
|
36
|
+
"CloudAdapter.process: request can't be None",
|
|
37
|
+
-63002,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
AgentRequired = ErrorMessage(
|
|
41
|
+
"CloudAdapter.process: agent can't be None",
|
|
42
|
+
-63003,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
StreamAlreadyEnded = ErrorMessage(
|
|
46
|
+
"The stream has already ended.",
|
|
47
|
+
-63004,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
TurnContextRequired = ErrorMessage(
|
|
51
|
+
"TurnContext cannot be None.",
|
|
52
|
+
-63005,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
ActivityRequired = ErrorMessage(
|
|
56
|
+
"Activity cannot be None.",
|
|
57
|
+
-63006,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
AppIdRequired = ErrorMessage(
|
|
61
|
+
"AppId cannot be empty or None.",
|
|
62
|
+
-63007,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
InvalidActivityType = ErrorMessage(
|
|
66
|
+
"Invalid or missing activity type.",
|
|
67
|
+
-63008,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
ConversationIdRequired = ErrorMessage(
|
|
71
|
+
"Conversation ID cannot be empty or None.",
|
|
72
|
+
-63009,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
AuthHeaderRequired = ErrorMessage(
|
|
76
|
+
"Authorization header is required.",
|
|
77
|
+
-63010,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
InvalidAuthHeader = ErrorMessage(
|
|
81
|
+
"Invalid authorization header format.",
|
|
82
|
+
-63011,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
ClaimsIdentityRequired = ErrorMessage(
|
|
86
|
+
"ClaimsIdentity is required.",
|
|
87
|
+
-63012,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
ChannelServiceRouteNotFound = ErrorMessage(
|
|
91
|
+
"Channel service route not found for: {0}",
|
|
92
|
+
-63013,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
TokenExchangeRequired = ErrorMessage(
|
|
96
|
+
"Token exchange requires a token exchange resource.",
|
|
97
|
+
-63014,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
MissingHttpClient = ErrorMessage(
|
|
101
|
+
"HTTP client is required.",
|
|
102
|
+
-63015,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
InvalidBotFrameworkActivity = ErrorMessage(
|
|
106
|
+
"Invalid Bot Framework Activity format.",
|
|
107
|
+
-63016,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
CredentialsRequired = ErrorMessage(
|
|
111
|
+
"Credentials are required for authentication.",
|
|
112
|
+
-63017,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# General/Validation Errors (-66000 to -66999)
|
|
116
|
+
InvalidConfiguration = ErrorMessage(
|
|
117
|
+
"Invalid configuration: {0}",
|
|
118
|
+
-66000,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
RequiredParameterMissing = ErrorMessage(
|
|
122
|
+
"Required parameter missing: {0}",
|
|
123
|
+
-66001,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
InvalidParameterValue = ErrorMessage(
|
|
127
|
+
"Invalid parameter value for {0}: {1}",
|
|
128
|
+
-66002,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
OperationNotSupported = ErrorMessage(
|
|
132
|
+
"Operation not supported: {0}",
|
|
133
|
+
-66003,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
ResourceNotFound = ErrorMessage(
|
|
137
|
+
"Resource not found: {0}",
|
|
138
|
+
-66004,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
UnexpectedError = ErrorMessage(
|
|
142
|
+
"An unexpected error occurred: {0}",
|
|
143
|
+
-66005,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
InvalidStateObject = ErrorMessage(
|
|
147
|
+
"Invalid state object: {0}",
|
|
148
|
+
-66006,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
SerializationError = ErrorMessage(
|
|
152
|
+
"Serialization error: {0}",
|
|
153
|
+
-66007,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
DeserializationError = ErrorMessage(
|
|
157
|
+
"Deserialization error: {0}",
|
|
158
|
+
-66008,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
TimeoutError = ErrorMessage(
|
|
162
|
+
"Operation timed out: {0}",
|
|
163
|
+
-66009,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
NetworkError = ErrorMessage(
|
|
167
|
+
"Network error occurred: {0}",
|
|
168
|
+
-66010,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
def __init__(self):
|
|
172
|
+
"""Initialize ErrorResources singleton."""
|
|
173
|
+
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.6.0.
|
|
3
|
+
Version: 0.6.0.dev11
|
|
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.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==0.6.0.dev11
|
|
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=
|
|
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=UTEsUaIoISZjDjGgr-bwQqKmqA8AN1jE-cjN9U8921Y,2102
|
|
81
|
+
microsoft_agents/hosting/core/errors/error_resources.py,sha256=41b2DM3aS_89MN6NHO3l6uqxjhBudgfU1uFQAteEpIQ,3904
|
|
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.
|
|
95
|
-
microsoft_agents_hosting_core-0.6.0.
|
|
96
|
-
microsoft_agents_hosting_core-0.6.0.
|
|
97
|
-
microsoft_agents_hosting_core-0.6.0.
|
|
98
|
-
microsoft_agents_hosting_core-0.6.0.
|
|
97
|
+
microsoft_agents_hosting_core-0.6.0.dev11.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
98
|
+
microsoft_agents_hosting_core-0.6.0.dev11.dist-info/METADATA,sha256=yd85NaZ-vgi3his-UEveuHuCad0QFQZQDKXWN9yliMk,9244
|
|
99
|
+
microsoft_agents_hosting_core-0.6.0.dev11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
microsoft_agents_hosting_core-0.6.0.dev11.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
101
|
+
microsoft_agents_hosting_core-0.6.0.dev11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|