@@ -8,7 +8,6 @@ import { assembleLocalAgentTemplates } from '@codebuff/backend/templates/agent-r
88import { getFileTokenScores } from '@codebuff/code-map/parse'
99import { TEST_USER_ID } from '@codebuff/common/constants'
1010import { mockModule } from '@codebuff/common/testing/mock-modules'
11- import { applyAndRevertChanges } from '@codebuff/common/util/changes'
1211import { generateCompactId } from '@codebuff/common/util/string'
1312import { handleToolCall } from '@codebuff/npm-app/tool-handlers'
1413import { getSystemInfo } from '@codebuff/npm-app/utils/system-info'
@@ -289,40 +288,6 @@ export function extractErrorFiles(output: string): string[] {
289288 . map ( ( line ) => line . split ( '(' ) [ 0 ] . trim ( ) )
290289}
291290
292- export const applyAndRevertChangesSequentially = ( ( ) => {
293- const queue : Array < ( ) => Promise < void > > = [ ]
294- let isProcessing = false
295-
296- const processQueue = async ( ) => {
297- if ( isProcessing || queue . length === 0 ) return
298- isProcessing = true
299- const nextOperation = queue . shift ( )
300- if ( nextOperation ) {
301- await nextOperation ( )
302- }
303- isProcessing = false
304- processQueue ( )
305- }
306-
307- return async (
308- projectRoot : string ,
309- changes : FileChanges ,
310- onApply : ( ) => Promise < void > ,
311- ) => {
312- return new Promise < void > ( ( resolve , reject ) => {
313- queue . push ( async ( ) => {
314- try {
315- await applyAndRevertChanges ( projectRoot , changes , onApply )
316- resolve ( )
317- } catch ( error ) {
318- reject ( error )
319- }
320- } )
321- processQueue ( )
322- } )
323- }
324- } ) ( )
325-
326291export function resetRepoToCommit ( projectPath : string , commit : string ) {
327292 console . log ( `Resetting repository at ${ projectPath } to commit ${ commit } ...` )
328293 try {
@@ -346,6 +311,5 @@ export default {
346311 runToolCalls,
347312 loopMainPrompt,
348313 extractErrorFiles,
349- applyAndRevertChangesSequentially,
350314 resetRepoToCommit,
351315}
0 commit comments