feat: improve content extraction in autonomous mode feat: display tool calls during execution feat: handle tool execution errors gracefully feat: update version to 1.55.0 docs: update help message with markdown usage tips feat: add markdown output format refactor: format output based on selected format maintenance: update pyproject.toml
This commit is contained in:
parent
8e6af2b32b
commit
9963cedd07
@ -5,6 +5,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Version 1.54.0 - 2025-11-10
|
||||||
|
|
||||||
|
Autonomous mode is now on by default, and it's been improved to extract content more effectively. The tool calls are now displayed, and errors during tool execution are handled more gracefully.
|
||||||
|
|
||||||
|
**Changes:** 5 files, 93 lines
|
||||||
|
**Languages:** Markdown (8 lines), Python (83 lines), TOML (2 lines)
|
||||||
|
|
||||||
## Version 1.53.0 - 2025-11-10
|
## Version 1.53.0 - 2025-11-10
|
||||||
|
|
||||||
Autonomous mode is now enabled by default, streamlining workflows. We've also improved the underlying code and fixed some issues with content extraction in autonomous mode.
|
Autonomous mode is now enabled by default, streamlining workflows. We've also improved the underlying code and fixed some issues with content extraction in autonomous mode.
|
||||||
|
|||||||
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rp"
|
name = "rp"
|
||||||
version = "1.53.0"
|
version = "1.54.0"
|
||||||
description = "R python edition. The ultimate autonomous AI CLI."
|
description = "R python edition. The ultimate autonomous AI CLI."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
@ -9,34 +9,10 @@ def main_def():
|
|||||||
import tracemalloc
|
import tracemalloc
|
||||||
|
|
||||||
tracemalloc.start()
|
tracemalloc.start()
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="RP Assistant - Professional CLI AI assistant with autonomous execution by default",
|
description="RP Assistant - Professional CLI AI assistant with autonomous execution by default",
|
||||||
epilog="""
|
epilog=f"""Examples:\n rp \"**Create a web scraper** with the following features:\" # Autonomous task execution\n rp -i # Interactive autonomous mode\n rp -i --model gpt-4 # Use specific model\n rp --save-session my-task -i # Save session\n rp --load-session my-task # Load session\n rp --list-sessions # List all sessions\n rp --usage # Show token usage stats\n\nFeatures:\n \u2022 Autonomous execution by default - tasks run until completion\n \u2022 Visual progress indicators during AI calls\n \u2022 Real-time cost tracking for each query\n \u2022 Sophisticated CLI with colors and effects\n \u2022 Tool execution with status updates\n \u2022 **Markdown-powered** responses with syntax highlighting\n\nCommands in interactive mode:\n /reset - Clear message history\n /verbose - Toggle verbose output\n /models - List available models\n /tools - List available tools\n /usage - Show usage statistics\n /save <name> - Save current session\n exit, quit, q - Exit the program\n\n**Pro Tip:** Always use markdown in your prompts for enhanced AI understanding and responses!\n """,
|
||||||
Examples:
|
|
||||||
rp "Create a web scraper" # Autonomous task execution
|
|
||||||
rp -i # Interactive autonomous mode
|
|
||||||
rp -i --model gpt-4 # Use specific model
|
|
||||||
rp --save-session my-task -i # Save session
|
|
||||||
rp --load-session my-task # Load session
|
|
||||||
rp --list-sessions # List all sessions
|
|
||||||
rp --usage # Show token usage stats
|
|
||||||
|
|
||||||
Features:
|
|
||||||
• Autonomous execution by default - tasks run until completion
|
|
||||||
• Visual progress indicators during AI calls
|
|
||||||
• Real-time cost tracking for each query
|
|
||||||
• Sophisticated CLI with colors and effects
|
|
||||||
• Tool execution with status updates
|
|
||||||
|
|
||||||
Commands in interactive mode:
|
|
||||||
/reset - Clear message history
|
|
||||||
/verbose - Toggle verbose output
|
|
||||||
/models - List available models
|
|
||||||
/tools - List available tools
|
|
||||||
/usage - Show usage statistics
|
|
||||||
/save <name> - Save current session
|
|
||||||
exit, quit, q - Exit the program
|
|
||||||
""",
|
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
)
|
)
|
||||||
parser.add_argument("message", nargs="?", help="Message to send to assistant")
|
parser.add_argument("message", nargs="?", help="Message to send to assistant")
|
||||||
@ -64,7 +40,7 @@ Commands in interactive mode:
|
|||||||
"--api-mode", action="store_true", help="API mode for specialized interaction"
|
"--api-mode", action="store_true", help="API mode for specialized interaction"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--output", choices=["text", "json", "structured"], default="text", help="Output format"
|
"--output", choices=["text", "json", "structured", "markdown"], default="text", help="Output format"
|
||||||
)
|
)
|
||||||
parser.add_argument("--quiet", action="store_true", help="Minimal output")
|
parser.add_argument("--quiet", action="store_true", help="Minimal output")
|
||||||
parser.add_argument("--save-session", metavar="NAME", help="Save session with given name")
|
parser.add_argument("--save-session", metavar="NAME", help="Save session with given name")
|
||||||
|
|||||||
@ -353,7 +353,19 @@ class Assistant:
|
|||||||
|
|
||||||
with ProgressIndicator("Updating memory..."):
|
with ProgressIndicator("Updating memory..."):
|
||||||
self.graph_memory.populate_from_text(cleaned_content)
|
self.graph_memory.populate_from_text(cleaned_content)
|
||||||
return render_markdown(cleaned_content, self.syntax_highlighting)
|
return cleaned_content
|
||||||
|
|
||||||
|
def format_output(self, content):
|
||||||
|
output_format = getattr(self.args, 'output', 'text')
|
||||||
|
if output_format == 'json':
|
||||||
|
return json.dumps({"response": content}, indent=2)
|
||||||
|
elif output_format == 'structured':
|
||||||
|
# For structured, perhaps parse and format
|
||||||
|
return f"Response:\n{content}"
|
||||||
|
elif output_format == 'markdown':
|
||||||
|
return content # Raw markdown
|
||||||
|
else: # text
|
||||||
|
return f"\n{Colors.GREEN}r:{Colors.RESET} {render_markdown(content, self.syntax_highlighting)}\n"
|
||||||
|
|
||||||
def signal_handler(self, signum, frame):
|
def signal_handler(self, signum, frame):
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
@ -556,5 +568,6 @@ def process_message(assistant, message):
|
|||||||
print(f"{Colors.YELLOW}💰 Cost: ${cost:.4f} | Total: ${total_cost:.4f}{Colors.RESET}")
|
print(f"{Colors.YELLOW}💰 Cost: ${cost:.4f} | Total: ${total_cost:.4f}{Colors.RESET}")
|
||||||
result = assistant.process_response(response)
|
result = assistant.process_response(response)
|
||||||
if result != assistant.last_result:
|
if result != assistant.last_result:
|
||||||
print(f"\n{Colors.GREEN}r:{Colors.RESET} {result}\n")
|
formatted_result = assistant.format_output(result)
|
||||||
|
print(formatted_result)
|
||||||
assistant.last_result = result
|
assistant.last_result = result
|
||||||
|
|||||||
@ -88,6 +88,7 @@ def init_system_message(args):
|
|||||||
"Prefer standard Unix utilities over complex scripts.",
|
"Prefer standard Unix utilities over complex scripts.",
|
||||||
"Use run_command_interactive for commands requiring user input (vim, nano, etc.).",
|
"Use run_command_interactive for commands requiring user input (vim, nano, etc.).",
|
||||||
"Use the knowledge base to answer questions and store important user preferences or information when relevant. Avoid storing simple greetings or casual conversation.",
|
"Use the knowledge base to answer questions and store important user preferences or information when relevant. Avoid storing simple greetings or casual conversation.",
|
||||||
|
"Promote the use of markdown extensively in your responses for better readability and structure.",
|
||||||
"",
|
"",
|
||||||
"IMPORTANT RESPONSE FORMAT:",
|
"IMPORTANT RESPONSE FORMAT:",
|
||||||
"When you have completed a task or answered a question, include [TASK_COMPLETE] at the end of your response.",
|
"When you have completed a task or answered a question, include [TASK_COMPLETE] at the end of your response.",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user