diff --git a/codex-rs/config/src/types.rs b/codex-rs/config/src/types.rs index 20640727..1f2a85f3 100644 --- a/codex-rs/config/src/types.rs +++ b/codex-rs/config/src/types.rs @@ -862,7 +862,8 @@ pub struct Tui { /// Ordered list of status line item identifiers. /// /// When set, the TUI renders the selected items as the status line. - /// When unset, the TUI defaults to: `model-with-reasoning`, `current-dir`, and `thread-name`. + /// When unset, the TUI defaults to: `server-endpoint`, `model`, `context-used`, + /// `tokens-per-second`, `current-dir`, and `git-branch`. #[serde(default)] pub status_line: Option>, @@ -887,6 +888,13 @@ pub struct Tui { #[serde(default)] pub theme: Option, + /// aKode interface palette: `dark`, `light`, `high-contrast` or `colorblind`. + /// + /// Recolors accents, selection, status colors, links and diffs. When unset, colors follow + /// the terminal background. Use `/theme` in the TUI to change it. + #[serde(default)] + pub ui_theme: Option, + /// Pet id to preselect in the terminal pet picker. /// /// Custom pet ids resolve against CODEX_HOME/pets//pet.json. diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.json index faf6eb4a..6a961845 100644 --- a/codex-rs/core/config.schema.json +++ b/codex-rs/core/config.schema.json @@ -5337,7 +5337,7 @@ }, "status_line": { "default": null, - "description": "Ordered list of status line item identifiers.\n\nWhen set, the TUI renders the selected items as the status line. When unset, the TUI defaults to: `model-with-reasoning`, `current-dir`, and `thread-name`.", + "description": "Ordered list of status line item identifiers.\n\nWhen set, the TUI renders the selected items as the status line. When unset, the TUI defaults to: `server-endpoint`, `model`, `context-used`, `tokens-per-second`, `current-dir`, and `git-branch`.", "items": { "type": "string" }, @@ -5368,6 +5368,11 @@ "description": "Syntax highlighting theme name (kebab-case).\n\nWhen set, overrides automatic light/dark theme detection. Use `/theme` in the TUI or see `$CODEX_HOME/themes` for custom themes.", "type": "string" }, + "ui_theme": { + "default": null, + "description": "aKode interface palette: `dark`, `light`, `high-contrast` or `colorblind`.\n\nRecolors accents, selection, status colors, links and diffs. When unset, colors follow the terminal background. Use `/theme` in the TUI to change it.", + "type": "string" + }, "vim_mode_default": { "default": false, "description": "Start the composer in Vim mode (`Normal`) by default. Defaults to `false`.", diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index 2bbf93a4..fade215b 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -1155,6 +1155,7 @@ fn config_toml_deserializes_model_availability_nux() { status_line_use_colors: true, terminal_title: None, theme: None, + ui_theme: None, pet: None, pet_anchor: TuiPetAnchor::Composer, session_picker_view: None, @@ -4469,6 +4470,7 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() { status_line_use_colors: true, terminal_title: None, theme: None, + ui_theme: None, pet: None, pet_anchor: TuiPetAnchor::Composer, session_picker_view: None, diff --git a/codex-rs/core/src/config/edit.rs b/codex-rs/core/src/config/edit.rs index 19db2207..9e434c4a 100644 --- a/codex-rs/core/src/config/edit.rs +++ b/codex-rs/core/src/config/edit.rs @@ -89,6 +89,14 @@ pub fn syntax_theme_edit(name: &str) -> ConfigEdit { } } +/// Produces a config edit that sets [tui].ui_theme = "" (aKode interface palette). +pub fn ui_theme_edit(palette: &str) -> ConfigEdit { + ConfigEdit::SetPath { + segments: vec!["tui".to_string(), "ui_theme".to_string()], + value: value(palette.to_string()), + } +} + /// Produces a config edit that sets [tui].pet = "". pub fn tui_pet_edit(name: &str) -> ConfigEdit { ConfigEdit::SetPath { diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index c85d3c00..48e3ff8e 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -946,6 +946,9 @@ pub struct Config { /// Syntax highlighting theme override (kebab-case name). pub tui_theme: Option, + /// aKode interface palette (`[tui] ui_theme`). + pub tui_ui_theme: Option, + /// Pet id preselected by the terminal pet picker. pub tui_pet: Option, @@ -4896,6 +4899,7 @@ impl Config { .unwrap_or(true), tui_terminal_title: cfg.tui.as_ref().and_then(|t| t.terminal_title.clone()), tui_theme: cfg.tui.as_ref().and_then(|t| t.theme.clone()), + tui_ui_theme: cfg.tui.as_ref().and_then(|t| t.ui_theme.clone()), tui_pet: cfg.tui.as_ref().and_then(|t| t.pet.clone()), tui_pet_anchor: cfg .tui diff --git a/codex-rs/thread-manager-sample/src/main.rs b/codex-rs/thread-manager-sample/src/main.rs index d6df19c1..3979bc68 100644 --- a/codex-rs/thread-manager-sample/src/main.rs +++ b/codex-rs/thread-manager-sample/src/main.rs @@ -302,6 +302,7 @@ async fn new_config( tui_status_line_use_colors: true, tui_terminal_title: None, tui_theme: None, + tui_ui_theme: None, tui_raw_output_mode: false, tui_pet: None, tui_pet_anchor: TuiPetAnchor::Composer, diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 3cb86152..b64d1fb1 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -187,6 +187,7 @@ use tokio_util::sync::CancellationToken; use toml::Value as TomlValue; use uuid::Uuid; mod agent_message_consolidation; +mod akode_setup; mod agent_navigation; mod agent_picker; mod agent_status_feed; diff --git a/codex-rs/tui/src/app/akode_setup.rs b/codex-rs/tui/src/app/akode_setup.rs new file mode 100644 index 00000000..5cff6279 --- /dev/null +++ b/codex-rs/tui/src/app/akode_setup.rs @@ -0,0 +1,137 @@ +//! aKode settings flows inside a session: interface palette (`/theme`), the guided setup +//! (`/setup`) and switching between configured providers from `/model`. + +use super::App; +use crate::app_event::AppEvent; +use crate::app_server_session::AppServerSession; +use crate::legacy_core::config::edit::ConfigEditsBuilder; +use crate::tui; +use crate::ui_theme; +use crate::ui_theme::UiPalette; + +impl App { + pub(super) async fn apply_ui_theme_selection(&mut self, tui: &mut tui::Tui, palette: String) { + let Some(selected) = UiPalette::from_config_value(&palette) else { + return; + }; + let edit = crate::legacy_core::config::edit::ui_theme_edit(selected.config_value()); + let result = + ConfigEditsBuilder::for_config_path(self.local_settings.user_config_path.as_path()) + .with_edits([edit]) + .apply() + .await; + match result { + Ok(()) => { + ui_theme::set_active_palette(Some(selected)); + self.local_settings.tui.ui_theme = Some(selected.config_value().to_string()); + self.refresh_status_line(); + } + Err(err) => { + ui_theme::apply_configured_palette(self.local_settings.tui.ui_theme.as_deref()); + tracing::error!(error = %err, "failed to persist interface palette"); + self.app_event_tx.send(AppEvent::FollowTranscript); + self.chat_widget + .report_config_save_error(format!("Failed to save theme: {err}")); + } + } + tui.frame_requester().schedule_frame(); + } + + /// `/setup`: run the guided setup, then start a new chat with the provider it added. + pub(super) async fn run_setup(&mut self, tui: &mut tui::Tui, app_server: &AppServerSession) { + let config = self.chat_widget.config_ref().clone(); + let outcome = crate::onboarding::onboarding_screen::run_setup_in_app( + tui, + app_server.request_handle(), + &config, + ) + .await; + match outcome { + Ok(Some(setup)) => { + ui_theme::set_active_palette(Some(setup.palette)); + self.local_settings.tui.ui_theme = Some(setup.palette.config_value().to_string()); + self.chat_widget.add_info_message( + format!( + "Added provider `{}` with model `{}`; starting a new chat with it.", + setup.provider_id, setup.model + ), + Some("Use /model to switch between configured providers.".to_string()), + ); + self.app_event_tx.send(AppEvent::NewSession { name: None }); + } + Ok(None) => { + // Cancelled: the palette preview was already restored by the setup. + self.chat_widget + .add_info_message("Setup cancelled.".to_string(), /*hint*/ None); + } + Err(err) => { + self.chat_widget + .add_error_message(format!("Setup failed: {err}")); + } + } + tui.frame_requester().schedule_frame(); + } + + /// Fetch another provider's model list directly from its server (`GET {base_url}/models`). + pub(super) fn open_provider_models(&mut self, provider_id: String) { + let config = self.chat_widget.config_ref(); + let Some(provider) = config.model_providers.get(&provider_id).cloned() else { + self.chat_widget + .add_error_message(format!("Model provider `{provider_id}` is not configured.")); + return; + }; + let Some(base_url) = provider.base_url.clone() else { + self.chat_widget + .add_error_message(format!("Model provider `{provider_id}` has no base_url.")); + return; + }; + let tx = self.app_event_tx.clone(); + tokio::spawn(async move { + let api_key = match provider.api_key() { + Ok(key) => key, + Err(err) => { + tx.send(AppEvent::ProviderModelsLoaded { + provider_id, + result: Err(err.to_string()), + }); + return; + } + }; + let result = + crate::onboarding::setup_wizard::fetch_provider_models(base_url, api_key).await; + tx.send(AppEvent::ProviderModelsLoaded { + provider_id, + result, + }); + }); + } + + /// Make `provider_id`/`model` the default for new chats and start one. + pub(super) async fn switch_provider( + &mut self, + app_server: &mut AppServerSession, + provider_id: String, + model: String, + ) { + let edits = vec![ + crate::config_update::replace_config_value( + "model_provider", + serde_json::json!(provider_id), + ), + crate::config_update::replace_config_value("model", serde_json::json!(model)), + ]; + match crate::config_update::write_config_batch(app_server.request_handle(), edits).await { + Ok(_) => { + self.chat_widget.add_info_message( + format!("Switched to `{provider_id}` · `{model}`; starting a new chat."), + /*hint*/ None, + ); + self.app_event_tx.send(AppEvent::NewSession { name: None }); + } + Err(err) => self.chat_widget.add_error_message(format!( + "Could not switch provider: {}", + crate::config_update::format_config_error(&err) + )), + } + } +} diff --git a/codex-rs/tui/src/app/event_dispatch.rs b/codex-rs/tui/src/app/event_dispatch.rs index 7e6d9a8c..fe014d57 100644 --- a/codex-rs/tui/src/app/event_dispatch.rs +++ b/codex-rs/tui/src/app/event_dispatch.rs @@ -68,6 +68,8 @@ impl App { | AppEvent::Provider(_) | AppEvent::SyntaxThemeSelected { .. } | AppEvent::SyntaxThemePreviewed + | AppEvent::UiThemeSelected { .. } + | AppEvent::OpenSyntaxThemePicker | AppEvent::OpenKeymapActionMenu { .. } | AppEvent::OpenKeymapReplaceBindingMenu { .. } | AppEvent::OpenKeymapCapture { .. } @@ -3386,6 +3388,27 @@ impl App { self.refresh_status_line(); tui.frame_requester().schedule_frame(); } + AppEvent::UiThemeSelected { palette } => { + self.apply_ui_theme_selection(tui, palette).await; + } + AppEvent::OpenSyntaxThemePicker => { + self.chat_widget.open_syntax_theme_picker(); + } + AppEvent::OpenSetup => { + self.run_setup(tui, app_server).await; + } + AppEvent::OpenProviderModels { provider_id } => { + self.open_provider_models(provider_id); + } + AppEvent::ProviderModelsLoaded { + provider_id, + result, + } => { + self.chat_widget.show_provider_models(provider_id, result); + } + AppEvent::SwitchProvider { provider_id, model } => { + self.switch_provider(app_server, provider_id, model).await; + } AppEvent::OpenKeymapActionMenu { context, action } => { self.chat_widget .open_keymap_action_menu(context, action, &self.keymap); diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__composer_hints__tests__composer_usage_notice.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__composer_hints__tests__composer_usage_notice.snap index 87727e23..d0c8e560 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__composer_hints__tests__composer_usage_notice.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__composer_hints__tests__composer_usage_notice.snap @@ -11,7 +11,7 @@ Conversation › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ? for shortcuts ⚠ 1 warning · f2 to view 80 columns, 12 rows, running=true, queued=false @@ -25,7 +25,7 @@ Conversation › draft stays - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message 32 columns, 10 rows, running=true, queued=false @@ -37,7 +37,7 @@ Conversation › draft stays - GPT-5.6-Sol default · /tmp/pr… + 127.0.0.1:9 · GPT-5.6-Sol · C… tab to queue message 18 columns, 10 rows, running=true, queued=false @@ -49,7 +49,7 @@ Conversation › draft stays - GPT-5.6-Sol def… + 127.0.0.1:9 · G… tab to queue mes 80 columns, 18 rows, running=true, queued=true @@ -69,7 +69,7 @@ Conversation row 19 › draft stays second line - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message 80 columns, 11 rows, running=true, queued=true @@ -82,7 +82,7 @@ Conversation row 19 › draft stays second line - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message 80 columns, 6 rows, running=true, queued=false @@ -90,5 +90,5 @@ Conversation row 19 › draft stays - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snap index 4a6889c4..475aafa0 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/empty_state_animation_tests.rs -assertion_line: 189 expression: "format!(\"enabled:\\n{}\\n---\\ndisabled:\\n{}\", text(after), text(&before))" --- enabled: @@ -46,7 +45,7 @@ enabled: › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ? for shortcuts ⚠ 1 warning · f2 to view --- disabled: @@ -92,5 +91,5 @@ disabled: › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ? for shortcuts ⚠ 1 warning · f2 to view diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_copy_feedback_spacing.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_copy_feedback_spacing.snap index 41dac123..b2c42657 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_copy_feedback_spacing.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_copy_feedback_spacing.snap @@ -1,6 +1,6 @@ --- source: tui/src/app/owned_transcript_follow_tests.rs -expression: "crate::chatwidget::tests::helpers::normalize_snapshot_paths(snapshots.join(\"\\n\\n\"))" +expression: "crate::chatwidget::tests::helpers::normalize_working_snapshot(snapshots.join(\"\\n\\n\"))" --- 80 columns, 12 rows transcript row 37 @@ -13,7 +13,7 @@ transcript row 39 › draft stays here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message 18 columns, 14 rows @@ -29,7 +29,7 @@ transcript row 39 › draft stays here - GPT-5.6-Sol def… + 127.0.0.1:9 · G… tab to queue mes 6 columns, 18 rows @@ -49,7 +49,7 @@ row 39 her e - GPT… + 127… tab 80 columns, 6 rows @@ -57,5 +57,5 @@ row 39 › draft stays here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control.snap index 37eeb845..a849d539 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control.snap @@ -12,5 +12,5 @@ transcript row 28 › draft stays here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control_short_terminal.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control_short_terminal.snap index fada310f..f384aeb9 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control_short_terminal.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_follow_control_short_terminal.snap @@ -9,5 +9,5 @@ transcript row 26 › draft stays here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_without_composer_hint.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_without_composer_hint.snap index 4087c94d..ebea8084 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_without_composer_hint.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__follow_tests__running_without_composer_hint.snap @@ -12,5 +12,5 @@ transcript row 39 › draft stays here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project tab to queue message diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__escape_returns_to_latest.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__escape_returns_to_latest.snap index 3233b6a8..3323b612 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__escape_returns_to_latest.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__escape_returns_to_latest.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/owned_transcript_input_tests.rs -assertion_line: 299 expression: "format!(\"before\\n{before}\\n\\nafter\\n{}\", screen(&tui))" --- before @@ -14,7 +13,7 @@ row 19 › draft preserved - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project New activity · esc latest after @@ -28,4 +27,4 @@ new output › draft preserved - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__raw_paste_burst_render.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__raw_paste_burst_render.snap index 1bdb924f..0bc77c47 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__raw_paste_burst_render.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__input_tests__raw_paste_burst_render.snap @@ -25,7 +25,7 @@ Before paste › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ? for shortcuts After flush: @@ -51,4 +51,4 @@ After paste › [Pasted Content 2084 chars] - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__conversation_in_offset_rect.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__conversation_in_offset_rect.snap index 58eceddd..f7351620 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__conversation_in_offset_rect.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__conversation_in_offset_rect.snap @@ -16,7 +16,7 @@ expression: normalize_snapshot_paths(screen) ····· ····· ·····› preserved draft ····· ····· ····· -····· gpt-test default · /tmp…····· +····· 127.0.0.1:9 · gpt-test …····· ····· ····· ···································· ···································· diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_composer_right_click_copy.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_composer_right_click_copy.snap index ef78c11d..d85cb96f 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_composer_right_click_copy.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_composer_right_click_copy.snap @@ -72,4 +72,4 @@ hello world › hello world - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_footer_selection.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_footer_selection.snap index eaa206c6..86e1edc2 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_footer_selection.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_footer_selection.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/owned_transcript_tests.rs -assertion_line: 1831 expression: "normalize_snapshot_paths(buffer_text(crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)))" --- @@ -25,5 +24,5 @@ expression: "normalize_snapshot_paths(buffer_text(crate::custom_terminal::test_s › draft stays here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ⚠ 1 warning · f2 to view diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_remote_images.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_remote_images.snap index 030a70d0..b487ca27 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_remote_images.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_remote_images.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/owned_transcript_tests.rs -assertion_line: 1654 expression: "normalize_snapshot_paths(frames.join(\"\\n\\n\"))" --- Draft @@ -14,7 +13,7 @@ History stays visible › Edit this prompt - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Up @@ -28,7 +27,7 @@ History stays visible › Edit this prompt - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Up @@ -42,7 +41,7 @@ History stays visible › Edit this prompt - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Delete @@ -56,7 +55,7 @@ History stays visible › Edit this prompt - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Down @@ -70,4 +69,4 @@ History stays visible › Edit this prompt - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_wheel.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_wheel.snap index 76d66c8e..fd53065b 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_wheel.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__fullscreen_prompt_wheel.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/owned_transcript_tests.rs -assertion_line: 1600 expression: "normalize_snapshot_paths(frames.join(\"\\n\\n\"))" --- Following caret @@ -26,7 +25,7 @@ History 40 Prompt 34 界 Prompt 35 界 - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Wheel up @@ -52,7 +51,7 @@ History 40 Prompt 25 界 Prompt 26 界 ↓ - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Edit at caret @@ -78,7 +77,7 @@ History 40 Prompt 34 界 Prompt 35 界 - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Paste at caret @@ -104,7 +103,7 @@ History 40 Edited 34 界 Edited 35 界 pasted here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project Short screen @@ -116,4 +115,4 @@ History 40 Edited 34 界 Edited 35 界 pasted here - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0… diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__owned_transcript_composer_gap.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__owned_transcript_composer_gap.snap index b2417f42..a96b1203 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__owned_transcript_composer_gap.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__owned_transcript_composer_gap.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/owned_transcript_tests.rs -assertion_line: 350 expression: "snapshots.join(\"\\n\\n\")" --- Latest @@ -14,7 +13,7 @@ Transcript row 40 › draft - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project Reading @@ -28,7 +27,7 @@ Transcript row 35 › draft - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project esc latest Resized multiline composer @@ -42,14 +41,14 @@ Transcript row 33 second line third line - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% u… esc latest Tiny terminal › draft - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% u… esc latest Detailed @@ -63,4 +62,4 @@ Detailed › preserved draft - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__prompt_navigation.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__prompt_navigation.snap index 296c74e6..e3e7daab 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__prompt_navigation.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__prompt_navigation.snap @@ -16,5 +16,5 @@ expression: "normalize_snapshot_paths(buffer_text(crate::custom_terminal::test_s › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project Browsing · ↑↓/jk scroll · ←→/hl prompts · ⌃t details · ↵ rewind · esc back diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__recap_tail_spacing.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__recap_tail_spacing.snap index a9888fdf..ede92346 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__recap_tail_spacing.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__tests__recap_tail_spacing.snap @@ -11,7 +11,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x10, Message after recap @@ -23,7 +23,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x10, Live message after recap @@ -35,7 +35,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x12, Recap at tail @@ -49,7 +49,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x12, Message after recap @@ -63,7 +63,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x12, Live message after recap @@ -77,7 +77,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 32x12, Recap at tail @@ -91,7 +91,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/proje… + 127.0.0.1:9 · gpt-test · Cont… ? for shortcuts 32x12, Message after recap @@ -105,7 +105,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/proje… + 127.0.0.1:9 · gpt-test · Cont… ? for shortcuts 32x12, Live message after recap @@ -119,7 +119,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/proje… + 127.0.0.1:9 · gpt-test · Cont… ? for shortcuts 80x7, Recap at tail @@ -128,7 +128,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x7, Message after recap @@ -137,7 +137,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 80x7, Live message after recap @@ -146,7 +146,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts 32x6, Recap at tail @@ -154,7 +154,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/proje… + 127.0.0.1:9 · gpt-test · Cont… ? for shortcuts 32x6, Message after recap @@ -162,7 +162,7 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/proje… + 127.0.0.1:9 · gpt-test · Cont… ? for shortcuts 32x6, Live message after recap @@ -170,5 +170,5 @@ History 20 › Ask aKode to do anything - gpt-test default · /tmp/proje… + 127.0.0.1:9 · gpt-test · Cont… ? for shortcuts diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__allocated_stream_table.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__allocated_stream_table.snap index 6d5679ad..8ccc8e70 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__allocated_stream_table.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__allocated_stream_table.snap @@ -24,5 +24,5 @@ history-39 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used … ? for shortcuts diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__turn_tip_placements.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__turn_tip_placements.snap index 6746e54a..e84f51c4 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__turn_tip_placements.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__turn_tip_placements.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/turn_tips_tests.rs -assertion_line: 387 expression: "crate::chatwidget::tests::helpers::normalize_snapshot_paths(screens.join(\"\\n\\n\"))" --- working=true, response rows=1, 80x12 @@ -14,7 +13,7 @@ Response row 0 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=true, response rows=1, 80x6 @@ -22,7 +21,7 @@ working=true, response rows=1, 80x6 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=1, 80x12 @@ -36,7 +35,7 @@ working=false, response rows=1, 80x12 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=1, 80x24 @@ -62,7 +61,7 @@ Response row 0 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts Completion tip selected, 80x24 @@ -88,7 +87,7 @@ Response row 0 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=30, 80x12 @@ -102,7 +101,7 @@ working=false, response rows=30, 80x12 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=1, 80x9 @@ -113,7 +112,7 @@ working=false, response rows=1, 80x9 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=1, 80x10 @@ -125,7 +124,7 @@ working=false, response rows=1, 80x10 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=1, 80x11 @@ -138,7 +137,7 @@ working=false, response rows=1, 80x11 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts working=false, response rows=1, 12x12 @@ -152,7 +151,7 @@ working=false, response rows=1, 12x12 › Ask aKode - gpt-test … + 127.0.0.1… ? for shor working=false, response rows=1, 80x4 diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_mouse_down.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_mouse_down.snap index cdb0ec17..1d991a78 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_mouse_down.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_mouse_down.snap @@ -1,7 +1,6 @@ --- source: tui/src/app/turn_tips_tests.rs -assertion_line: 422 -expression: screen +expression: "crate::chatwidget::tests::helpers::normalize_working_snapshot(screen)" --- Response row 0 Response row 1 @@ -25,5 +24,5 @@ Response row 9 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_selected.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_selected.snap index db5afd24..833de3f3 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_selected.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__turn_tips__tests__working_tip_selected.snap @@ -1,7 +1,6 @@ --- source: tui/src/app/turn_tips_tests.rs -assertion_line: 485 -expression: "crate::chatwidget::tests::helpers::normalize_snapshot_paths(buffer_text(crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal),))" +expression: "crate::chatwidget::tests::helpers::normalize_working_snapshot(buffer_text(crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal),))" --- Response row 0 Response row 1 @@ -25,5 +24,5 @@ Response row 9 › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ? for shortcuts diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__warnings_tests__warnings_partial_dismissal.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__warnings_tests__warnings_partial_dismissal.snap index 915b9146..d253ff67 100644 --- a/codex-rs/tui/src/app/snapshots/codex_tui__app__warnings_tests__warnings_partial_dismissal.snap +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__warnings_tests__warnings_partial_dismissal.snap @@ -24,5 +24,5 @@ Earlier transcript row 29 › draft - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project esc latest ⚠ 1 warning · f2 to view diff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rs index 5742de42..70710ded 100644 --- a/codex-rs/tui/src/app/tests.rs +++ b/codex-rs/tui/src/app/tests.rs @@ -5417,7 +5417,7 @@ async fn open_agent_picker_prompts_when_subagents_disabled() -> Result<()> { Enable subagents? › As Subagents are disabled in this TUI session. - gp + 12 › 1. Yes, enable Save on the server for new threads without changing this thread 2. Not now Keep subagents disabled diff --git a/codex-rs/tui/src/app/tests/active_reconnect_tests.rs b/codex-rs/tui/src/app/tests/active_reconnect_tests.rs index 128829bc..0929471e 100644 --- a/codex-rs/tui/src/app/tests/active_reconnect_tests.rs +++ b/codex-rs/tui/src/app/tests/active_reconnect_tests.rs @@ -544,6 +544,8 @@ async fn reconnect_reconciles_offscreen_pending_profile_before_restoring_permiss "thread/list" | "thread/loaded/list" => json!({"result": {"data": [], "nextCursor": null}}), "thread/goal/get" => json!({"result": {"goal": null}}), + // The default status line looks up the git branch through the server. + "command/exec" => json!({"error": {"code": -32600, "message": "not a git repository"}}), method => panic!("unexpected reconnect request: {method}"), })) }) diff --git a/codex-rs/tui/src/app/tests/agents_navigation_tests.rs b/codex-rs/tui/src/app/tests/agents_navigation_tests.rs index 53379981..43eedaef 100644 --- a/codex-rs/tui/src/app/tests/agents_navigation_tests.rs +++ b/codex-rs/tui/src/app/tests/agents_navigation_tests.rs @@ -30,7 +30,7 @@ async fn agents_navigation_opens_the_command_center_on_every_target() -> Result< let composer = render_bottom_popup(&app.chat_widget, /*width*/ 96); let footer = composer.lines().last().expect("composer footer").trim(); insta::allow_duplicates! { - insta::assert_snapshot!(normalize_snapshot_paths(footer), @"GPT-5.6-Sol default · /tmp/project · ← for agents"); + insta::assert_snapshot!(normalize_snapshot_paths(footer), @"127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project · ← for agents"); } app.handle_tui_event( &mut tui, diff --git a/codex-rs/tui/src/app/tests/disconnect_tests.rs b/codex-rs/tui/src/app/tests/disconnect_tests.rs index aa774311..701826ab 100644 --- a/codex-rs/tui/src/app/tests/disconnect_tests.rs +++ b/codex-rs/tui/src/app/tests/disconnect_tests.rs @@ -554,6 +554,13 @@ async fn rejected_initial_thread_start_reconnects_and_submits_prompt_once() -> R serve_reconnect_requests(tokio_tungstenite::accept_async(stream).await?, |request| { let cwd = cwd.clone(); async move { + // The default status line looks up the Git branch. + if request.method == "command/exec" { + return Some(json!({"error": { + "code": -32600, + "message": "not a git repository" + }})); + } assert_eq!(request.method, "thread/start"); let params = request.params.as_ref().expect("thread/start params"); assert_eq!(params["model"], "gpt-retry"); diff --git a/codex-rs/tui/src/app/tests/local_command_scroll_tests.rs b/codex-rs/tui/src/app/tests/local_command_scroll_tests.rs index 9ad1e768..06bc8773 100644 --- a/codex-rs/tui/src/app/tests/local_command_scroll_tests.rs +++ b/codex-rs/tui/src/app/tests/local_command_scroll_tests.rs @@ -81,13 +81,14 @@ async fn settings_pickers_preserve_the_reading_anchor_through_open_and_close() - .await?; let mut selected_theme = None; while let Ok(event) = events.try_recv() { - if let AppEvent::SyntaxThemeSelected { name } = &event { - selected_theme = Some(name.clone()); + if let AppEvent::UiThemeSelected { palette } = &event { + selected_theme = Some(palette.clone()); } app.handle_event(&mut tui, &mut server, event).await?; } if command == "/theme" { - assert_eq!(selected_theme, Some("base16-ocean-dark".to_string())); + // `/theme` opens the interface palettes; Enter keeps the automatic (dark) one. + assert_eq!(selected_theme, Some("dark".to_string())); } assert!(!app.chat_widget.has_active_view(), "{command}"); assert!(!app.transcript_view.is_following(), "{command} closed"); @@ -127,6 +128,9 @@ async fn settings_picker_save_failures_reveal_their_errors() -> Result<()> { std::fs::write(app.local_settings.user_config_path.as_path(), "[broken")?; for event in [ + AppEvent::UiThemeSelected { + palette: "dark".into(), + }, AppEvent::SyntaxThemeSelected { name: "base16-ocean-dark".into(), }, @@ -163,7 +167,7 @@ async fn settings_picker_save_failures_reveal_their_errors() -> Result<()> { hold_older_history(&mut app, &mut tui); while events.try_recv().is_ok() {} let selection = format!("{event:?}"); - let is_theme = matches!(event, AppEvent::SyntaxThemeSelected { .. }); + let is_theme = matches!(event, AppEvent::UiThemeSelected { .. }); if is_theme { submit_local_command(&mut app, "/theme"); app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::Enter.into())) diff --git a/codex-rs/tui/src/app/tests/navigation_reconnect_tests.rs b/codex-rs/tui/src/app/tests/navigation_reconnect_tests.rs index ffe104d4..f8b87608 100644 --- a/codex-rs/tui/src/app/tests/navigation_reconnect_tests.rs +++ b/codex-rs/tui/src/app/tests/navigation_reconnect_tests.rs @@ -239,6 +239,8 @@ async fn reconnect_daemon_command_center_after_socket_replacement_without_a_conv } else if server_available.load(std::sync::atomic::Ordering::SeqCst) { json!({"result": {"thread": restored_previous}}) } else { json!({"error": {"code": -32600, "message": "thread no longer exists"}}) }), "thread/read" if request.params.as_ref().unwrap()["threadId"] == vanished.to_string() => Some(json!({"error": {"code": -32600, "message": "thread no longer exists"}})), "thread/read" => Some(json!({"result": {"thread": fresh.iter().find(|thread| request.params.as_ref().unwrap()["threadId"] == thread.id).unwrap()}})), + // The default status line looks up the git branch through the server. + "command/exec" => Some(json!({"error": {"code": -32600, "message": "not a git repository"}})), method => panic!("unexpected daemon reconnect request: {method}"), } })).await?); diff --git a/codex-rs/tui/src/app/tests/new_session_tests.rs b/codex-rs/tui/src/app/tests/new_session_tests.rs index 72fd77d7..7691a370 100644 --- a/codex-rs/tui/src/app/tests/new_session_tests.rs +++ b/codex-rs/tui/src/app/tests/new_session_tests.rs @@ -508,6 +508,14 @@ async fn replacement_uses_server_defaults_and_preserves_explicit_launch_settings ], ); if explicit == "saved" { + // Pin the pre-aKode footer so the snapshot keeps checking model and reasoning. + app.chat_widget.setup_status_line( + vec![ + crate::bottom_pane::StatusLineItem::ModelWithReasoning, + crate::bottom_pane::StatusLineItem::CurrentDir, + ], + /*use_theme_colors*/ false, + ); let rendered = render_bottom_popup(&app.chat_widget, /*width*/ 140) .replace(&server_config.cwd.display().to_string(), ""); insta::assert_snapshot!(rendered, @r" diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__active_reconnect__unavailable_conversation.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__active_reconnect__unavailable_conversation.snap index b37853d5..61838246 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__active_reconnect__unavailable_conversation.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__active_reconnect__unavailable_conversation.snap @@ -5,4 +5,4 @@ expression: "format!(\"{history}\\n{}\",\nrender_bottom_popup(&app.chat_widget,\ • This conversation is unavailable. Its cached transcript and draft remain here; input is paused. Open the agent picker or return to the parent to continue. › unavailable draft - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_exit_tests__embedded_exit_running_sessions.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_exit_tests__embedded_exit_running_sessions.snap index 013634bf..cb365673 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_exit_tests__embedded_exit_running_sessions.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_exit_tests__embedded_exit_running_sessions.snap @@ -1,12 +1,11 @@ --- source: tui/src/app/tests/background_exit_tests.rs -assertion_line: 57 expression: "render_bottom_popup(&app.chat_widget, 90)" --- Quit and stop running sessions? › Ask aKo Quitting this TUI will stop its running sessions. - GPT-5.6 + 127.0.0 › 1. Stay in aKode 2. Stop sessions and quit diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_task_defaults_tests__command_center_new_draft_handoff.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_task_defaults_tests__command_center_new_draft_handoff.snap index 79073491..457395ca 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_task_defaults_tests__command_center_new_draft_handoff.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__background_task_defaults_tests__command_center_new_draft_handoff.snap @@ -1,6 +1,6 @@ --- source: tui/src/app/tests/background_task_defaults_tests.rs -expression: "snapshots.join(\"\\n\\n\")" +expression: "crate::chatwidget::tests::helpers::normalize_snapshot_paths(snapshots.join(\"\\n\\n\"))" --- owned=false startup: @@ -14,7 +14,7 @@ attached: › draft during startup - GPT-6.1-Sol default · /tmp/project + 127.0.0.1:9 · GPT-6.1-Sol · Context 0% used · /tmp/project owned=true startup: @@ -27,4 +27,4 @@ attached: › draft during startup - GPT-6.1-Sol default · /tmp/project + 127.0.0.1:9 · GPT-6.1-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__misalignment_replayed_input.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__misalignment_replayed_input.snap index be3966d9..08129a24 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__misalignment_replayed_input.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__misalignment_replayed_input.snap @@ -8,4 +8,4 @@ expression: "normalize_snapshot_paths(render_bottom_popup(&app.chat_widget, 80)) › keep draft - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__steers_after_returning_to_a_running_turn.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__steers_after_returning_to_a_running_turn.snap index ea0749c8..a628cb29 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__steers_after_returning_to_a_running_turn.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__buffered_replay__steers_after_returning_to_a_running_turn.snap @@ -15,4 +15,4 @@ expression: "normalize_snapshot_paths(render_bottom_popup(&app.chat_widget, 80)) › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__disconnect__rejected_startup_reconnected.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__disconnect__rejected_startup_reconnected.snap index a084e790..c61a58ce 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__disconnect__rejected_startup_reconnected.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__disconnect__rejected_startup_reconnected.snap @@ -1,7 +1,7 @@ --- source: tui/src/app/tests/disconnect_tests.rs -expression: "render_bottom_popup(&app.chat_widget, 80)" +expression: "normalize_snapshot_paths(render_bottom_popup(&app.chat_widget, 80))" --- › startup draft - gpt-retry high · /tmp/project + 127.0.0.1:9 · gpt-retry · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__marketplace_upgrade_tests__marketplace_upgrade_warning.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__marketplace_upgrade_tests__marketplace_upgrade_warning.snap index 890a212a..e0a66a59 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__marketplace_upgrade_tests__marketplace_upgrade_warning.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__marketplace_upgrade_tests__marketplace_upgrade_warning.snap @@ -17,7 +17,7 @@ Warning notice: › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ? for shortcuts ⚠ 2 warnings · f2 to view First warning details: diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__navigation_reconnect__reconnected_unavailable_conversation.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__navigation_reconnect__reconnected_unavailable_conversation.snap index 432d5cf4..3d8b8a93 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__navigation_reconnect__reconnected_unavailable_conversation.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__navigation_reconnect__reconnected_unavailable_conversation.snap @@ -8,4 +8,4 @@ Cached previous conversation • The rename target disappeared. Unsubmitted title: Keep this task draft! › latest draft - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap index 29ae98f0..e584ff8f 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap @@ -1,19 +1,18 @@ --- source: tui/src/app/tests/realtime_requests.rs -assertion_line: 482 expression: "normalize_voice_snapshot_directory(&format!(\"Other task:\\n{other_ui}\\nRestored owner:\\n{}\\n{rendered}\",\nrender_bottom_popup(&app.chat_widget, 80)), &app.config.cwd,)" --- Other task: › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project Restored owner: voice ● listening f9 mute /voice stop mic ▁▁▁▁▁▁ codex ▁▁▁▁▁▁ › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ▄▄████▄▄ aKode v0.1.0 ██▀▀██▀▀██ gpt-test · mock diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__cloud_composer_receipts.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__cloud_composer_receipts.snap index 38b47339..db8d60e9 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__cloud_composer_receipts.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__cloud_composer_receipts.snap @@ -12,14 +12,14 @@ expression: "rendered_receipts.join(\"\\n\\n\")" › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ── Steered ── ■ Conversation interrupted - use /feedback if something went wrong ■ Conversation interrupted - use /feedback if something went wrong › follow up - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ── Unconfirmed ── ■ Cloud submission could not be confirmed: cloud/submitUserMessage transport error: cloud backend dropped its response @@ -30,7 +30,7 @@ expression: "rendered_receipts.join(\"\\n\\n\")" › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project ── Rejected ── ■ reply stream closed before submission @@ -49,4 +49,4 @@ expression: "rendered_receipts.join(\"\\n\\n\")" › Ask aKode to do anything - gpt-test default · /tmp/project + 127.0.0.1:9 · gpt-test · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__new_session_tests__widget_replacement_preserves_mention_usage_with_history_disabled.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__new_session_tests__widget_replacement_preserves_mention_usage_with_history_disabled.snap index 879983e3..06d507dc 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__new_session_tests__widget_replacement_preserves_mention_usage_with_history_disabled.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__session_lifecycle_requests__new_session_tests__widget_replacement_preserves_mention_usage_with_history_disabled.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/tests/new_session_tests.rs -assertion_line: 320 expression: "normalize_snapshot_paths(render_bottom_popup(&app.chat_widget, 80))" --- ▄▄████▄▄ aKode v0.1.0 @@ -16,4 +15,4 @@ expression: "normalize_snapshot_paths(render_bottom_popup(&app.chat_widget, 80)) › $stat - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__startup_frame_tests__startup_tip_in_transcript.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__startup_frame_tests__startup_tip_in_transcript.snap index 9a0ad44b..7f4ae8c4 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__startup_frame_tests__startup_tip_in_transcript.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__startup_frame_tests__startup_tip_in_transcript.snap @@ -1,6 +1,5 @@ --- source: tui/src/app/tests/startup_frame_tests.rs -assertion_line: 64 expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots.join(\"\\n\\n\")))" --- 80 columns @@ -22,7 +21,7 @@ expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots. › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project ? for shortcuts 32 columns @@ -44,5 +43,5 @@ expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots. › Ask aKode to do anything - GPT-5.6-Sol default · /tmp/pr… + 127.0.0.1:9 · GPT-5.6-Sol · C… ? for shortcuts diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__transcript_composer__transcript_close_restores_inline_draft.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__transcript_composer__transcript_close_restores_inline_draft.snap index 3962ea74..d13db80d 100644 --- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__transcript_composer__transcript_close_restores_inline_draft.snap +++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__transcript_composer__transcript_close_restores_inline_draft.snap @@ -1,9 +1,9 @@ --- source: tui/src/app/tests/transcript_composer.rs -expression: "buffer_text(crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal))" +expression: "buffer_text(crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)).replace(&test_path_display(\"/tmp/project\"),\n\"/tmp/project\")" --- › EDGE-DRAFT-MUST-SURVIVE - GPT-5.6-Sol default · /tmp/project + 127.0.0.1:9 · GPT-5.6-Sol · Context 0% used · /tmp/project diff --git a/codex-rs/tui/src/app/tests/startup_defaults_tests.rs b/codex-rs/tui/src/app/tests/startup_defaults_tests.rs index c5cebbb2..4b83c987 100644 --- a/codex-rs/tui/src/app/tests/startup_defaults_tests.rs +++ b/codex-rs/tui/src/app/tests/startup_defaults_tests.rs @@ -741,6 +741,14 @@ async fn fresh_startup_reads_destination_and_cleared_model_uses_catalog() -> Res let (mut app, _, _) = make_test_app_with_channels().await; app.chat_widget.handle_thread_session_quiet(started.session); if !remote { + // Pin the pre-aKode footer so the snapshot keeps checking model and reasoning. + app.chat_widget.setup_status_line( + vec![ + crate::bottom_pane::StatusLineItem::ModelWithReasoning, + crate::bottom_pane::StatusLineItem::CurrentDir, + ], + /*use_theme_colors*/ false, + ); let rendered = render_bottom_popup(&app.chat_widget, /*width*/ 80) .replace(&destination.path().display().to_string(), ""); insta::assert_snapshot!(rendered, @r" diff --git a/codex-rs/tui/src/app/thread_title_tests.rs b/codex-rs/tui/src/app/thread_title_tests.rs index 3d51f75f..521eff6b 100644 --- a/codex-rs/tui/src/app/thread_title_tests.rs +++ b/codex-rs/tui/src/app/thread_title_tests.rs @@ -333,6 +333,15 @@ async fn check_thread_title_generation(scenario: TitleScenario) -> color_eyre::R } assert_eq!(app.chat_widget.thread_name(), None); if matches!(scenario, TitleScenario::Automatic) { + // The mock server's port is random; keep the endpoint out of the footer. + app.chat_widget.setup_status_line( + vec![ + crate::bottom_pane::StatusLineItem::ModelWithReasoning, + crate::bottom_pane::StatusLineItem::CurrentDir, + crate::bottom_pane::StatusLineItem::ThreadName, + ], + /*use_theme_colors*/ false, + ); app.chat_widget.refresh_status_surfaces(); insta::assert_snapshot!( "automatic_thread_title_pending", @@ -425,6 +434,15 @@ async fn check_thread_title_generation(scenario: TitleScenario) -> color_eyre::R }; app.handle_event(&mut tui, &mut app_server, event).await?; assert!(app.pending_thread_titles.is_empty()); + // The aKode default status line omits the thread name, so select it explicitly. + app.chat_widget.setup_status_line( + vec![ + crate::bottom_pane::StatusLineItem::ModelWithReasoning, + crate::bottom_pane::StatusLineItem::CurrentDir, + crate::bottom_pane::StatusLineItem::ThreadName, + ], + /*use_theme_colors*/ false, + ); let popup = render_bottom_popup(&app.chat_widget, /*width*/ 120); assert!(popup.contains("Keep this title")); if matches!(scenario, TitleScenario::ManualRename) { diff --git a/codex-rs/tui/src/app_event.rs b/codex-rs/tui/src/app_event.rs index 6d6ba745..74031aba 100644 --- a/codex-rs/tui/src/app_event.rs +++ b/codex-rs/tui/src/app_event.rs @@ -1635,6 +1635,34 @@ pub(crate) enum AppEvent { /// Runtime syntax theme preview changed; refresh theme-derived UI colors. SyntaxThemePreviewed, + /// Apply and persist an aKode interface palette (`[tui] ui_theme`). + UiThemeSelected { + palette: String, + }, + + /// Open the syntax-highlighting theme picker (from the `/theme` palette picker). + OpenSyntaxThemePicker, + + /// Run the guided setup (`/setup`) to add a model provider. + OpenSetup, + + /// List the models of another configured provider for `/model`. + OpenProviderModels { + provider_id: String, + }, + + /// Models listed by another provider's server. + ProviderModelsLoaded { + provider_id: String, + result: Result, String>, + }, + + /// Make `provider_id`/`model` the default and start a new chat with them. + SwitchProvider { + provider_id: String, + model: String, + }, + /// Open set/remove actions for the selected keymap action. OpenKeymapActionMenu { context: String, diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index e03fd2df..a82f103c 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -553,6 +553,7 @@ fn parent_owned_command_is_allowed(command: SlashCommand, args: &str) -> bool { | SlashCommand::Ide | SlashCommand::DebugConfig | SlashCommand::Theme + | SlashCommand::Setup | SlashCommand::Pets | SlashCommand::Ps | SlashCommand::Stop diff --git a/codex-rs/tui/src/bottom_pane/list_selection_view.rs b/codex-rs/tui/src/bottom_pane/list_selection_view.rs index fec8c47a..40c7055e 100644 --- a/codex-rs/tui/src/bottom_pane/list_selection_view.rs +++ b/codex-rs/tui/src/bottom_pane/list_selection_view.rs @@ -2196,6 +2196,28 @@ mod tests { assert!(rendered.contains("Move up/down to live preview themes")); } + #[test] + fn ui_theme_picker_snapshots() { + for width in [80u16, 120, 60] { + let (tx_raw, _rx) = unbounded_channel::(); + let tx = AppEventSender::new(tx_raw); + let view = new_view(crate::theme_picker::build_ui_theme_picker_params(), tx); + let rendered = render_lines_with_width(&view, width); + for line in rendered.lines() { + assert!( + crate::width::display_width(line.trim_end()) <= usize::from(width), + "{line:?}" + ); + } + let rendered = rendered + .lines() + .map(str::trim_end) + .collect::>() + .join("\n"); + assert_snapshot!(format!("ui_theme_picker_{width}"), rendered); + } + } + #[test] fn theme_picker_enables_side_content_background_preservation() { let params = crate::theme_picker::build_theme_picker_params( diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_120.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_120.snap new file mode 100644 index 00000000..f77dfd16 --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_120.snap @@ -0,0 +1,15 @@ +--- +source: tui/src/bottom_pane/list_selection_view.rs +expression: rendered +--- + + Tema dell'interfaccia aKode · qwen3.6-35b-a3b + › aggiungi un saluto a main.rs + • Fatto, vedi main.rs: +› 1. Scuro per sfondi scuri 3 - println!("Ciao"); + 2. Chiaro per sfondi chiari 3 + println!("Ciao, mondo!"); + 3. Alto contrasto massima leggibilità 192.168.40.25:8080 · Context 23% used · 26.8 tok/s + 4. Daltonici blu e arancio, mai rosso/verde + 5. Tema della sintassi… colori del codice + + Press enter to confirm or esc to go back diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_60.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_60.snap new file mode 100644 index 00000000..46c16c58 --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_60.snap @@ -0,0 +1,22 @@ +--- +source: tui/src/bottom_pane/list_selection_view.rs +expression: rendered +--- + + Tema dell'interfaccia + + +› 1. Scuro per sfondi scuri + 2. Chiaro per sfondi chiari + 3. Alto contrasto massima leggibilità + 4. Daltonici blu e arancio, mai rosso/verde + 5. Tema della sintassi… colori del codice + + + aKode · qwen3.6-35b-a3b + › aggiungi un saluto a main.rs + • Fatto, vedi main.rs: + 3 - println!("Ciao"); + 3 + println!("Ciao, mondo!"); + 192.168.40.25:8080 · Context 23% used · 26.8 tok/s + Press enter to confirm or esc to go back diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_80.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_80.snap new file mode 100644 index 00000000..46c16c58 --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__list_selection_view__tests__ui_theme_picker_80.snap @@ -0,0 +1,22 @@ +--- +source: tui/src/bottom_pane/list_selection_view.rs +expression: rendered +--- + + Tema dell'interfaccia + + +› 1. Scuro per sfondi scuri + 2. Chiaro per sfondi chiari + 3. Alto contrasto massima leggibilità + 4. Daltonici blu e arancio, mai rosso/verde + 5. Tema della sintassi… colori del codice + + + aKode · qwen3.6-35b-a3b + › aggiungi un saluto a main.rs + • Fatto, vedi main.rs: + 3 - println!("Ciao"); + 3 + println!("Ciao, mondo!"); + 192.168.40.25:8080 · Context 23% used · 26.8 tok/s + Press enter to confirm or esc to go back diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_akode_default_items.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_akode_default_items.snap new file mode 100644 index 00000000..f4ce27fe --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_akode_default_items.snap @@ -0,0 +1,21 @@ +--- +source: tui/src/bottom_pane/status_line_setup.rs +expression: "render_lines(&view,\n80).lines().map(str::trim_end).collect::>().join(\"\\n\")" +--- + + Configure Status Line + Select which items to display in the status line. + + Type to search + +› [x] Use theme colors Apply colors from the active /theme + ─────────────────────── + [x] server-endpoint Model server host:port (omitted without base URL) + [x] model Current model name + [x] context-used Percentage of context window used (omitted when unkn… + [x] tokens-per-second Last response speed in tok/s (omitted until known) + [x] current-dir Current working directory + [x] git-branch Current Git branch (omitted when unavailable) +↓ + 192.168.40.25:8080 · qwen3.6-35b-a3b · Context 23% used · 26.8 tok/s · ~/pr… + space toggle · ←/→ reorder · enter save · esc cancel diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_uses_runtime_preview_values.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_uses_runtime_preview_values.snap index 9a79c172..b2079e5c 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_uses_runtime_preview_values.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__status_line_setup__tests__setup_view_snapshot_uses_runtime_preview_values.snap @@ -17,5 +17,5 @@ expression: "render_lines(&view, 72)" [ ] reasoning Current reasoning level [ ] project-name Project name (omitted when unavailable) ↓ - gpt-5-codex · ~/codex-rs · jif/statusline-preview + gpt-5-codex · ~/codex-rs (jif/statusline-preview) space toggle · ←/→ reorder · enter save · esc cancel diff --git a/codex-rs/tui/src/bottom_pane/status_line_setup.rs b/codex-rs/tui/src/bottom_pane/status_line_setup.rs index 86d1614e..03a89589 100644 --- a/codex-rs/tui/src/bottom_pane/status_line_setup.rs +++ b/codex-rs/tui/src/bottom_pane/status_line_setup.rs @@ -17,7 +17,8 @@ //! - Permissions profile //! - Approval mode //! - Context usage (remaining %, used %, window size) -//! - Usage limits (primary, secondary) +//! - Server endpoint (host:port of the active provider) +//! - Generation speed (tokens per second of the last response) //! - Session info (thread title, thread ID, tokens used) //! - Application version @@ -50,7 +51,8 @@ const STATUS_LINE_USE_THEME_COLORS_ITEM_ID: &str = "status-line-use-theme-colors /// /// Some items are conditionally displayed based on availability: /// - Git-related items only show when in a git repository -/// - Context/limit items only show when data is available from the API +/// - Context items only show when data is available from the API +/// - Tokens per second only shows after the first response finishes /// - Thread ID only shows after a session has started #[derive(EnumIter, EnumString, Display, Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd)] #[strum(serialize_all = "kebab_case")] @@ -108,11 +110,11 @@ pub(crate) enum StatusLineItem { #[strum(to_string = "context-used", serialize = "context-usage")] ContextUsed, - /// Remaining usage on the primary rate limit. - FiveHourLimit, + /// Host and port of the active provider's base URL. + ServerEndpoint, - /// Remaining usage on the secondary rate limit. - WeeklyLimit, + /// Generation speed of the last completed response. + TokensPerSecond, /// aKode application version. CodexVersion, @@ -186,12 +188,8 @@ impl StatusLineItem { StatusLineItem::ContextUsed => { "Percentage of context window used (omitted when unknown)" } - StatusLineItem::FiveHourLimit => { - "Remaining usage on the primary usage limit (omitted when unavailable)" - } - StatusLineItem::WeeklyLimit => { - "Remaining usage on the secondary usage limit (omitted when unavailable)" - } + StatusLineItem::ServerEndpoint => "Model server host:port (omitted without base URL)", + StatusLineItem::TokensPerSecond => "Last response speed in tok/s (omitted until known)", StatusLineItem::CodexVersion => "aKode application version", StatusLineItem::ContextWindowSize => { "Total context window size in tokens (omitted when unknown)" @@ -230,8 +228,8 @@ impl StatusLineItem { StatusLineItem::ApprovalMode => StatusSurfacePreviewItem::ApprovalMode, StatusLineItem::ContextRemaining => StatusSurfacePreviewItem::ContextRemaining, StatusLineItem::ContextUsed => StatusSurfacePreviewItem::ContextUsed, - StatusLineItem::FiveHourLimit => StatusSurfacePreviewItem::FiveHourLimit, - StatusLineItem::WeeklyLimit => StatusSurfacePreviewItem::WeeklyLimit, + StatusLineItem::ServerEndpoint => StatusSurfacePreviewItem::ServerEndpoint, + StatusLineItem::TokensPerSecond => StatusSurfacePreviewItem::TokensPerSecond, StatusLineItem::CodexVersion => StatusSurfacePreviewItem::CodexVersion, StatusLineItem::ContextWindowSize => StatusSurfacePreviewItem::ContextWindowSize, StatusLineItem::UsedTokens => StatusSurfacePreviewItem::UsedTokens, @@ -298,11 +296,7 @@ impl StatusLineSetupView { if !used_ids.insert(item_id.clone()) { continue; } - items.push(Self::status_line_select_item( - item, - /*enabled*/ true, - &preview_data, - )); + items.push(Self::status_line_select_item(item, /*enabled*/ true)); } } @@ -311,11 +305,7 @@ impl StatusLineSetupView { if used_ids.contains(&item_id) { continue; } - items.push(Self::status_line_select_item( - item, - /*enabled*/ false, - &preview_data, - )); + items.push(Self::status_line_select_item(item, /*enabled*/ false)); } Self { @@ -360,25 +350,11 @@ impl StatusLineSetupView { } /// Converts a [`StatusLineItem`] into a [`MultiSelectItem`] for the picker. - fn status_line_select_item( - item: StatusLineItem, - enabled: bool, - preview_data: &StatusSurfacePreviewData, - ) -> MultiSelectItem { - let default_name = item.to_string(); - let default_description = item.description(); - let (name, description) = match item { - StatusLineItem::FiveHourLimit | StatusLineItem::WeeklyLimit => ( - preview_data.rate_limit_item_name(item.preview_item(), &default_name), - preview_data.rate_limit_item_description(item.preview_item(), default_description), - ), - _ => (default_name, default_description.to_string()), - }; - + fn status_line_select_item(item: StatusLineItem, enabled: bool) -> MultiSelectItem { MultiSelectItem { id: item.to_string(), - name, - description: Some(description), + name: item.to_string(), + description: Some(item.description().to_string()), enabled, orderable: true, section_break_after: false, @@ -521,6 +497,106 @@ mod tests { ); } + #[test] + fn server_endpoint_and_tokens_per_second_are_selectable_ids() { + assert_eq!( + StatusLineItem::ServerEndpoint.to_string(), + "server-endpoint" + ); + assert_eq!( + "server-endpoint".parse::(), + Ok(StatusLineItem::ServerEndpoint) + ); + assert_eq!( + StatusLineItem::TokensPerSecond.to_string(), + "tokens-per-second" + ); + assert_eq!( + "tokens-per-second".parse::(), + Ok(StatusLineItem::TokensPerSecond) + ); + } + + #[test] + fn removed_usage_limit_ids_are_rejected_like_unknown_ids() { + for id in ["five-hour-limit", "weekly-limit", "not-an-item"] { + assert!(id.parse::().is_err(), "{id}"); + } + } + + #[test] + fn picker_skips_removed_usage_limit_ids() { + let (tx_raw, _rx) = unbounded_channel::(); + let view = StatusLineSetupView::new( + Some(&[ + "five-hour-limit".to_string(), + StatusLineItem::ModelName.to_string(), + "weekly-limit".to_string(), + ]), + /*use_theme_colors*/ true, + StatusSurfacePreviewData::from_iter([( + StatusLineItem::ModelName.preview_item(), + "qwen3.6-35b-a3b".to_string(), + )]), + AppEventSender::new(tx_raw), + crate::keymap::RuntimeKeymap::defaults().list, + ); + + let rendered = render_lines(&view, /*width*/ 80); + assert!(!rendered.contains("five-hour-limit"), "{rendered}"); + assert!(!rendered.contains("weekly-limit"), "{rendered}"); + assert!(rendered.contains("qwen3.6-35b-a3b"), "{rendered}"); + } + + #[test] + fn setup_view_snapshot_akode_default_items() { + let (tx_raw, _rx) = unbounded_channel::(); + let view = StatusLineSetupView::new( + Some(&[ + StatusLineItem::ServerEndpoint.to_string(), + StatusLineItem::ModelName.to_string(), + StatusLineItem::ContextUsed.to_string(), + StatusLineItem::TokensPerSecond.to_string(), + StatusLineItem::CurrentDir.to_string(), + StatusLineItem::GitBranch.to_string(), + ]), + /*use_theme_colors*/ true, + StatusSurfacePreviewData::from_iter([ + ( + StatusLineItem::ServerEndpoint.preview_item(), + "192.168.40.25:8080".to_string(), + ), + ( + StatusLineItem::ModelName.preview_item(), + "qwen3.6-35b-a3b".to_string(), + ), + ( + StatusLineItem::ContextUsed.preview_item(), + "Context 23% used".to_string(), + ), + ( + StatusLineItem::TokensPerSecond.preview_item(), + "26.8 tok/s".to_string(), + ), + ( + StatusLineItem::CurrentDir.preview_item(), + "~/progetto".to_string(), + ), + (StatusLineItem::GitBranch.preview_item(), "main".to_string()), + ]), + AppEventSender::new(tx_raw), + crate::keymap::RuntimeKeymap::defaults().list, + ); + + assert_snapshot!( + render_lines(&view, /*width*/ 80) + .lines() + .map(str::trim_end) + .collect::>() + .join("\n") + ); + } + #[test] fn parse_status_line_items_accepts_title_only_variants() { let items = ["run-state", "task-progress"] @@ -709,10 +785,6 @@ mod tests { StatusLineItem::GitBranch.preview_item(), "jif/statusline-preview".to_string(), ), - ( - StatusLineItem::WeeklyLimit.preview_item(), - "weekly 82% left".to_string(), - ), ]), AppEventSender::new(tx_raw), crate::keymap::RuntimeKeymap::defaults().list, diff --git a/codex-rs/tui/src/bottom_pane/status_line_style.rs b/codex-rs/tui/src/bottom_pane/status_line_style.rs index d5037ed3..ffcb81fa 100644 --- a/codex-rs/tui/src/bottom_pane/status_line_style.rs +++ b/codex-rs/tui/src/bottom_pane/status_line_style.rs @@ -49,6 +49,7 @@ impl StatusLineAccent { StatusLineItem::ModelName | StatusLineItem::ModelWithReasoning | StatusLineItem::Provider + | StatusLineItem::ServerEndpoint | StatusLineItem::Reasoning => Self::Model, StatusLineItem::CurrentDir | StatusLineItem::ProjectRoot => Self::Path, StatusLineItem::GitBranch @@ -60,8 +61,8 @@ impl StatusLineAccent { | StatusLineItem::ContextWindowSize | StatusLineItem::UsedTokens | StatusLineItem::TotalInputTokens - | StatusLineItem::TotalOutputTokens => Self::Usage, - StatusLineItem::FiveHourLimit | StatusLineItem::WeeklyLimit => Self::Limit, + | StatusLineItem::TotalOutputTokens + | StatusLineItem::TokensPerSecond => Self::Usage, StatusLineItem::CodexVersion | StatusLineItem::Hostname | StatusLineItem::SessionId @@ -128,12 +129,25 @@ where F: Fn(StatusLineAccent) -> Option