Clean up the agent transcript view

This commit is contained in:
Jonathan Singer
2026-07-20 09:51:56 -04:00
parent 9a9b5cc1c2
commit b41abc9e58
3 changed files with 115 additions and 101 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="dark" />
<title>Strix Results</title>
<script type="module" crossorigin src="./assets/index-DcwQJgKU.js"></script>
<script type="module" crossorigin src="./assets/index-mc1W09x2.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-B8pfoev9.css">
</head>
<body>
@@ -76,6 +76,19 @@ function eventSeq(id: string): number {
return m ? parseInt(m[1], 10) : 0;
}
/**
* The SDK session we reconstruct includes each agent's incoming "user" messages:
* the subagent spawn prompt ("== Inherited context from parent =="), inter-agent
* message deliveries, and other large blobs. The cloud app never renders these
* as chat bubbles (its timeline is assistant "thinking" + tool executions, and
* inter-agent messages surface through the tool renderers). Mirror that: keep
* assistant messages and tool calls, drop incoming user/human messages.
*/
function isIncomingUserChat(event: TranscriptEvent): boolean {
const role = event.data?.role;
return event.type === "chat" && (role === "user" || role === "human");
}
const STATUS_STYLE: Record<string, string> = {
completed: "text-emerald-400 border-emerald-500/30 bg-emerald-500/10",
running: "text-blue-400 border-blue-500/30 bg-blue-500/10",
@@ -127,7 +140,8 @@ export function buildGraphAgents(
const task = (args.task as string) ?? "";
if (name && task) taskByName.set(name, task);
}
} else {
} else if (!isIncomingUserChat(e)) {
// Count only assistant messages, matching what the transcript renders.
messageCount.set(e.agent_id, (messageCount.get(e.agent_id) ?? 0) + 1);
}
}
@@ -162,7 +176,7 @@ export function AgentTranscript({
const mine = useMemo(
() =>
events
.filter((e) => e.agent_id === agent.id)
.filter((e) => e.agent_id === agent.id && !isIncomingUserChat(e))
.sort((a, b) => eventSeq(a.id) - eventSeq(b.id)),
[events, agent.id]
);