import { Emitter } from 'strict-event-emitter'; import type { MessageSender, WorkerStatusUpdate } from '../messages'; export interface ShellEvents { 'shell/runCommand': [ { command: string; args: Array; options: ShellCommandOptions; }, ShellInfo ]; 'shell/exit': ShellInfo; 'shell/stdin': { data: string | Uint8Array; workerId: string; }; } export interface ShellCommandOptions { cwd?: string; env?: Record; } export declare type ShellInfo = { id: string; }; export declare class ShellApi { private readonly channel; constructor(channel: MessageSender); create(): ShellProcess; } export declare class ShellProcess { private readonly channel; id?: string; state: 'running' | 'idle'; stdout: Emitter<{ data: [string]; }>; stderr: Emitter<{ data: [string]; }>; stdin: { write: (data: string | Uint8Array) => Promise; }; constructor(channel: MessageSender); private forwardStdEvents; /** * Evaluates a given module in the File */ runCommand(command: string, args: Array, options?: ShellCommandOptions): Promise; on(message: 'exit', listener: (exitCode: number, error?: { message: string; }) => void): Promise; on(message: 'progress', listener: (status: WorkerStatusUpdate) => void): Promise; /** * Terminates the shell process. */ kill(): Promise; }