Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,11 @@ export async function presentAssistantMessage(cline: Task) {
// Track if we've already pushed a tool result for this tool call (native protocol only)
let hasToolResult = false

// Check if we're using native tool protocol (do this once before defining pushToolResult)
const toolProtocol = resolveToolProtocol(cline.apiConfiguration, cline.api.getModel().info)
const isNative = isNativeProtocol(toolProtocol)
// Determine protocol by checking if this tool call has an ID.
// Native protocol tool calls ALWAYS have an ID (set when parsed from tool_call chunks).
// XML protocol tool calls NEVER have an ID (parsed from XML text).
const toolCallId = (block as any).id
const isNative = !!toolCallId

const pushToolResult = (content: ToolResponse) => {
if (isNative && toolCallId) {
Expand Down Expand Up @@ -511,9 +512,9 @@ export async function presentAssistantMessage(cline: Task) {
case "apply_diff": {
await checkpointSaveAndMark(cline)

// Check if native protocol is enabled - if so, always use single-file class-based tool
const applyDiffToolProtocol = resolveToolProtocol(cline.apiConfiguration, cline.api.getModel().info)
if (isNativeProtocol(applyDiffToolProtocol)) {
// Check if this tool call came from native protocol by checking for ID
// Native calls always have IDs, XML calls never do
if (isNative) {
await applyDiffToolClass.handle(cline, block as ToolUse<"apply_diff">, {
askApproval,
handleError,
Expand Down
Loading