Rewrite extension management tools (#5057)
Signed-off-by: Angela Ning <aning@squareup.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::agents::extension_manager_extension;
|
||||
use crate::agents::todo_extension;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -34,8 +35,8 @@ impl ProcessExit {
|
||||
}
|
||||
}
|
||||
|
||||
pub static PLATFORM_EXTENSIONS: Lazy<HashMap<&'static str, PlatformExtensionDef>> =
|
||||
Lazy::new(|| {
|
||||
pub static PLATFORM_EXTENSIONS: Lazy<HashMap<&'static str, PlatformExtensionDef>> = Lazy::new(
|
||||
|| {
|
||||
let mut map = HashMap::new();
|
||||
|
||||
map.insert(
|
||||
@@ -49,12 +50,28 @@ pub static PLATFORM_EXTENSIONS: Lazy<HashMap<&'static str, PlatformExtensionDef>
|
||||
},
|
||||
);
|
||||
|
||||
map
|
||||
});
|
||||
map.insert(
|
||||
"extensionmanager",
|
||||
PlatformExtensionDef {
|
||||
name: extension_manager_extension::EXTENSION_NAME,
|
||||
description:
|
||||
"Enable extension management tools for discovering, enabling, and disabling extensions",
|
||||
default_enabled: true,
|
||||
client_factory: |ctx| Box::new(extension_manager_extension::ExtensionManagerClient::new(ctx).unwrap()),
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
map
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct PlatformExtensionContext {
|
||||
pub session_id: Option<String>,
|
||||
pub extension_manager:
|
||||
Option<std::sync::Weak<crate::agents::extension_manager::ExtensionManager>>,
|
||||
pub tool_route_manager:
|
||||
Option<std::sync::Weak<crate::agents::tool_route_manager::ToolRouteManager>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user