mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Sync collaboration mode naming across Default prompt, tools, and TUI (#10666)
## Summary
- add shared `ModeKind` helpers for display names, TUI visibility, and
`request_user_input` availability
- derive TUI mode filtering/labels from shared `ModeKind` metadata
instead of local hardcoded matches
- derive `request_user_input` availability text and unavailable error
mode names from shared mode metadata
- replace hardcoded known mode names in the Default collaboration-mode
template with `{{KNOWN_MODE_NAMES}}` and fill it from
`TUI_VISIBLE_COLLABORATION_MODES`
- add regression tests for mode metadata sync and placeholder
replacement
## Notes
- `cargo test -p codex-core` integration target (`tests/all`) still
shows pre-existing env-specific failures in this environment due missing
`test_stdio_server` binary resolution; core unit tests are green.
## Codex author
`codex resume 019c26ff-dfe7-7173-bc04-c9e1fff1e447`
This commit is contained in:
@@ -5490,11 +5490,10 @@ impl ChatWidget {
|
||||
if !self.collaboration_modes_enabled() {
|
||||
return None;
|
||||
}
|
||||
match self.active_mode_kind() {
|
||||
ModeKind::Plan => Some("Plan"),
|
||||
ModeKind::Default => Some("Default"),
|
||||
ModeKind::PairProgramming | ModeKind::Execute => None,
|
||||
}
|
||||
let active_mode = self.active_mode_kind();
|
||||
active_mode
|
||||
.is_tui_visible()
|
||||
.then_some(active_mode.display_name())
|
||||
}
|
||||
|
||||
fn collaboration_mode_indicator(&self) -> Option<CollaborationModeIndicator> {
|
||||
|
||||
@@ -2,15 +2,11 @@ use codex_core::models_manager::manager::ModelsManager;
|
||||
use codex_protocol::config_types::CollaborationModeMask;
|
||||
use codex_protocol::config_types::ModeKind;
|
||||
|
||||
fn is_tui_mode(kind: ModeKind) -> bool {
|
||||
matches!(kind, ModeKind::Plan | ModeKind::Default)
|
||||
}
|
||||
|
||||
fn filtered_presets(models_manager: &ModelsManager) -> Vec<CollaborationModeMask> {
|
||||
models_manager
|
||||
.list_collaboration_modes()
|
||||
.into_iter()
|
||||
.filter(|mask| mask.mode.is_some_and(is_tui_mode))
|
||||
.filter(|mask| mask.mode.is_some_and(ModeKind::is_tui_visible))
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -31,7 +27,7 @@ pub(crate) fn mask_for_kind(
|
||||
models_manager: &ModelsManager,
|
||||
kind: ModeKind,
|
||||
) -> Option<CollaborationModeMask> {
|
||||
if !is_tui_mode(kind) {
|
||||
if !kind.is_tui_visible() {
|
||||
return None;
|
||||
}
|
||||
filtered_presets(models_manager)
|
||||
|
||||
Reference in New Issue
Block a user