feat: map codex thread collaboration progress

This commit is contained in:
AI Bot
2026-06-01 17:52:29 +08:00
parent defa3da185
commit 2a5dccf5cb
11 changed files with 317 additions and 7 deletions

View File

@@ -1437,6 +1437,31 @@ public final class BossUi {
}
}
JSONObject threadCollaboration = progress == null ? null : progress.optJSONObject("threadCollaboration");
if (threadCollaboration != null) {
String tool = threadCollaboration.optString("tool", "").trim();
String status = threadCollaboration.optString("status", "").trim();
String target = threadCollaboration.optString("target", "").trim();
String agentStatus = threadCollaboration.optString("agentStatus", "").trim();
if (!TextUtils.isEmpty(tool) || !TextUtils.isEmpty(status) ||
!TextUtils.isEmpty(target) || !TextUtils.isEmpty(agentStatus)) {
card.addView(divider(context));
card.addView(sectionTitle(context, "线程协作"));
if (!TextUtils.isEmpty(tool) || !TextUtils.isEmpty(status)) {
String label = !TextUtils.isEmpty(tool) && !TextUtils.isEmpty(status)
? "工具 " + tool + " · " + status
: !TextUtils.isEmpty(tool) ? "工具 " + tool : "状态 " + status;
card.addView(detailRow(context, "", label, "", false));
}
if (!TextUtils.isEmpty(target)) {
card.addView(detailRow(context, "", "目标 " + target, "", false, true));
}
if (!TextUtils.isEmpty(agentStatus)) {
card.addView(detailRow(context, "", "智能体 " + agentStatus, "", false, true));
}
}
}
JSONObject accountStatus = progress == null ? null : progress.optJSONObject("accountStatus");
JSONObject modelVerification = progress == null ? null : progress.optJSONObject("modelVerification");
JSONArray verifications = modelVerification == null ? null : modelVerification.optJSONArray("verifications");

View File

@@ -1176,6 +1176,56 @@ public class ProjectDetailActivityUiTest {
assertFalse(viewTreeContainsText(messageView, "/Users/kris"));
}
@Test
public void executionProgressMessageRendersCodexThreadCollaborationSection() throws Exception {
Intent intent = new Intent()
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_ID, "thread-collab")
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_NAME, "Boss开发主线程");
TestProjectDetailActivity activity = Robolectric
.buildActivity(TestProjectDetailActivity.class, intent)
.setup()
.get();
JSONObject message = new JSONObject()
.put("id", "progress-thread-collab-1")
.put("sender", "master")
.put("senderLabel", "主 Agent")
.put("body", "执行进度")
.put("kind", "execution_progress")
.put("sentAt", "2026-06-01T11:20:00+08:00")
.put("executionProgress", new JSONObject()
.put("status", "running")
.put("steps", new JSONArray()
.put(new JSONObject().put("text", "调用 Codex 线程协作").put("status", "running")))
.put("threadCollaboration", new JSONObject()
.put("tool", "send_input")
.put("status", "completed")
.put("target", "已有线程")
.put("agentStatus", "completed")
.put("senderThreadId", "thread-source-secret-should-not-render")
.put("receiverThreadId", "thread-target-secret-should-not-render")
.put("prompt", "internal prompt token=sk-secret-should-not-render"))
.put("compaction", new JSONObject()
.put("status", "completed")
.put("message", "上下文已压缩")));
View messageView = ReflectionHelpers.callInstanceMethod(
activity,
"buildMessageView",
ReflectionHelpers.ClassParameter.from(JSONObject.class, message)
);
assertTrue(viewTreeContainsText(messageView, "线程协作"));
assertTrue(viewTreeContainsText(messageView, "工具 send_input · completed"));
assertTrue(viewTreeContainsText(messageView, "目标 已有线程"));
assertTrue(viewTreeContainsText(messageView, "智能体 completed"));
assertTrue(viewTreeContainsText(messageView, "上下文已压缩"));
assertFalse(viewTreeContainsText(messageView, "thread-source-secret-should-not-render"));
assertFalse(viewTreeContainsText(messageView, "thread-target-secret-should-not-render"));
assertFalse(viewTreeContainsText(messageView, "internal prompt"));
assertFalse(viewTreeContainsText(messageView, "sk-secret-should-not-render"));
}
@Test
public void nativeRemoteExecutionProgressDoesNotRenderCodexSections() throws Exception {
Intent intent = new Intent()