This commit is contained in:
parent
92e1a25bca
commit
fb9c4724ca
|
|
@ -1,5 +1,5 @@
|
||||||
from .__version__ import __version__
|
from .__version__ import __version__
|
||||||
from .console.formatting import print_stage_header, print_task_header
|
from .console.formatting import print_stage_header, print_task_header, print_error
|
||||||
from .console.output import print_agent_output
|
from .console.output import print_agent_output
|
||||||
from .text.processing import truncate_output
|
from .text.processing import truncate_output
|
||||||
|
|
||||||
|
|
@ -8,5 +8,6 @@ __all__ = [
|
||||||
'print_task_header',
|
'print_task_header',
|
||||||
'print_agent_output',
|
'print_agent_output',
|
||||||
'truncate_output',
|
'truncate_output',
|
||||||
|
'print_error',
|
||||||
'__version__'
|
'__version__'
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ from ra_aid.tools import (
|
||||||
fuzzy_find_project_files, ripgrep_search, list_directory_tree
|
fuzzy_find_project_files, ripgrep_search, list_directory_tree
|
||||||
)
|
)
|
||||||
from ra_aid.tools.memory import _global_memory, get_related_files
|
from ra_aid.tools.memory import _global_memory, get_related_files
|
||||||
from ra_aid import print_agent_output, print_stage_header, print_task_header
|
from ra_aid import print_agent_output, print_stage_header, print_task_header, print_error
|
||||||
from ra_aid.prompts import (
|
from ra_aid.prompts import (
|
||||||
RESEARCH_PROMPT,
|
RESEARCH_PROMPT,
|
||||||
PLANNING_PROMPT,
|
PLANNING_PROMPT,
|
||||||
|
|
@ -133,7 +133,7 @@ def run_agent_with_retry(agent, prompt: str, config: dict):
|
||||||
|
|
||||||
delay = base_delay * (2 ** attempt) # Exponential backoff
|
delay = base_delay * (2 ** attempt) # Exponential backoff
|
||||||
error_type = e.__class__.__name__
|
error_type = e.__class__.__name__
|
||||||
print(f"Encountered {error_type}: {str(e)}. Retrying in {delay} seconds... (Attempt {attempt + 1}/{max_retries})")
|
print_error(f"Encountered {error_type}: {str(e)}. Retrying in {delay} seconds... (Attempt {attempt + 1}/{max_retries})")
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
@ -254,9 +254,8 @@ def validate_environment():
|
||||||
missing.append('aider binary not found in PATH. Please install aider: pip install aider')
|
missing.append('aider binary not found in PATH. Please install aider: pip install aider')
|
||||||
|
|
||||||
if missing:
|
if missing:
|
||||||
print("Error: Missing required dependencies:", file=sys.stderr)
|
error_list = "\n".join(f"- {error}" for error in missing)
|
||||||
for error in missing:
|
print_error(f"Missing required dependencies:\n\n{error_list}")
|
||||||
print(f"- {error}", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -269,7 +268,7 @@ def main():
|
||||||
|
|
||||||
# Validate message is provided
|
# Validate message is provided
|
||||||
if not args.message:
|
if not args.message:
|
||||||
print("Error: --message is required", file=sys.stderr)
|
print_error("--message is required")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
base_task = args.message
|
base_task = args.message
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,11 @@ def print_task_header(task: str) -> None:
|
||||||
task: The task text to print (supports Markdown formatting)
|
task: The task text to print (supports Markdown formatting)
|
||||||
"""
|
"""
|
||||||
console.print(Panel(Markdown(task), title="🔧 Task", border_style="yellow bold"))
|
console.print(Panel(Markdown(task), title="🔧 Task", border_style="yellow bold"))
|
||||||
|
|
||||||
|
def print_error(message: str) -> None:
|
||||||
|
"""Print an error message in a red-bordered panel with warning emoji.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
message: The error message to display (supports Markdown formatting)
|
||||||
|
"""
|
||||||
|
console.print(Panel(Markdown(message), title="Error", border_style="red bold"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue