UNPKG

@comake/skl-js-engine

Version:

Standard Knowledge Language Javascript Engine

113 lines 2.57 kB
/** * Options for code execution */ export interface ExecutionOptions { /** * Maximum execution time in milliseconds */ timeout?: number; /** * Maximum number of retries (default: 0) */ retries?: number; /** * Name of the function to execute (default: 'main') */ functionName?: string; /** * Allow network access (default: false) */ allowNetwork?: boolean; /** * List of domains allowed for network access * Only used when allowNetwork is true */ allowedDomains?: string[]; /** * Allow file system read access (default: false) */ allowRead?: boolean; /** * Allow access to environment variables (default: false) */ allowEnv?: boolean; /** * Enable debug mode with additional logging (default: false) */ debugMode?: boolean; } /** * Result of code execution */ export interface ExecutionResult { /** * Whether the execution was successful */ success: boolean; /** * Execution result (if successful) */ result?: any; /** * Execution error (if failed) */ error?: Error; /** * Console output logs */ logs: string[]; /** * Execution time in milliseconds */ executionTime: number; } /** * Input data structure for the executor */ export interface ExecutorInput { code: string; args: Record<string, any>; functionName: string; skdsEndpointUrl: string; } /** * Output data structure from the executor */ export interface ExecutorOutput { result?: any; error?: { message: string; name?: string; stack?: string; }; logs: string[]; executionTime?: number; } /** * Process communication data structure */ export interface ProcessCommunicationData { stdoutData: string; stderrData: string; } /** * Permission configuration for Deno execution */ export interface PermissionConfig { allowNetwork: boolean; allowedDomains: string[]; allowEnv: boolean; allowRead: boolean; } export interface ICodeExecutor { execute: (code: string, args: Record<string, any>, executionOptions: ExecutionOptions) => Promise<any>; } export interface IShutdownOptions { /** * Shutdown after timeout in milliseconds * If not provided, the process will be terminated immediately * If provided, the process will be terminated after the timeout, existing timeouts will be cancelled */ afterTimeout?: number; } //# sourceMappingURL=types.d.ts.map