Download adapter/src/collab_harbor/pi-bash-timeout.js from HuggingFaceSwarms/collaborative-intelligence-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 925 Bytes
-
https://huggingface.co/datasets/HuggingFaceSwarms/collaborative-intelligence-benchmark/resolve/main/adapter/src/collab_harbor/pi-bash-timeout.js
- Command line
-
hf download hf://datasets/HuggingFaceSwarms/collaborative-intelligence-benchmark/adapter/src/collab_harbor/pi-bash-timeout.js
-
curl -L -o pi-bash-timeout.js https://huggingface.co/datasets/HuggingFaceSwarms/collaborative-intelligence-benchmark/resolve/main/adapter/src/collab_harbor/pi-bash-timeout.js
925 Bytes
| // Opt-in local Pi bash default only. Stanford sandbox tools are unaffected. | |
| // CI_PI_BASH_TIMEOUT_SEC=120 supplies a timeout only when the model omitted it. | |
| // Execution, errors, process-tree cleanup and explicit timeouts stay builtin. | |
| export default function (pi) { | |
| const configured = process.env.CI_PI_BASH_TIMEOUT_SEC; | |
| if (configured === undefined || configured === '') return; | |
| const seconds = Number(configured); | |
| if (!Number.isFinite(seconds) || seconds <= 0 || seconds * 1000 > 2147483647) { | |
| throw new Error('CI_PI_BASH_TIMEOUT_SEC must be a positive finite builtin-supported duration'); | |
| } | |
| pi.on('tool_call', event => { | |
| // Pi1.5 explicitly supports in-place mutation before builtin execution. | |
| // Do not repair invalid explicit arguments: normal builtin validation wins. | |
| if (event.toolName === 'bash' && event.input.timeout === undefined) { | |
| event.input.timeout = seconds; | |
| } | |
| }); | |
| } | |