Skip to content

Commit 3aa837e

Browse files
committed
Handle partial messages in the codebase search tool
1 parent 448dc2b commit 3aa837e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/core/tools/codebaseSearchTool.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,32 @@ export async function codebaseSearchTool(
2929
let query: string | undefined = block.params.query
3030
let directoryPrefix: string | undefined = block.params.path
3131

32-
if (!query) {
33-
cline.consecutiveMistakeCount++
34-
pushToolResult(await cline.sayAndCreateMissingParamError(toolName, "query"))
35-
return
36-
}
3732
query = removeClosingTag("query", query)
3833

3934
if (directoryPrefix) {
4035
directoryPrefix = removeClosingTag("path", directoryPrefix)
4136
directoryPrefix = path.normalize(directoryPrefix)
4237
}
4338

44-
// Extract optional sendResultsToUI parameter
45-
46-
const approvalPayload = {
39+
const sharedMessageProps = {
4740
tool: "codebaseSearch",
4841
query: query,
4942
path: directoryPrefix,
5043
isOutsideWorkspace: false,
5144
}
5245

53-
const didApprove = await askApproval("tool", JSON.stringify(approvalPayload))
46+
if (block.partial) {
47+
await cline.ask("tool", JSON.stringify(sharedMessageProps), block.partial).catch(() => {})
48+
return
49+
}
50+
51+
if (!query) {
52+
cline.consecutiveMistakeCount++
53+
pushToolResult(await cline.sayAndCreateMissingParamError(toolName, "query"))
54+
return
55+
}
56+
57+
const didApprove = await askApproval("tool", JSON.stringify(sharedMessageProps))
5458
if (!didApprove) {
5559
pushToolResult(formatResponse.toolDenied())
5660
return

0 commit comments

Comments
 (0)