@@ -38,67 +38,20 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
3838 ipc . on ( IpcMessageType . TaskCommand , async ( _clientId , { commandName, data } ) => {
3939 switch ( commandName ) {
4040 case TaskCommandName . StartNewTask :
41- this . log ( `[API] StartNewTask -> ${ data . text } ` )
42- this . log ( `[API] StartNewTask -> ${ JSON . stringify ( data . configuration ) } ` )
43-
44- try {
45- await this . startNewTask ( data )
46-
47- ipc . broadcast ( {
48- type : IpcMessageType . TaskEvent ,
49- origin : IpcOrigin . Server ,
50- data : {
51- eventName : RooCodeEventName . Message ,
52- payload : [
53- {
54- taskId : "[system]" ,
55- action : "created" ,
56- message : {
57- ts : Date . now ( ) ,
58- type : "say" ,
59- text : `ACK: TaskCommand -> ${ commandName } ` ,
60- } ,
61- } ,
62- ] ,
63- } ,
64- } )
65- } catch ( error ) {
66- this . log ( `[API] error starting new task: ${ error } ` )
67- }
68-
41+ this . log ( `[API] StartNewTask -> ${ data . text } , ${ JSON . stringify ( data . configuration ) } ` )
42+ await this . startNewTask ( data )
6943 break
7044 case TaskCommandName . CancelTask :
7145 this . log ( `[API] CancelTask -> ${ data } ` )
72-
7346 await this . cancelTask ( data )
74-
75- ipc . broadcast ( {
76- type : IpcMessageType . TaskEvent ,
77- origin : IpcOrigin . Server ,
78- data : {
79- eventName : RooCodeEventName . Message ,
80- payload : [
81- {
82- taskId : "[system]" ,
83- action : "created" ,
84- message : {
85- ts : Date . now ( ) ,
86- type : "say" ,
87- text : `ACK: CancelTask -> ${ data } ` ,
88- } ,
89- } ,
90- ] ,
91- } ,
92- } )
93-
47+ break
48+ case TaskCommandName . CloseTask :
49+ this . log ( `[API] CloseTask -> ${ data } ` )
50+ await vscode . commands . executeCommand ( "workbench.action.files.saveFiles" )
51+ await vscode . commands . executeCommand ( "workbench.action.closeWindow" )
9452 break
9553 }
9654 } )
97-
98- ipc . on ( IpcMessageType . VSCodeCommand , async ( _clientId , command ) => {
99- this . log ( `[API] VSCodeCommand -> ${ command } ` )
100- await vscode . commands . executeCommand ( command )
101- } )
10255 }
10356 }
10457
0 commit comments