Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions pdd/sync_determine_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@
from pdd.llm_invoke import llm_invoke
from pdd.get_language import get_language

_COST_MAP = {
'auto-deps': 0.10,
'generate': 0.50,
'example': 0.30,
'crash': 0.40,
'verify': 0.35,
'test': 0.60,
'fix': 0.45,
'update': 0.25,
'analyze_conflict': 0.20,
'nothing': 0.0,
'all_synced': 0.0,
'error': 0.0,
'fail_and_request_manual_merge': 0.0
}

# Constants - Use functions for dynamic path resolution
def get_pdd_dir():
"""Get the .pdd directory relative to current working directory."""
Expand Down Expand Up @@ -512,22 +528,8 @@ def get_git_diff(file_path: Path) -> str:

def estimate_operation_cost(operation: str, language: str = "python") -> float:
"""Returns estimated cost in dollars for each operation based on typical LLM usage."""
cost_map = {
'auto-deps': 0.10,
'generate': 0.50,
'example': 0.30,
'crash': 0.40,
'verify': 0.35,
'test': 0.60,
'fix': 0.45,
'update': 0.25,
'analyze_conflict': 0.20,
'nothing': 0.0,
'all_synced': 0.0,
'error': 0.0,
'fail_and_request_manual_merge': 0.0
}
return cost_map.get(operation, 0.0)
# Move cost_map to module level to avoid recreating the dict on every function call
return _COST_MAP.get(operation, 0.0)


def validate_expected_files(fingerprint: Optional[Fingerprint], paths: Dict[str, Path]) -> Dict[str, bool]:
Expand Down