diff --git a/codex-rs/exec/src/cli.rs b/codex-rs/exec/src/cli.rs index 5774fc18..2f5fe4fb 100644 --- a/codex-rs/exec/src/cli.rs +++ b/codex-rs/exec/src/cli.rs @@ -67,6 +67,10 @@ pub struct Cli { #[arg(long = "json", default_value_t = false)] pub json: bool, + /// Whether to include the plan tool in the conversation. + #[arg(long = "include-plan-tool", default_value_t = false)] + pub include_plan_tool: bool, + /// Specifies file where the last message from the agent should be written. #[arg(long = "output-last-message")] pub last_message_file: Option, diff --git a/codex-rs/exec/src/event_processor_with_human_output.rs b/codex-rs/exec/src/event_processor_with_human_output.rs index b22d4b72..cb972bf9 100644 --- a/codex-rs/exec/src/event_processor_with_human_output.rs +++ b/codex-rs/exec/src/event_processor_with_human_output.rs @@ -539,8 +539,37 @@ impl EventProcessor for EventProcessorWithHumanOutput { } EventMsg::PlanUpdate(plan_update_event) => { let UpdatePlanArgs { explanation, plan } = plan_update_event; - ts_println!(self, "explanation: {explanation:?}"); - ts_println!(self, "plan: {plan:?}"); + + // Header + ts_println!(self, "{}", "Plan update".style(self.magenta)); + + // Optional explanation + if let Some(explanation) = explanation + && !explanation.trim().is_empty() + { + ts_println!(self, "{}", explanation.style(self.italic)); + } + + // Pretty-print the plan items with simple status markers. + for item in plan { + use codex_core::plan_tool::StepStatus; + match item.status { + StepStatus::Completed => { + ts_println!(self, " {} {}", "✓".style(self.green), item.step); + } + StepStatus::InProgress => { + ts_println!(self, " {} {}", "→".style(self.cyan), item.step); + } + StepStatus::Pending => { + ts_println!( + self, + " {} {}", + "•".style(self.dimmed), + item.step.style(self.dimmed) + ); + } + } + } } EventMsg::GetHistoryEntryResponse(_) => { // Currently ignored in exec output. diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs index ed8b26c1..9c561cfb 100644 --- a/codex-rs/exec/src/lib.rs +++ b/codex-rs/exec/src/lib.rs @@ -53,6 +53,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option) -> any sandbox_mode: sandbox_mode_cli_arg, prompt, output_schema: output_schema_path, + include_plan_tool, config_overrides, } = cli; @@ -161,7 +162,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option) -> any model_provider, codex_linux_sandbox_exe, base_instructions: None, - include_plan_tool: None, + include_plan_tool: Some(include_plan_tool), include_apply_patch_tool: None, include_view_image_tool: None, show_raw_agent_reasoning: oss.then_some(true),