/* Module: runtimes Concrete ToolRuntime implementations for specific tools. Each runtime stays small and focused and reuses the orchestrator for approvals + sandbox + retry. */ use crate::exec::ExecExpiration; use crate::path_utils; use crate::sandboxing::CommandSpec; use crate::sandboxing::SandboxPermissions; use crate::shell::Shell; use crate::tools::sandboxing::ToolError; use std::collections::HashMap; use std::path::Path; pub mod apply_patch; pub mod shell; pub mod unified_exec; /// Shared helper to construct a CommandSpec from a tokenized command line. /// Validates that at least a program is present. pub(crate) fn build_command_spec( command: &[String], cwd: &Path, env: &HashMap, expiration: ExecExpiration, sandbox_permissions: SandboxPermissions, justification: Option, ) -> Result { let (program, args) = command .split_first() .ok_or_else(|| ToolError::Rejected("command args are empty".to_string()))?; Ok(CommandSpec { program: program.clone(), args: args.to_vec(), cwd: cwd.to_path_buf(), env: env.clone(), expiration, sandbox_permissions, justification, }) } /// POSIX-only helper: for commands produced by `Shell::derive_exec_args` /// for Bash/Zsh/sh of the form `[shell_path, "-lc", "