Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: v2
inputs:
- git_repo: https://github.com/a2aproject/A2A.git
ref: v1.0.0-rc
ref: main
subdir: specification
managed:
enabled: true
Expand Down
8 changes: 4 additions & 4 deletions src/a2a/server/apps/jsonrpc/jsonrpc_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
GetExtendedAgentCardRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
ListTaskPushNotificationConfigRequest,
ListTaskPushNotificationConfigsRequest,
ListTasksRequest,
SendMessageRequest,
SubscribeToTaskRequest,
Expand Down Expand Up @@ -171,7 +171,7 @@ class JSONRPCApplication(ABC):
'CancelTask': CancelTaskRequest,
'CreateTaskPushNotificationConfig': CreateTaskPushNotificationConfigRequest,
'GetTaskPushNotificationConfig': GetTaskPushNotificationConfigRequest,
'ListTaskPushNotificationConfig': ListTaskPushNotificationConfigRequest,
'ListTaskPushNotificationConfigs': ListTaskPushNotificationConfigsRequest,
'DeleteTaskPushNotificationConfig': DeleteTaskPushNotificationConfigRequest,
'SubscribeToTask': SubscribeToTaskRequest,
'GetExtendedAgentCard': GetExtendedAgentCardRequest,
Expand Down Expand Up @@ -486,9 +486,9 @@ async def _process_non_streaming_request(
context,
)
)
case ListTaskPushNotificationConfigRequest():
case ListTaskPushNotificationConfigsRequest():
handler_result = (
await self.handler.list_push_notification_config(
await self.handler.list_push_notification_configs(
request_obj,
context,
)
Expand Down
17 changes: 7 additions & 10 deletions src/a2a/server/request_handlers/default_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
DeleteTaskPushNotificationConfigRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
ListTaskPushNotificationConfigRequest,
ListTaskPushNotificationConfigResponse,
ListTaskPushNotificationConfigsRequest,
ListTaskPushNotificationConfigsResponse,
ListTasksRequest,
ListTasksResponse,
Message,
Expand Down Expand Up @@ -502,7 +502,6 @@

return TaskPushNotificationConfig(
task_id=task_id,
id=params.config_id,
push_notification_config=params.config,
)

Expand Down Expand Up @@ -532,7 +531,6 @@
if config.id == config_id:
return TaskPushNotificationConfig(
task_id=task_id,
id=config.id,
push_notification_config=config,
)

Expand Down Expand Up @@ -580,32 +578,31 @@
async for event in result_aggregator.consume_and_emit(consumer):
yield event

async def on_list_task_push_notification_config(
async def on_list_task_push_notification_configs(
self,
params: ListTaskPushNotificationConfigRequest,
params: ListTaskPushNotificationConfigsRequest,
context: ServerCallContext | None = None,
) -> ListTaskPushNotificationConfigResponse:
"""Default handler for 'ListTaskPushNotificationConfig'.
) -> ListTaskPushNotificationConfigsResponse:
"""Default handler for 'ListTaskPushNotificationConfigs'.

Requires a `PushConfigStore` to be configured.
"""
if not self._push_config_store:
raise ServerError(error=UnsupportedOperationError())

task_id = params.task_id
task: Task | None = await self.task_store.get(task_id, context)
if not task:
raise ServerError(error=TaskNotFoundError())

push_notification_config_list = await self._push_config_store.get_info(

Check notice on line 598 in src/a2a/server/request_handlers/default_request_handler.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/server/request_handlers/default_request_handler.py (490-498)
task_id
)

return ListTaskPushNotificationConfigResponse(
return ListTaskPushNotificationConfigsResponse(
configs=[
TaskPushNotificationConfig(
task_id=task_id,
id=config.id,
push_notification_config=config,
)
for config in push_notification_config_list
Expand Down
14 changes: 7 additions & 7 deletions src/a2a/server/request_handlers/jsonrpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
GetExtendedAgentCardRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
ListTaskPushNotificationConfigRequest,
ListTaskPushNotificationConfigsRequest,
ListTasksRequest,
SendMessageRequest,
SendMessageResponse,
Expand Down Expand Up @@ -403,26 +403,26 @@ async def list_tasks(
request_id, e.error if e.error else InternalError()
)

async def list_push_notification_config(
async def list_push_notification_configs(
self,
request: ListTaskPushNotificationConfigRequest,
request: ListTaskPushNotificationConfigsRequest,
context: ServerCallContext | None = None,
) -> dict[str, Any]:
"""Handles the 'ListTaskPushNotificationConfig' JSON-RPC method.
"""Handles the 'ListTaskPushNotificationConfigs' JSON-RPC method.

Args:
request: The incoming `ListTaskPushNotificationConfigRequest` object.
request: The incoming `ListTaskPushNotificationConfigsRequest` object.
context: Context provided by the server.

Returns:
A dict representing the JSON-RPC response.
"""
request_id = self._get_request_id(context)
try:
response = await self.request_handler.on_list_task_push_notification_config(
response = await self.request_handler.on_list_task_push_notification_configs(
request, context
)
# response is a ListTaskPushNotificationConfigResponse proto
# response is a ListTaskPushNotificationConfigsResponse proto
result = MessageToDict(response, preserving_proto_field_name=False)
return _build_success_response(request_id, result)
except ServerError as e:
Expand Down
14 changes: 7 additions & 7 deletions src/a2a/server/request_handlers/request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
DeleteTaskPushNotificationConfigRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
ListTaskPushNotificationConfigRequest,
ListTaskPushNotificationConfigResponse,
ListTaskPushNotificationConfigsRequest,
ListTaskPushNotificationConfigsResponse,
ListTasksRequest,
ListTasksResponse,
Message,
Expand Down Expand Up @@ -120,7 +120,7 @@ async def on_message_send_stream(
`Event` objects from the agent's execution.

Raises:
ServerError(UnsupportedOperationError): By default, if not implemented.
ServerError(UnsupportedOperationError): By default, if not implemented.
"""
raise ServerError(error=UnsupportedOperationError())
yield
Expand Down Expand Up @@ -185,12 +185,12 @@ async def on_subscribe_to_task(
yield

@abstractmethod
async def on_list_task_push_notification_config(
async def on_list_task_push_notification_configs(
self,
params: ListTaskPushNotificationConfigRequest,
params: ListTaskPushNotificationConfigsRequest,
context: ServerCallContext | None = None,
) -> ListTaskPushNotificationConfigResponse:
"""Handles the 'ListTaskPushNotificationConfig' method.
) -> ListTaskPushNotificationConfigsResponse:
"""Handles the 'ListTaskPushNotificationConfigs' method.

Retrieves the current push notification configurations for a task.

Expand Down
9 changes: 5 additions & 4 deletions src/a2a/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
GetTaskRequest,
HTTPAuthSecurityScheme,
ImplicitOAuthFlow,
ListTaskPushNotificationConfigRequest,
ListTaskPushNotificationConfigResponse,
ListTaskPushNotificationConfigsRequest,
ListTaskPushNotificationConfigsResponse,
ListTasksRequest,
ListTasksResponse,
Message,
Expand Down Expand Up @@ -78,6 +78,7 @@
| GetTaskPushNotificationConfigRequest
| SubscribeToTaskRequest
| GetExtendedAgentCardRequest
| ListTaskPushNotificationConfigsRequest
)


Expand Down Expand Up @@ -113,8 +114,8 @@
'InvalidAgentResponseError',
'InvalidParamsError',
'InvalidRequestError',
'ListTaskPushNotificationConfigRequest',
'ListTaskPushNotificationConfigResponse',
'ListTaskPushNotificationConfigsRequest',
'ListTaskPushNotificationConfigsResponse',
'ListTasksRequest',
'ListTasksResponse',
'Message',
Expand Down
240 changes: 118 additions & 122 deletions src/a2a/types/a2a_pb2.py

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions src/a2a/types/a2a_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,14 @@ class AgentCardSignature(_message.Message):
def __init__(self, protected: _Optional[str] = ..., signature: _Optional[str] = ..., header: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...

class TaskPushNotificationConfig(_message.Message):
__slots__ = ("tenant", "id", "task_id", "push_notification_config")
__slots__ = ("tenant", "task_id", "push_notification_config")
TENANT_FIELD_NUMBER: _ClassVar[int]
ID_FIELD_NUMBER: _ClassVar[int]
TASK_ID_FIELD_NUMBER: _ClassVar[int]
PUSH_NOTIFICATION_CONFIG_FIELD_NUMBER: _ClassVar[int]
tenant: str
id: str
task_id: str
push_notification_config: PushNotificationConfig
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ..., task_id: _Optional[str] = ..., push_notification_config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., push_notification_config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...

class StringList(_message.Message):
__slots__ = ("list",)
Expand Down Expand Up @@ -547,12 +545,14 @@ class ListTasksResponse(_message.Message):
def __init__(self, tasks: _Optional[_Iterable[_Union[Task, _Mapping]]] = ..., next_page_token: _Optional[str] = ..., page_size: _Optional[int] = ..., total_size: _Optional[int] = ...) -> None: ...

class CancelTaskRequest(_message.Message):
__slots__ = ("tenant", "id")
__slots__ = ("tenant", "id", "metadata")
TENANT_FIELD_NUMBER: _ClassVar[int]
ID_FIELD_NUMBER: _ClassVar[int]
METADATA_FIELD_NUMBER: _ClassVar[int]
tenant: str
id: str
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ...) -> None: ...
metadata: _struct_pb2.Struct
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ..., metadata: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...

class GetTaskPushNotificationConfigRequest(_message.Message):
__slots__ = ("tenant", "task_id", "id")
Expand All @@ -575,16 +575,14 @@ class DeleteTaskPushNotificationConfigRequest(_message.Message):
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., id: _Optional[str] = ...) -> None: ...

class CreateTaskPushNotificationConfigRequest(_message.Message):
__slots__ = ("tenant", "task_id", "config_id", "config")
__slots__ = ("tenant", "task_id", "config")
TENANT_FIELD_NUMBER: _ClassVar[int]
TASK_ID_FIELD_NUMBER: _ClassVar[int]
CONFIG_ID_FIELD_NUMBER: _ClassVar[int]
CONFIG_FIELD_NUMBER: _ClassVar[int]
tenant: str
task_id: str
config_id: str
config: PushNotificationConfig
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., config_id: _Optional[str] = ..., config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...

class SubscribeToTaskRequest(_message.Message):
__slots__ = ("tenant", "id")
Expand All @@ -594,7 +592,7 @@ class SubscribeToTaskRequest(_message.Message):
id: str
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ...) -> None: ...

class ListTaskPushNotificationConfigRequest(_message.Message):
class ListTaskPushNotificationConfigsRequest(_message.Message):
__slots__ = ("tenant", "task_id", "page_size", "page_token")
TENANT_FIELD_NUMBER: _ClassVar[int]
TASK_ID_FIELD_NUMBER: _ClassVar[int]
Expand Down Expand Up @@ -632,7 +630,7 @@ class StreamResponse(_message.Message):
artifact_update: TaskArtifactUpdateEvent
def __init__(self, task: _Optional[_Union[Task, _Mapping]] = ..., message: _Optional[_Union[Message, _Mapping]] = ..., status_update: _Optional[_Union[TaskStatusUpdateEvent, _Mapping]] = ..., artifact_update: _Optional[_Union[TaskArtifactUpdateEvent, _Mapping]] = ...) -> None: ...

class ListTaskPushNotificationConfigResponse(_message.Message):
class ListTaskPushNotificationConfigsResponse(_message.Message):
__slots__ = ("configs", "next_page_token")
CONFIGS_FIELD_NUMBER: _ClassVar[int]
NEXT_PAGE_TOKEN_FIELD_NUMBER: _ClassVar[int]
Expand Down
Loading
Loading