/** * Shared command execution utilities for extensions and custom tools. */ /** * Options for executing shell commands. */ export interface ExecOptions { /** AbortSignal to cancel the command */ signal?: AbortSignal; /** Timeout in milliseconds */ timeout?: number; /** Working directory */ cwd?: string; /** Environment for the child process. Defaults to process.env. */ env?: NodeJS.ProcessEnv; /** * Maximum output retained per stream, in UTF-16 code units (~bytes for ASCII). * Output is kept as a rolling tail; when exceeded, the oldest output is dropped * and the matching truncation flag is set on the result. Defaults to 16 MiB. */ maxBuffer?: number; } /** * Result of executing a shell command. */ export interface ExecResult { stdout: string; stderr: string; code: number; killed: boolean; /** True when stdout exceeded maxBuffer and only its tail was retained. */ stdoutTruncated: boolean; /** True when stderr exceeded maxBuffer and only its tail was retained. */ stderrTruncated: boolean; /** Present when the process failed to spawn (e.g. ENOENT); code is 1 in that case. */ errorMessage?: string; } export interface RollingOutputBuffer { push(chunk: string): void; text(): string; truncated(): boolean; } /** Bounded child-process output accumulator: keeps a rolling tail of at most maxUnits UTF-16 units. */ export declare function createRollingOutputBuffer(maxUnits: number): RollingOutputBuffer; /** * Execute a shell command and return stdout/stderr/code. * Supports timeout and abort signal. Output retention per stream is bounded * (rolling tail, see ExecOptions.maxBuffer) so a chatty child process cannot * grow the host heap without bound. */ export declare function execCommand(command: string, args: string[], cwd: string, options?: ExecOptions): Promise; //# sourceMappingURL=exec.d.ts.map