Skip to content

Commit a11d6de

Browse files
committed
Merge branch 'resource-scoping' of https://github.com/sokoliva/a2a-python into resource-scoping
2 parents 99cf89f + 86d769e commit a11d6de

File tree

17 files changed

+253
-274
lines changed

17 files changed

+253
-274
lines changed

buf.gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: v2
33
inputs:
44
- git_repo: https://github.com/a2aproject/A2A.git
5-
ref: v1.0.0-rc
5+
ref: main
66
subdir: specification
77
managed:
88
enabled: true

src/a2a/server/apps/jsonrpc/jsonrpc_app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
GetExtendedAgentCardRequest,
4040
GetTaskPushNotificationConfigRequest,
4141
GetTaskRequest,
42-
ListTaskPushNotificationConfigRequest,
42+
ListTaskPushNotificationConfigsRequest,
4343
ListTasksRequest,
4444
SendMessageRequest,
4545
SubscribeToTaskRequest,
@@ -171,7 +171,7 @@ class JSONRPCApplication(ABC):
171171
'CancelTask': CancelTaskRequest,
172172
'CreateTaskPushNotificationConfig': CreateTaskPushNotificationConfigRequest,
173173
'GetTaskPushNotificationConfig': GetTaskPushNotificationConfigRequest,
174-
'ListTaskPushNotificationConfig': ListTaskPushNotificationConfigRequest,
174+
'ListTaskPushNotificationConfigs': ListTaskPushNotificationConfigsRequest,
175175
'DeleteTaskPushNotificationConfig': DeleteTaskPushNotificationConfigRequest,
176176
'SubscribeToTask': SubscribeToTaskRequest,
177177
'GetExtendedAgentCard': GetExtendedAgentCardRequest,
@@ -486,9 +486,9 @@ async def _process_non_streaming_request(
486486
context,
487487
)
488488
)
489-
case ListTaskPushNotificationConfigRequest():
489+
case ListTaskPushNotificationConfigsRequest():
490490
handler_result = (
491-
await self.handler.list_push_notification_config(
491+
await self.handler.list_push_notification_configs(
492492
request_obj,
493493
context,
494494
)

src/a2a/server/request_handlers/default_request_handler.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
DeleteTaskPushNotificationConfigRequest,
3333
GetTaskPushNotificationConfigRequest,
3434
GetTaskRequest,
35-
ListTaskPushNotificationConfigRequest,
36-
ListTaskPushNotificationConfigResponse,
35+
ListTaskPushNotificationConfigsRequest,
36+
ListTaskPushNotificationConfigsResponse,
3737
ListTasksRequest,
3838
ListTasksResponse,
3939
Message,
@@ -502,7 +502,6 @@ async def on_create_task_push_notification_config(
502502

503503
return TaskPushNotificationConfig(
504504
task_id=task_id,
505-
id=params.config_id,
506505
push_notification_config=params.config,
507506
)
508507

@@ -532,7 +531,6 @@ async def on_get_task_push_notification_config(
532531
if config.id == config_id:
533532
return TaskPushNotificationConfig(
534533
task_id=task_id,
535-
id=config.id,
536534
push_notification_config=config,
537535
)
538536

@@ -580,12 +578,12 @@ async def on_subscribe_to_task(
580578
async for event in result_aggregator.consume_and_emit(consumer):
581579
yield event
582580

583-
async def on_list_task_push_notification_config(
581+
async def on_list_task_push_notification_configs(
584582
self,
585-
params: ListTaskPushNotificationConfigRequest,
583+
params: ListTaskPushNotificationConfigsRequest,
586584
context: ServerCallContext | None = None,
587-
) -> ListTaskPushNotificationConfigResponse:
588-
"""Default handler for 'ListTaskPushNotificationConfig'.
585+
) -> ListTaskPushNotificationConfigsResponse:
586+
"""Default handler for 'ListTaskPushNotificationConfigs'.
589587
590588
Requires a `PushConfigStore` to be configured.
591589
"""
@@ -601,11 +599,10 @@ async def on_list_task_push_notification_config(
601599
task_id
602600
)
603601

604-
return ListTaskPushNotificationConfigResponse(
602+
return ListTaskPushNotificationConfigsResponse(
605603
configs=[
606604
TaskPushNotificationConfig(
607605
task_id=task_id,
608-
id=config.id,
609606
push_notification_config=config,
610607
)
611608
for config in push_notification_config_list

src/a2a/server/request_handlers/jsonrpc_handler.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
GetExtendedAgentCardRequest,
2525
GetTaskPushNotificationConfigRequest,
2626
GetTaskRequest,
27-
ListTaskPushNotificationConfigRequest,
27+
ListTaskPushNotificationConfigsRequest,
2828
ListTasksRequest,
2929
SendMessageRequest,
3030
SendMessageResponse,
@@ -403,26 +403,26 @@ async def list_tasks(
403403
request_id, e.error if e.error else InternalError()
404404
)
405405

406-
async def list_push_notification_config(
406+
async def list_push_notification_configs(
407407
self,
408-
request: ListTaskPushNotificationConfigRequest,
408+
request: ListTaskPushNotificationConfigsRequest,
409409
context: ServerCallContext | None = None,
410410
) -> dict[str, Any]:
411-
"""Handles the 'ListTaskPushNotificationConfig' JSON-RPC method.
411+
"""Handles the 'ListTaskPushNotificationConfigs' JSON-RPC method.
412412
413413
Args:
414-
request: The incoming `ListTaskPushNotificationConfigRequest` object.
414+
request: The incoming `ListTaskPushNotificationConfigsRequest` object.
415415
context: Context provided by the server.
416416
417417
Returns:
418418
A dict representing the JSON-RPC response.
419419
"""
420420
request_id = self._get_request_id(context)
421421
try:
422-
response = await self.request_handler.on_list_task_push_notification_config(
422+
response = await self.request_handler.on_list_task_push_notification_configs(
423423
request, context
424424
)
425-
# response is a ListTaskPushNotificationConfigResponse proto
425+
# response is a ListTaskPushNotificationConfigsResponse proto
426426
result = MessageToDict(response, preserving_proto_field_name=False)
427427
return _build_success_response(request_id, result)
428428
except ServerError as e:

src/a2a/server/request_handlers/request_handler.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
DeleteTaskPushNotificationConfigRequest,
1010
GetTaskPushNotificationConfigRequest,
1111
GetTaskRequest,
12-
ListTaskPushNotificationConfigRequest,
13-
ListTaskPushNotificationConfigResponse,
12+
ListTaskPushNotificationConfigsRequest,
13+
ListTaskPushNotificationConfigsResponse,
1414
ListTasksRequest,
1515
ListTasksResponse,
1616
Message,
@@ -120,7 +120,7 @@ async def on_message_send_stream(
120120
`Event` objects from the agent's execution.
121121
122122
Raises:
123-
ServerError(UnsupportedOperationError): By default, if not implemented.
123+
ServerError(UnsupportedOperationError): By default, if not implemented.
124124
"""
125125
raise ServerError(error=UnsupportedOperationError())
126126
yield
@@ -185,12 +185,12 @@ async def on_subscribe_to_task(
185185
yield
186186

187187
@abstractmethod
188-
async def on_list_task_push_notification_config(
188+
async def on_list_task_push_notification_configs(
189189
self,
190-
params: ListTaskPushNotificationConfigRequest,
190+
params: ListTaskPushNotificationConfigsRequest,
191191
context: ServerCallContext | None = None,
192-
) -> ListTaskPushNotificationConfigResponse:
193-
"""Handles the 'ListTaskPushNotificationConfig' method.
192+
) -> ListTaskPushNotificationConfigsResponse:
193+
"""Handles the 'ListTaskPushNotificationConfigs' method.
194194
195195
Retrieves the current push notification configurations for a task.
196196

src/a2a/types/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
GetTaskRequest,
2424
HTTPAuthSecurityScheme,
2525
ImplicitOAuthFlow,
26-
ListTaskPushNotificationConfigRequest,
27-
ListTaskPushNotificationConfigResponse,
26+
ListTaskPushNotificationConfigsRequest,
27+
ListTaskPushNotificationConfigsResponse,
2828
ListTasksRequest,
2929
ListTasksResponse,
3030
Message,
@@ -78,6 +78,7 @@
7878
| GetTaskPushNotificationConfigRequest
7979
| SubscribeToTaskRequest
8080
| GetExtendedAgentCardRequest
81+
| ListTaskPushNotificationConfigsRequest
8182
)
8283

8384

@@ -113,8 +114,8 @@
113114
'InvalidAgentResponseError',
114115
'InvalidParamsError',
115116
'InvalidRequestError',
116-
'ListTaskPushNotificationConfigRequest',
117-
'ListTaskPushNotificationConfigResponse',
117+
'ListTaskPushNotificationConfigsRequest',
118+
'ListTaskPushNotificationConfigsResponse',
118119
'ListTasksRequest',
119120
'ListTasksResponse',
120121
'Message',

src/a2a/types/a2a_pb2.py

Lines changed: 118 additions & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/a2a/types/a2a_pb2.pyi

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,14 @@ class AgentCardSignature(_message.Message):
299299
def __init__(self, protected: _Optional[str] = ..., signature: _Optional[str] = ..., header: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...
300300

301301
class TaskPushNotificationConfig(_message.Message):
302-
__slots__ = ("tenant", "id", "task_id", "push_notification_config")
302+
__slots__ = ("tenant", "task_id", "push_notification_config")
303303
TENANT_FIELD_NUMBER: _ClassVar[int]
304-
ID_FIELD_NUMBER: _ClassVar[int]
305304
TASK_ID_FIELD_NUMBER: _ClassVar[int]
306305
PUSH_NOTIFICATION_CONFIG_FIELD_NUMBER: _ClassVar[int]
307306
tenant: str
308-
id: str
309307
task_id: str
310308
push_notification_config: PushNotificationConfig
311-
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ..., task_id: _Optional[str] = ..., push_notification_config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...
309+
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., push_notification_config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...
312310

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

549547
class CancelTaskRequest(_message.Message):
550-
__slots__ = ("tenant", "id")
548+
__slots__ = ("tenant", "id", "metadata")
551549
TENANT_FIELD_NUMBER: _ClassVar[int]
552550
ID_FIELD_NUMBER: _ClassVar[int]
551+
METADATA_FIELD_NUMBER: _ClassVar[int]
553552
tenant: str
554553
id: str
555-
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ...) -> None: ...
554+
metadata: _struct_pb2.Struct
555+
def __init__(self, tenant: _Optional[str] = ..., id: _Optional[str] = ..., metadata: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...
556556

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

577577
class CreateTaskPushNotificationConfigRequest(_message.Message):
578-
__slots__ = ("tenant", "task_id", "config_id", "config")
578+
__slots__ = ("tenant", "task_id", "config")
579579
TENANT_FIELD_NUMBER: _ClassVar[int]
580580
TASK_ID_FIELD_NUMBER: _ClassVar[int]
581-
CONFIG_ID_FIELD_NUMBER: _ClassVar[int]
582581
CONFIG_FIELD_NUMBER: _ClassVar[int]
583582
tenant: str
584583
task_id: str
585-
config_id: str
586584
config: PushNotificationConfig
587-
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., config_id: _Optional[str] = ..., config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...
585+
def __init__(self, tenant: _Optional[str] = ..., task_id: _Optional[str] = ..., config: _Optional[_Union[PushNotificationConfig, _Mapping]] = ...) -> None: ...
588586

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

597-
class ListTaskPushNotificationConfigRequest(_message.Message):
595+
class ListTaskPushNotificationConfigsRequest(_message.Message):
598596
__slots__ = ("tenant", "task_id", "page_size", "page_token")
599597
TENANT_FIELD_NUMBER: _ClassVar[int]
600598
TASK_ID_FIELD_NUMBER: _ClassVar[int]
@@ -632,7 +630,7 @@ class StreamResponse(_message.Message):
632630
artifact_update: TaskArtifactUpdateEvent
633631
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: ...
634632

635-
class ListTaskPushNotificationConfigResponse(_message.Message):
633+
class ListTaskPushNotificationConfigsResponse(_message.Message):
636634
__slots__ = ("configs", "next_page_token")
637635
CONFIGS_FIELD_NUMBER: _ClassVar[int]
638636
NEXT_PAGE_TOKEN_FIELD_NUMBER: _ClassVar[int]

0 commit comments

Comments
 (0)