From a32d305ae6a8c8680932b5259f7dd7e5a086db26 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 29 May 2025 14:57:55 -0700 Subject: [PATCH 1/2] fix: update UI treatment of slash command menu to match that of the TS CLI (#1161) Uses the same colors as in the TypeScript CLI: ![image](https://github.com/user-attachments/assets/919cd472-ffb4-4654-a46a-d84f0cd9c097) Now it is also readable on a light theme, e.g., in Ghostty: ![image](https://github.com/user-attachments/assets/468c37b0-ea63-4455-9b48-73dc2c95f0f6) --- codex-rs/tui/src/bottom_pane/command_popup.rs | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/command_popup.rs b/codex-rs/tui/src/bottom_pane/command_popup.rs index 505a4bc699..0dcb98865c 100644 --- a/codex-rs/tui/src/bottom_pane/command_popup.rs +++ b/codex-rs/tui/src/bottom_pane/command_popup.rs @@ -4,6 +4,7 @@ use ratatui::buffer::Buffer; use ratatui::layout::Rect; use ratatui::style::Color; use ratatui::style::Style; +use ratatui::style::Stylize; use ratatui::widgets::Block; use ratatui::widgets::BorderType; use ratatui::widgets::Borders; @@ -147,8 +148,6 @@ impl CommandPopup { impl WidgetRef for CommandPopup { fn render_ref(&self, area: Rect, buf: &mut Buffer) { - let style = Style::default().bg(Color::Blue).fg(Color::White); - let matches = self.filtered_commands(); let mut rows: Vec = Vec::new(); @@ -157,21 +156,25 @@ impl WidgetRef for CommandPopup { if visible_matches.is_empty() { rows.push(Row::new(vec![ - Cell::from("").style(style), - Cell::from("No matching commands").style(style.add_modifier(Modifier::ITALIC)), + Cell::from(""), + Cell::from("No matching commands").add_modifier(Modifier::ITALIC), ])); } else { + let default_style = Style::default(); + let command_style = Style::default().fg(Color::LightBlue); for (idx, cmd) in visible_matches.iter().enumerate() { - let highlight = Style::default().bg(Color::White).fg(Color::Blue); - let cmd_style = if Some(idx) == self.selected_idx { - highlight + let (cmd_style, desc_style) = if Some(idx) == self.selected_idx { + ( + command_style.bg(Color::DarkGray), + default_style.bg(Color::DarkGray), + ) } else { - style + (command_style, default_style) }; rows.push(Row::new(vec![ - Cell::from(cmd.command().to_string()).style(cmd_style), - Cell::from(cmd.description().to_string()).style(style), + Cell::from(format!("/{}", cmd.command())).style(cmd_style), + Cell::from(cmd.description().to_string()).style(desc_style), ])); } } @@ -182,13 +185,11 @@ impl WidgetRef for CommandPopup { rows, [Constraint::Length(FIRST_COLUMN_WIDTH), Constraint::Min(10)], ) - .style(style) - .column_spacing(1) + .column_spacing(0) .block( Block::default() .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .style(style), + .border_type(BorderType::Rounded), ); table.render(area, buf); From 173374e376e733b0d77a834ecb019bb86214cc35 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 29 May 2025 15:27:20 -0700 Subject: [PATCH 2/2] chore: update GitHub workflow for native artifacts for npm release --- codex-cli/scripts/install_native_deps.sh | 2 +- codex-rs/core/src/chat_completions.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/codex-cli/scripts/install_native_deps.sh b/codex-cli/scripts/install_native_deps.sh index 09c1553228..c1697fb5fe 100755 --- a/codex-cli/scripts/install_native_deps.sh +++ b/codex-cli/scripts/install_native_deps.sh @@ -65,7 +65,7 @@ mkdir -p "$BIN_DIR" # Until we start publishing stable GitHub releases, we have to grab the binaries # from the GitHub Action that created them. Update the URL below to point to the # appropriate workflow run: -WORKFLOW_URL="https://github.com/openai/codex/actions/runs/15280451034" +WORKFLOW_URL="https://github.com/openai/codex/actions/runs/15334411824" WORKFLOW_ID="${WORKFLOW_URL##*/}" ARTIFACTS_DIR="$(mktemp -d)" diff --git a/codex-rs/core/src/chat_completions.rs b/codex-rs/core/src/chat_completions.rs index 7760c48fbf..955f87696b 100644 --- a/codex-rs/core/src/chat_completions.rs +++ b/codex-rs/core/src/chat_completions.rs @@ -25,6 +25,7 @@ use crate::flags::OPENAI_REQUEST_MAX_RETRIES; use crate::flags::OPENAI_STREAM_IDLE_TIMEOUT_MS; use crate::models::ContentItem; use crate::models::ResponseItem; +use crate::openai_tools::create_tools_json; use crate::util::backoff; /// Implementation for the classic Chat Completions API. This is intentionally @@ -56,10 +57,13 @@ pub(crate) async fn stream_chat_completions( } } + let tools_json = create_tools_json(prompt, model)?; + // Rewrite tools to match the chat completions tool call format: + // https://platform.openai.com/docs/guides/function-calling?api-mode=chat let payload = json!({ "model": model, "messages": messages, - "stream": true + "stream": true, }); let base_url = provider.base_url.trim_end_matches('/');