@@ -42,10 +42,10 @@ import {
4242 MAX_CHECKPOINT_TIMEOUT_SECONDS ,
4343 MIN_CHECKPOINT_TIMEOUT_SECONDS ,
4444 TOOL_PROTOCOL ,
45- ToolProtocol ,
4645} from "@roo-code/types"
4746import { TelemetryService } from "@roo-code/telemetry"
4847import { CloudService , BridgeOrchestrator } from "@roo-code/cloud"
48+ import { getToolProtocolFromSettings } from "../../utils/toolProtocol"
4949
5050// api
5151import { ApiHandler , ApiHandlerCreateMessageMetadata , buildApiHandler } from "../../api"
@@ -408,8 +408,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
408408
409409 // Initialize the assistant message parser only for XML protocol.
410410 // For native protocol, tool calls come as tool_call chunks, not XML.
411- const toolProtocol = vscode . workspace . getConfiguration ( Package . name ) . get < ToolProtocol > ( "toolProtocol" , "xml" )
412- this . assistantMessageParser = toolProtocol === "xml" ? new AssistantMessageParser ( ) : undefined
411+ this . assistantMessageParser = getToolProtocolFromSettings ( ) === "xml" ? new AssistantMessageParser ( ) : undefined
413412
414413 this . messageQueueService = new MessageQueueService ( )
415414
@@ -2416,16 +2415,14 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
24162415 const parsedBlocks = this . assistantMessageParser . getContentBlocks ( )
24172416
24182417 // Check if we're using native protocol
2419- const toolProtocol = vscode . workspace
2420- . getConfiguration ( Package . name )
2421- . get < ToolProtocol > ( "toolProtocol" , "xml" )
2422- const isNative = isNativeProtocol ( toolProtocol )
2418+ const isNative = isNativeProtocol ( getToolProtocolFromSettings ( ) )
24232419
24242420 if ( isNative ) {
24252421 // For native protocol: Preserve tool_use blocks that were added via tool_call chunks
24262422 // These are added directly to assistantMessageContent and have an 'id' property
24272423 const nativeToolBlocks = this . assistantMessageContent . filter (
2428- ( block ) : block is ToolUse < any > => block . type === "tool_use" && ( block as any ) . id !== undefined ,
2424+ ( block ) : block is ToolUse < any > =>
2425+ block . type === "tool_use" && ( block as any ) . id !== undefined ,
24292426 )
24302427 // Merge: parser blocks (text) + native tool blocks (tools with IDs)
24312428 this . assistantMessageContent = [ ...parsedBlocks , ...nativeToolBlocks ]
@@ -2580,10 +2577,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
25802577 // apiConversationHistory at line 1876. Since the assistant failed to respond,
25812578 // we need to remove that message before retrying to avoid having two consecutive
25822579 // user messages (which would cause tool_result validation errors).
2583- const toolProtocol = vscode . workspace
2584- . getConfiguration ( Package . name )
2585- . get < ToolProtocol > ( "toolProtocol" , "xml" )
2586- const isNativeProtocol = toolProtocol === TOOL_PROTOCOL . NATIVE
2580+ const isNativeProtocol = getToolProtocolFromSettings ( ) === TOOL_PROTOCOL . NATIVE
25872581
25882582 if ( isNativeProtocol && this . apiConversationHistory . length > 0 ) {
25892583 const lastMessage = this . apiConversationHistory [ this . apiConversationHistory . length - 1 ]
@@ -2770,9 +2764,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
27702764 newTaskRequireTodos : vscode . workspace
27712765 . getConfiguration ( Package . name )
27722766 . get < boolean > ( "newTaskRequireTodos" , false ) ,
2773- toolProtocol : vscode . workspace
2774- . getConfiguration ( Package . name )
2775- . get < ToolProtocol > ( "toolProtocol" , "xml" ) ,
2767+ toolProtocol : getToolProtocolFromSettings ( ) ,
27762768 } ,
27772769 undefined , // todoList
27782770 this . api . getModel ( ) . id ,
@@ -2982,7 +2974,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
29822974 // Determine if we should include native tools based on:
29832975 // 1. Tool protocol is set to NATIVE
29842976 // 2. Model supports native tools
2985- const toolProtocol = vscode . workspace . getConfiguration ( Package . name ) . get < ToolProtocol > ( "toolProtocol" , "xml" )
2977+ const toolProtocol = getToolProtocolFromSettings ( )
29862978 const modelInfo = this . api . getModel ( ) . info
29872979 const shouldIncludeTools = toolProtocol === TOOL_PROTOCOL . NATIVE && ( modelInfo . supportsNativeTools ?? false )
29882980
0 commit comments