use crate::providers::cli::{Envelope, LocalCli, UsageNames};
use std::time::Duration;
pub const PROGRAM: &str = "codex";
pub fn envelope() -> Envelope {
Envelope::at("/output").with_usage(
"/usage",
UsageNames {
input: "input_tokens".into(),
cache_read: "cached_input_tokens".into(),
cache_write: String::new(),
output: "output_tokens".into(),
},
)
}
pub fn provider(timeout: Duration) -> LocalCli {
LocalCli::new("codex-cli", PROGRAM, ["exec", "--json"], timeout)
.reading(envelope())
.with_model_flag("--model")
.with_probe(["--version"])
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_preset_is_probed() {
assert!(provider(Duration::from_secs(60)).probe.is_some());
}
}