refactor: rename getNewMessages to consumeNewMessages

Rename to signal mutation behavior - the function advances the cursor
as a side effect, so 'consume' better reflects that calling it twice
with the same input yields different results.
This commit is contained in:
Kenny
2026-01-14 21:06:26 -05:00
parent acb16bcb27
commit 3de559ff87
4 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ import { BACKGROUND_TASK_DESCRIPTION, BACKGROUND_OUTPUT_DESCRIPTION, BACKGROUND_
import { findNearestMessageWithFields, findFirstMessageWithAgent, MESSAGE_STORAGE } from "../../features/hook-message-injector"
import { getSessionAgent } from "../../features/claude-code-session-state"
import { log } from "../../shared/logger"
import { getNewMessages } from "../../shared/session-cursor"
import { consumeNewMessages } from "../../shared/session-cursor"
type OpencodeClient = PluginInput["client"]
@@ -240,7 +240,7 @@ Session ID: ${task.sessionID}
return timeA.localeCompare(timeB)
})
const newMessages = getNewMessages(task.sessionID, sortedMessages)
const newMessages = consumeNewMessages(task.sessionID, sortedMessages)
if (newMessages.length === 0) {
const duration = formatDuration(task.startedAt, task.completedAt)
return `Task Result