allow enabling of cowboy mode from approval prompt; print tool error panels
This commit is contained in:
parent
a8bdfbd922
commit
2b0a3b1167
|
|
@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
- Allow shell commands to be run in read-only mode.
|
||||
- When asking for shell command approval, allow cowboy mode to be enabled.
|
||||
- Update prompt to suggest commands be run in non-interactive mode if possible, e.g. using --no-pager git flag.
|
||||
- Show tool errors in a panel.
|
||||
|
||||
## [0.6.1] - 2024-12-17
|
||||
|
||||
|
|
|
|||
|
|
@ -25,3 +25,7 @@ def print_agent_output(chunk: Dict[str, Any]) -> None:
|
|||
else:
|
||||
if msg.content.strip():
|
||||
console.print(Panel(Markdown(msg.content), title="🤖 Assistant"))
|
||||
elif 'tools' in chunk and 'messages' in chunk['tools']:
|
||||
for msg in chunk['tools']['messages']:
|
||||
if msg.status == 'error' and msg.content:
|
||||
console.print(Panel(Markdown(msg.content), title="❌ Tool Error", border_style="red bold"))
|
||||
|
|
@ -69,6 +69,7 @@ If the task requires *ANY* compilation, unit tests, or any other non-trivial cha
|
|||
If this is a trival task that can be completed in one shot, do the change using tools available and call one_shot_completed.
|
||||
Remember, many tasks are more complex and nuanced than they seem and still require requesting implementation.
|
||||
For one shot tasks, still take some time to consider whether compilation, testing, or additional validation should be done to check your work.
|
||||
If implement the task yourself, do not request implementation.
|
||||
|
||||
Thoroughness and Completeness
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from typing import Dict, Union
|
|||
from langchain_core.tools import tool
|
||||
from rich.console import Console
|
||||
from rich.panel import Panel
|
||||
from rich.prompt import Confirm
|
||||
from rich.prompt import Prompt
|
||||
from ra_aid.tools.memory import _global_memory
|
||||
from ra_aid.proc.interactive import run_interactive_command
|
||||
from ra_aid.text.processing import truncate_output
|
||||
|
|
@ -39,12 +39,27 @@ def run_shell_command(command: str) -> Dict[str, Union[str, int, bool]]:
|
|||
console.print(Panel(command, title="🐚 Shell", border_style="bright_yellow"))
|
||||
|
||||
if not cowboy_mode:
|
||||
if not Confirm.ask("Execute this command?", default=True):
|
||||
choices = ["y", "n", "c"]
|
||||
response = Prompt.ask(
|
||||
"Execute this command? (y=yes, n=no, c=enable cowboy mode for session)",
|
||||
choices=choices,
|
||||
default="y",
|
||||
show_choices=True,
|
||||
show_default=True
|
||||
)
|
||||
|
||||
if response == "n":
|
||||
print()
|
||||
return {
|
||||
"output": "Command execution cancelled by user",
|
||||
"return_code": 1,
|
||||
"success": False
|
||||
}
|
||||
elif response == "c":
|
||||
_global_memory['config']['cowboy_mode'] = True
|
||||
console.print("")
|
||||
console.print(" " + get_cowboy_message())
|
||||
console.print("")
|
||||
|
||||
try:
|
||||
print()
|
||||
|
|
|
|||
Loading…
Reference in New Issue