Skip to content

feat: A2A-Version header validation and negotiation#18

Open
zeroasterisk wants to merge 1 commit intoactioncard:mainfrom
zeroasterisk:feat/v1-version-header
Open

feat: A2A-Version header validation and negotiation#18
zeroasterisk wants to merge 1 commit intoactioncard:mainfrom
zeroasterisk:feat/v1-version-header

Conversation

@zeroasterisk
Copy link
Copy Markdown

Part of #13 (A2A v1.0 Protocol Support)

What This PR Does

Adds A2A-Version header support for version negotiation per the A2A protocol spec.

Server side (lib/a2a/plug.ex)

  • Reads A2A-Version request header on POST (JSON-RPC) requests
  • If present and not in server's supported versions list → returns VersionNotSupportedError (-32009)
  • If absent → accepts (per spec, absent header is OK)
  • Adds :supported_versions option to Plug init (default ["1.0", "1.0.0"])
  • Sets A2A-Version response header on all JSON-RPC responses

Client side (lib/a2a/client.ex)

  • Sends A2A-Version: 1.0 header with every request

Error module (lib/a2a/jsonrpc/error.ex)

  • Adds version_not_supported/1 constructor for error code -32009

Tests (10 new)

  • Version validation: absent header accepted, supported versions 1.0 and 1.0.0 accepted
  • Unsupported version returns VersionNotSupportedError with correct code/message/data
  • Response includes A2A-Version header
  • Custom :supported_versions option works correctly
  • Client sends A2A-Version: 1.0 on send_message, get_task, cancel_task

397 tests, 0 failures

Fixes part of #13

Server side (lib/a2a/plug.ex):
- Read A2A-Version request header
- If present and not in supported versions list, return VersionNotSupportedError (-32009)
- If absent, accept (per spec, absent header is OK)
- Add :supported_versions option to Plug init (default ["1.0", "1.0.0"])
- Set A2A-Version response header on all JSON-RPC responses

Client side (lib/a2a/client.ex):
- Send A2A-Version: 1.0 header with every request

Error module (lib/a2a/jsonrpc/error.ex):
- Add version_not_supported/1 constructor for -32009 error

Tests: 10 new tests covering version validation, unsupported version error,
absent header acceptance, response header, custom supported_versions, and
client header verification.

397 tests, 0 failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant