File tree Expand file tree Collapse file tree 1 file changed +41
-2
lines changed Expand file tree Collapse file tree 1 file changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
2626 createFile ,
2727 readFile ,
2828 deleteFile ,
29+ deleteExec ,
2930 performFileAction ,
3031 listDirectory ,
3132 createDirectory ,
@@ -242,8 +243,46 @@ export class PintShellsClient implements IAgentClientShells {
242243 buffer : [ ] ,
243244 } ;
244245 }
245- delete ( shellId : ShellId ) : Promise < CommandShellDTO | TerminalShellDTO | null > {
246- throw new Error ( "Not implemented" ) ;
246+ async delete ( shellId : ShellId ) : Promise < CommandShellDTO | TerminalShellDTO | null > {
247+ try {
248+ // First get the exec details before deleting it
249+ const exec = await getExec ( {
250+ client : this . apiClient ,
251+ path : {
252+ id : shellId ,
253+ } ,
254+ } ) ;
255+
256+ if ( ! exec . data ) {
257+ return null ; // Exec doesn't exist
258+ }
259+
260+ // Convert to shell DTO before deletion
261+ const shellDTO = this . convertExecToShellDTO ( exec . data ) ;
262+
263+ // Delete the exec
264+ const deleteResponse = await deleteExec ( {
265+ client : this . apiClient ,
266+ path : {
267+ id : shellId ,
268+ } ,
269+ } ) ;
270+
271+ if ( deleteResponse . data ) {
272+ // Clean up any open shells reference
273+ if ( this . openShells [ shellId ] ) {
274+ this . openShells [ shellId ] . abort ( ) ;
275+ delete this . openShells [ shellId ] ;
276+ }
277+
278+ return shellDTO as CommandShellDTO | TerminalShellDTO ;
279+ } else {
280+ return null ;
281+ }
282+ } catch ( error ) {
283+ console . error ( "Failed to delete shell:" , error ) ;
284+ return null ;
285+ }
247286 }
248287 async getShells ( ) : Promise < ShellDTO [ ] > {
249288 const execs = await listExecs ( {
You can’t perform that action at this time.
0 commit comments