Base: codex-main originale (prima del fork aKode)
This commit is contained in:
40
codex-rs/tools/src/tool_config.rs
Normal file
40
codex-rs/tools/src/tool_config.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use codex_features::Feature;
|
||||
use codex_features::Features;
|
||||
use codex_protocol::config_types::ModeKind;
|
||||
use codex_protocol::config_types::TUI_VISIBLE_COLLABORATION_MODES;
|
||||
|
||||
pub fn request_user_input_available_modes(features: &Features) -> Vec<ModeKind> {
|
||||
TUI_VISIBLE_COLLABORATION_MODES
|
||||
.into_iter()
|
||||
.filter(|mode| {
|
||||
mode.allows_request_user_input()
|
||||
|| (features.enabled(Feature::DefaultModeRequestUserInput)
|
||||
&& *mode == ModeKind::Default)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ToolEnvironmentMode {
|
||||
None,
|
||||
Single,
|
||||
Multiple,
|
||||
}
|
||||
|
||||
impl ToolEnvironmentMode {
|
||||
pub fn from_count(count: usize) -> Self {
|
||||
match count {
|
||||
0 => Self::None,
|
||||
1 => Self::Single,
|
||||
_ => Self::Multiple,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_environment(self) -> bool {
|
||||
!matches!(self, Self::None)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tool_config_tests.rs"]
|
||||
mod tests;
|
||||
Reference in New Issue
Block a user