@@ -6,7 +6,6 @@ import z from 'zod/v4'
66import { convertJsonSchemaToZod } from 'zod-from-json-schema'
77
88import { checkLiveUserInput } from '../live-user-inputs'
9- import { logger } from '../util/logger'
109import { requestToolCall } from '../websockets/websocket-action'
1110import { codebuffToolDefs } from './definitions/list'
1211import { codebuffToolHandlers } from './handlers/list'
@@ -31,6 +30,7 @@ import type {
3130 customToolDefinitionsSchema ,
3231 ProjectFileContext ,
3332} from '@codebuff/common/util/file'
33+ import type { Logger } from '@codebuff/types/logger'
3434import type { WebSocket } from 'ws'
3535
3636export type CustomToolCall = {
@@ -131,28 +131,33 @@ export interface ExecuteToolCallParams<T extends string = ToolName> {
131131 userId : string | undefined
132132 autoInsertEndStepParam ?: boolean
133133 excludeToolFromMessageHistory ?: boolean
134+ logger : Logger
134135}
135136
136- export function executeToolCall < T extends ToolName > ( {
137- toolName,
138- input,
139- toolCalls,
140- toolResults,
141- toolResultsToAddAfterStream,
142- previousToolCallFinished,
143- ws,
144- agentTemplate,
145- fileContext,
146- agentStepId,
147- clientSessionId,
148- userInputId,
149- fullResponse,
150- onResponseChunk,
151- state,
152- userId,
153- autoInsertEndStepParam = false ,
154- excludeToolFromMessageHistory = false ,
155- } : ExecuteToolCallParams < T > ) : Promise < void > {
137+ export function executeToolCall < T extends ToolName > (
138+ params : ExecuteToolCallParams < T > ,
139+ ) : Promise < void > {
140+ const {
141+ toolName,
142+ input,
143+ toolCalls,
144+ toolResults,
145+ toolResultsToAddAfterStream,
146+ previousToolCallFinished,
147+ ws,
148+ agentTemplate,
149+ fileContext,
150+ agentStepId,
151+ clientSessionId,
152+ userInputId,
153+ fullResponse,
154+ onResponseChunk,
155+ state,
156+ userId,
157+ autoInsertEndStepParam = false ,
158+ excludeToolFromMessageHistory = false ,
159+ logger,
160+ } = params
156161 const toolCall : CodebuffToolCall < T > | ToolCallError = parseRawToolCall < T > ( {
157162 rawToolCall : {
158163 toolName,
@@ -360,24 +365,28 @@ export function parseRawCustomToolCall(params: {
360365 }
361366}
362367
363- export async function executeCustomToolCall ( {
364- toolName,
365- input,
366- toolCalls,
367- toolResults,
368- toolResultsToAddAfterStream,
369- previousToolCallFinished,
370- ws,
371- agentTemplate,
372- fileContext,
373- clientSessionId,
374- userInputId,
375- onResponseChunk,
376- state,
377- userId,
378- autoInsertEndStepParam = false ,
379- excludeToolFromMessageHistory = false ,
380- } : ExecuteToolCallParams < string > ) : Promise < void > {
368+ export async function executeCustomToolCall (
369+ params : ExecuteToolCallParams < string > ,
370+ ) : Promise < void > {
371+ const {
372+ toolName,
373+ input,
374+ toolCalls,
375+ toolResults,
376+ toolResultsToAddAfterStream,
377+ previousToolCallFinished,
378+ ws,
379+ agentTemplate,
380+ fileContext,
381+ clientSessionId,
382+ userInputId,
383+ onResponseChunk,
384+ state,
385+ userId,
386+ autoInsertEndStepParam = false ,
387+ excludeToolFromMessageHistory = false ,
388+ logger,
389+ } = params
381390 const toolCall : CustomToolCall | ToolCallError = parseRawCustomToolCall ( {
382391 customToolDefs : await getMCPToolData ( {
383392 ws,
0 commit comments