diff --git a/.github/workflows/update-a2a-types.yml b/.github/workflows/update-a2a-types.yml index a7f193c5d..cba9c6107 100644 --- a/.github/workflows/update-a2a-types.yml +++ b/.github/workflows/update-a2a-types.yml @@ -47,8 +47,8 @@ jobs: token: ${{ secrets.A2A_BOT_PAT }} committer: a2a-bot author: a2a-bot - commit-message: 'feat: Update A2A types from specification 🤖' - title: 'feat: Update A2A types from specification 🤖' + commit-message: 'feat(spec): Update A2A types from specification 🤖' + title: 'feat(spec): Update A2A types from specification 🤖' body: | This PR updates `src/a2a/types.py` based on the latest `specification/json/a2a.json` from [a2aproject/A2A](https://github.com/a2aproject/A2A/commit/${{ github.event.client_payload.sha }}). branch: auto-update-a2a-types-${{ github.event.client_payload.sha }} diff --git a/.ruff.toml b/.ruff.toml index 70f8ded31..9ebfa2800 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -143,7 +143,6 @@ inline-quotes = "single" [format] exclude = [ - "types.py", "src/a2a/grpc/**", ] docstring-code-format = true diff --git a/scripts/generate_types.sh b/scripts/generate_types.sh index 546c20f96..64889c281 100644 --- a/scripts/generate_types.sh +++ b/scripts/generate_types.sh @@ -35,4 +35,7 @@ uv run datamodel-codegen \ --use-subclass-enum \ --base-class a2a._base.A2ABaseModel +echo "Formatting generated file with ruff..." +uv run ruff format "$GENERATED_FILE" + echo "Codegen finished successfully." diff --git a/src/a2a/types.py b/src/a2a/types.py index 4962cbd0f..f4e2880db 100644 --- a/src/a2a/types.py +++ b/src/a2a/types.py @@ -133,7 +133,9 @@ class AgentSkill(A2ABaseModel): """ Supported media types for output. """ - tags: list[str] = Field(..., examples=[['cooking', 'customer support', 'billing']]) + tags: list[str] = Field( + ..., examples=[['cooking', 'customer support', 'billing']] + ) """ Set of tagwords describing classes of capabilities for this specific skill. """ @@ -1271,7 +1273,9 @@ class Artifact(A2ABaseModel): class DeleteTaskPushNotificationConfigResponse( - RootModel[JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse] + RootModel[ + JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse + ] ): root: JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse """ @@ -1280,7 +1284,9 @@ class DeleteTaskPushNotificationConfigResponse( class GetTaskPushNotificationConfigResponse( - RootModel[JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse] + RootModel[ + JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse + ] ): root: JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse """ @@ -1289,7 +1295,9 @@ class GetTaskPushNotificationConfigResponse( class ListTaskPushNotificationConfigResponse( - RootModel[JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse] + RootModel[ + JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse + ] ): root: JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse """ @@ -1444,7 +1452,9 @@ class SendStreamingMessageRequest(A2ABaseModel): class SetTaskPushNotificationConfigResponse( - RootModel[JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse] + RootModel[ + JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse + ] ): root: JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse """ @@ -1497,7 +1507,9 @@ class TaskStatus(A2ABaseModel): Additional status updates for client """ state: TaskState - timestamp: str | None = Field(default=None, examples=['2023-10-27T10:00:00Z']) + timestamp: str | None = Field( + default=None, examples=['2023-10-27T10:00:00Z'] + ) """ ISO 8601 datetime string when the status was recorded. """ @@ -1757,7 +1769,9 @@ class SendStreamingMessageSuccessResponse(A2ABaseModel): """ -class CancelTaskResponse(RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]): +class CancelTaskResponse( + RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse] +): root: JSONRPCErrorResponse | CancelTaskSuccessResponse """ JSON-RPC response for the 'tasks/cancel' method. @@ -1800,7 +1814,9 @@ class JSONRPCResponse( """ -class SendMessageResponse(RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]): +class SendMessageResponse( + RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse] +): root: JSONRPCErrorResponse | SendMessageSuccessResponse """ JSON-RPC response model for the 'message/send' method.