import type { ProxyMarked, Remote } from 'comlink'; import type { IWorkerIO } from './buffered_io'; import type { IInitDriveFSCallback, IOutputCallback, IQueryParamsCallback, ISize } from './callback'; import type { ICallExternalCommand, ICallExternalTabComplete, IDownloadModuleCallback, IEnableBufferedStdinCallback, ISetMainIOCallback, ITerminateCallback } from './callback_internal'; import type { IStdinContext } from './context'; import type { IShell } from './defs'; import type { Termios } from './termios'; /** * Representation of external commmand in the web worker, real external commands exists in the * main UI thread. */ export interface IExternalCommandConfig { name: string; hasTabComplete: boolean; } interface IOptionsCommon { shellId: string; color: boolean; mountpoint?: string; cwd?: string; baseUrl: string; wasmBaseUrl: string; browsingContextId?: string; aliases: { [key: string]: string; }; environment: { [key: string]: string | undefined; }; externalCommandConfigs: IExternalCommandConfig[]; initialDirectories?: string[]; initialFiles?: IShell.IFiles; } interface IShellCommon { initialize(options: IShellWorker.IOptions, callExternalCommand: IShellWorker.IProxyCallExternalCommand, callExternalTabComplete: IShellWorker.IProxyCallExternalTabComplete, downloadModuleCallback: IShellWorker.IProxyDownloadModuleCallback, enableBufferedStdinCallback: IShellWorker.IProxyEnableBufferedStdinCallback, outputCallback: IShellWorker.IProxyOutputCallback, setMainIOCallback: IShellWorker.IProxySetMainIOCallback, terminateCallback: IShellWorker.IProxyTerminateCallback, wasmUrlQueryParamsCallback?: IShellWorker.IProxyQueryParamsCallback): void; exitCode: number; externalInput(maxChars: number | null): Promise; externalOutput(text: string, isStderr: boolean): void; input(char: string): Promise; setSize(size: ISize): void; start(): Promise; themeChange(isDark?: boolean): Promise; } export interface IShellWorker extends IShellCommon { externalSetTermios(flags: Termios.IFlags): void; } export interface IShellImpl extends IShellCommon { } export declare namespace IShellWorker { interface IProxyCallExternalCommand extends ICallExternalCommand, ProxyMarked { } interface IProxyCallExternalTabComplete extends ICallExternalTabComplete, ProxyMarked { } interface IProxyDownloadModuleCallback extends IDownloadModuleCallback, ProxyMarked { } interface IProxyEnableBufferedStdinCallback extends IEnableBufferedStdinCallback, ProxyMarked { } interface IProxyOutputCallback extends IOutputCallback, ProxyMarked { } interface IProxyQueryParamsCallback extends IQueryParamsCallback, ProxyMarked { } interface IProxySetMainIOCallback extends ISetMainIOCallback, ProxyMarked { } interface IProxyTerminateCallback extends ITerminateCallback, ProxyMarked { } interface IOptions extends IOptionsCommon { sharedArrayBuffer?: SharedArrayBuffer; supportsServiceWorker: boolean; } } export type IRemoteShell = Remote; export declare namespace IShellImpl { interface IOptions extends IOptionsCommon { callExternalCommand: IShellWorker.IProxyCallExternalCommand; callExternalTabComplete: IShellWorker.IProxyCallExternalTabComplete; downloadModuleCallback: IShellWorker.IProxyDownloadModuleCallback; enableBufferedStdinCallback: IEnableBufferedStdinCallback; initDriveFSCallback: IInitDriveFSCallback; terminateCallback: IShellWorker.IProxyTerminateCallback; workerIO: IWorkerIO; stdinContext: IStdinContext; termios: Termios.Termios; wasmUrlQueryParamsCallback?: IShellWorker.IProxyQueryParamsCallback; } } export {};