import { t as BlockOptions } from "./api-DwlbDD0P.mjs"; //#region src/shell.d.ts interface ShellResult { stdout: Buffer; stderr: Buffer; exitCode: number | null; } interface ShellOptions { cwd?: string; env?: Record; timeout?: number; } /** * Shell adapter interface for executing commands * Different runtimes (Bun, Node.js, Deno) implement this interface */ interface ShellAdapter { /** * Execute a shell command * @param cmd - Command array (e.g., ['bash', '-lc', script]) * @param opts - Execution options (cwd, env, timeout) * @returns Promise with stdout, stderr, exitCode */ execute(cmd: string[], opts?: ShellOptions): Promise; } interface StateFiles { envFile?: string; cwdFile?: string; funcFile?: string; } /** * Build a bash prelude script that loads session state and then runs a command. * Used by CmdSession and PtySession to wrap the subprocess command. * * The prelude: * 1. Disables errexit (set +e) so the runner can check exit codes * 2. Sources environment variables from envFile (if present) * 3. Restores working directory from cwdFile (if present) * 4. Sources function definitions from funcFile (if present) * 5. Runs the given command (without exec, since it may be a shell function) */ declare function buildSessionPrelude(cmd: string, stateFiles: StateFiles): string; /** * Escape a string for safe use in shell commands */ declare function shellEscape(s: string): string; /** * Build a bash script that loads persistent state, runs commands, and saves state * * State persistence files: * - envFile: Exported environment variables * - cwdFile: Current working directory * - funcFile: Bash function definitions */ declare function buildScript(commands: string[], opts: BlockOptions, envFile: string, cwdFile: string, funcFile: string): string; /** * Build a script to call a hook if it exists */ declare function buildHookScript(hookName: string, envFile: string, cwdFile: string, funcFile: string): string; //#endregion export { buildScript as a, buildHookScript as i, ShellOptions as n, buildSessionPrelude as o, ShellResult as r, shellEscape as s, ShellAdapter as t };