AcpSyncClient client = AcpClient.sync(transport)
.sessionUpdateConsumer(notification -> {
SessionUpdate update = notification.update();
if (update instanceof AgentMessageChunk msg) {
System.out.print(((TextContent) msg.content()).text());
} else if (update instanceof AgentThoughtChunk thought) {
System.out.println("[Thought] " +
((TextContent) thought.content()).text());
} else if (update instanceof ToolCall tc) {
System.out.println("[Tool] " + tc.title() +
" | " + tc.kind() + " | " + tc.status());
} else if (update instanceof ToolCallUpdateNotification tcUpdate) {
System.out.println("[ToolUpdate] " +
tcUpdate.toolCallId() + " -> " + tcUpdate.status());
} else if (update instanceof Plan plan) {
System.out.println("[Plan] " + plan.entries().size() + " entries:");
plan.entries().forEach(entry ->
System.out.println(" - " + entry.content() +
" [" + entry.status() + "]"));
} else if (update instanceof AvailableCommandsUpdate commands) {
System.out.println("[Commands] " +
commands.availableCommands().size() + " available");
} else if (update instanceof CurrentModeUpdate mode) {
System.out.println("[Mode] " + mode.currentModeId());
}
})
.build();