Skip to main content

agentmux_srv_core/backend/providers/
codex.rs

1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4use super::{Tier, ProviderConfig, ControllerType, AppServerConfig, AppServerKind};
5
6pub(super) static CODEX: ProviderConfig = ProviderConfig {
7    id: "codex",
8    tier: Tier::FirstClass,
9    cli_command: "codex",
10    controller_type: ControllerType::Subprocess,
11    app_server: Some(AppServerConfig {
12        kind: AppServerKind::Codex,
13        launch_args: &["app-server", "--listen", "stdio://"],
14        fallback_controller: ControllerType::Subprocess,
15        fallback_output_format: "codex-json",
16    }),
17    // exec subcommand runs non-interactively; --json emits NDJSON events; - reads prompt from stdin
18    launch_args: &[
19        "exec",
20        "--json",
21        "--dangerously-bypass-approvals-and-sandbox",
22        "-",
23    ],
24    // Codex resume requires a subcommand change (exec resume <id>), not a simple flag.
25    // Multi-turn is handled by re-running exec; None disables automatic --resume append.
26    persistent_launch_args: None,
27    resume_flag: None,
28    session_id_field: "thread_id",
29    styled_output_format: "codex-json",
30    auth_config_dir_env_var: "CODEX_HOME",
31    auth_dir_name: "codex",
32    history_native_subdir: Some("sessions"),
33    auth_extra_env: &[],
34    unset_env: &[],
35    npm_package: "@openai/codex",
36    pinned_version: "0.154.0",
37    base_url_env_var: None,
38    supported_vendors: &["openai"],
39    // Confirmed: SPEC_CODEX_PROVIDER_INTEGRATION_2026_08_08.md §10.2 —
40    // "Codex's native project instruction discovery continues to load
41    // user/repository AGENTS.md files normally."
42    startup_instructions_filename: Some("AGENTS.md"),
43    // Read set = the write target, per the same citation above: Codex loads
44    // repository AGENTS.md natively.
45    native_instruction_sources: &["AGENTS.md"],
46    native_instruction_dirs: &[],
47};