import { actions , createKernelRef } from "@nteract/core" ; import { DesktopCommand , ReqContent , ReqKernelSpec } from "../types" ; import { currentDocumentDirectory } from "../utils/directories" ; export const KillKernel = { name : "KillKernel" , props : { contentRef : "required" , } , makeAction : actions . killKernel . with ( { restarting : false } ) , } ; export const InterruptKernel = { name : "InterruptKernel" , props : { contentRef : "required" , } , makeAction : actions . interruptKernel , } ; export const RestartKernel = { name : "RestartKernel" , props : { contentRef : "required" , } , makeAction : actions . restartKernel . with ( { outputHandling : "None" } ) , } ; export const RestartAndClearAll = { name : "RestartAndClearAll" , props : { contentRef : "required" , } , makeAction : actions . restartKernel . with ( { outputHandling : "Clear All" } ) , } ; export const RestartAndRunAll = { name : "RestartAndRunAll" , props : { contentRef : "required" , } , makeAction : actions . restartKernel . with ( { outputHandling : "Run All" } ) , } ; export const NewKernel = { name : "NewKernel" , props : { contentRef : "required" , kernelSpec : "required" , } , * makeActions ( store , props ) { yield actions . launchKernel ( { cwd : currentDocumentDirectory ( store , props . contentRef ) , kernelRef : createKernelRef ( ) , selectNextKernel : true , ... props , } ) ; } , } ;