feat: use tool level permission control (#2081)

This commit is contained in:
Yingjie He
2025-04-09 13:45:15 -07:00
committed by GitHub
parent 513d5c8f5a
commit 9610406065
6 changed files with 115 additions and 129 deletions
+6 -9
View File
@@ -628,17 +628,15 @@ impl Session {
output::hide_thinking();
// Format the confirmation prompt
let prompt = "Goose would like to call the above tool, do you approve?".to_string();
let prompt = "Goose would like to call the above tool, do you allow?".to_string();
// Get confirmation from user
let confirmed = cliclack::confirm(prompt).initial_value(true).interact()?;
let permission = if confirmed {
Permission::AllowOnce
} else {
Permission::DenyOnce
};
let permission = cliclack::select(prompt)
.item(Permission::AllowOnce, "Allow", "Allow the tool call once")
.item(Permission::AlwaysAllow, "Always Allow", "Always allow the tool call")
.item(Permission::DenyOnce, "Deny", "Deny the tool call")
.interact()?;
self.agent.handle_confirmation(confirmation.id.clone(), PermissionConfirmation {
principal_name: "tool_name_placeholder".to_string(),
principal_type: PrincipalType::Tool,
permission,
},).await;
@@ -656,7 +654,6 @@ impl Session {
Permission::DenyOnce
};
self.agent.handle_confirmation(enable_extension_request.id.clone(), PermissionConfirmation {
principal_name: "extension_name_placeholder".to_string(),
principal_type: PrincipalType::Extension,
permission,
},).await;