feat: add litellmProxy provider option for explicit LiteLLM compatibility (#8658)

Co-authored-by: Mark Henderson <Mark.Henderson99@hotmail.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
seilk
2026-01-16 07:00:36 +09:00
committed by opencode
parent df8e6e6014
commit 9b57db30d1
4 changed files with 226 additions and 1 deletions

View File

@@ -533,6 +533,17 @@ export namespace MessageV2 {
errorText: part.state.error,
callProviderMetadata: part.metadata,
})
// Handle pending/running tool calls to prevent dangling tool_use blocks
// Anthropic/Claude APIs require every tool_use to have a corresponding tool_result
if (part.state.status === "pending" || part.state.status === "running")
assistantMessage.parts.push({
type: ("tool-" + part.tool) as `tool-${string}`,
state: "output-error",
toolCallId: part.callID,
input: part.state.input,
errorText: "[Tool execution was interrupted]",
callProviderMetadata: part.metadata,
})
}
if (part.type === "reasoning") {
assistantMessage.parts.push({