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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user