Skip to content

Commit 80b4fb6

Browse files
author
q1600822305
committed
feat: sync to v3.45.0 + restore tool protocol selector with rebuilt type definitions
1 parent a676dd1 commit 80b4fb6

5 files changed

Lines changed: 19 additions & 7 deletions

File tree

packages/types/src/model.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ export type ModelParameter = z.infer<typeof modelParametersSchema>
6565
export const isModelParameter = (value: string): value is ModelParameter =>
6666
modelParameters.includes(value as ModelParameter)
6767

68+
/**
69+
* ToolProtocol
70+
*/
71+
72+
export const TOOL_PROTOCOL = {
73+
XML: "xml" as const,
74+
NATIVE: "native" as const,
75+
}
76+
77+
export type ToolProtocol = "xml" | "native"
78+
6879
/**
6980
* ModelInfo
7081
*/
@@ -110,6 +121,10 @@ export const modelInfoSchema = z.object({
110121
isStealthModel: z.boolean().optional(),
111122
// Flag to indicate if the model is free (no cost)
112123
isFree: z.boolean().optional(),
124+
// Flag to indicate if the model supports native tool calling (OpenAI-style function calling)
125+
supportsNativeTools: z.boolean().optional(),
126+
// Default tool protocol preferred by this model
127+
defaultToolProtocol: z.enum(["xml", "native"]).optional(),
113128
// Exclude specific native tools from being available (only applies to native protocol)
114129
// These tools will be removed from the set of tools available to the model
115130
excludedTools: z.array(z.string()).optional(),

packages/types/src/provider-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ const baseProviderSettingsSchema = z.object({
172172
modelTemperature: z.number().nullish(),
173173
rateLimitSeconds: z.number().optional(),
174174
consecutiveMistakeLimit: z.number().min(0).optional(),
175+
toolProtocol: z.enum(["xml", "native"]).optional(),
175176

176177
// Model reasoning.
177178
enableReasoningEffort: z.boolean().optional(),

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,6 @@ export async function presentAssistantMessage(cline: Task) {
754754
askApproval,
755755
handleError,
756756
pushToolResult,
757-
removeClosingTag,
758-
toolProtocol,
759757
})
760758
break
761759
case "apply_patch":

src/core/prompts/tools/multi-edit-file.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { ToolArgs } from "./types"
2-
3-
export function getMultiEditFileDescription(args: ToolArgs): string {
1+
export function getMultiEditFileDescription(args: { cwd: string }): string {
42
return `## multi_edit_file
53
Description: Apply multiple edits to a single file. Two modes available:
64
1. String match: {"old_string": "find", "new_string": "replace"}

src/core/tools/MultiEditFileTool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class MultiEditFileTool extends BaseTool<"multi_edit_file"> {
149149

150150
async execute(params: MultiEditFileParams, task: Task, callbacks: ToolCallbacks): Promise<void> {
151151
const { path: relPath, edits } = params
152-
const { askApproval, handleError, pushToolResult, toolProtocol } = callbacks
152+
const { askApproval, handleError, pushToolResult } = callbacks
153153

154154
let relPathForErrorHandling: string | undefined
155155

@@ -245,7 +245,7 @@ export class MultiEditFileTool extends BaseTool<"multi_edit_file"> {
245245
await finalizePartialToolAskIfNeeded(relPath)
246246
task.didToolFailInCurrentTurn = true
247247
await task.say("rooignore_error", relPath)
248-
pushToolResult(formatResponse.rooIgnoreError(relPath, toolProtocol))
248+
pushToolResult(formatResponse.rooIgnoreError(relPath))
249249
return
250250
}
251251

0 commit comments

Comments
 (0)