Skip to content

Commit 10e3cb8

Browse files
committed
fix!: Update the name of A2A headers
A2A-Version and A2A-Extensions are specified by the spec (as of dec790a) instead of the X-A2A-*. Also updates the gRPC context keys to get rid of the prefix. I did not change the `X-A2A-Notification-Token` header that is still present in the spec but I'll open a PR to verify if that's not an omission Signed-off-by: Jeff Mesnil <jmesnil@ibm.com>
1 parent 566978c commit 10e3cb8

8 files changed

Lines changed: 33 additions & 33 deletions

File tree

‎client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/GrpcTransport.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public class GrpcTransport implements ClientTransport {
6161
AuthInterceptor.AUTHORIZATION,
6262
Metadata.ASCII_STRING_MARSHALLER);
6363
private static final Metadata.Key<String> EXTENSIONS_KEY = Metadata.Key.of(
64-
A2AHeaders.X_A2A_EXTENSIONS,
64+
A2AHeaders.A2A_EXTENSIONS,
6565
Metadata.ASCII_STRING_MARSHALLER);
6666
private static final Metadata.Key<String> VERSION_KEY = Metadata.Key.of(
67-
A2AHeaders.X_A2A_VERSION,
67+
A2AHeaders.A2A_VERSION,
6868
Metadata.ASCII_STRING_MARSHALLER);
6969
private final A2AServiceBlockingV2Stub blockingStub;
7070
private final A2AServiceStub asyncStub;
@@ -380,7 +380,7 @@ private io.a2a.grpc.SendMessageRequest createGrpcSendMessageRequest(MessageSendP
380380

381381
/**
382382
* Creates gRPC metadata from ClientCallContext headers.
383-
* Extracts headers like X-A2A-Extensions and sets them as gRPC metadata.
383+
* Extracts headers like A2A-Extensions and sets them as gRPC metadata.
384384
*
385385
* @param context the client call context containing headers, may be null
386386
* @param payloadAndHeaders the payload and headers wrapper, may be null
@@ -390,14 +390,14 @@ private Metadata createGrpcMetadata(@Nullable ClientCallContext context, @Nullab
390390
Metadata metadata = new Metadata();
391391

392392
if (context != null && context.getHeaders() != null) {
393-
// Set X-A2A-Version header if present
394-
String versionHeader = context.getHeaders().get(A2AHeaders.X_A2A_VERSION);
393+
// Set A2A-Version header if present
394+
String versionHeader = context.getHeaders().get(A2AHeaders.A2A_VERSION);
395395
if (versionHeader != null) {
396396
metadata.put(VERSION_KEY, versionHeader);
397397
}
398398

399-
// Set X-A2A-Extensions header if present
400-
String extensionsHeader = context.getHeaders().get(A2AHeaders.X_A2A_EXTENSIONS);
399+
// Set A2A-Extensions header if present
400+
String extensionsHeader = context.getHeaders().get(A2AHeaders.A2A_EXTENSIONS);
401401
if (extensionsHeader != null) {
402402
metadata.put(EXTENSIONS_KEY, extensionsHeader);
403403
}

‎common/src/main/java/io/a2a/common/A2AHeaders.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ public final class A2AHeaders {
99
* HTTP header name for A2A protocol version.
1010
* Used to communicate the protocol version that the client is using.
1111
*/
12-
public static final String X_A2A_VERSION = "X-A2A-Version";
12+
public static final String A2A_VERSION = "A2A-Version";
1313

1414
/**
1515
* HTTP header name for A2A extensions.
1616
* Used to communicate which extensions are requested by the client.
1717
*/
18-
public static final String X_A2A_EXTENSIONS = "X-A2A-Extensions";
18+
public static final String A2A_EXTENSIONS = "A2A-Extensions";
1919

2020
/**
2121
* HTTP header name for a push notification token.

‎reference/grpc/src/main/java/io/a2a/server/grpc/quarkus/A2AExtensionsInterceptor.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*
2222
* <h2>Captured Information</h2>
2323
* <ul>
24-
* <li><b>A2A Protocol Version</b>: {@code X-A2A-Version} header</li>
25-
* <li><b>A2A Extensions</b>: {@code X-A2A-Extensions} header</li>
24+
* <li><b>A2A Protocol Version</b>: {@code A2A-Version} header</li>
25+
* <li><b>A2A Extensions</b>: {@code A2A-Extensions} header</li>
2626
* <li><b>Complete Metadata</b>: All request headers via {@link io.grpc.Metadata}</li>
2727
* <li><b>Method Name</b>: gRPC method being invoked</li>
2828
* <li><b>Peer Information</b>: Client connection details</li>
@@ -68,8 +68,8 @@ public class A2AExtensionsInterceptor implements ServerInterceptor {
6868
*
6969
* <p><b>Extraction Process:</b>
7070
* <ol>
71-
* <li>Extract {@code X-A2A-Version} header from metadata</li>
72-
* <li>Extract {@code X-A2A-Extensions} header from metadata</li>
71+
* <li>Extract {@code A2A-Version} header from metadata</li>
72+
* <li>Extract {@code A2A-Extensions} header from metadata</li>
7373
* <li>Capture complete {@link Metadata} object</li>
7474
* <li>Capture gRPC method name from {@link ServerCall}</li>
7575
* <li>Map gRPC method to A2A protocol method name</li>
@@ -93,12 +93,12 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
9393

9494
// Extract A2A protocol version header
9595
Metadata.Key<String> versionKey =
96-
Metadata.Key.of(A2AHeaders.X_A2A_VERSION, Metadata.ASCII_STRING_MARSHALLER);
96+
Metadata.Key.of(A2AHeaders.A2A_VERSION, Metadata.ASCII_STRING_MARSHALLER);
9797
String version = metadata.get(versionKey);
9898

9999
// Extract A2A extensions header
100100
Metadata.Key<String> extensionsKey =
101-
Metadata.Key.of(A2AHeaders.X_A2A_EXTENSIONS, Metadata.ASCII_STRING_MARSHALLER);
101+
Metadata.Key.of(A2AHeaders.A2A_EXTENSIONS, Metadata.ASCII_STRING_MARSHALLER);
102102
String extensions = metadata.get(extensionsKey);
103103

104104
// Create enhanced context with rich information (equivalent to Python's ServicerContext)

‎reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ public String getUsername() {
250250
state.put(TENANT_KEY, extractTenant(rc));
251251
state.put(TRANSPORT_KEY, TransportProtocol.JSONRPC);
252252

253-
// Extract requested protocol version from X-A2A-Version header
254-
String requestedVersion = rc.request().getHeader(A2AHeaders.X_A2A_VERSION);
253+
// Extract requested protocol version from A2A-Version header
254+
String requestedVersion = rc.request().getHeader(A2AHeaders.A2A_VERSION);
255255

256-
// Extract requested extensions from X-A2A-Extensions header
257-
List<String> extensionHeaderValues = rc.request().headers().getAll(A2AHeaders.X_A2A_EXTENSIONS);
256+
// Extract requested extensions from A2A-Extensions header
257+
List<String> extensionHeaderValues = rc.request().headers().getAll(A2AHeaders.A2A_EXTENSIONS);
258258
Set<String> requestedExtensions = A2AExtensions.getRequestedExtensions(extensionHeaderValues);
259259

260260
return new ServerCallContext(user, state, requestedExtensions, requestedVersion);

‎reference/rest/src/main/java/io/a2a/server/rest/quarkus/A2AServerRoutes.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,11 @@ public String getUsername() {
434434
state.put(TENANT_KEY, extractTenant(rc));
435435
state.put(TRANSPORT_KEY, TransportProtocol.HTTP_JSON);
436436

437-
// Extract requested protocol version from X-A2A-Version header
438-
String requestedVersion = rc.request().getHeader(A2AHeaders.X_A2A_VERSION);
437+
// Extract requested protocol version from A2A-Version header
438+
String requestedVersion = rc.request().getHeader(A2AHeaders.A2A_VERSION);
439439

440-
// Extract requested extensions from X-A2A-Extensions header
441-
List<String> extensionHeaderValues = rc.request().headers().getAll(A2AHeaders.X_A2A_EXTENSIONS);
440+
// Extract requested extensions from A2A-Extensions header
441+
List<String> extensionHeaderValues = rc.request().headers().getAll(A2AHeaders.A2A_EXTENSIONS);
442442
Set<String> requestedExtensions = A2AExtensions.getRequestedExtensions(extensionHeaderValues);
443443

444444
return new ServerCallContext(user, state, requestedExtensions, requestedVersion);

‎transport/grpc/src/main/java/io/a2a/transport/grpc/context/GrpcContextKeys.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@
4040
public final class GrpcContextKeys {
4141

4242
/**
43-
* Context key for storing the X-A2A-Version header value.
43+
* Context key for storing the A2A-Version header value.
4444
* Set by server interceptors and accessed by service handlers.
4545
*/
4646
public static final Context.Key<String> VERSION_HEADER_KEY =
47-
Context.key("x-a2a-version");
47+
Context.key("a2a-version");
4848

4949
/**
50-
* Context key for storing the X-A2A-Extensions header value.
50+
* Context key for storing the A2A-Extensions header value.
5151
* Set by server interceptors and accessed by service handlers.
5252
*/
5353
public static final Context.Key<String> EXTENSIONS_HEADER_KEY =
54-
Context.key("x-a2a-extensions");
54+
Context.key("a2a-extensions");
5555

5656
/**
5757
* Context key for storing the complete gRPC Metadata object.

‎transport/grpc/src/main/java/io/a2a/transport/grpc/handler/CallContextFactory.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* <li>User authentication from security context</li>
1919
* <li>gRPC metadata (headers)</li>
2020
* <li>Method name and peer information</li>
21-
* <li>A2A protocol version from {@code X-A2A-Version} header</li>
22-
* <li>Required extensions from {@code X-A2A-Extensions} header</li>
21+
* <li>A2A protocol version from {@code A2A-Version} header</li>
22+
* <li>Required extensions from {@code A2A-Extensions} header</li>
2323
* <li>Response observer for gRPC streaming</li>
2424
* </ul>
2525
*

‎transport/grpc/src/main/java/io/a2a/transport/grpc/handler/GrpcHandler.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ public void deleteTaskPushNotificationConfig(io.a2a.grpc.DeleteTaskPushNotificat
600600
* <li>HTTP headers extracted from metadata</li>
601601
* <li>gRPC method name</li>
602602
* <li>Peer information (client connection details)</li>
603-
* <li>A2A protocol version from {@code X-A2A-Version} header (via context)</li>
604-
* <li>Required extensions from {@code X-A2A-Extensions} header (via context)</li>
603+
* <li>A2A protocol version from {@code A2A-Version} header (via context)</li>
604+
* <li>Required extensions from {@code A2A-Extensions} header (via context)</li>
605605
* </ul>
606606
*
607607
* <p><b>Custom Context Creation:</b>
@@ -901,7 +901,7 @@ public static void setStreamingSubscribedRunnable(Runnable runnable) {
901901
protected abstract Executor getExecutor();
902902

903903
/**
904-
* Attempts to extract the X-A2A-Version header from the current gRPC context.
904+
* Attempts to extract the A2A-Version header from the current gRPC context.
905905
* This will only work if a server interceptor has been configured to capture
906906
* the metadata and store it in the context.
907907
*
@@ -917,7 +917,7 @@ public static void setStreamingSubscribedRunnable(Runnable runnable) {
917917
}
918918

919919
/**
920-
* Attempts to extract the X-A2A-Extensions header from the current gRPC context.
920+
* Attempts to extract the A2A-Extensions header from the current gRPC context.
921921
* This will only work if a server interceptor has been configured to capture
922922
* the metadata and store it in the context.
923923
*

0 commit comments

Comments
 (0)