|
27 | 27 | from copilot import CopilotClient |
28 | 28 | from copilot.generated.session_events import SessionEventType |
29 | 29 |
|
30 | | -# These types move between SDK versions/platforms. Try multiple paths. |
31 | | -try: |
32 | | - from copilot import PermissionRequestResult, ProviderConfig |
33 | | -except ImportError: |
34 | | - try: |
35 | | - from copilot.types import PermissionRequestResult, ProviderConfig |
36 | | - except ImportError: |
37 | | - PermissionRequestResult = None |
38 | | - ProviderConfig = dict |
| 30 | +# Import types from copilot SDK |
| 31 | +from copilot.session import PermissionRequestResult, ProviderConfig |
39 | 32 |
|
40 | 33 | from azure.ai.agentserver.core.constants import Constants |
41 | 34 | from azure.ai.agentserver.core.logger import get_logger |
@@ -302,9 +295,7 @@ async def agent_run( |
302 | 295 | acl = self._acl |
303 | 296 |
|
304 | 297 | def _perm_result(**kwargs): |
305 | | - if PermissionRequestResult is not None: |
306 | | - return PermissionRequestResult(**kwargs) |
307 | | - return kwargs |
| 298 | + return PermissionRequestResult(**kwargs) |
308 | 299 |
|
309 | 300 | def _on_permission(req, _ctx): |
310 | 301 | kind = getattr(req, "kind", "unknown") |
@@ -901,9 +892,7 @@ async def agent_run(self, context: AgentRunContext): |
901 | 892 | acl = self._acl |
902 | 893 |
|
903 | 894 | def _perm_result_boot(**kwargs): |
904 | | - if PermissionRequestResult is not None: |
905 | | - return PermissionRequestResult(**kwargs) |
906 | | - return kwargs |
| 895 | + return PermissionRequestResult(**kwargs) |
907 | 896 |
|
908 | 897 | def _on_permission_boot(req, _ctx): |
909 | 898 | kind = getattr(req, "kind", "unknown") |
|
0 commit comments