mirror of
https://github.com/openai/codex.git
synced 2026-05-01 18:06:47 +00:00
feat: codex sampler (#17784)
Add a pure sampler using the Codex auth and model config. To be used by other binary such as tape recorder
This commit is contained in:
@@ -40,11 +40,14 @@ mod app_cmd;
|
||||
mod desktop_app;
|
||||
mod marketplace_cmd;
|
||||
mod mcp_cmd;
|
||||
mod responses_cmd;
|
||||
#[cfg(not(windows))]
|
||||
mod wsl_paths;
|
||||
|
||||
use crate::marketplace_cmd::MarketplaceCli;
|
||||
use crate::mcp_cmd::McpCli;
|
||||
use crate::responses_cmd::ResponsesCommand;
|
||||
use crate::responses_cmd::run_responses_command;
|
||||
|
||||
use codex_core::config::Config;
|
||||
use codex_core::config::ConfigOverrides;
|
||||
@@ -151,6 +154,10 @@ enum Subcommand {
|
||||
#[clap(hide = true)]
|
||||
ResponsesApiProxy(ResponsesApiProxyArgs),
|
||||
|
||||
/// Internal: send one raw Responses API payload through Codex auth.
|
||||
#[clap(hide = true)]
|
||||
Responses(ResponsesCommand),
|
||||
|
||||
/// Internal: relay stdio to a Unix domain socket.
|
||||
#[clap(hide = true, name = "stdio-to-uds")]
|
||||
StdioToUds(StdioToUdsCommand),
|
||||
@@ -1015,6 +1022,14 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
|
||||
tokio::task::spawn_blocking(move || codex_responses_api_proxy::run_main(args))
|
||||
.await??;
|
||||
}
|
||||
Some(Subcommand::Responses(ResponsesCommand {})) => {
|
||||
reject_remote_mode_for_subcommand(
|
||||
root_remote.as_deref(),
|
||||
root_remote_auth_token_env.as_deref(),
|
||||
"responses",
|
||||
)?;
|
||||
run_responses_command(root_config_overrides).await?;
|
||||
}
|
||||
Some(Subcommand::StdioToUds(cmd)) => {
|
||||
reject_remote_mode_for_subcommand(
|
||||
root_remote.as_deref(),
|
||||
@@ -1666,6 +1681,15 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn responses_subcommand_is_hidden_from_help_but_parses() {
|
||||
let help = MultitoolCli::command().render_help().to_string();
|
||||
assert!(!help.contains("responses"));
|
||||
|
||||
let cli = MultitoolCli::try_parse_from(["codex", "responses"]).expect("parse");
|
||||
assert!(matches!(cli.subcommand, Some(Subcommand::Responses(_))));
|
||||
}
|
||||
|
||||
fn sample_exit_info(conversation_id: Option<&str>, thread_name: Option<&str>) -> AppExitInfo {
|
||||
let token_usage = TokenUsage {
|
||||
output_tokens: 2,
|
||||
|
||||
Reference in New Issue
Block a user