mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: hide hidden extensions on desktop settings
This commit is contained in:
@@ -177,6 +177,7 @@ async fn handle_manual_provider_setup(config: &Config) {
|
||||
);
|
||||
set_extension(ExtensionEntry {
|
||||
enabled: true,
|
||||
hidden: false,
|
||||
config: ExtensionConfig::default(),
|
||||
});
|
||||
}
|
||||
@@ -1083,6 +1084,7 @@ fn configure_builtin_extension() -> anyhow::Result<()> {
|
||||
|
||||
set_extension(ExtensionEntry {
|
||||
enabled: true,
|
||||
hidden: false,
|
||||
config,
|
||||
});
|
||||
|
||||
@@ -1119,6 +1121,7 @@ fn configure_stdio_extension() -> anyhow::Result<()> {
|
||||
|
||||
set_extension(ExtensionEntry {
|
||||
enabled: true,
|
||||
hidden: false,
|
||||
config: ExtensionConfig::Stdio {
|
||||
name: name.clone(),
|
||||
cmd,
|
||||
@@ -1162,6 +1165,7 @@ fn configure_streamable_http_extension() -> anyhow::Result<()> {
|
||||
|
||||
set_extension(ExtensionEntry {
|
||||
enabled: true,
|
||||
hidden: false,
|
||||
config: ExtensionConfig::StreamableHttp {
|
||||
name: name.clone(),
|
||||
uri,
|
||||
@@ -1844,6 +1848,7 @@ pub async fn handle_openrouter_auth() -> anyhow::Result<()> {
|
||||
if !has_developer {
|
||||
set_extension(ExtensionEntry {
|
||||
enabled: true,
|
||||
hidden: false,
|
||||
config: ExtensionConfig::Platform {
|
||||
name: "developer".to_string(),
|
||||
description: "Developer extension".to_string(),
|
||||
@@ -1913,6 +1918,7 @@ pub async fn handle_tetrate_auth() -> anyhow::Result<()> {
|
||||
if !has_developer {
|
||||
set_extension(ExtensionEntry {
|
||||
enabled: true,
|
||||
hidden: false,
|
||||
config: ExtensionConfig::Platform {
|
||||
name: "developer".to_string(),
|
||||
description: "Developer extension".to_string(),
|
||||
|
||||
@@ -254,7 +254,10 @@ pub async fn read_config(
|
||||
pub async fn get_extensions() -> Result<Json<ExtensionResponse>, ErrorResponse> {
|
||||
let extensions = goose::config::get_all_extensions()
|
||||
.into_iter()
|
||||
.filter(|ext| !goose::agents::extension_manager::is_hidden_extension(&ext.config.name()))
|
||||
.map(|mut ext| {
|
||||
ext.hidden = goose::agents::extension_manager::is_hidden_extension(&ext.config.name());
|
||||
ext
|
||||
})
|
||||
.collect();
|
||||
let warnings = goose::config::get_warnings();
|
||||
Ok(Json(ExtensionResponse {
|
||||
@@ -284,6 +287,7 @@ pub async fn add_extension(
|
||||
|
||||
goose::config::set_extension(ExtensionEntry {
|
||||
enabled: extension_query.enabled,
|
||||
hidden: false,
|
||||
config: extension_query.config,
|
||||
});
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ const EXTENSIONS_CONFIG_KEY: &str = "extensions";
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, ToSchema)]
|
||||
pub struct ExtensionEntry {
|
||||
pub enabled: bool,
|
||||
#[serde(default)]
|
||||
pub hidden: bool,
|
||||
#[serde(flatten)]
|
||||
pub config: ExtensionConfig,
|
||||
}
|
||||
|
||||
@@ -86,7 +86,11 @@ fn migrate_platform_extensions(config: &mut Mapping) -> bool {
|
||||
}
|
||||
};
|
||||
|
||||
let new_entry = ExtensionEntry { config, enabled };
|
||||
let new_entry = ExtensionEntry {
|
||||
config,
|
||||
enabled,
|
||||
hidden: false,
|
||||
};
|
||||
|
||||
if let Ok(value) = serde_yaml::to_value(&new_entry) {
|
||||
extensions_map.insert(ext_key, value);
|
||||
@@ -129,6 +133,7 @@ mod tests {
|
||||
available_tools: Vec::new(),
|
||||
},
|
||||
enabled: false,
|
||||
hidden: false,
|
||||
};
|
||||
extensions.insert(
|
||||
serde_yaml::Value::String("todo".to_string()),
|
||||
|
||||
@@ -741,6 +741,7 @@ mod tests {
|
||||
// Set it as disabled initially so tests can enable it
|
||||
let todo_extension_entry = ExtensionEntry {
|
||||
enabled: false,
|
||||
hidden: false,
|
||||
config: ExtensionConfig::Platform {
|
||||
name: "todo".to_string(),
|
||||
description:
|
||||
|
||||
@@ -5257,6 +5257,9 @@
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"hidden": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +457,7 @@ export type ExtensionData = {
|
||||
|
||||
export type ExtensionEntry = ExtensionConfig & {
|
||||
enabled: boolean;
|
||||
hidden?: boolean;
|
||||
};
|
||||
|
||||
export type ExtensionLoadResult = {
|
||||
|
||||
@@ -25,6 +25,7 @@ export type { ExtensionConfig } from '../api/types.gen';
|
||||
// Define a local version that matches the structure of the imported one
|
||||
export type FixedExtensionEntry = ExtensionConfig & {
|
||||
enabled: boolean;
|
||||
hidden?: boolean;
|
||||
};
|
||||
|
||||
interface ConfigContextType {
|
||||
|
||||
@@ -81,6 +81,7 @@ export default function ExtensionsSection({
|
||||
if (extensionsList.length === 0) return [];
|
||||
|
||||
return [...extensionsList]
|
||||
.filter((ext) => !ext.hidden)
|
||||
.sort((a, b) => {
|
||||
// First sort by builtin
|
||||
if (a.type === 'builtin' && b.type !== 'builtin') return -1;
|
||||
@@ -228,9 +229,7 @@ export default function ExtensionsSection({
|
||||
<Button
|
||||
className="flex items-center gap-2 justify-center"
|
||||
variant="secondary"
|
||||
onClick={() =>
|
||||
window.open('https://goose-docs.ai/v1/extensions/', '_blank')
|
||||
}
|
||||
onClick={() => window.open('https://goose-docs.ai/v1/extensions/', '_blank')}
|
||||
>
|
||||
<GPSIcon size={12} />
|
||||
{intl.formatMessage(i18n.browseExtensions)}
|
||||
|
||||
Reference in New Issue
Block a user