feat: add write approve mode (#1628)

This commit is contained in:
Yingjie He
2025-03-11 20:52:41 -07:00
committed by GitHub
parent 4aafc49707
commit 6abc336484
5 changed files with 17 additions and 6 deletions

View File

@@ -697,6 +697,11 @@ pub fn configure_goose_mode_dialog() -> Result<(), Box<dyn Error>> {
.item( .item(
"approve", "approve",
"Approve Mode", "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" "Editing, creating, deleting files and using extensions will require human approval"
) )
.item( .item(
@@ -713,7 +718,11 @@ pub fn configure_goose_mode_dialog() -> Result<(), Box<dyn Error>> {
} }
"approve" => { "approve" => {
config.set_param("GOOSE_MODE", Value::String("approve".to_string()))?; 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" => { "chat" => {
config.set_param("GOOSE_MODE", Value::String("chat".to_string()))?; config.set_param("GOOSE_MODE", Value::String("chat".to_string()))?;

View File

@@ -77,7 +77,7 @@ impl GooseCompleter {
/// Complete flags for the /mode command /// Complete flags for the /mode command
fn complete_mode_flags(&self, line: &str) -> Result<(usize, Vec<Pair>)> { 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(); let parts: Vec<&str> = line.split_whitespace().collect();

View File

@@ -335,7 +335,7 @@ impl Session {
let mode = mode.to_lowercase(); let mode = mode.to_lowercase();
// Check if mode is valid // 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!( output::render_error(&format!(
"Invalid mode '{}'. Mode must be one of: auto, approve, chat", "Invalid mode '{}'. Mode must be one of: auto, approve, chat",
mode mode

View File

@@ -275,7 +275,7 @@ impl Agent for TruncateAgent {
// Clone goose_mode once before the match to avoid move issues // Clone goose_mode once before the match to avoid move issues
let mode = goose_mode.clone(); let mode = goose_mode.clone();
match mode.as_str() { match mode.as_str() {
"approve" => { "approve" | "write_approve" => {
let mut read_only_tools = Vec::new(); let mut read_only_tools = Vec::new();
let mut needs_confirmation = Vec::<&ToolRequest>::new(); let mut needs_confirmation = Vec::<&ToolRequest>::new();
let mut approved_tools = Vec::new(); let mut approved_tools = Vec::new();
@@ -298,7 +298,7 @@ impl Agent for TruncateAgent {
} }
// Only check read-only status for tools needing confirmation // 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; read_only_tools = detect_read_only_tools(&capabilities, needs_confirmation.clone()).await;
} }

View File

@@ -15,7 +15,8 @@ Gooses permissions determine how much autonomy it has when modifying files, u
| Mode | Description | Best For | | Mode | Description | Best For |
| ---------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | ---------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| **Auto Mode** | Goose can modify files, use extensions, and delete files **without requiring approval**. | Users who want **full automation** and seamless integration into their workflow. | | **Auto Mode** | Goose can modify files, use extensions, and delete files **without requiring approval**. | Users who want **full automation** and seamless integration into their workflow. |
| **Approve Mode** | Goose **asks for confirmation** before modifying, creating, deleting files and before using extensions. | Users who want to **review and approve** changes and extension use before they happen. | | **Approve Mode** | Goose **asks for confirmation** before all tools and extensions. | Users who want to **review and approve** any changes and extension use before they happen. |
| **Write Approve Mode** | Goose **asks for confirmation** before modifying, creating, deleting files and before using extensions. | Users who want to **review and approve** write or risky changes and extension use before they happen. |
| **Chat Mode** | Goose **only engages in chat**, with no extension use or file modifications. | Users who prefer a **conversational AI experience** without automation. | | **Chat Mode** | Goose **only engages in chat**, with no extension use or file modifications. | Users who prefer a **conversational AI experience** without automation. |
:::warning :::warning
@@ -82,6 +83,7 @@ Here's how to configure:
│ ● Auto Mode │ ● Auto Mode
// highlight-end // highlight-end
| ○ Approve Mode | ○ Approve Mode
| ○ Write Approve Mode
| ○ Chat Mode | ○ Chat Mode
| |
└ Set to Auto Mode - full file modification enabled └ Set to Auto Mode - full file modification enabled