| ... | @@ -1411,7 +1411,9 @@ describe("deriveMessagesTimelineRows", () => { | ... | @@ -1411,7 +1411,9 @@ describe("deriveMessagesTimelineRows", () => { |
| 1411 | ); | 1411 | ); |
| 1412 | | 1412 | |
| 1413 | it("reuses one activity row for initial thinking and the latest tool", () => { | 1413 | it("reuses one activity row for initial thinking and the latest tool", () => { |
| 1414 | const deriveRows = (toolLifecycleStatus: "inProgress" | "completed" | "declined" | null) => | 1414 | const deriveRows = ( |
| | 1415 | toolLifecycleStatus: "inProgress" | "completed" | "failed" | "declined" | null, |
| | 1416 | ) => |
| 1415 | deriveMessagesTimelineRows({ | 1417 | deriveMessagesTimelineRows({ |
| 1416 | timelineEntries: | 1418 | timelineEntries: |
| 1417 | toolLifecycleStatus === null | 1419 | toolLifecycleStatus === null |
| ... | @@ -1430,6 +1432,7 @@ describe("deriveMessagesTimelineRows", () => { | ... | @@ -1430,6 +1432,7 @@ describe("deriveMessagesTimelineRows", () => { |
| 1430 | requestKind: "command", | 1432 | requestKind: "command", |
| 1431 | tone: "tool" as const, | 1433 | tone: "tool" as const, |
| 1432 | toolLifecycleStatus, | 1434 | toolLifecycleStatus, |
| | 1435 | ...(toolLifecycleStatus === "inProgress" ? { detail: "exit code 1" } : {}), |
| 1433 | }, | 1436 | }, |
| 1434 | }, | 1437 | }, |
| 1435 | ], | 1438 | ], |
| ... | @@ -1448,6 +1451,7 @@ describe("deriveMessagesTimelineRows", () => { | ... | @@ -1448,6 +1451,7 @@ describe("deriveMessagesTimelineRows", () => { |
| 1448 | const initialRows = deriveRows(null); | 1451 | const initialRows = deriveRows(null); |
| 1449 | const runningRows = deriveRows("inProgress"); | 1452 | const runningRows = deriveRows("inProgress"); |
| 1450 | const completedRows = deriveRows("completed"); | 1453 | const completedRows = deriveRows("completed"); |
| | 1454 | const failedRows = deriveRows("failed"); |
| 1451 | const declinedRows = deriveRows("declined"); | 1455 | const declinedRows = deriveRows("declined"); |
| 1452 | const initialActivityRow = initialRows.find((row) => row.id === "live-activity-row"); | 1456 | const initialActivityRow = initialRows.find((row) => row.id === "live-activity-row"); |
| 1453 | const runningActivityRow = runningRows.find((row) => row.id === "live-activity-row"); | 1457 | const runningActivityRow = runningRows.find((row) => row.id === "live-activity-row"); |
| ... | @@ -1456,11 +1460,14 @@ describe("deriveMessagesTimelineRows", () => { | ... | @@ -1456,11 +1460,14 @@ describe("deriveMessagesTimelineRows", () => { |
| 1456 | expect(initialActivityRow).toMatchObject({ kind: "thinking" }); | 1460 | expect(initialActivityRow).toMatchObject({ kind: "thinking" }); |
| 1457 | expect(runningActivityRow).toMatchObject({ kind: "work-live", active: true }); | 1461 | expect(runningActivityRow).toMatchObject({ kind: "work-live", active: true }); |
| 1458 | expect(completedActivityRow).toMatchObject({ kind: "work-live", active: true }); | 1462 | expect(completedActivityRow).toMatchObject({ kind: "work-live", active: true }); |
| | 1463 | expect(failedRows.some((row) => row.kind === "work-live")).toBe(false); |
| | 1464 | expect(failedRows.at(-1)).toMatchObject({ kind: "thinking", id: "live-activity-row" }); |
| 1459 | expect(declinedRows.find((row) => row.kind === "work-live")).toMatchObject({ active: false }); | 1465 | expect(declinedRows.find((row) => row.kind === "work-live")).toMatchObject({ active: false }); |
| 1460 | expect(declinedRows.at(-1)).toMatchObject({ kind: "thinking", id: "live-activity-row" }); | 1466 | expect(declinedRows.at(-1)).toMatchObject({ kind: "thinking", id: "live-activity-row" }); |
| 1461 | expect(initialRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); | 1467 | expect(initialRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); |
| 1462 | expect(runningRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); | 1468 | expect(runningRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); |
| 1463 | expect(completedRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); | 1469 | expect(completedRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); |
| | 1470 | expect(failedRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); |
| 1464 | expect(declinedRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); | 1471 | expect(declinedRows.filter((row) => row.id === "live-activity-row")).toHaveLength(1); |
| 1465 | }); | 1472 | }); |
| 1466 | | 1473 | |