Skip to content

Commit 403fe76

Browse files
committed
bug: parameters were reversed when creating the AgentExtension.
1 parent 8142e00 commit 403fe76

3 files changed

Lines changed: 56 additions & 4 deletions

File tree

agent_sdks/kotlin/src/main/kotlin/com/google/a2ui/a2a/A2uiA2a.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ object A2uiA2a {
5555

5656
val isSupportRequired = false
5757
return AgentExtension(
58-
A2UI_EXTENSION_URI,
58+
"Provides agent driven UI using the A2UI JSON format.",
5959
params,
6060
isSupportRequired,
61-
"Provides agent driven UI using the A2UI JSON format.",
61+
A2UI_EXTENSION_URI,
6262
)
6363
}
6464

agent_sdks/kotlin/src/main/kotlin/com/google/a2ui/adk/a2a_extension/Converters.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.google.genai.types.Part
2828
import io.a2a.spec.Event as A2aEvent
2929
import io.a2a.spec.Message
3030
import io.a2a.spec.Message.Role.ROLE_AGENT
31+
import io.a2a.spec.Part as A2aPart
3132
import io.a2a.spec.TaskState
3233
import io.a2a.spec.TaskStatus
3334
import io.a2a.spec.TaskStatusUpdateEvent
@@ -49,7 +50,7 @@ class A2uiPartConverter(
4950
// to returning DataParts for A2UI, and omitting standard conversions here.
5051
// Client applications should adapt this integration logic based on actual available converters.
5152

52-
fun convert(part: Part): List<io.a2a.spec.Part<*>> {
53+
fun convert(part: Part): List<A2aPart<*>> {
5354
val functionResponse = part.functionResponse().orElse(null)
5455
val isSendA2uiJsonToClientResponse =
5556
functionResponse != null &&
@@ -129,7 +130,7 @@ class A2uiEventConverter(
129130
// 2. Process Content
130131
val content = event.content().orElse(null)
131132
if (content != null) {
132-
val outputParts = mutableListOf<io.a2a.spec.Part<*>>()
133+
val outputParts = mutableListOf<A2aPart<*>>()
133134

134135
val genaiParts = content.parts().orElse(emptyList()) ?: emptyList()
135136
for (part in genaiParts) {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.a2ui.a2a
18+
19+
import com.google.a2ui.core.schema.A2uiConstants
20+
import kotlin.test.Test
21+
import kotlin.test.assertEquals
22+
import kotlin.test.assertFalse
23+
import kotlin.test.assertNotNull
24+
import kotlin.test.assertTrue
25+
26+
class A2uiA2aTest {
27+
28+
@Test
29+
fun createsAgentExtensionWithDefaultParams() {
30+
val extension = A2uiA2a.getA2uiAgentExtension()
31+
32+
assertEquals("Provides agent driven UI using the A2UI JSON format.", extension.description)
33+
assertNotNull(extension.params)
34+
assertTrue(extension.params!!.isEmpty())
35+
assertFalse(extension.required)
36+
assertEquals(A2uiA2a.A2UI_EXTENSION_URI, extension.uri)
37+
}
38+
39+
@Test
40+
fun createsAgentExtensionWithCustomParams() {
41+
val extension =
42+
A2uiA2a.getA2uiAgentExtension(
43+
acceptsInlineCatalogs = true,
44+
supportedCatalogIds = listOf("c1", "c2"),
45+
)
46+
47+
assertNotNull(extension.params)
48+
assertEquals(true, extension.params!![A2uiConstants.INLINE_CATALOGS_KEY])
49+
assertEquals(listOf("c1", "c2"), extension.params!![A2uiConstants.SUPPORTED_CATALOG_IDS_KEY])
50+
}
51+
}

0 commit comments

Comments
 (0)