Download adapter/src/collab_harbor/pi_bash_timeout.py from HuggingFaceSwarms/collaborative-intelligence-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/datasets/HuggingFaceSwarms/collaborative-intelligence-benchmark/resolve/224ef0159bf077fc54fbab5f169c785e4e1cc821/adapter/src/collab_harbor/pi_bash_timeout.py
- Command line
-
hf download hf://datasets/HuggingFaceSwarms/collaborative-intelligence-benchmark@224ef0159bf077fc54fbab5f169c785e4e1cc821/adapter/src/collab_harbor/pi_bash_timeout.py
-
curl -L -o pi_bash_timeout.py https://huggingface.co/datasets/HuggingFaceSwarms/collaborative-intelligence-benchmark/resolve/224ef0159bf077fc54fbab5f169c785e4e1cc821/adapter/src/collab_harbor/pi_bash_timeout.py
1.62 kB
| """Opt-in default for extra local Pi bash; never a model/episode deadline.""" | |
| from __future__ import annotations | |
| import hashlib | |
| import math | |
| import shutil | |
| from pathlib import Path | |
| def bash_timeout_configuration(source_package: Path, seconds: float | None) -> dict: | |
| if seconds is not None and (not math.isfinite(seconds) or seconds <= 0 or seconds * 1000 > 2147483647): | |
| raise ValueError("Local Pi bash timeout must be a positive finite builtin-supported duration") | |
| return {"mode": "optional-local-bash-default-v1", "enabled": seconds is not None, | |
| "default_seconds": seconds, "explicit_tool_timeout_preserved": True, | |
| "stanford_native_tools_changed": False, "model_or_episode_timeout": False, | |
| "extension_sha256": hashlib.sha256((source_package / "pi-bash-timeout.js").read_bytes()).hexdigest()} | |
| def stage_bash_timeout(source_package: Path, agent: Path) -> None: | |
| target = agent / "collab_harbor/pi-bash-timeout.js" | |
| target.parent.mkdir(parents=True, exist_ok=True) | |
| shutil.copyfile(source_package / "pi-bash-timeout.js", target) | |
| target.chmod(0o644) | |
| def docker_bash_timeout_lines(seconds: float | None = None) -> str: | |
| # No ENV default in generated tasks. Profiles explicitly opt in. | |
| lines = "COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js\n" | |
| if seconds is not None: | |
| if not math.isfinite(seconds) or seconds <= 0 or seconds * 1000 > 2147483647: | |
| raise ValueError("Invalid local Pi bash timeout") | |
| lines += f"ENV CI_PI_BASH_TIMEOUT_SEC={seconds:g}\n" | |
| return lines | |