patchpal 0.22.4__tar.gz → 0.22.6__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.
Files changed (67) hide show
  1. {patchpal-0.22.4/patchpal.egg-info → patchpal-0.22.6}/PKG-INFO +4 -3
  2. {patchpal-0.22.4 → patchpal-0.22.6}/README.md +3 -2
  3. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/__init__.py +1 -1
  4. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/agent/function_calling.py +2 -0
  5. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/cli/sandbox.py +51 -4
  6. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/context.py +4 -1
  7. {patchpal-0.22.4 → patchpal-0.22.6/patchpal.egg-info}/PKG-INFO +4 -3
  8. {patchpal-0.22.4 → patchpal-0.22.6}/LICENSE +0 -0
  9. {patchpal-0.22.4 → patchpal-0.22.6}/MANIFEST.in +0 -0
  10. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/agent/__init__.py +0 -0
  11. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/agent/react.py +0 -0
  12. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/cli/__init__.py +0 -0
  13. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/cli/autopilot.py +0 -0
  14. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/cli/interactive.py +0 -0
  15. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/cli/mcp.py +0 -0
  16. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/cli/streaming.py +0 -0
  17. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/config.py +0 -0
  18. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/permissions.py +0 -0
  19. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/prompts/react_prompt.md +0 -0
  20. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/prompts/system_prompt.md +0 -0
  21. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/skills.py +0 -0
  22. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/__init__.py +0 -0
  23. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/audit.py +0 -0
  24. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/code_analysis.py +0 -0
  25. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/common.py +0 -0
  26. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/definitions.py +0 -0
  27. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/file_reading.py +0 -0
  28. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/file_writing.py +0 -0
  29. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/find_tool.py +0 -0
  30. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/grep_tool.py +0 -0
  31. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/image_handler.py +0 -0
  32. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/mcp.py +0 -0
  33. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/repo_map.py +0 -0
  34. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/shell_tools.py +0 -0
  35. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/todo_tools.py +0 -0
  36. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/tool_schema.py +0 -0
  37. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/user_interaction.py +0 -0
  38. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal/tools/web_tools.py +0 -0
  39. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal.egg-info/SOURCES.txt +0 -0
  40. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal.egg-info/dependency_links.txt +0 -0
  41. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal.egg-info/entry_points.txt +0 -0
  42. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal.egg-info/requires.txt +0 -0
  43. {patchpal-0.22.4 → patchpal-0.22.6}/patchpal.egg-info/top_level.txt +0 -0
  44. {patchpal-0.22.4 → patchpal-0.22.6}/pyproject.toml +0 -0
  45. {patchpal-0.22.4 → patchpal-0.22.6}/setup.cfg +0 -0
  46. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_agent.py +0 -0
  47. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_cli.py +0 -0
  48. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_config_dynamic.py +0 -0
  49. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_context.py +0 -0
  50. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_custom_tools.py +0 -0
  51. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_enabled_tools.py +0 -0
  52. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_find_tool.py +0 -0
  53. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_guardrails.py +0 -0
  54. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_image_blocking.py +0 -0
  55. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_maximum_security.py +0 -0
  56. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_mcp_config.py +0 -0
  57. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_memory.py +0 -0
  58. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_operational_safety.py +0 -0
  59. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_optional_tools.py +0 -0
  60. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_permissions.py +0 -0
  61. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_react.py +0 -0
  62. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_reasoning_content.py +0 -0
  63. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_repo_map.py +0 -0
  64. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_simplified_prompt.py +0 -0
  65. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_skills.py +0 -0
  66. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_streaming.py +0 -0
  67. {patchpal-0.22.4 → patchpal-0.22.6}/tests/test_tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchpal
3
- Version: 0.22.4
3
+ Version: 0.22.6
4
4
  Summary: An agentic coding and automation assistant, supporting both local and cloud LLMs
5
5
  Author: PatchPal Contributors
6
6
  License-Expression: Apache-2.0
@@ -59,6 +59,7 @@ Most agent frameworks are [built in TypeScript](https://news.ycombinator.com/ite
59
59
 
60
60
  **Key Features**
61
61
  - [Terminal Interface](https://amaiya.github.io/patchpal/usage/interactive/) for interactive development
62
+ - [Sandbox Mode](https://amaiya.github.io/patchpal/usage/sandbox/) for secure container isolation
62
63
  - [Python SDK](https://amaiya.github.io/patchpal/usage/python-api/) for flexibility and extensibility
63
64
  - [Built-In](https://amaiya.github.io/patchpal/features/tools/) and [Custom Tools](https://amaiya.github.io/patchpal/features/custom-tools/)
64
65
  - [Skills System](https://amaiya.github.io/patchpal/features/skills/) and [MCP Integration](https://amaiya.github.io/patchpal/features/mcp/)
@@ -76,7 +77,7 @@ $ pip install patchpal # install
76
77
  $ patchpal --model <model_id> # start
77
78
  ```
78
79
 
79
- > Model support: Any [LiteLLM-supported model](https://models.litellm.ai/) is can be used.
80
+ > Model support: Any [LiteLLM-supported model](https://models.litellm.ai/) can be used.
80
81
  > Platform support: Linux, macOS, and Windows are all supported
81
82
 
82
83
  **Alternative: Run with Docker/Podman (no installation required)**
@@ -173,7 +174,7 @@ While originally designed for software development, PatchPal is also a general-p
173
174
  > There are so many coding agent harnesses. Why build yet another one?
174
175
 
175
176
  1. Most agent harnesses are in TypeScript. We wanted [something in Python](https://amaiya.github.io/patchpal/usage/python-api/) that we could easily extend for our custom workflows.
176
- 2. PatchPal includes a [unique guardrails system](https://amaiya.github.io/patchpal/configuration/#security-permissions) that is better suited to privacy-conscious use cases involving sensitive data.
177
+ 2. PatchPal includes a [unique guardrails system](https://amaiya.github.io/patchpal/safety/) that is better suited to privacy-conscious use cases involving sensitive data.
177
178
  3. We needed an agent harness that seamlessly works with [both local and cloud models](https://amaiya.github.io/patchpal/models/overview/#supported-models), including AWS GovCloud Bedrock models.
178
179
 
179
180
 
@@ -11,6 +11,7 @@ Most agent frameworks are [built in TypeScript](https://news.ycombinator.com/ite
11
11
 
12
12
  **Key Features**
13
13
  - [Terminal Interface](https://amaiya.github.io/patchpal/usage/interactive/) for interactive development
14
+ - [Sandbox Mode](https://amaiya.github.io/patchpal/usage/sandbox/) for secure container isolation
14
15
  - [Python SDK](https://amaiya.github.io/patchpal/usage/python-api/) for flexibility and extensibility
15
16
  - [Built-In](https://amaiya.github.io/patchpal/features/tools/) and [Custom Tools](https://amaiya.github.io/patchpal/features/custom-tools/)
16
17
  - [Skills System](https://amaiya.github.io/patchpal/features/skills/) and [MCP Integration](https://amaiya.github.io/patchpal/features/mcp/)
@@ -28,7 +29,7 @@ $ pip install patchpal # install
28
29
  $ patchpal --model <model_id> # start
29
30
  ```
30
31
 
31
- > Model support: Any [LiteLLM-supported model](https://models.litellm.ai/) is can be used.
32
+ > Model support: Any [LiteLLM-supported model](https://models.litellm.ai/) can be used.
32
33
  > Platform support: Linux, macOS, and Windows are all supported
33
34
 
34
35
  **Alternative: Run with Docker/Podman (no installation required)**
@@ -125,7 +126,7 @@ While originally designed for software development, PatchPal is also a general-p
125
126
  > There are so many coding agent harnesses. Why build yet another one?
126
127
 
127
128
  1. Most agent harnesses are in TypeScript. We wanted [something in Python](https://amaiya.github.io/patchpal/usage/python-api/) that we could easily extend for our custom workflows.
128
- 2. PatchPal includes a [unique guardrails system](https://amaiya.github.io/patchpal/configuration/#security-permissions) that is better suited to privacy-conscious use cases involving sensitive data.
129
+ 2. PatchPal includes a [unique guardrails system](https://amaiya.github.io/patchpal/safety/) that is better suited to privacy-conscious use cases involving sensitive data.
129
130
  3. We needed an agent harness that seamlessly works with [both local and cloud models](https://amaiya.github.io/patchpal/models/overview/#supported-models), including AWS GovCloud Bedrock models.
130
131
 
131
132
 
@@ -1,6 +1,6 @@
1
1
  """PatchPal - An open-source Claude Code clone implemented purely in Python."""
2
2
 
3
- __version__ = "0.22.4"
3
+ __version__ = "0.22.6"
4
4
 
5
5
  from patchpal.agent import create_agent, create_react_agent
6
6
  from patchpal.cli.autopilot import autopilot_loop
@@ -741,6 +741,7 @@ It's currently empty (just the template). The file is automatically loaded at se
741
741
  response = litellm.completion(
742
742
  model=self.model_id,
743
743
  messages=messages,
744
+ max_tokens=32000, # Explicit output token limit for predictable context usage
744
745
  timeout=LLM_TIMEOUT,
745
746
  **self.litellm_kwargs,
746
747
  )
@@ -1078,6 +1079,7 @@ It's currently empty (just the template). The file is automatically loaded at se
1078
1079
  "messages": messages,
1079
1080
  "tools": tools,
1080
1081
  "tool_choice": "auto",
1082
+ "max_tokens": 32000, # Explicit output token limit for predictable context usage
1081
1083
  "timeout": LLM_TIMEOUT,
1082
1084
  "stream": stream,
1083
1085
  **self.litellm_kwargs,
@@ -163,6 +163,7 @@ def detect_llm_endpoints_from_env():
163
163
  os.environ.get("AWS_BEDROCK_REGION")
164
164
  or os.environ.get("AWS_REGION")
165
165
  or os.environ.get("AWS_DEFAULT_REGION")
166
+ or os.environ.get("AWS_REGION_NAME") # LiteLLM-specific
166
167
  )
167
168
  if aws_region and (
168
169
  os.environ.get("AWS_ACCESS_KEY_ID") or os.environ.get("AWS_SECRET_ACCESS_KEY")
@@ -427,7 +428,25 @@ def build_container_args(sandbox_args, patchpal_args):
427
428
  if needs_privileged:
428
429
  print("⚠️ Rootless Podman detected - using --privileged mode for iptables")
429
430
  container_args.extend(["--privileged"])
430
- container_args.extend(["--cgroup-manager=cgroupfs"])
431
+ # Only add --cgroup-manager on Linux (not supported on Windows/macOS Podman machines)
432
+ try:
433
+ # Check if we're on a Podman machine (macOS/Windows) vs native Linux
434
+ machine_check = subprocess.run(
435
+ ["podman", "machine", "list"], capture_output=True, text=True, check=False
436
+ )
437
+ # If machine list works and shows machines, we're on macOS/Windows
438
+ is_podman_machine = (
439
+ machine_check.returncode == 0
440
+ and machine_check.stdout.strip()
441
+ and len(machine_check.stdout.strip().split("\n")) > 1
442
+ )
443
+
444
+ if not is_podman_machine:
445
+ # Native Linux - add cgroup-manager flag
446
+ container_args.extend(["--cgroup-manager=cgroupfs"])
447
+ except Exception:
448
+ # If check fails, skip the flag (safer default)
449
+ pass
431
450
  else:
432
451
  container_args.extend(["--cap-add=NET_ADMIN"])
433
452
 
@@ -635,19 +654,22 @@ def build_container_args(sandbox_args, patchpal_args):
635
654
  # Add main patchpal command
636
655
  if sandbox_args.restrict_network:
637
656
  # Use launch-agent-sandbox pattern: model from env var
657
+ # Falls back to PATCHPAL_MODEL if MODEL not set
638
658
  shell_cmd_parts.append(f"""
639
659
  echo ""
640
660
  echo "=== Starting PatchPal ==="
641
- echo "Model: $MODEL"
661
+ echo "Model: ${{MODEL:-$PATCHPAL_MODEL}}"
642
662
  echo ""
643
- exec {patchpal_cmd} --model "$MODEL"
663
+ exec {patchpal_cmd} --model "${{MODEL:-$PATCHPAL_MODEL}}"
644
664
  """)
645
665
  else:
646
666
  # Normal mode: use $@ to pass all arguments
667
+ # Display model from command line or fall back to PATCHPAL_MODEL env var
668
+ model_display = model_name if model_name else "${PATCHPAL_MODEL:-default}"
647
669
  shell_cmd_parts.append(f"""
648
670
  echo ""
649
671
  echo "=== Starting PatchPal ==="
650
- echo "Model: {model_name if model_name else "default"}"
672
+ echo "Model: {model_display}"
651
673
  echo ""
652
674
  exec {patchpal_cmd} "$@"
653
675
  """)
@@ -984,6 +1006,31 @@ def main():
984
1006
  print(f"Loading environment variables from: {sandbox_args.env_file}")
985
1007
  load_env_file(sandbox_args.env_file)
986
1008
 
1009
+ # If LITELLM_KWARGS contains AWS params, normalize env var names to uppercase
1010
+ # This must happen before endpoint detection for AWS Bedrock auto-detection to work
1011
+ litellm_kwargs = os.environ.get("PATCHPAL_LITELLM_KWARGS") or os.environ.get(
1012
+ "LITELLM_KWARGS", ""
1013
+ )
1014
+ if litellm_kwargs and "aws_" in litellm_kwargs.lower():
1015
+ # Try to parse as JSON first
1016
+ try:
1017
+ import json
1018
+
1019
+ kwargs_dict = json.loads(litellm_kwargs)
1020
+ # Extract AWS parameters and set as environment variables
1021
+ for key, value in kwargs_dict.items():
1022
+ if key.lower().startswith("aws_"):
1023
+ upper_key = key.upper()
1024
+ if upper_key not in os.environ:
1025
+ os.environ[upper_key] = value
1026
+ except (json.JSONDecodeError, ValueError):
1027
+ # Not JSON, check if individual env vars exist (comma-separated format)
1028
+ for key, value in list(os.environ.items()):
1029
+ if key.lower().startswith("aws_"):
1030
+ upper_key = key.upper()
1031
+ if upper_key not in os.environ:
1032
+ os.environ[upper_key] = value
1033
+
987
1034
  # Auto-detect LLM endpoints if network restrictions are enabled
988
1035
  detected_endpoints = []
989
1036
  if sandbox_args.restrict_network:
@@ -257,7 +257,10 @@ Be comprehensive but concise. The goal is to continue work seamlessly without lo
257
257
  self.system_prompt = system_prompt
258
258
  self.estimator = TokenEstimator(model_id)
259
259
  self.context_limit = self._get_context_limit()
260
- self.output_reserve = 4_096 # Reserve tokens for model output
260
+ # Reserve 16% of context for output (min 4K, max 32K)
261
+ # This ensures older models like GPT-4 (8K) get 1.28K reserve
262
+ # while modern models get full 32K reserve
263
+ self.output_reserve = min(32_000, max(4_000, int(self.context_limit * 0.16)))
261
264
 
262
265
  def _get_context_limit(self) -> int:
263
266
  """Get context limit for model.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchpal
3
- Version: 0.22.4
3
+ Version: 0.22.6
4
4
  Summary: An agentic coding and automation assistant, supporting both local and cloud LLMs
5
5
  Author: PatchPal Contributors
6
6
  License-Expression: Apache-2.0
@@ -59,6 +59,7 @@ Most agent frameworks are [built in TypeScript](https://news.ycombinator.com/ite
59
59
 
60
60
  **Key Features**
61
61
  - [Terminal Interface](https://amaiya.github.io/patchpal/usage/interactive/) for interactive development
62
+ - [Sandbox Mode](https://amaiya.github.io/patchpal/usage/sandbox/) for secure container isolation
62
63
  - [Python SDK](https://amaiya.github.io/patchpal/usage/python-api/) for flexibility and extensibility
63
64
  - [Built-In](https://amaiya.github.io/patchpal/features/tools/) and [Custom Tools](https://amaiya.github.io/patchpal/features/custom-tools/)
64
65
  - [Skills System](https://amaiya.github.io/patchpal/features/skills/) and [MCP Integration](https://amaiya.github.io/patchpal/features/mcp/)
@@ -76,7 +77,7 @@ $ pip install patchpal # install
76
77
  $ patchpal --model <model_id> # start
77
78
  ```
78
79
 
79
- > Model support: Any [LiteLLM-supported model](https://models.litellm.ai/) is can be used.
80
+ > Model support: Any [LiteLLM-supported model](https://models.litellm.ai/) can be used.
80
81
  > Platform support: Linux, macOS, and Windows are all supported
81
82
 
82
83
  **Alternative: Run with Docker/Podman (no installation required)**
@@ -173,7 +174,7 @@ While originally designed for software development, PatchPal is also a general-p
173
174
  > There are so many coding agent harnesses. Why build yet another one?
174
175
 
175
176
  1. Most agent harnesses are in TypeScript. We wanted [something in Python](https://amaiya.github.io/patchpal/usage/python-api/) that we could easily extend for our custom workflows.
176
- 2. PatchPal includes a [unique guardrails system](https://amaiya.github.io/patchpal/configuration/#security-permissions) that is better suited to privacy-conscious use cases involving sensitive data.
177
+ 2. PatchPal includes a [unique guardrails system](https://amaiya.github.io/patchpal/safety/) that is better suited to privacy-conscious use cases involving sensitive data.
177
178
  3. We needed an agent harness that seamlessly works with [both local and cloud models](https://amaiya.github.io/patchpal/models/overview/#supported-models), including AWS GovCloud Bedrock models.
178
179
 
179
180
 
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