fix(session-recovery): recognize 'tool' type as valid content

OpenCode storage uses 'tool' type for tool calls, but the hasContent
check only recognized 'tool_use' (Anthropic API format). This caused
messages with tool calls to be incorrectly identified as empty.
This commit is contained in:
YeonGyu-Kim
2025-12-08 11:36:15 +09:00
parent aa35f2eab6
commit 0df7e9b10b

View File

@@ -344,7 +344,7 @@ function findEmptyContentMessageFromStorage(sessionID: string): string | null {
if (THINKING_TYPES.has(p.type)) return false
if (META_TYPES.has(p.type)) return false
if (p.type === "text" && p.text?.trim()) return true
if (p.type === "tool_use") return true
if (p.type === "tool_use" || p.type === "tool") return true
if (p.type === "tool_result") return true
return false
})
@@ -365,7 +365,7 @@ function hasNonEmptyOutput(msg: MessageData): boolean {
if (THINKING_TYPES.has(p.type)) return false
if (p.type === "step-start" || p.type === "step-finish") return false
if (p.type === "text" && p.text && p.text.trim()) return true
if (p.type === "tool_use" && p.id) return true
if ((p.type === "tool_use" || p.type === "tool") && p.id) return true
if (p.type === "tool_result") return true
return false
})