File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import { PrintModeEvent } from '../../common/src/types/print-mode'
1919export type ClientToolName =
2020 | 'read_files'
2121 | 'write_file'
22- | 'str_replace'
2322 | 'run_terminal_command'
2423
2524export type CodebuffClientOptions = {
@@ -216,7 +215,11 @@ export class CodebuffClient {
216215 const args = action . args
217216 let result : string
218217 try {
219- const override = this . overrideTools [ toolName as ClientToolName ]
218+ let override = this . overrideTools [ toolName as ClientToolName ]
219+ if ( ! override && toolName === 'str_replace' ) {
220+ // Note: write_file and str_replace have the same implementation, so reuse their write_file override.
221+ override = this . overrideTools [ 'write_file' ]
222+ }
220223 if ( override ) {
221224 const overrideResult = await override ( args )
222225 result = overrideResult . toolResultMessage
@@ -231,7 +234,7 @@ export class CodebuffClient {
231234 )
232235 } else {
233236 throw new Error (
234- `Tool not implemented in sdk . Please provide an override or modify your agent to not use this tool: ${ toolName } ` ,
237+ `Tool not implemented in SDK . Please provide an override or modify your agent to not use this tool: ${ toolName } ` ,
235238 )
236239 }
237240 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments