@@ -3,7 +3,7 @@ import * as fs from "fs/promises"
33import * as path from "path"
44import * as vscode from "vscode"
55
6- import type { ClineMessage } from "@roo-code/types"
6+ import { RooCodeEventName , type ClineMessage } from "@roo-code/types"
77
88import { waitFor , sleep } from "../utils"
99import { setDefaultSuiteTimeout } from "../test-utils"
@@ -192,7 +192,7 @@ function validateInput(input) {
192192 }
193193 }
194194 }
195- api . on ( "message" , messageHandler )
195+ api . on ( RooCodeEventName . Message , messageHandler )
196196
197197 // Listen for task events
198198 const taskStartedHandler = ( id : string ) => {
@@ -201,15 +201,15 @@ function validateInput(input) {
201201 console . log ( "Task started:" , id )
202202 }
203203 }
204- api . on ( "taskStarted" , taskStartedHandler )
204+ api . on ( RooCodeEventName . TaskStarted , taskStartedHandler )
205205
206206 const taskCompletedHandler = ( id : string ) => {
207207 if ( id === taskId ) {
208208 taskCompleted = true
209209 console . log ( "Task completed:" , id )
210210 }
211211 }
212- api . on ( "taskCompleted" , taskCompletedHandler )
212+ api . on ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
213213
214214 let taskId : string
215215 try {
@@ -260,9 +260,9 @@ ${testFile.content}\nAssume the file exists and you can modify it directly.`,
260260 console . log ( "Test passed! apply_diff tool executed and file modified successfully" )
261261 } finally {
262262 // Clean up
263- api . off ( "message" , messageHandler )
264- api . off ( "taskStarted" , taskStartedHandler )
265- api . off ( "taskCompleted" , taskCompletedHandler )
263+ api . off ( RooCodeEventName . Message , messageHandler )
264+ api . off ( RooCodeEventName . TaskStarted , taskStartedHandler )
265+ api . off ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
266266 }
267267 } )
268268
@@ -305,7 +305,7 @@ ${testFile.content}\nAssume the file exists and you can modify it directly.`,
305305 }
306306 }
307307 }
308- api . on ( "message" , messageHandler )
308+ api . on ( RooCodeEventName . Message , messageHandler )
309309
310310 // Listen for task events
311311 const taskStartedHandler = ( id : string ) => {
@@ -314,15 +314,15 @@ ${testFile.content}\nAssume the file exists and you can modify it directly.`,
314314 console . log ( "Task started:" , id )
315315 }
316316 }
317- api . on ( "taskStarted" , taskStartedHandler )
317+ api . on ( RooCodeEventName . TaskStarted , taskStartedHandler )
318318
319319 const taskCompletedHandler = ( id : string ) => {
320320 if ( id === taskId ) {
321321 taskCompleted = true
322322 console . log ( "Task completed:" , id )
323323 }
324324 }
325- api . on ( "taskCompleted" , taskCompletedHandler )
325+ api . on ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
326326
327327 let taskId : string
328328 try {
@@ -375,9 +375,9 @@ ${testFile.content}\nAssume the file exists and you can modify it directly.`,
375375 console . log ( "Test passed! apply_diff tool executed and multiple replacements applied successfully" )
376376 } finally {
377377 // Clean up
378- api . off ( "message" , messageHandler )
379- api . off ( "taskStarted" , taskStartedHandler )
380- api . off ( "taskCompleted" , taskCompletedHandler )
378+ api . off ( RooCodeEventName . Message , messageHandler )
379+ api . off ( RooCodeEventName . TaskStarted , taskStartedHandler )
380+ api . off ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
381381 }
382382 } )
383383
@@ -424,22 +424,22 @@ function keepThis() {
424424 }
425425 }
426426 }
427- api . on ( "message" , messageHandler )
427+ api . on ( RooCodeEventName . Message , messageHandler )
428428
429429 // Listen for task events
430430 const taskStartedHandler = ( id : string ) => {
431431 if ( id === taskId ) {
432432 taskStarted = true
433433 }
434434 }
435- api . on ( "taskStarted" , taskStartedHandler )
435+ api . on ( RooCodeEventName . TaskStarted , taskStartedHandler )
436436
437437 const taskCompletedHandler = ( id : string ) => {
438438 if ( id === taskId ) {
439439 taskCompleted = true
440440 }
441441 }
442- api . on ( "taskCompleted" , taskCompletedHandler )
442+ api . on ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
443443
444444 let taskId : string
445445 try {
@@ -487,9 +487,9 @@ ${testFile.content}\nAssume the file exists and you can modify it directly.`,
487487 console . log ( "Test passed! apply_diff tool executed and targeted modification successful" )
488488 } finally {
489489 // Clean up
490- api . off ( "message" , messageHandler )
491- api . off ( "taskStarted" , taskStartedHandler )
492- api . off ( "taskCompleted" , taskCompletedHandler )
490+ api . off ( RooCodeEventName . Message , messageHandler )
491+ api . off ( RooCodeEventName . TaskStarted , taskStartedHandler )
492+ api . off ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
493493 }
494494 } )
495495
@@ -532,22 +532,22 @@ ${testFile.content}\nAssume the file exists and you can modify it directly.`,
532532 }
533533 }
534534 }
535- api . on ( "message" , messageHandler )
535+ api . on ( RooCodeEventName . Message , messageHandler )
536536
537537 // Listen for task events
538538 const taskStartedHandler = ( id : string ) => {
539539 if ( id === taskId ) {
540540 taskStarted = true
541541 }
542542 }
543- api . on ( "taskStarted" , taskStartedHandler )
543+ api . on ( RooCodeEventName . TaskStarted , taskStartedHandler )
544544
545545 const taskCompletedHandler = ( id : string ) => {
546546 if ( id === taskId ) {
547547 taskCompleted = true
548548 }
549549 }
550- api . on ( "taskCompleted" , taskCompletedHandler )
550+ api . on ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
551551
552552 let taskId : string
553553 try {
@@ -598,9 +598,9 @@ Assume the file exists and you can modify it directly.`,
598598 console . log ( "Test passed! apply_diff attempted and error handled gracefully" )
599599 } finally {
600600 // Clean up
601- api . off ( "message" , messageHandler )
602- api . off ( "taskStarted" , taskStartedHandler )
603- api . off ( "taskCompleted" , taskCompletedHandler )
601+ api . off ( RooCodeEventName . Message , messageHandler )
602+ api . off ( RooCodeEventName . TaskStarted , taskStartedHandler )
603+ api . off ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
604604 }
605605 } )
606606
@@ -663,7 +663,7 @@ function checkInput(input) {
663663 }
664664 }
665665 }
666- api . on ( "message" , messageHandler )
666+ api . on ( RooCodeEventName . Message , messageHandler )
667667
668668 // Listen for task events
669669 const taskStartedHandler = ( id : string ) => {
@@ -672,15 +672,15 @@ function checkInput(input) {
672672 console . log ( "Task started:" , id )
673673 }
674674 }
675- api . on ( "taskStarted" , taskStartedHandler )
675+ api . on ( RooCodeEventName . TaskStarted , taskStartedHandler )
676676
677677 const taskCompletedHandler = ( id : string ) => {
678678 if ( id === taskId ) {
679679 taskCompleted = true
680680 console . log ( "Task completed:" , id )
681681 }
682682 }
683- api . on ( "taskCompleted" , taskCompletedHandler )
683+ api . on ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
684684
685685 let taskId : string
686686 try {
@@ -742,9 +742,9 @@ Assume the file exists and you can modify it directly.`,
742742 console . log ( "Test passed! apply_diff tool executed and multiple search/replace blocks applied successfully" )
743743 } finally {
744744 // Clean up
745- api . off ( "message" , messageHandler )
746- api . off ( "taskStarted" , taskStartedHandler )
747- api . off ( "taskCompleted" , taskCompletedHandler )
745+ api . off ( RooCodeEventName . Message , messageHandler )
746+ api . off ( RooCodeEventName . TaskStarted , taskStartedHandler )
747+ api . off ( RooCodeEventName . TaskCompleted , taskCompletedHandler )
748748 }
749749 } )
750750} )
0 commit comments