feat: use the same permission flow for enable extensions (#2302)
This commit is contained in:
@@ -17,7 +17,6 @@ use completion::GooseCompleter;
|
||||
use etcetera::choose_app_strategy;
|
||||
use etcetera::AppStrategy;
|
||||
use goose::agents::extension::{Envs, ExtensionConfig};
|
||||
use goose::agents::platform_tools::PLATFORM_ENABLE_EXTENSION_TOOL_NAME;
|
||||
use goose::agents::{Agent, SessionConfig};
|
||||
use goose::config::Config;
|
||||
use goose::message::{Message, MessageContent};
|
||||
@@ -623,29 +622,6 @@ impl Session {
|
||||
principal_type: PrincipalType::Tool,
|
||||
permission,
|
||||
},).await;
|
||||
} else if let Some(MessageContent::ExtensionRequest(enable_extension_request)) = message.content.first() {
|
||||
output::hide_thinking();
|
||||
|
||||
let extension_action = if enable_extension_request.tool_name == PLATFORM_ENABLE_EXTENSION_TOOL_NAME {
|
||||
"enable"
|
||||
} else {
|
||||
"disable"
|
||||
};
|
||||
|
||||
let prompt = format!("Goose would like to {} the following extension, do you approve?", extension_action);
|
||||
let confirmed = cliclack::select(prompt)
|
||||
.item(true, "Yes, for this session", format!("{} the extension for this session", extension_action))
|
||||
.item(false, "No", format!("Do not {} the extension", extension_action))
|
||||
.interact()?;
|
||||
let permission = if confirmed {
|
||||
Permission::AllowOnce
|
||||
} else {
|
||||
Permission::DenyOnce
|
||||
};
|
||||
self.agent.handle_confirmation(enable_extension_request.id.clone(), PermissionConfirmation {
|
||||
principal_type: PrincipalType::Extension,
|
||||
permission,
|
||||
},).await;
|
||||
}
|
||||
// otherwise we have a model/tool to render
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user