|
2 | 2 | import json |
3 | 3 | import logging |
4 | 4 | import traceback |
5 | | - |
6 | 5 | from abc import ABC, abstractmethod |
7 | 6 | from collections.abc import AsyncGenerator, Callable |
8 | 7 | from typing import TYPE_CHECKING, Any |
|
11 | 10 |
|
12 | 11 | from a2a.auth.user import UnauthenticatedUser |
13 | 12 | from a2a.auth.user import User as A2AUser |
14 | | -from a2a.extensions.common import ( |
15 | | - HTTP_EXTENSION_HEADER, |
16 | | - get_requested_extensions, |
17 | | -) |
| 13 | +from a2a.extensions.common import (HTTP_EXTENSION_HEADER, |
| 14 | + get_requested_extensions) |
18 | 15 | from a2a.server.context import ServerCallContext |
19 | 16 | from a2a.server.request_handlers.jsonrpc_handler import JSONRPCHandler |
20 | 17 | from a2a.server.request_handlers.request_handler import RequestHandler |
21 | | -from a2a.types import ( |
22 | | - A2AError, |
23 | | - A2ARequest, |
24 | | - AgentCard, |
25 | | - CancelTaskRequest, |
26 | | - DeleteTaskPushNotificationConfigRequest, |
27 | | - GetAuthenticatedExtendedCardRequest, |
28 | | - GetTaskPushNotificationConfigRequest, |
29 | | - GetTaskRequest, |
30 | | - InternalError, |
31 | | - InvalidRequestError, |
32 | | - JSONParseError, |
33 | | - JSONRPCError, |
34 | | - JSONRPCErrorResponse, |
35 | | - JSONRPCRequest, |
36 | | - JSONRPCResponse, |
37 | | - ListTaskPushNotificationConfigRequest, |
38 | | - SendMessageRequest, |
39 | | - SendStreamingMessageRequest, |
40 | | - SendStreamingMessageResponse, |
41 | | - SetTaskPushNotificationConfigRequest, |
42 | | - TaskResubscriptionRequest, |
43 | | - UnsupportedOperationError, |
44 | | -) |
45 | | -from a2a.utils.constants import ( |
46 | | - AGENT_CARD_WELL_KNOWN_PATH, |
47 | | - DEFAULT_RPC_URL, |
48 | | - EXTENDED_AGENT_CARD_PATH, |
49 | | - PREV_AGENT_CARD_WELL_KNOWN_PATH, |
50 | | -) |
| 18 | +from a2a.types import (A2AError, A2ARequest, AgentCard, CancelTaskRequest, |
| 19 | + DeleteTaskPushNotificationConfigRequest, |
| 20 | + GetAuthenticatedExtendedCardRequest, |
| 21 | + GetTaskPushNotificationConfigRequest, GetTaskRequest, |
| 22 | + InternalError, InvalidRequestError, JSONParseError, |
| 23 | + JSONRPCError, JSONRPCErrorResponse, JSONRPCRequest, |
| 24 | + JSONRPCResponse, ListTaskPushNotificationConfigRequest, |
| 25 | + SendMessageRequest, SendStreamingMessageRequest, |
| 26 | + SendStreamingMessageResponse, |
| 27 | + SetTaskPushNotificationConfigRequest, |
| 28 | + TaskResubscriptionRequest, UnsupportedOperationError) |
| 29 | +from a2a.utils.constants import (AGENT_CARD_WELL_KNOWN_PATH, DEFAULT_RPC_URL, |
| 30 | + EXTENDED_AGENT_CARD_PATH, |
| 31 | + PREV_AGENT_CARD_WELL_KNOWN_PATH) |
51 | 32 | from a2a.utils.errors import MethodNotImplementedError |
52 | 33 |
|
53 | | - |
54 | 34 | logger = logging.getLogger(__name__) |
55 | 35 |
|
56 | 36 | if TYPE_CHECKING: |
@@ -529,7 +509,7 @@ def _modify_rpc_url(self, agent_card: AgentCard, request: Request): |
529 | 509 | extra_path = forwarded_path[: -len(request.url.path)] |
530 | 510 | new_path = extra_path + rpc_path |
531 | 511 | # If original path was just "/", |
532 | | - # we remove trailing "/" in the the extended one |
| 512 | + # we remove trailing "/" in the extended one |
533 | 513 | if len(new_path) > 1 and rpc_path == '/': |
534 | 514 | new_path = new_path.rstrip('/') |
535 | 515 | rpc_path = new_path |
|
0 commit comments