feat(studio): render structured AI conversations
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

Add reusable UI2 conversation balloons, tool cards, native Markdown, copy actions and controlled streaming scroll. Preserve typed ACP tool updates and chat lifecycle, add Alt+Enter sending, update specifications and qualify the UI through desktop tests. Include the Pong asset cache.
This commit is contained in:
2026-11-23 19:12:26 +00:00
parent ae7d01aa99
commit 481c479427
25 changed files with 1080 additions and 40 deletions
@@ -194,11 +194,38 @@ public final class CodexAcpConnection implements AgentConnection {
Event event=null;
if(type.equals("agent_message_chunk")&&update.path("content").path("type").asText().equals("text"))
event=new Event(id,Kind.TEXT,update.path("content").path("text").asText());
else if(type.equals("tool_call")||type.equals("tool_call_update"))
event=new Event(id,Kind.ACTIVITY,update.path("title").asText(update.path("status").asText("Tool activity")));
else if(type.equals("tool_call")||type.equals("tool_call_update")){
String toolId=update.path("toolCallId").asText();
if(!toolId.isBlank()&&toolId.length()<=512){
String content=null;
if(update.has("content")&&!update.path("content").isNull()){
var parts=new ArrayList<String>();
for(var part:update.path("content")){
if(part.path("type").asText().equals("content")&&part.path("content").path("type").asText().equals("text"))
parts.add(part.path("content").path("text").asText());
else if(part.path("type").asText().equals("diff"))
parts.add(part.path("path").asText()+"\n"+part.path("oldText").asText()+"\n→\n"+part.path("newText").asText());
}
content=boundedToolText(String.join("\n",parts));
}
event=new Event(id,Kind.TOOL,"",new ToolUpdate(toolId,toolField(update,"title"),toolField(update,"kind"),
toolField(update,"status"),toolField(update,"rawInput"),toolField(update,"rawOutput"),content));
}
}
else if(type.equals("agent_thought_chunk"))event=new Event(id,Kind.ACTIVITY,"Working");
if(event!=null){var acknowledgement=accepted.get(id);if(acknowledgement!=null)acknowledgement.complete(null);events.accept(event);}
}
private static String toolField(JsonNode update,String field){
var value=update.get(field);
if(value==null||value.isNull())return null;
return boundedToolText(value.isTextual()?value.asText():value.toPrettyString());
}
private static String boundedToolText(String text){
text=message(text);
if(text.length()<=64_000)return text;
int end=Character.isHighSurrogate(text.charAt(63_979))?63_979:63_980;
return text.substring(0,end)+"\n[truncated]";
}
private void permission(JsonNode message){
var params=message.path("params");String session=params.path("sessionId").asText();String key=message.path("id").toString();
var choices=new ArrayList<Choice>();for(var o:params.path("options"))choices.add(new Choice(o.path("optionId").asText(),o.path("name").asText(),o.path("kind").asText()));