Path: blob/master/src/packages/conat/project/api/system.ts
5707 views
import type {1ExecuteCodeOutput,2ExecuteCodeOptions,3} from "@cocalc/util/types/execute-code";4import type { DirectoryListingEntry } from "@cocalc/util/types";5import type {6Configuration,7ConfigurationAspect,8} from "@cocalc/comm/project-configuration";9import { type ProjectJupyterApiOptions } from "@cocalc/util/jupyter/api-types";1011export const system = {12terminate: true,1314version: true,1516listing: true,17deleteFiles: true,18moveFiles: true,19renameFile: true,20realpath: true,21canonicalPaths: true,2223// these should be deprecated -- the new streaming writeFile and readFile in conat/files are better.24writeTextFileToProject: true,25readTextFileFromProject: true,2627configuration: true,2829ping: true,30test: true,31exec: true,3233signal: true,3435// jupyter stateless API36jupyterExecute: true,3738// jupyter kernel management39listJupyterKernels: true,40stopJupyterKernel: true,41};4243export interface System {44// stop the api service45terminate: () => Promise<void>;4647version: () => Promise<number>;4849listing: (opts: {50path: string;51hidden?: boolean;52}) => Promise<DirectoryListingEntry[]>;53deleteFiles: (opts: { paths: string[] }) => Promise<void>;54moveFiles: (opts: { paths: string[]; dest: string }) => Promise<void>;55renameFile: (opts: { src: string; dest: string }) => Promise<void>;56realpath: (path: string) => Promise<string>;57canonicalPaths: (paths: string[]) => Promise<string[]>;5859writeTextFileToProject: (opts: {60path: string;61content: string;62}) => Promise<void>;63readTextFileFromProject: (opts: { path: string }) => Promise<string>;6465configuration: (66aspect: ConfigurationAspect,67no_cache?,68) => Promise<Configuration>;6970ping: () => Promise<{ now: number }>;7172test: () => Promise<{ project_id: string; server_time: number }>;7374exec: (opts: ExecuteCodeOptions) => Promise<ExecuteCodeOutput>;7576signal: (opts: {77signal: number;78pids?: number[];79pid?: number;80}) => Promise<void>;8182jupyterExecute: (opts: ProjectJupyterApiOptions) => Promise<object[]>;8384listJupyterKernels: () => Promise<85{ pid: number; connectionFile: string; kernel_name?: string }[]86>;87stopJupyterKernel: (opts: { pid: number }) => Promise<{ success: boolean }>;88}899091