chore: remove verbose prints and add agent/memory tool registration in assistant core

This commit is contained in:
2025-11-04 04:57:23 +00:00
parent 5d42e8d377
commit e815e2e2a3
16 changed files with 787 additions and 55 deletions
+7 -32
View File
@@ -3,41 +3,16 @@ from typing import Dict, Any
from pr.ui.colors import Colors
def display_tool_call(tool_name, arguments, status="running", result=None):
status_icons = {
"running": ("", Colors.YELLOW),
"success": ("", Colors.GREEN),
"error": ("", Colors.RED)
}
if status == "running":
return
icon, color = status_icons.get(status, ("", Colors.WHITE))
args_str = ", ".join([f"{k}={str(v)[:20]}" for k, v in list(arguments.items())[:2]])
line = f"{tool_name}({args_str})"
print(f"\n{Colors.BOLD}{'' * 80}{Colors.RESET}")
print(f"{color}{icon} {Colors.BOLD}{Colors.CYAN}TOOL: {tool_name}{Colors.RESET}")
print(f"{Colors.BOLD}{'' * 80}{Colors.RESET}")
if len(line) > 80:
line = line[:77] + "..."
if arguments:
print(f"{Colors.YELLOW}Parameters:{Colors.RESET}")
for key, value in arguments.items():
value_str = str(value)
if len(value_str) > 100:
value_str = value_str[:100] + "..."
print(f" {Colors.CYAN}{key}:{Colors.RESET} {value_str}")
if result is not None and status != "running":
print(f"\n{Colors.YELLOW}Result:{Colors.RESET}")
result_str = json.dumps(result, indent=2) if isinstance(result, dict) else str(result)
if len(result_str) > 500:
result_str = result_str[:500] + f"\n{Colors.GRAY}... (truncated){Colors.RESET}"
if status == "success":
print(f"{Colors.GREEN}{result_str}{Colors.RESET}")
elif status == "error":
print(f"{Colors.RED}{result_str}{Colors.RESET}")
else:
print(result_str)
print(f"{Colors.BOLD}{'' * 80}{Colors.RESET}\n")
print(f"{Colors.GRAY}{line}{Colors.RESET}")
def print_autonomous_header(task):
print(f"{Colors.BOLD}Task:{Colors.RESET} {task}")