Skip to content

Commit be23932

Browse files
Refactor write-file to pass logger as parameter
🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 5837477 commit be23932

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

backend/src/tools/handlers/tool/write-file.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const handleWriteFile = (({
7575

7676
getLatestState,
7777
state,
78+
logger,
7879
}: {
7980
previousToolCallFinished: Promise<void>
8081
toolCall: CodebuffToolCall<'write_file'>
@@ -95,14 +96,14 @@ export const handleWriteFile = (({
9596
fullResponse?: string
9697
prompt?: string
9798
messages?: Message[]
98-
logger?: Logger
9999
} & OptionalFileProcessingState
100+
logger: Logger
100101
}): {
101102
result: Promise<CodebuffToolOutput<'write_file'>>
102103
state: FileProcessingState
103104
} => {
104105
const { path, instructions, content } = toolCall.input
105-
const { ws, fingerprintId, userId, fullResponse, prompt, logger } = state
106+
const { ws, fingerprintId, userId, fullResponse, prompt } = state
106107
if (!ws) {
107108
throw new Error('Internal error for write_file: Missing WebSocket in state')
108109
}
@@ -119,9 +120,6 @@ export const handleWriteFile = (({
119120
if (!agentMessagesUntruncated) {
120121
throw new Error('Internal error for write_file: Missing messages in state')
121122
}
122-
if (!logger) {
123-
throw new Error('Internal error for write_file: Missing logger in state')
124-
}
125123

126124
// Initialize state for this file path if needed
127125
if (!fileProcessingPromisesByPath[path]) {

0 commit comments

Comments
 (0)