File tree Expand file tree Collapse file tree 2 files changed +37
-5
lines changed Expand file tree Collapse file tree 2 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ import {
2727 readFile ,
2828 deleteFile ,
2929 deleteExec ,
30+ updateExec ,
31+ execExecStdin ,
3032 performFileAction ,
3133 listDirectory ,
3234 createDirectory ,
@@ -348,11 +350,42 @@ export class PintShellsClient implements IAgentClientShells {
348350 async rename ( shellId : ShellId , name : string ) : Promise < null > {
349351 return null ;
350352 }
351- restart ( shellId : ShellId ) : Promise < null > {
352- throw new Error ( "Not implemented" ) ;
353+ async restart ( shellId : ShellId ) : Promise < null > {
354+ try {
355+ await updateExec ( {
356+ client : this . apiClient ,
357+ path : {
358+ id : shellId ,
359+ } ,
360+ body : {
361+ status : 'running' ,
362+ } ,
363+ } ) ;
364+
365+ return null ;
366+ } catch ( error ) {
367+ console . error ( "Failed to restart shell:" , error ) ;
368+ return null ;
369+ }
353370 }
354- send ( shellId : ShellId , input : string , size : ShellSize ) : Promise < null > {
355- throw new Error ( "Not implemented" ) ;
371+ async send ( shellId : ShellId , input : string , size : ShellSize ) : Promise < null > {
372+ try {
373+ await execExecStdin ( {
374+ client : this . apiClient ,
375+ path : {
376+ id : shellId ,
377+ } ,
378+ body : {
379+ type : 'stdin' ,
380+ input : input ,
381+ } ,
382+ } ) ;
383+
384+ return null ;
385+ } catch ( error ) {
386+ console . error ( "Failed to send input to shell:" , error ) ;
387+ return null ;
388+ }
356389 }
357390}
358391
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ const client = await sandbox.connect();
2020//console.log("Running command...");
2121//console.log(await client.commands.run("echo 'Hello World'"));
2222
23-
2423console . log ( "creating directory..." ) ;
2524console . log ( await client . fs . mkdir ( "/workspace/newdir" ) ) ;
2625console . log ( "creating file in new dir..." ) ;
You can’t perform that action at this time.
0 commit comments