fix: Update condition for final message in output (#106)

The last message in the Claude Code output does not have a role, but instead has a field "type" set to "result". With the current condition, the duration is never appended to the header of the comments.
This commit is contained in:
Andrew Munsell
2025-06-01 18:33:02 -07:00
committed by GitHub
parent a8a36ced96
commit 0cd44e50dd

View File

@@ -166,7 +166,7 @@ async function run() {
if (Array.isArray(outputData) && outputData.length > 0) {
const lastElement = outputData[outputData.length - 1];
if (
lastElement.role === "system" &&
lastElement.type === "result" &&
"cost_usd" in lastElement &&
"duration_ms" in lastElement
) {