pub struct AppServerBuilder { /* private fields */ }Expand description
Builder for launching a Codex app-server process.
Produces commands of the form: codex [-c k=v]... app-server --listen stdio:// [extra]...
All model, sandbox, and approval configuration that isn’t expressible as a
CLI flag is done via JSON-RPC requests after connecting. For everything
that is a CLI flag, see config_override and
extra_args.
Implementations§
Source§impl AppServerBuilder
impl AppServerBuilder
Sourcepub fn working_directory<P: Into<PathBuf>>(self, dir: P) -> Self
pub fn working_directory<P: Into<PathBuf>>(self, dir: P) -> Self
Set the working directory for the app-server process.
Sourcepub fn config_override<K, V>(self, key: K, value: V) -> Self
pub fn config_override<K, V>(self, key: K, value: V) -> Self
Append a -c key=value global config override.
Repeatable. Each call appends one override; order is preserved on the
command line. The value is passed to codex unparsed — codex tries
TOML, then falls back to the raw string. The caller is responsible for
any quoting / escaping the value itself needs (e.g. arrays:
("sandbox_permissions", r#"["disk-full-read-access"]"#)).
-c flags are placed before the app-server subcommand because
they’re parsed as global codex options, not subcommand args.
§Example
use codex_codes::AppServerBuilder;
let builder = AppServerBuilder::new()
.config_override("sandbox_mode", "workspace-write")
.config_override("approval_policy", "on-request");Sourcepub fn extra_args<I, S>(self, args: I) -> Self
pub fn extra_args<I, S>(self, args: I) -> Self
Append raw arguments to the app-server subcommand invocation.
Inserted after the hardcoded --listen stdio://, so they land as
subcommand args. Use this for flags the SDK doesn’t model yet — e.g.
--strict-config, or --session-source app-server once that becomes
available on the multitool subcommand.
For -c key=value global overrides use config_override
instead; those need to be placed before the subcommand.
§Example
use codex_codes::AppServerBuilder;
let builder = AppServerBuilder::new()
.extra_args(["--strict-config"]);Sourcepub fn spawn_sync(self) -> Result<Child>
pub fn spawn_sync(self) -> Result<Child>
Spawn the app-server process synchronously.
Trait Implementations§
Source§impl Clone for AppServerBuilder
impl Clone for AppServerBuilder
Source§fn clone(&self) -> AppServerBuilder
fn clone(&self) -> AppServerBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more