pub fn preflight(
driver: &str,
lib_dir: &Path,
cli_alias: Option<&str>,
) -> Result<PathBuf, LoopError>Expand description
Validate the driver name and confirm the driver lib file exists, the
driver binary is on PATH, and the lib defines driver_invoke.
driver: one of claude-code, hermes, openclaw (whitelist-enforced).
lib_dir: directory containing driver-<driver>.sh.
cli_alias: optional CLI alias from --cli flag (F2). Precedence for
binary resolution: $CLAUDE_CLI env > cli_alias > $CLI env > “claude”.
Returns the resolved path to the driver lib file on success.
Returns LoopError::Config for whitelist/path/function errors,
LoopError::Dispatch for a missing binary (the caller maps that to exit 77).