feat: Initial library extraction from PIN LLM benchmark

DockerSandbox + LangChain file/shell tools extracted into a standalone package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 11:47:44 +02:00
commit 80c2f9b159
17 changed files with 758 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
"""_utils.py shared helpers for file-ops tools."""
from __future__ import annotations
import posixpath
_MAX_OUTPUT_LINES = 200
_MAX_OUTPUT_CHARS = 20_000
_TRUNCATION_NOTICE = "\n... [output truncated] ..."
def truncate_output(output: str) -> str:
"""Truncate *output* to avoid hitting token limits."""
lines = output.splitlines(keepends=True)
if len(lines) > _MAX_OUTPUT_LINES:
output = "".join(lines[:_MAX_OUTPUT_LINES]) + _TRUNCATION_NOTICE
if len(output) > _MAX_OUTPUT_CHARS:
output = output[:_MAX_OUTPUT_CHARS] + _TRUNCATION_NOTICE
return output
def _parent(path: str) -> str:
"""Return the parent directory of *path* (best-effort, no I/O)."""
parent = posixpath.dirname(path.rstrip("/"))
return parent or "."