Skip to main content

AgentAdapter

Trait AgentAdapter 

Source
pub trait AgentAdapter {
    // Required methods
    fn name(&self) -> &'static str;
    fn exec_command(
        &self,
        phase: u32,
        prompt: &str,
        extra_writable_roots: &[PathBuf],
    ) -> (&'static str, Vec<String>);
    fn completion_signal_detected(&self, output: &str) -> bool;

    // Provided method
    fn extra_env(&self) -> Vec<(String, String)> { ... }
}
Expand description

Common behavior implemented by every supported coding-agent backend.

Required Methods§

Source

fn name(&self) -> &'static str

Human-readable adapter name.

Source

fn exec_command( &self, phase: u32, prompt: &str, extra_writable_roots: &[PathBuf], ) -> (&'static str, Vec<String>)

Build the command and arguments to launch this agent headless with the given prompt for phase. Returns (program, args).

extra_writable_roots are directories OUTSIDE the agent’s working directory that its sandbox must still be allowed to write. Linked git worktrees keep their git metadata under the main repo’s .git/ — and Codex additionally read-only-mounts the cwd’s resolved git dir, so BOTH the common .git and the worktree admin dir (.git/worktrees/<name>) must be granted explicitly (13-06 dogfood finding, verified with codex sandbox probes). Adapters without a sandbox ignore it.

Source

fn completion_signal_detected(&self, output: &str) -> bool

Detect an agent-specific completion signal in captured output.

Provided Methods§

Source

fn extra_env(&self) -> Vec<(String, String)>

Extra environment variables for the agent process tree. Codex uses this to disable commit/tag signing inside its sandbox: the operator’s signing agent (ssh-agent/gpg-agent) is unreachable there, so signed commits fail headless with a passphrase error (13-06 dogfood finding — same rationale as the unsigned VersionBump tags). GIT_CONFIG_* env scoping keeps the override out of every repo/global config.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§