mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
## Summary `/collab` was intentionally removed in [#12012](https://github.com/openai/codex/pull/12012), but the TUI/app-server migration accidentally brought that slash-command path back. This restores the earlier product decision so the TUI no longer advertises or dispatches `/collab`. This command was redundant because it did the same thing as `/plan` but in a less-intuitive way. ## What Changed - Remove `SlashCommand::Collab` from the TUI slash-command surface. - Delete the picker and app-event plumbing that only existed to service `/collab`. - Remove obsolete TUI test coverage for the deleted picker flow.
59 lines
1.9 KiB
Rust
59 lines
1.9 KiB
Rust
use codex_models_manager::collaboration_mode_presets::builtin_collaboration_mode_presets;
|
|
use codex_protocol::config_types::CollaborationModeMask;
|
|
use codex_protocol::config_types::ModeKind;
|
|
|
|
use crate::model_catalog::ModelCatalog;
|
|
|
|
fn filtered_presets(_model_catalog: &ModelCatalog) -> Vec<CollaborationModeMask> {
|
|
builtin_collaboration_mode_presets()
|
|
.into_iter()
|
|
.filter(|mask| mask.mode.is_some_and(ModeKind::is_tui_visible))
|
|
.collect()
|
|
}
|
|
|
|
pub(crate) fn default_mask(model_catalog: &ModelCatalog) -> Option<CollaborationModeMask> {
|
|
let presets = filtered_presets(model_catalog);
|
|
presets
|
|
.iter()
|
|
.find(|mask| mask.mode == Some(ModeKind::Default))
|
|
.cloned()
|
|
.or_else(|| presets.into_iter().next())
|
|
}
|
|
|
|
pub(crate) fn mask_for_kind(
|
|
model_catalog: &ModelCatalog,
|
|
kind: ModeKind,
|
|
) -> Option<CollaborationModeMask> {
|
|
if !kind.is_tui_visible() {
|
|
return None;
|
|
}
|
|
filtered_presets(model_catalog)
|
|
.into_iter()
|
|
.find(|mask| mask.mode == Some(kind))
|
|
}
|
|
|
|
/// Cycle to the next collaboration mode preset in list order.
|
|
pub(crate) fn next_mask(
|
|
model_catalog: &ModelCatalog,
|
|
current: Option<&CollaborationModeMask>,
|
|
) -> Option<CollaborationModeMask> {
|
|
let presets = filtered_presets(model_catalog);
|
|
if presets.is_empty() {
|
|
return None;
|
|
}
|
|
let current_kind = current.and_then(|mask| mask.mode);
|
|
let next_index = presets
|
|
.iter()
|
|
.position(|mask| mask.mode == current_kind)
|
|
.map_or(0, |idx| (idx + 1) % presets.len());
|
|
presets.get(next_index).cloned()
|
|
}
|
|
|
|
pub(crate) fn default_mode_mask(model_catalog: &ModelCatalog) -> Option<CollaborationModeMask> {
|
|
mask_for_kind(model_catalog, ModeKind::Default)
|
|
}
|
|
|
|
pub(crate) fn plan_mask(model_catalog: &ModelCatalog) -> Option<CollaborationModeMask> {
|
|
mask_for_kind(model_catalog, ModeKind::Plan)
|
|
}
|