tools/eval (stdlib Python): one agent loop, system prompt and tool set (list/read/write/edit files, run, finish) for every language; language profiles for aji_air, rust, zig carry only toolchain invocation, docs location and command classification; bubblewrap sandbox without network, read-only toolchain and /docs; providers: Anthropic Messages, OpenAI-compatible (incl. local servers), scripted; run record per protocol §28 (hashes, versions, limits, hardware, seed, all events, patches, commands, final repository, first-generation snapshot, evaluator verdicts, cost); metrics §14-§17; resumable matrix plans; report (VSR, repair cycles, context, cost per correct solution); classify (§27 categories, caught-by, smoke-test causes). docs/evaluation/harness.md (task format for the private benchmark repository, evaluator contract, record schema); dev-tasks/dev-echo (harness development task, no benchmark family); smoke plan shape for the owner's E-S choice (binary/stream parser, bounded pipeline); self-tests in CI
46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
"""Benchmark task directories (provided at run time; hidden material never
|
|
lives in the public repository).
|
|
|
|
<task>/task.json
|
|
id, version, set ("dev" | "validation" | "test"), family,
|
|
prompt language-neutral statement (file, relative)
|
|
languages {lang: {"workspace": dir, "test": command}}
|
|
`workspace` is copied fresh into every run; `test` is
|
|
the public test command, counted as a test run
|
|
limits tool_calls, total_tokens, wall_seconds,
|
|
command_timeout, output_chars (defaults below)
|
|
concurrency bool (schedule exploration gate, protocol §13)
|
|
"""
|
|
|
|
import os
|
|
|
|
from . import util
|
|
|
|
DEFAULT_LIMITS = {"tool_calls": 150, "total_tokens": 3_000_000, "wall_seconds": 3600, "command_timeout": 300, "output_chars": 20_000}
|
|
|
|
|
|
class Task:
|
|
def __init__(self, path):
|
|
self.dir = os.path.realpath(path)
|
|
spec = util.read_json(os.path.join(self.dir, "task.json"))
|
|
for key in ("id", "version", "prompt", "languages"):
|
|
if key not in spec:
|
|
raise SystemExit(f"{path}/task.json: missing {key!r}")
|
|
self.spec = spec
|
|
self.id = spec["id"]
|
|
self.version = str(spec["version"])
|
|
self.set = spec.get("set", "dev")
|
|
with open(os.path.join(self.dir, spec["prompt"]), encoding="utf-8") as f:
|
|
self.prompt = f.read()
|
|
self.limits = dict(DEFAULT_LIMITS, **spec.get("limits", {}))
|
|
|
|
def language(self, name):
|
|
if name not in self.spec["languages"]:
|
|
raise SystemExit(f"task {self.id} has no variant for language {name!r}")
|
|
lang = self.spec["languages"][name]
|
|
return {"workspace": os.path.join(self.dir, lang["workspace"]), "test": lang.get("test")}
|
|
|
|
def hash(self):
|
|
"""Hash of the public task material (statement and starter workspaces)."""
|
|
return util.sha256_path(self.dir)
|