Render sub-agent activity from log

This commit is contained in:
Mohamed Boudra
2026-05-02 17:20:22 +07:00
parent 771f164e26
commit 49e3011a28
21 changed files with 208 additions and 303 deletions
@@ -179,13 +179,6 @@ describe("shared messages stream parsing", () => {
subAgentType: "Explore",
description: "Inspect repository structure",
log: "[Read] README.md",
actions: [
{
index: 1,
toolName: "Read",
summary: "README.md",
},
],
},
error: null,
},
@@ -122,18 +122,6 @@ describe("shared messages tool_call schema", () => {
subAgentType: "Explore",
description: "Inspect repository structure",
log: "[Read] README.md\n[Bash] ls",
actions: [
{
index: 1,
toolName: "Read",
summary: "README.md",
},
{
index: 2,
toolName: "Bash",
summary: "ls",
},
],
},
});
@@ -142,12 +130,11 @@ describe("shared messages tool_call schema", () => {
expect(parsed.detail.type).toBe("sub_agent");
if (parsed.detail.type === "sub_agent") {
expect(parsed.detail.subAgentType).toBe("Explore");
expect(parsed.detail.actions).toHaveLength(2);
}
}
});
it("defaults missing sub_agent actions for older payloads", () => {
it("parses sub_agent detail without structured actions", () => {
const parsed = AgentTimelineItemPayloadSchema.parse({
type: "tool_call",
callId: "call_sub_agent_legacy",
@@ -166,7 +153,7 @@ describe("shared messages tool_call schema", () => {
if (parsed.type === "tool_call") {
expect(parsed.detail.type).toBe("sub_agent");
if (parsed.detail.type === "sub_agent") {
expect(parsed.detail.actions).toEqual([]);
expect(parsed.detail.log).toBe("[Read] README.md");
}
}
});
-10
View File
@@ -414,16 +414,6 @@ const ToolCallDetailPayloadSchema: z.ZodType<ToolCallDetail, z.ZodTypeDef, unkno
description: z.string().optional(),
childSessionId: z.string().optional(),
log: z.string(),
actions: z
.array(
z.object({
index: z.number().int().positive(),
toolName: z.string(),
summary: z.string().optional(),
}),
)
.optional()
.default([]),
}),
z.object({
type: z.literal("plain_text"),
@@ -48,13 +48,6 @@ describe("shared tool-call display mapping", () => {
subAgentType: "Explore",
description: "Inspect repository structure",
log: "[Read] README.md",
actions: [
{
index: 1,
toolName: "Read",
summary: "README.md",
},
],
},
});