-
-
Notifications
You must be signed in to change notification settings - Fork 32
Feature: Auto-approval for specific tools #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
76b2add
feat(console_ui.py): enhance tool approval prompt to include options …
lewistransts 205dd44
chore(tool_manager.py): remove commented-out code for loading auto-ap…
lewistransts f459a3a
chore(console_ui.py): remove commented-out code for clarity and maint…
lewistransts e0f1cc7
refactor(tool_manager.py): move _load_persistent_auto_approved_tools …
lewistransts da8321c
fix(console_ui.py): update prompt text for tool approval options to i…
lewistransts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -451,7 +451,7 @@ def display_tool_confirmation_request(self, tool_info): | |
| # Use Rich to print the prompt but still need to use input() for user interaction | ||
| self.console.print( | ||
| Text( | ||
| "\nAllow this tool to run? [y]es/[n]o/[all] future calls: ", | ||
| "\nAllow this tool to run? [y]es/[n]o/[a]lways in this session/[f]orever (this and future sessions): ", | ||
| style=RICH_STYLE_YELLOW, | ||
| ), | ||
| end="", | ||
|
|
@@ -471,7 +471,7 @@ def display_tool_confirmation_request(self, tool_info): | |
| confirmation_id, {"action": "deny"} | ||
| ) | ||
| break | ||
| elif response in ["all", "a"]: | ||
| elif response in ["a", "all"]: | ||
| self.message_handler.resolve_tool_confirmation( | ||
| confirmation_id, {"action": "approve_all"} | ||
| ) | ||
|
|
@@ -482,9 +482,25 @@ def display_tool_confirmation_request(self, tool_info): | |
| approved_text.append("' for this session.") | ||
| self.console.print(approved_text) | ||
| break | ||
| elif response in ["f", "forever"]: | ||
| # Add tool to persistent auto-approval list | ||
| from AgentCrew.modules.config import ConfigManagement | ||
| config_manager = ConfigManagement() | ||
| config_manager.write_auto_approval_tools(tool_use["name"], add=True) | ||
|
|
||
| self.message_handler.resolve_tool_confirmation( | ||
| confirmation_id, {"action": "approve"} | ||
| ) | ||
| saved_text = Text( | ||
| "✓ Tool '", style=RICH_STYLE_YELLOW | ||
| ) | ||
| saved_text.append(tool_use["name"]) | ||
|
||
| saved_text.append("' will be auto-approved forever.") | ||
| self.console.print(saved_text) | ||
| break | ||
| else: | ||
| self.console.print( | ||
| Text("Please enter 'y', 'n', or 'all'.", style=RICH_STYLE_YELLOW) | ||
| Text("Please enter 'y', 'n', 'a', or 'f'.", style=RICH_STYLE_YELLOW) | ||
| ) | ||
| self._start_input_thread() | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be [a]ll (in this session) instead of [a]lways in this session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed