refactor(coding-agent): replaced reverse/find usage with last-item array helpers

- Updated plan-mode and hindsight session state lookups to use Array.findLast for selecting the latest assistant or user message.
- Updated postmortem callback iteration to use Array.toReversed before mapping cleanup callbacks.
This commit is contained in:
can1357
2026-05-15 11:57:05 +02:00
parent ea76fae05f
commit 361a40dc43
3 changed files with 4 additions and 5 deletions
@@ -426,7 +426,7 @@ Execute each step in order.`,
// Extract todos from last message
const messages = event.messages;
const lastAssistant = [...messages].reverse().find(m => m.role === "assistant");
const lastAssistant = messages.findLast(m => m.role === "assistant");
if (lastAssistant && Array.isArray(lastAssistant.content)) {
const textContent = lastAssistant.content
.filter(