From 1dd1f0d92a378b9d078307c26e00059f768849cf Mon Sep 17 00:00:00 2001 From: zhangwenjun-huawei Date: Fri, 18 Sep 2026 21:07:02 +0800 Subject: [PATCH] fix(sample): drop legacy Notification-T/NL/v1 extension URI Replace the legacy Notification-T/NL/v1 extension URI with the canonical Notification-T/v1 across the subscribe-incident and service-recovery samples: - subscribe-incident: ClientSampleFlow, the server flow and the AgentCard now use Notification-T/v1 (constant renamed from NOTIFICATION_T_EXTENSION_URI_NL) - service-recovery: remove the legacy NL alias constant and its AgentCard extension entry; the server flow accepts and reads only Notification-T/v1 Signed-off-by: zhangwenjun-huawei --- .../agentcard/ServerSampleAgentCardBuilder.java | 10 +--------- .../server/flow/ServerSampleFlow.java | 12 ++---------- .../client/flow/ClientSampleFlow.java | 6 +++--- .../agentcard/ServerSampleAgentCardBuilder.java | 6 +++--- .../server/flow/ServerSampleFlow.java | 12 ++---------- 5 files changed, 11 insertions(+), 35 deletions(-) diff --git a/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/agentcard/ServerSampleAgentCardBuilder.java b/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/agentcard/ServerSampleAgentCardBuilder.java index f4e65dd4..727d105f 100644 --- a/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/agentcard/ServerSampleAgentCardBuilder.java +++ b/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/agentcard/ServerSampleAgentCardBuilder.java @@ -12,9 +12,6 @@ public final class ServerSampleAgentCardBuilder { static final String NOTIFICATION_T_EXTENSION_URI = "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/v1"; - static final String NOTIFICATION_T_EXTENSION_URI_NL = - "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/NL/v1"; - private ServerSampleAgentCardBuilder() {} /** @@ -51,12 +48,7 @@ public static Map buildAgentCard(String host, int port) { "uri", NOTIFICATION_T_EXTENSION_URI, "description", - "Extension of structured prompt Notification-T requests."), - Map.of( - "uri", - NOTIFICATION_T_EXTENSION_URI_NL, - "description", - "Legacy alias of the Notification-T extension."))), + "Extension of structured prompt Notification-T requests."))), "supportedInterfaces", List.of(Map.of( "protocolBinding", "HTTP+JSON", diff --git a/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/flow/ServerSampleFlow.java b/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/flow/ServerSampleFlow.java index 77b6b4ea..c70ff5ec 100644 --- a/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/flow/ServerSampleFlow.java +++ b/a2a-t-sample/src/main/java/net/openan/a2at/sample/service_recovery/server/flow/ServerSampleFlow.java @@ -31,9 +31,6 @@ * @since 2026-08 */ public final class ServerSampleFlow { - static final String NOTIFICATION_T_EXTENSION_URI_NL = - "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/NL/v1"; - static final String NOTIFICATION_T_EXTENSION_URI = "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/v1"; @@ -147,8 +144,7 @@ private static void requireNotificationExtension(ServerCallContext callContext) String modernValue = headers.get("A2A-Extensions"); String legacyValue = headers.get("X-A2A-Extensions"); String extensionValue = modernValue != null ? modernValue : legacyValue; - if (!NOTIFICATION_T_EXTENSION_URI_NL.equals(extensionValue) - && !NOTIFICATION_T_EXTENSION_URI.equals(extensionValue)) { + if (!NOTIFICATION_T_EXTENSION_URI.equals(extensionValue)) { throw new ValueErrorException("a2a client extensions is not exist."); } } @@ -158,11 +154,7 @@ private static String extractPromptText(RequestContext requestContext) { if (message == null || message.metadata() == null) { throw new ValueErrorException("Expected message metadata for Notification-T prompt"); } - String promptText = stringValue(message.metadata().get(NOTIFICATION_T_EXTENSION_URI_NL)); - if (promptText.isEmpty()) { - promptText = stringValue(message.metadata().get(NOTIFICATION_T_EXTENSION_URI)); - } - return promptText; + return stringValue(message.metadata().get(NOTIFICATION_T_EXTENSION_URI)); } @SuppressWarnings("unchecked") diff --git a/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/client/flow/ClientSampleFlow.java b/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/client/flow/ClientSampleFlow.java index 7918efa2..77ca9e26 100644 --- a/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/client/flow/ClientSampleFlow.java +++ b/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/client/flow/ClientSampleFlow.java @@ -25,8 +25,8 @@ * @since 2026-05 */ public final class ClientSampleFlow { - static final String NOTIFICATION_T_EXTENSION_URI_NL = - "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/NL/v1"; + static final String NOTIFICATION_T_EXTENSION_URI = + "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/v1"; static final String NATURAL_LANGUAGE_PROMPT_INPUT_ZH = "请生成一个Incident事件订阅任务:通知主题为Incident,订阅条件为订阅级别为critical的ETH-LOS的故障,上报通知数据格式为DataPart"; @@ -99,7 +99,7 @@ public static List> runClientFlow( String promptText = requirePromptText(promptResult); BuiltA2AJavaRequest builtRequest = A2AJavaRequestBuilder.buildStreamRequest( - promptText, NOTIFICATION_T_EXTENSION_URI_NL, buildRequestMetadata(scenarioPayload)); + promptText, NOTIFICATION_T_EXTENSION_URI, buildRequestMetadata(scenarioPayload)); emit(logSink, SampleLoggingFormatter.formatPayloadLog("client", "a2a-request-body", builtRequest.request())); emit( logSink, diff --git a/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/agentcard/ServerSampleAgentCardBuilder.java b/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/agentcard/ServerSampleAgentCardBuilder.java index 62b74c98..edebfb86 100644 --- a/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/agentcard/ServerSampleAgentCardBuilder.java +++ b/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/agentcard/ServerSampleAgentCardBuilder.java @@ -12,8 +12,8 @@ public final class ServerSampleAgentCardBuilder { static final String TASK_T_EXTENSION_URI_NL = "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Task-T/NL/v1"; - static final String NOTIFICATION_T_EXTENSION_URI_NL = - "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/NL/v1"; + static final String NOTIFICATION_T_EXTENSION_URI = + "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/v1"; private ServerSampleAgentCardBuilder() {} @@ -47,7 +47,7 @@ public static Map buildAgentCard(String host, int port) { "Extension of structured prompt Task-T requests."), Map.of( "uri", - NOTIFICATION_T_EXTENSION_URI_NL, + NOTIFICATION_T_EXTENSION_URI, "description", "Extension of structured prompt Notification-T requests."))), "supportedInterfaces", diff --git a/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/flow/ServerSampleFlow.java b/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/flow/ServerSampleFlow.java index 632db86b..91413caa 100644 --- a/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/flow/ServerSampleFlow.java +++ b/a2a-t-sample/src/main/java/net/openan/a2at/sample/subscribe_incident/server/flow/ServerSampleFlow.java @@ -21,9 +21,6 @@ * @since 2026-05 */ public final class ServerSampleFlow { - static final String NOTIFICATION_T_EXTENSION_URI_NL = - "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/NL/v1"; - static final String NOTIFICATION_T_EXTENSION_URI = "https://projects.tmforum.org/a2aproject/telecommunication/extensions/Notification-T/v1"; @@ -110,8 +107,7 @@ private static void requireNotificationExtension(ServerCallContext callContext) String modernValue = headers.get("A2A-Extensions"); String legacyValue = headers.get("X-A2A-Extensions"); String extensionValue = modernValue != null ? modernValue : legacyValue; - if (!NOTIFICATION_T_EXTENSION_URI_NL.equals(extensionValue) - && !NOTIFICATION_T_EXTENSION_URI.equals(extensionValue)) { + if (!NOTIFICATION_T_EXTENSION_URI.equals(extensionValue)) { throw new ValueErrorException("a2a client extensions is not exist."); } } @@ -121,11 +117,7 @@ private static String extractPromptText(RequestContext requestContext) { if (message == null || message.metadata() == null) { throw new ValueErrorException("Expected message metadata for Notification-T prompt"); } - String promptText = stringValue(message.metadata().get(NOTIFICATION_T_EXTENSION_URI_NL)); - if (promptText.isEmpty()) { - promptText = stringValue(message.metadata().get(NOTIFICATION_T_EXTENSION_URI)); - } - return promptText; + return stringValue(message.metadata().get(NOTIFICATION_T_EXTENSION_URI)); } @SuppressWarnings("unchecked")