feat: add write approve mode (#1628)
This commit is contained in:
@@ -697,6 +697,11 @@ pub fn configure_goose_mode_dialog() -> Result<(), Box<dyn Error>> {
|
||||
.item(
|
||||
"approve",
|
||||
"Approve Mode",
|
||||
"All tools, extensions and file modificatio will require human approval"
|
||||
)
|
||||
.item(
|
||||
"write_approve",
|
||||
"Write Approve Mode",
|
||||
"Editing, creating, deleting files and using extensions will require human approval"
|
||||
)
|
||||
.item(
|
||||
@@ -713,7 +718,11 @@ pub fn configure_goose_mode_dialog() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
"approve" => {
|
||||
config.set_param("GOOSE_MODE", Value::String("approve".to_string()))?;
|
||||
cliclack::outro("Set to Approve Mode - modifications require approval")?;
|
||||
cliclack::outro("Set to Approve Mode - all tools and modifications require approval")?;
|
||||
}
|
||||
"write_approve" => {
|
||||
config.set_param("GOOSE_MODE", Value::String("write_approve".to_string()))?;
|
||||
cliclack::outro("Set to Write Approve Mode - modifications require approval")?;
|
||||
}
|
||||
"chat" => {
|
||||
config.set_param("GOOSE_MODE", Value::String("chat".to_string()))?;
|
||||
|
||||
@@ -77,7 +77,7 @@ impl GooseCompleter {
|
||||
|
||||
/// Complete flags for the /mode command
|
||||
fn complete_mode_flags(&self, line: &str) -> Result<(usize, Vec<Pair>)> {
|
||||
let modes = ["auto", "approve", "chat"];
|
||||
let modes = ["auto", "approve", "write_approve", "chat"];
|
||||
|
||||
let parts: Vec<&str> = line.split_whitespace().collect();
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ impl Session {
|
||||
let mode = mode.to_lowercase();
|
||||
|
||||
// Check if mode is valid
|
||||
if !["auto", "approve", "chat"].contains(&mode.as_str()) {
|
||||
if !["auto", "approve", "chat", "write_approve"].contains(&mode.as_str()) {
|
||||
output::render_error(&format!(
|
||||
"Invalid mode '{}'. Mode must be one of: auto, approve, chat",
|
||||
mode
|
||||
|
||||
@@ -275,7 +275,7 @@ impl Agent for TruncateAgent {
|
||||
// Clone goose_mode once before the match to avoid move issues
|
||||
let mode = goose_mode.clone();
|
||||
match mode.as_str() {
|
||||
"approve" => {
|
||||
"approve" | "write_approve" => {
|
||||
let mut read_only_tools = Vec::new();
|
||||
let mut needs_confirmation = Vec::<&ToolRequest>::new();
|
||||
let mut approved_tools = Vec::new();
|
||||
@@ -298,7 +298,7 @@ impl Agent for TruncateAgent {
|
||||
}
|
||||
|
||||
// Only check read-only status for tools needing confirmation
|
||||
if !needs_confirmation.is_empty() {
|
||||
if !needs_confirmation.is_empty() && mode == "write_approve" {
|
||||
read_only_tools = detect_read_only_tools(&capabilities, needs_confirmation.clone()).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user