chore: migrate config paths to XDG base directory and add hit_count tracking to api_cache

This commit is contained in:
2025-11-05 14:34:23 +00:00
parent 9f155db7c2
commit ab9c29467c
32 changed files with 2598 additions and 340 deletions
+13 -4
View File
@@ -16,6 +16,10 @@ def run_autonomous_mode(assistant, task):
logger.debug(f"=== AUTONOMOUS MODE START ===")
logger.debug(f"Task: {task}")
from pr.core.knowledge_context import inject_knowledge_context
inject_knowledge_context(assistant, task)
assistant.messages.append({"role": "user", "content": f"{task}"})
try:
@@ -94,9 +98,14 @@ def process_response_autonomous(assistant, response):
arguments = json.loads(tool_call["function"]["arguments"])
result = execute_single_tool(assistant, func_name, arguments)
result = truncate_tool_result(result)
if isinstance(result, str):
try:
result = json.loads(result)
except json.JSONDecodeError as ex:
result = {"error": str(ex)}
status = "success" if result.get("status") == "success" else "error"
result = truncate_tool_result(result)
display_tool_call(func_name, arguments, status, result)
tool_results.append(
@@ -141,9 +150,9 @@ def execute_single_tool(assistant, func_name, arguments):
db_get,
db_query,
db_set,
editor_insert_text,
editor_replace_text,
editor_search,
# editor_insert_text,
# editor_replace_text,
# editor_search,
getpwd,
http_fetch,
index_source_directory,