Clean up display.

This commit is contained in:
AI Christianson 2024-12-19 14:56:24 -05:00
parent 5d579246d5
commit 22aeb2812d
3 changed files with 15 additions and 22 deletions

View File

@ -11,7 +11,7 @@ from .list_directory import list_directory_tree
from .ripgrep import ripgrep_search from .ripgrep import ripgrep_search
from .memory import ( from .memory import (
delete_tasks, emit_research_notes, emit_plan, emit_task, get_memory_value, emit_key_facts, delete_tasks, emit_research_notes, emit_plan, emit_task, get_memory_value, emit_key_facts,
request_implementation, skip_implementation, delete_key_facts, request_research_subtask, request_implementation, delete_key_facts, request_research_subtask,
emit_key_snippets, delete_key_snippets, emit_related_files, swap_task_order emit_key_snippets, delete_key_snippets, emit_related_files, swap_task_order
) )
@ -33,7 +33,6 @@ __all__ = [
'request_implementation', 'request_implementation',
'run_programming_task', 'run_programming_task',
'run_shell_command', 'run_shell_command',
'skip_implementation',
'write_file_tool', 'write_file_tool',
'request_research_subtask', 'request_research_subtask',
'ripgrep_search', 'ripgrep_search',

View File

@ -2,6 +2,7 @@ from typing import Dict, List, Any, Union, TypedDict, Optional, Sequence, Set
from rich.console import Console from rich.console import Console
from rich.markdown import Markdown from rich.markdown import Markdown
from rich.panel import Panel from rich.panel import Panel
from rich.rule import Rule
from langchain_core.tools import tool from langchain_core.tools import tool
class SnippetInfo(TypedDict): class SnippetInfo(TypedDict):
@ -27,7 +28,6 @@ _global_memory: Dict[str, Union[List[Any], Dict[int, str], Dict[int, SnippetInfo
'key_snippets': {}, # Dict[int, SnippetInfo] - ID to snippet mapping 'key_snippets': {}, # Dict[int, SnippetInfo] - ID to snippet mapping
'key_snippet_id_counter': 0, # Counter for generating unique snippet IDs 'key_snippet_id_counter': 0, # Counter for generating unique snippet IDs
'implementation_requested': False, 'implementation_requested': False,
'implementation_skipped': [],
'related_files': set() 'related_files': set()
} }
@ -184,24 +184,12 @@ def request_implementation() -> str:
Empty string Empty string
""" """
_global_memory['implementation_requested'] = True _global_memory['implementation_requested'] = True
console.print(Panel("Implementation stage requested", title="🚀 Implementation Requested")) console.print()
console.print(Rule("🚀 Implementation Requested", style="yellow"))
console.print()
return "" return ""
@tool("skip_implementation")
def skip_implementation(reason: str) -> str:
"""Indicate that implementation can be skipped.
Used when research/planning determines no changes are needed.
Args:
reason: Why implementation can be skipped
Returns:
The stored reason
"""
_global_memory['implementation_skipped'].append(reason)
console.print(Panel(Markdown(reason), title="⏭️ Implementation Skipped"))
return reason
@tool("emit_key_snippets") @tool("emit_key_snippets")
def emit_key_snippets(snippets: List[SnippetInfo]) -> str: def emit_key_snippets(snippets: List[SnippetInfo]) -> str:

View File

@ -1,6 +1,6 @@
from langchain_core.tools import tool from langchain_core.tools import tool
from rich.console import Console from rich.console import Console
from rich.panel import Panel from rich.rule import Rule
console = Console() console = Console()
@ -9,7 +9,9 @@ def existing_project_detected() -> dict:
""" """
When to call: Once you have confirmed that the current working directory contains project files. When to call: Once you have confirmed that the current working directory contains project files.
""" """
console.print(Panel("Existing project detected.", title="📁 Existing Project Detected", border_style="bright_blue")) print()
console.print(Rule("📁 Existing Project Detected", style="bright_blue"))
print()
return { return {
'hint': ( 'hint': (
"You are working within an existing codebase that already has established patterns and standards. " "You are working within an existing codebase that already has established patterns and standards. "
@ -28,7 +30,9 @@ def monorepo_detected() -> dict:
""" """
When to call: After identifying that multiple packages or modules exist within a single repository. When to call: After identifying that multiple packages or modules exist within a single repository.
""" """
console.print(Panel("Monorepo detected.", title="📦 Monorepo Detected", border_style="bright_blue")) print()
console.print(Rule("📦 Monorepo Detected", style="bright_blue"))
print()
return { return {
'hint': ( 'hint': (
"You are researching in a monorepo environment that manages multiple packages or services under one roof. " "You are researching in a monorepo environment that manages multiple packages or services under one roof. "
@ -50,7 +54,9 @@ def ui_detected() -> dict:
""" """
When to call: After detecting that the project contains a user interface layer or front-end component. When to call: After detecting that the project contains a user interface layer or front-end component.
""" """
console.print(Panel("UI detected.", title="🎯 UI Detected", border_style="bright_blue")) print()
console.print(Rule("🎯 UI Detected", style="bright_blue"))
print()
return { return {
'hint': ( 'hint': (
"You are working with a user interface component where established UI conventions, styles, and frameworks are likely in place. " "You are working with a user interface component where established UI conventions, styles, and frameworks are likely in place. "