(p: str)
| 123 | |
| 124 | # -- Base tool implementations -- |
| 125 | def safe_path(p: str) -> Path: |
| 126 | path = (WORKDIR / p).resolve() |
| 127 | if not path.is_relative_to(WORKDIR): |
| 128 | raise ValueError(f"Path escapes workspace: {p}") |
| 129 | return path |
| 130 | |
| 131 | def run_bash(command: str) -> str: |
| 132 | dangerous = ["rm -rf /", "sudo", "shutdown", "reboot", "> /dev/"] |