Merge branch 'experiment/cross-check' of gitlab.com:samnasbo/shared/galaxy
This commit is contained in:
@@ -86,13 +86,14 @@ use crate::settings::{
|
||||
AgentModeCodingPermissionsType, AgentModeCommandExecutionDenylist,
|
||||
AgentModeCommandExecutionPredicate, AgentModeQuerySuggestionsEnabled, BedrockAutoLogin,
|
||||
BedrockEnabled, CanUseWarpCreditsForFallback, CodeSettings, CodebaseContextEnabled,
|
||||
FileBasedMcpEnabled, GitOperationsAutogenEnabled, IncludeAgentCommandsInHistory, InputSettings,
|
||||
IntelligentAutosuggestionsEnabled, LongRunningCommandSubmissionMode, MemoryEnabled,
|
||||
NLDInTerminalEnabled, NaturalLanguageAutosuggestionsEnabled, OpenAIEnabled,
|
||||
OrchestrationMessageDisplayMode, PromptSubmissionMode, RuleSuggestionsEnabled,
|
||||
SharedBlockTitleGenerationEnabled, ShouldRenderCLIAgentToolbar,
|
||||
ShouldRenderUseAgentToolbarForUserCommands, ShowAgentTips, ShowConversationHistory,
|
||||
ShowHintText, ThinkingDisplayMode, VoiceInputEnabled, WarpDriveContextEnabled,
|
||||
CrosscheckEnabled, FileBasedMcpEnabled, GitOperationsAutogenEnabled,
|
||||
IncludeAgentCommandsInHistory, InputSettings, IntelligentAutosuggestionsEnabled,
|
||||
LongRunningCommandSubmissionMode, MemoryEnabled, NLDInTerminalEnabled,
|
||||
NaturalLanguageAutosuggestionsEnabled, OpenAIEnabled, OrchestrationMessageDisplayMode,
|
||||
PromptSubmissionMode, RuleSuggestionsEnabled, SharedBlockTitleGenerationEnabled,
|
||||
ShouldRenderCLIAgentToolbar, ShouldRenderUseAgentToolbarForUserCommands, ShowAgentTips,
|
||||
ShowConversationHistory, ShowHintText, ThinkingDisplayMode, VoiceInputEnabled,
|
||||
WarpDriveContextEnabled,
|
||||
};
|
||||
use crate::terminal::session_settings::{SessionSettings, SessionSettingsChangedEvent};
|
||||
use crate::terminal::CLIAgent;
|
||||
@@ -122,6 +123,8 @@ pub enum AISubpage {
|
||||
Bedrock,
|
||||
/// OpenAI-compatible (LiteLLM) provider configuration.
|
||||
OpenAI,
|
||||
/// Experimental features.
|
||||
Experiments,
|
||||
}
|
||||
|
||||
impl AISubpage {
|
||||
@@ -133,6 +136,7 @@ impl AISubpage {
|
||||
SettingsSection::ThirdPartyCLIAgents => Some(Self::ThirdPartyCLIAgents),
|
||||
SettingsSection::Bedrock => Some(Self::Bedrock),
|
||||
SettingsSection::OpenAI => Some(Self::OpenAI),
|
||||
SettingsSection::Experiments => Some(Self::Experiments),
|
||||
// AgentMCPServers renders the standalone MCPServers page, not an AI subpage.
|
||||
_ => None,
|
||||
}
|
||||
@@ -2427,6 +2431,9 @@ impl AISettingsPageView {
|
||||
let title: Option<&str> = None;
|
||||
return (PageType::new_uncategorized(widgets, title), None);
|
||||
}
|
||||
Some(AISubpage::Experiments) => {
|
||||
widgets.push(Box::new(ExperimentsWidget::default()));
|
||||
}
|
||||
}
|
||||
|
||||
// Subpage widgets render their own subheader-sized titles internally,
|
||||
@@ -3214,6 +3221,7 @@ pub enum AISettingsPageAction {
|
||||
agent: Option<CLIAgent>,
|
||||
},
|
||||
ToggleCloudAgentComputerUse,
|
||||
ToggleCrosscheckEnabled,
|
||||
}
|
||||
|
||||
impl From<&AISettingsPageAction> for LoginGatedFeature {
|
||||
@@ -3914,6 +3922,12 @@ impl TypedActionView for AISettingsPageView {
|
||||
});
|
||||
ctx.notify();
|
||||
}
|
||||
AISettingsPageAction::ToggleCrosscheckEnabled => {
|
||||
AISettings::handle(ctx).update(ctx, |settings, ctx| {
|
||||
report_if_error!(settings.crosscheck_enabled.toggle_and_save_value(ctx));
|
||||
});
|
||||
ctx.notify();
|
||||
}
|
||||
AISettingsPageAction::ToggleBedrockEnabled => {
|
||||
AISettings::handle(ctx).update(ctx, |settings, ctx| {
|
||||
report_if_error!(settings.bedrock_enabled.toggle_and_save_value(ctx));
|
||||
@@ -9092,6 +9106,77 @@ impl SettingsWidget for CustomModelRoutersWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Experiments widget ──────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Default)]
|
||||
struct ExperimentsWidget {
|
||||
crosscheck_toggle: SwitchStateHandle,
|
||||
}
|
||||
|
||||
impl SettingsWidget for ExperimentsWidget {
|
||||
type View = AISettingsPageView;
|
||||
|
||||
fn search_terms(&self) -> &str {
|
||||
"experiments crosscheck review reviewer sub-agent feedback loop lgtm"
|
||||
}
|
||||
|
||||
fn should_render(&self, _app: &AppContext) -> bool {
|
||||
FeatureFlag::CrosscheckWork.is_enabled()
|
||||
}
|
||||
|
||||
fn render(
|
||||
&self,
|
||||
view: &Self::View,
|
||||
appearance: &Appearance,
|
||||
app: &AppContext,
|
||||
) -> Box<dyn Element> {
|
||||
let ai_settings = AISettings::as_ref(app);
|
||||
let is_any_ai_enabled = ai_settings.is_any_ai_enabled(app);
|
||||
|
||||
let header = build_sub_header(
|
||||
appearance,
|
||||
"Experiments",
|
||||
Some(styles::header_font_color(is_any_ai_enabled, app)),
|
||||
)
|
||||
.with_margin_bottom(HEADER_PADDING)
|
||||
.finish();
|
||||
|
||||
let crosscheck_toggle = render_ai_setting_toggle::<CrosscheckEnabled>(
|
||||
"Crosscheck Work",
|
||||
AISettingsPageAction::ToggleCrosscheckEnabled,
|
||||
*ai_settings.crosscheck_enabled,
|
||||
is_any_ai_enabled,
|
||||
self.crosscheck_toggle.clone(),
|
||||
&view.local_only_icon_tooltip_states,
|
||||
app,
|
||||
);
|
||||
|
||||
let crosscheck_description = render_ai_setting_description(
|
||||
"When enabled, a reviewer agent critiques the main agent's output after each turn. \
|
||||
The feedback loop continues until the reviewer responds with \"LGTM!\" or the \
|
||||
maximum iteration count is reached.",
|
||||
is_any_ai_enabled,
|
||||
app,
|
||||
);
|
||||
|
||||
let model_description = render_ai_setting_description(
|
||||
"Configure the reviewer model and max iterations in settings.toml under \
|
||||
[agents.experiments].",
|
||||
is_any_ai_enabled,
|
||||
app,
|
||||
);
|
||||
|
||||
let column = Flex::column()
|
||||
.with_child(header)
|
||||
.with_child(crosscheck_toggle)
|
||||
.with_child(crosscheck_description)
|
||||
.with_child(model_description)
|
||||
.finish();
|
||||
|
||||
column
|
||||
}
|
||||
}
|
||||
|
||||
mod styles {
|
||||
use galaxy_core::ui::appearance::Appearance;
|
||||
use galaxy_core::ui::theme::Fill;
|
||||
|
||||
@@ -247,6 +247,7 @@ pub enum SettingsSection {
|
||||
ThirdPartyCLIAgents,
|
||||
Bedrock,
|
||||
OpenAI,
|
||||
Experiments,
|
||||
/// Internal backing-page identifier for CodeSettingsPageView. Multiple subpages
|
||||
/// (CodeIndexing, EditorAndCodeReview) share this single backing page,
|
||||
/// so this variant is needed as the key in `settings_pages`.
|
||||
@@ -275,6 +276,7 @@ impl Display for SettingsSection {
|
||||
SettingsSection::ThirdPartyCLIAgents => write!(f, "Third party CLI agents"),
|
||||
SettingsSection::Bedrock => write!(f, "AWS Bedrock"),
|
||||
SettingsSection::OpenAI => write!(f, "OpenAI / LiteLLM"),
|
||||
SettingsSection::Experiments => write!(f, "Experiments"),
|
||||
SettingsSection::Warpify => write!(f, "Wormhole"),
|
||||
SettingsSection::CodeIndexing => write!(f, "Indexing and projects"),
|
||||
SettingsSection::EditorAndCodeReview => write!(f, "Editor and Code Review"),
|
||||
@@ -332,6 +334,7 @@ impl SettingsSection {
|
||||
Self::ThirdPartyCLIAgents,
|
||||
Self::Bedrock,
|
||||
Self::OpenAI,
|
||||
Self::Experiments,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -366,6 +369,7 @@ impl FromStr for SettingsSection {
|
||||
"AWS Bedrock" | "Bedrock" => Ok(Self::Bedrock),
|
||||
"Indexing and projects" | "CodeIndexing" => Ok(Self::CodeIndexing),
|
||||
"Editor and Code Review" | "EditorAndCodeReview" => Ok(Self::EditorAndCodeReview),
|
||||
"Experiments" => Ok(Self::Experiments),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user