Skip to content

Commit 656d693

Browse files
committed
added a2ui support and display part added more support for other components
1 parent dfbb086 commit 656d693

File tree

7 files changed

+31
-7
lines changed

7 files changed

+31
-7
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.vishalmysore</groupId>
88
<artifactId>a2ajava</artifactId>
9-
<version>1.0.5</version>
9+
<version>1.0.6</version>
1010
<name>A2A Protocol Implementation for Java</name>
1111
<description>
1212
Java implementation of the A2A protocol v1.0, which allows for the exchange of data between different AI systems.
@@ -80,7 +80,7 @@
8080
<dependency>
8181
<groupId>io.github.vishalmysore</groupId>
8282
<artifactId>tools4ai</artifactId>
83-
<version>1.1.9</version>
83+
<version>1.1.9.2</version>
8484
</dependency>
8585

8686
<dependency>

src/main/java/io/github/vishalmysore/a2a/server/DyanamicTaskContoller.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.t4a.transform.PromptTransformer;
1414
import io.github.vishalmysore.a2a.domain.*;
1515

16+
import io.github.vishalmysore.a2ui.A2UIResponse;
1617
import io.github.vishalmysore.common.CallBackType;
1718
import lombok.Getter;
1819
import lombok.extern.java.Log;
@@ -190,7 +191,13 @@ private void processWithCallback(String text, Task task, ActionCallback actionCa
190191
Object obj = getBaseProcessor().processSingleAction(text,null, new LoggingHumanDecision(),new LogginggExplainDecision(),actionCallback);
191192
TaskStatus status = task.getStatus();
192193
status.setState(TaskState.COMPLETED);
193-
status.getMessage().getParts().add(createA2uiDataPart((Map<String, Object>) obj));
194+
if(obj instanceof A2UIResponse a2uiResponse) {
195+
status.getMessage().getParts().add(createA2uiDataPart(a2uiResponse.getResponseData()));
196+
} else {
197+
TextPart resultPart = createResultPart(obj);
198+
status.getMessage().getParts().add(resultPart);
199+
}
200+
194201
} else {
195202
getBaseProcessor().processSingleAction(text, actionCallback);
196203
}

src/main/java/io/github/vishalmysore/a2a/server/RealTimeAgentCardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private boolean isNonEmptyString(String value) {
133133
}
134134

135135
public void poplateCardFromProperties(AgentCard card) {
136-
Map<Object, Object> tools4AI = PredictionLoader.getInstance().getTools4AIProperties();
136+
Map<Object, Object> tools4AI = PredictionLoader.getInstance().fetchTools4AIPropDetails();
137137

138138
// Check and set description
139139
String cardDescription = (String) tools4AI.get("a2a.card.description");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.github.vishalmysore.a2ui;
2+
3+
import io.github.vishalmysore.common.CommonClientResponse;
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
import lombok.ToString;
7+
8+
import java.util.Map;
9+
10+
@Getter
11+
@Setter
12+
@ToString
13+
public class A2UIResponse implements CommonClientResponse {
14+
private Map<String, Object> responseData;
15+
16+
}

src/main/java/io/github/vishalmysore/common/CallBackType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
public enum CallBackType {
44
MCP, // Protocol for LLM communication
55
A2A,
6-
A2UI// App-to-App communication
6+
A2UI,// App-to-App communication
7+
UCP // Universal Commerce Protocol
78
}

src/main/java/io/github/vishalmysore/mcp/server/MCPToolsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void init() {
8888
}
8989

9090
public void setProperties() {
91-
Map<Object, Object> tools4AIProperties = PredictionLoader.getInstance().getTools4AIProperties();
91+
Map<Object, Object> tools4AIProperties = PredictionLoader.getInstance().fetchTools4AIPropDetails();
9292

9393
// Set serverName if the property is not null or empty
9494
String serverName = (String) tools4AIProperties.get("mcp.tools.servername");

src/test/java/io/github/vishalmysore/common/CallBackTypeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class CallBackTypeTest {
88
@Test
99
public void testEnumValues() {
1010
// Test that the enum has exactly two values
11-
assertEquals(3, CallBackType.values().length);
11+
assertEquals(4, CallBackType.values().length);
1212

1313
// Test the enum values are as expected
1414
assertEquals(CallBackType.MCP, CallBackType.valueOf("MCP"));

0 commit comments

Comments
 (0)