Skip to content

Commit 0df7e9b

Browse files
committed
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.
1 parent aa35f2e commit 0df7e9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/session-recovery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ function findEmptyContentMessageFromStorage(sessionID: string): string | null {
344344
if (THINKING_TYPES.has(p.type)) return false
345345
if (META_TYPES.has(p.type)) return false
346346
if (p.type === "text" && p.text?.trim()) return true
347-
if (p.type === "tool_use") return true
347+
if (p.type === "tool_use" || p.type === "tool") return true
348348
if (p.type === "tool_result") return true
349349
return false
350350
})
@@ -365,7 +365,7 @@ function hasNonEmptyOutput(msg: MessageData): boolean {
365365
if (THINKING_TYPES.has(p.type)) return false
366366
if (p.type === "step-start" || p.type === "step-finish") return false
367367
if (p.type === "text" && p.text && p.text.trim()) return true
368-
if (p.type === "tool_use" && p.id) return true
368+
if ((p.type === "tool_use" || p.type === "tool") && p.id) return true
369369
if (p.type === "tool_result") return true
370370
return false
371371
})

0 commit comments

Comments
 (0)