mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Add a standalone codex-exec-server executable (#57589)
## What changed Extract executor startup into `codex-exec-server-cli`, shared by `codex exec-server` and the new standalone binary. Preserve executor arguments, authentication, configuration overrides, and sandbox helper dispatch across both entry points. Build the standalone binary with `cargo build -p codex-exec-server-cli --bin codex-exec-server` and run it with `codex-exec-server --listen stdio`. ## Testing Add standalone CLI parsing and help coverage, plus an integration test for version reporting, stdio initialization, filesystem reads, process execution, and sandbox helper re-execution when supported. GitOrigin-RevId: ab3a81c6b91b6f45e4d72d8add2e01af8372e97f
This commit is contained in:
committed by
copyberry
parent
37f199dab1
commit
a9ea49e78b
@@ -0,0 +1,35 @@
|
||||
//! Startup shared by the full Codex CLI and the standalone executor.
|
||||
//! Internal sandbox and filesystem re-exec modes always dispatch before argument parsing.
|
||||
|
||||
use clap::CommandFactory;
|
||||
use clap::Parser;
|
||||
use codex_utils_cli::CliConfigOverrides;
|
||||
use codex_utils_cli::collect_config_overrides;
|
||||
|
||||
mod command;
|
||||
mod config;
|
||||
mod exec_server_auth;
|
||||
mod exec_server_credential;
|
||||
mod exec_server_telemetry;
|
||||
|
||||
pub use command::ExecServerCommand;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "codex-exec-server", bin_name = "codex-exec-server", version)]
|
||||
struct ExecServerCli {
|
||||
#[command(flatten)]
|
||||
config_overrides: CliConfigOverrides,
|
||||
#[command(flatten)]
|
||||
command: ExecServerCommand,
|
||||
}
|
||||
|
||||
/// Starts the executor after dispatching internal helper modes and preparing runtime paths.
|
||||
pub fn run_standalone() -> anyhow::Result<()> {
|
||||
codex_arg0::arg0_dispatch_or_else(|paths| async move {
|
||||
let args: Vec<_> = std::env::args_os().collect();
|
||||
let mut cli = ExecServerCli::parse_from(&args);
|
||||
cli.config_overrides = collect_config_overrides(ExecServerCli::command(), args)
|
||||
.unwrap_or_else(|error| error.exit());
|
||||
cli.command.run(&paths, &cli.config_overrides).await
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user