patchpal 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {patchpal-0.4.0/patchpal.egg-info → patchpal-0.4.2}/PKG-INFO +1 -1
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/__init__.py +1 -1
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/agent.py +2 -2
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/tools.py +10 -6
- {patchpal-0.4.0 → patchpal-0.4.2/patchpal.egg-info}/PKG-INFO +1 -1
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_agent.py +7 -7
- {patchpal-0.4.0 → patchpal-0.4.2}/LICENSE +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/MANIFEST.in +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/README.md +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/cli.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/context.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/permissions.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/skills.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal/system_prompt.md +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal.egg-info/SOURCES.txt +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal.egg-info/dependency_links.txt +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal.egg-info/entry_points.txt +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal.egg-info/requires.txt +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/patchpal.egg-info/top_level.txt +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/pyproject.toml +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/setup.cfg +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_cli.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_context.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_guardrails.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_operational_safety.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_skills.py +0 -0
- {patchpal-0.4.0 → patchpal-0.4.2}/tests/test_tools.py +0 -0
|
@@ -742,8 +742,8 @@ def _apply_prompt_caching(messages: List[Dict[str, Any]], model_id: str) -> List
|
|
|
742
742
|
# Bedrock uses cachePoint
|
|
743
743
|
cache_marker = {"cachePoint": {"type": "ephemeral"}}
|
|
744
744
|
else:
|
|
745
|
-
# Direct Anthropic API uses
|
|
746
|
-
cache_marker = {"
|
|
745
|
+
# Direct Anthropic API uses cache_control
|
|
746
|
+
cache_marker = {"cache_control": {"type": "ephemeral"}}
|
|
747
747
|
|
|
748
748
|
# Find system messages (usually at the start)
|
|
749
749
|
system_messages = [i for i, msg in enumerate(messages) if msg.get("role") == "system"]
|
|
@@ -665,7 +665,7 @@ def _check_path(path: str, must_exist: bool = True) -> Path:
|
|
|
665
665
|
Validate and resolve a path.
|
|
666
666
|
|
|
667
667
|
Args:
|
|
668
|
-
path: Path to validate (relative or
|
|
668
|
+
path: Path to validate (relative, absolute, or with ~ for home directory)
|
|
669
669
|
must_exist: Whether the file must exist
|
|
670
670
|
|
|
671
671
|
Returns:
|
|
@@ -678,12 +678,15 @@ def _check_path(path: str, must_exist: bool = True) -> Path:
|
|
|
678
678
|
Can access files anywhere on the system (repository or outside).
|
|
679
679
|
Sensitive files (.env, credentials) are always blocked for safety.
|
|
680
680
|
"""
|
|
681
|
+
# Expand ~ for home directory first
|
|
682
|
+
expanded_path = os.path.expanduser(path)
|
|
683
|
+
|
|
681
684
|
# Resolve path (handle both absolute and relative paths)
|
|
682
|
-
path_obj = Path(
|
|
685
|
+
path_obj = Path(expanded_path)
|
|
683
686
|
if path_obj.is_absolute():
|
|
684
687
|
p = path_obj.resolve()
|
|
685
688
|
else:
|
|
686
|
-
p = (REPO_ROOT /
|
|
689
|
+
p = (REPO_ROOT / expanded_path).resolve()
|
|
687
690
|
|
|
688
691
|
# Check if file exists when required
|
|
689
692
|
if must_exist and not p.is_file():
|
|
@@ -1074,12 +1077,13 @@ def tree(path: str = ".", max_depth: int = 3, show_hidden: bool = False) -> str:
|
|
|
1074
1077
|
# Limit max_depth
|
|
1075
1078
|
max_depth = min(max_depth, 10)
|
|
1076
1079
|
|
|
1077
|
-
#
|
|
1078
|
-
|
|
1080
|
+
# Expand ~ for home directory and resolve path (handle both absolute and relative paths)
|
|
1081
|
+
expanded_path = os.path.expanduser(path)
|
|
1082
|
+
path_obj = Path(expanded_path)
|
|
1079
1083
|
if path_obj.is_absolute():
|
|
1080
1084
|
start_path = path_obj.resolve()
|
|
1081
1085
|
else:
|
|
1082
|
-
start_path = (REPO_ROOT /
|
|
1086
|
+
start_path = (REPO_ROOT / expanded_path).resolve()
|
|
1083
1087
|
|
|
1084
1088
|
# Check if path exists and is a directory
|
|
1085
1089
|
if not start_path.exists():
|
|
@@ -441,13 +441,13 @@ def test_prompt_caching_application_anthropic():
|
|
|
441
441
|
# Test with direct Anthropic API
|
|
442
442
|
cached_messages = _apply_prompt_caching(messages.copy(), "anthropic/claude-sonnet-4-5")
|
|
443
443
|
|
|
444
|
-
# System message should have
|
|
445
|
-
assert "
|
|
446
|
-
assert cached_messages[0]["
|
|
444
|
+
# System message should have cache_control
|
|
445
|
+
assert "cache_control" in cached_messages[0]
|
|
446
|
+
assert cached_messages[0]["cache_control"] == {"type": "ephemeral"}
|
|
447
447
|
|
|
448
|
-
# Last 2 messages should have
|
|
449
|
-
assert "
|
|
450
|
-
assert "
|
|
448
|
+
# Last 2 messages should have cache_control
|
|
449
|
+
assert "cache_control" in cached_messages[-1] # Last user message
|
|
450
|
+
assert "cache_control" in cached_messages[-2] # Last assistant message
|
|
451
451
|
|
|
452
452
|
|
|
453
453
|
def test_prompt_caching_application_bedrock():
|
|
@@ -488,7 +488,7 @@ def test_prompt_caching_no_modification_for_unsupported():
|
|
|
488
488
|
cached_messages = _apply_prompt_caching(messages.copy(), "openai/gpt-4o")
|
|
489
489
|
|
|
490
490
|
# Messages should be unchanged
|
|
491
|
-
assert "
|
|
491
|
+
assert "cache_control" not in cached_messages[0]
|
|
492
492
|
assert "cachePoint" not in cached_messages[0]
|
|
493
493
|
assert cached_messages == messages
|
|
494
494
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|