E0-3/E0-4 groundwork: provider options, pinned docs, Track A/B in the protocol

- providers: per-model request extras (e.g. reasoning_effort), key_env,
  token_param (max_completion_tokens on api.openai.com); recorded
- docs pinned to the toolchain being run: Rust offline docs from the
  sysroot, Zig langref and std source of the same installation; several
  mounts under a read-only /docs; hashes recorded (cached for big trees)
- protocol: neutral model labels and calibration before classes (§2);
  smoke gates, fixed Aji commit, fixed per-model reasoning mode, slope of
  degradation (§39a); Track A controlled vs Track B native agents (§39b)
- plan: E-C calibration, E-G gates, E-N native-agent run
This commit is contained in:
dev committed 2026-10-04 17:28:15 +03:00
1 parent b49003bdb9
commit d7bb9273f3
14 files changed
+250 -60

No files matched your search

+12
View File
@@ -49,6 +49,18 @@ One model + one language + one task + one fresh workspace + one fresh agent cont
| `openai` | OpenAI-compatible chat completions (`OPENAI_API_KEY`); also local servers such as vLLM, llama.cpp or Ollama via `base_url` |
| `scripted` | replays fixed turns (self-tests) |
Per model, `extra` (JSON) is merged into every request body and recorded, for example `{"reasoning_effort": "medium"}`. `key_env` names the environment variable holding the key, and `token_param` chooses `max_tokens` or `max_completion_tokens`. Keys are never written to records.
**Documentation** is pinned to the toolchain being run:
| Language | Mounted under `/docs` |
|---|---|
| Aji | the Agent Reference Bundle |
| Rust | the toolchain's offline documentation from the sysroot: std API, the Reference, the Book |
| Zig | the matching language reference (`/docs/doc`) and standard library source (`/docs/std`) |
An environment variable (`AJI_EVAL_*_DOCS`) overrides this. Each mount's hash is recorded next to the compiler version, and hashes of large trees are cached in `~/.cache/ajieval`.
## Task directory (the interface to the private benchmark repository)
```text
+38 -1
View File
@@ -73,6 +73,8 @@ Model classes are assigned before Aji evaluation.
Parameter count alone MUST NOT determine capability class.
Models enter an experiment under neutral labels (`M1`, `M2`, …), never under a presumed class. A class is assigned only from a calibration score: 5–10 neutral coding tasks unrelated to Aji, run in the same scaffold and the same production settings (owner decision after Phase 3). If calibration places two models close together, the classes are redefined before any hidden test is run. Declaring a model weak and then showing that Aji helps it is not evidence.
At least one locally runnable model SHOULD be included.
## Task
@@ -1536,13 +1538,48 @@ Before the pilot, a small run checks the infrastructure, not the hypothesis:
```text
2 families (binary/stream parsing; concurrent bounded pipeline — owner decision after Phase 3)
× 3 languages (Aji/AIR, Rust, Zig)
× 3 model classes
× 3 models (M1, M2, M3, calibrated per §2)
× 2 runs
= 36 runs
```
It verifies that task statements are equivalent across languages, the harness works, the Agent Reference Bundle is sufficient, token and cost accounting is right, traces are stored completely and prompts carry no bias. No result of the smoke test is reported as evidence.
The smoke test is **Track A** (§39b): every model runs in the same scaffold (`tools/eval`), with the same system prompt, tools, turn limits, filesystem interface, documentation policy and evaluator. Each model uses one fixed production reasoning mode, the same for every language; reasoning modes are not artificially aligned across providers, and maximum modes are not used.
Gates before the 36 runs:
```text
each model: live dev-echo run PASS
Rust reference PASS evaluator
Zig reference PASS evaluator
Aji hand-written reference PASS evaluator
task statement review PASS
hidden tests review PASS
```
Reference solutions are written only after task statements and evaluators are frozen, and are never used to derive hidden assertions after model behavior has been seen.
Toolchains and documentation are pinned to the benchmark environment: the run record stores each compiler version together with the hash of the documentation mounted for it.
All 36 runs use **one Aji commit**. Aji is not changed after the first results, even when a poor diagnostic or an awkward construct is obvious; failures are classified (§27; causes: language, documentation, agent bundle, diagnostics, harness, model capability, task ambiguity) after the matrix is complete, and only then does the next iteration begin. Otherwise the experiment becomes online tuning.
The quantity of interest is the slope of degradation as model capability decreases, per language, not the absolute success rates.
---
# 39b. Controlled and native-agent tracks
```text
Track A — controlled language × model, one scaffold (tools/eval)
tests Model Capability Compression (H4)
Track B — native agent language × coding-agent product (each model in its
vendor's agent, e.g. Codex, Claude Code, OpenCode/Pi)
tests the practical economics of development
```
Track B measures model + system prompt + context management + tool policy + compaction + agent heuristics together, so its results are never used as evidence for H4. A first Track B run follows the smoke test: 2 tasks × 3 languages × 3 native agents × 1 run = 18 runs.
---
# 39. First concrete experiment
+4 -4
View File
@@ -1,11 +1,11 @@
{
"comment": "E-S engineering smoke test (protocol §39a): 2 tasks x 3 languages x 3 model classes x 2 runs = 36 runs. Copy next to the private task checkout, fill in task paths, models and the evaluator, then: python3 -m ajieval matrix plan.json (from tools/eval, with PYTHONPATH or cwd there). Infrastructure check only; no result is evidence.",
"comment": "E-S engineering smoke test, Track A (protocol §39a, §39b); models are neutral labels M1-M3 until calibrated (E-C): 2 tasks x 3 languages x 3 model classes x 2 runs = 36 runs. Copy next to the private task checkout, fill in task paths, models and the evaluator, then: python3 -m ajieval matrix plan.json (from tools/eval, with PYTHONPATH or cwd there). Infrastructure check only; no result is evidence.",
"tasks": ["../aji-bench/tasks/<binary-frame-decoder>", "../aji-bench/tasks/<bounded-pipeline>"],
"languages": ["aji_air", "rust", "zig"],
"models": [
{"class": "frontier", "provider": "anthropic", "model": "<frontier model id>"},
{"class": "mid", "provider": "openai", "model": "<mid model id>", "base_url": "<OpenAI-compatible endpoint>"},
{"class": "small", "provider": "openai", "model": "<small/local model id>", "base_url": "http://127.0.0.1:8000/v1"}
{"class": "M1", "provider": "openai", "model": "gpt-6.1-sol", "extra": {"reasoning_effort": "<fixed production mode>"}},
{"class": "M2", "provider": "anthropic", "model": "claude-opus-5-5", "extra": {}},
{"class": "M3", "provider": "openai", "model": "<exact GLM-5.3-Flash model id>", "base_url": "<Z.ai OpenAI-compatible endpoint>", "key_env": "ZAI_API_KEY"}
],
"runs": 2,
"sandbox": "bwrap",
+4 -1
View File
@@ -96,7 +96,10 @@ Evaluation runs alongside the phases; each stage starts when the language featur
| E0-2 | todo | (owner; in parallel with Phase 3, outside this repository) Private benchmark repository: task specs, evaluators, reference implementations, hidden tests for T01–T04; dev/validation/test split | — | evaluator hashes published; nothing hidden in this repository |
| E0-3 | done | Language-neutral agent scaffold and run recorder (protocol §5, §28) | — | `tools/eval/`, `docs/evaluation/harness.md`; one loop drives Aji, Rust and Zig (self-tests on `dev-echo`); every run record complete |
| E0-4 | todo | Rust and Zig baseline solutions and pinned local documentation | E0-2 | baselines pass the hidden tests |
| E-S | todo | Engineering smoke test: 2 families (binary/stream parser, concurrent bounded pipeline) × 3 languages × 3 model classes × 2 runs = 36 runs (protocol §39a); plan shape `docs/evaluation/smoke-plan.example.json`; failures classified by cause before any language change | E0-2, E0-3, E0-4 | harness, bundle sufficiency, accounting and traces verified |
| E-C | todo | Model calibration: models labelled M1–M3 run 5–10 neutral coding tasks unrelated to Aji in `tools/eval`; classes assigned from scores; live `dev-echo` per model (protocol §2, §39a) | E0-3 | calibration report; model IDs, endpoints and reasoning modes frozen |
| E-G | todo | Smoke gates: Rust, Zig and hand-written Aji references pass the frozen evaluators; task-statement and hidden-test review (protocol §39a) | E0-2, E0-4 | all gates pass |
| E-S | todo | Engineering smoke test, Track A: 2 families (binary/stream parser, concurrent bounded pipeline) × 3 languages × 3 models (M1–M3) × 2 runs = 36 runs on one Aji commit (protocol §39a); plan shape `docs/evaluation/smoke-plan.example.json`; failures classified by cause after the matrix, before any language change | E-C, E-G | harness, bundle sufficiency, accounting and traces verified |
| E-N | todo | Track B native-agent run: 2 tasks × 3 languages × 3 native agents × 1 run = 18 runs (protocol §39b); never evidence for H4 | E-S | native-agent report: cost and outcome per agent product |
| E-A | todo | Stage A pilot (condition `Aji/AIR`): T01–T04 families × Aji/Rust/Zig × 3 model classes × 3 runs = 108 runs (protocol §39); not headline evidence | E-S, basic Phase 3 | pilot report: effect size, broken tasks, cost, instrumentation |
| E-B | todo | Stage B: T05–T07 | Phase 3 | stage report |
| E-C | todo | Stage C: T08, litmus repair | Phase 5 | stage report |
+21 -6
View File
@@ -75,11 +75,20 @@ class Agent:
if not self.docs:
raise ToolError("no documentation is mounted")
rel = p[len("/docs"):].lstrip("/")
if os.path.isfile(self.docs):
if rel not in ("", os.path.basename(self.docs)):
if len(self.docs) == 1 and self.docs[0][0] == "":
base, kind = self.docs[0][1], "documentation"
else:
if rel == "":
raise ToolError("/docs is a directory")
head, _, rest = rel.partition("/")
match = [m for m in self.docs if m[0] == head]
if not match:
raise ToolError(f"no such file: {p}")
return self.docs, "documentation"
base, kind = self.docs, "documentation"
if os.path.isfile(match[0][1]):
if rest:
raise ToolError(f"no such file: {p}")
return match[0][1], "documentation"
base, rel, kind = match[0][1], rest, "documentation"
else:
raise ToolError("paths must be under /work or /docs")
full = os.path.realpath(os.path.join(base, rel))
@@ -90,11 +99,17 @@ class Agent:
# ---------------------------------------------------------------- tools
def tool_list_files(self, inp):
path = os.path.normpath(inp.get("path") or "/work")
if path == "/docs" and self.docs and not (len(self.docs) == 1 and self.docs[0][0] == ""):
return "\n".join("/docs/" + n for n, _ in self.docs)
full, kind = self.host_path(inp.get("path"))
if os.path.isfile(full):
return os.path.basename(full)
root_virtual = "/docs" if kind == "documentation" else "/work"
base = self.docs if kind == "documentation" else self.workspace
root_virtual, base = "/work", self.workspace
if kind == "documentation":
for n, p in self.docs:
if full == p or full.startswith(p + os.sep):
root_virtual, base = ("/docs/" + n if n else "/docs"), p
out = []
for root, dirs, files in os.walk(full):
dirs[:] = sorted(d for d in dirs if d not in (".git", "target", "zig-cache", ".zig-cache", "zig-out"))
+7 -2
View File
@@ -30,7 +30,8 @@ def cmd_run(a):
run_dir, rec = record.run_one(
a.task, a.language, a.provider, a.model, a.out, model_class=a.model_class, seed=a.seed, sandbox_kind=a.sandbox,
evaluator=shlex.split(a.evaluator) if a.evaluator else None, evaluator_hash_path=a.evaluator_hash_path,
pricing=load_pricing(a.pricing), base_url=a.base_url, max_tokens=a.max_tokens, temperature=a.temperature)
pricing=load_pricing(a.pricing), base_url=a.base_url, max_tokens=a.max_tokens, temperature=a.temperature,
provider_options={k: v for k, v in {"extra": json.loads(a.extra) if a.extra else None, "key_env": a.key_env, "token_param": a.token_param}.items() if v})
m = rec["metrics"]
print(json.dumps({"run": run_dir, "termination": m["termination"], "accepted": rec["accepted"], "tool_calls": m["tool_calls"],
"input_tokens": m["input_tokens"], "output_tokens": m["output_tokens"], "cost_usd": rec["cost_usd"]}))
@@ -64,7 +65,8 @@ def cmd_matrix(a):
tpath, lang, mdl["provider"], mdl["model"], out, model_class=mdl.get("class"), seed=seed,
sandbox_kind=plan.get("sandbox", "bwrap"), evaluator=evaluator, evaluator_hash_path=hash_path,
pricing=pricing, base_url=mdl.get("base_url"), max_tokens=mdl.get("max_tokens", 8192), temperature=mdl.get("temperature"),
limits=plan.get("limits"))
limits=plan.get("limits"),
provider_options={k: mdl[k] for k in ("extra", "key_env", "token_param") if k in mdl})
print(f" -> {rec['metrics']['termination']}, accepted={rec['accepted']}", file=sys.stderr)
report.print_report([out])
@@ -96,6 +98,9 @@ def main(argv=None):
r.add_argument("--base-url")
r.add_argument("--max-tokens", type=int, default=8192)
r.add_argument("--temperature", type=float)
r.add_argument("--extra", help='JSON merged into every request body, e.g. {"reasoning_effort": "medium"}')
r.add_argument("--key-env", help="name of the environment variable holding the API key (openai provider)")
r.add_argument("--token-param", help="max_tokens or max_completion_tokens (openai provider)")
r.set_defaults(fn=cmd_run)
m = sub.add_parser("matrix", help="run every cell of a plan file (resumable)")
+25 -4
View File
@@ -87,11 +87,32 @@ def versions(prof, env=None):
return out
def docs_path(prof):
def docs_mounts(prof):
"""Documentation mounted under /docs, as [(name, host path)]; name ""
means the directory is /docs itself. The environment variable wins;
otherwise `default`, or `from_toolchain` (paths relative to the bound
toolchain directory, so the documentation always matches the compiler
being run; each is mounted as /docs/<last path component>)."""
d = prof.get("docs") or {}
path = os.environ.get(d.get("env", ""), "") or d.get("default", "")
path = expand(path) if path else ""
return path if path and os.path.exists(path) else None
path = os.environ.get(d.get("env", ""), "") or (expand(d["default"]) if d.get("default") else "")
if path:
if not os.path.exists(path):
return []
return [("", path)] if os.path.isdir(path) else [(os.path.basename(path), path)]
rels = d.get("from_toolchain") or []
if isinstance(rels, str):
rels = [rels]
if not rels:
return []
_, binds = resolve_binaries(prof)
out = []
for rel in rels:
for b in binds:
cand = os.path.join(b, rel)
if os.path.exists(cand):
out.append((os.path.basename(rel.rstrip("/")), cand))
break
return out
def classify(prof, command):
+22 -9
View File
@@ -50,15 +50,16 @@ def _post(url, headers, body, timeout, retries=4):
class Anthropic:
name = "anthropic"
def __init__(self, model, max_tokens=8192, temperature=None, base_url=None, timeout=600):
def __init__(self, model, max_tokens=8192, temperature=None, base_url=None, timeout=600, extra=None, **_):
self.model, self.max_tokens, self.temperature, self.timeout = model, max_tokens, temperature, timeout
self.extra = dict(extra or {})
self.url = (base_url or "https://api.anthropic.com") + "/v1/messages"
self.key = os.environ.get("ANTHROPIC_API_KEY")
if not self.key:
raise SystemExit("ANTHROPIC_API_KEY is not set")
def params(self):
return {"max_tokens": self.max_tokens, "temperature": self.temperature}
return {"max_tokens": self.max_tokens, "temperature": self.temperature, "extra": self.extra}
def complete(self, system, messages, tools):
msgs = []
@@ -81,6 +82,7 @@ class Anthropic:
}
if self.temperature is not None:
body["temperature"] = self.temperature
body.update(self.extra)
r = _post(self.url, {"x-api-key": self.key, "anthropic-version": "2023-06-01"}, body, self.timeout)
content = []
for b in r.get("content", []):
@@ -104,15 +106,25 @@ class Anthropic:
class OpenAICompatible:
"""`extra` is merged into every request body (for example
{"reasoning_effort": "medium"}) and recorded. OpenAI's own endpoint takes
`max_completion_tokens`; other servers take `max_tokens` unless
`token_param` says otherwise. The API key is read from the environment
variable named by `key_env` (default OPENAI_API_KEY)."""
name = "openai"
def __init__(self, model, max_tokens=8192, temperature=None, base_url=None, timeout=600):
def __init__(self, model, max_tokens=8192, temperature=None, base_url=None, timeout=600, extra=None, key_env=None, token_param=None, **_):
self.model, self.max_tokens, self.temperature, self.timeout = model, max_tokens, temperature, timeout
self.url = (base_url or "https://api.openai.com/v1").rstrip("/") + "/chat/completions"
self.key = os.environ.get("OPENAI_API_KEY", "")
self.base = (base_url or "https://api.openai.com/v1").rstrip("/")
self.url = self.base + "/chat/completions"
self.key_env = key_env or "OPENAI_API_KEY"
self.secret = os.environ.get(self.key_env, "")
self.extra = dict(extra or {})
self.token_param = token_param or ("max_completion_tokens" if "api.openai.com" in self.base else "max_tokens")
def params(self):
return {"max_tokens": self.max_tokens, "temperature": self.temperature}
return {"max_tokens": self.max_tokens, "token_param": self.token_param, "temperature": self.temperature, "extra": self.extra, "key_env": self.key_env}
def complete(self, system, messages, tools):
msgs = [{"role": "system", "content": system}]
@@ -132,13 +144,14 @@ class OpenAICompatible:
msgs.append({"role": "user", "content": "\n".join(texts)})
body = {
"model": self.model,
"max_tokens": self.max_tokens,
self.token_param: self.max_tokens,
"messages": msgs,
"tools": [{"type": "function", "function": {"name": t["name"], "description": t["description"], "parameters": t["parameters"]}} for t in tools],
}
if self.temperature is not None:
body["temperature"] = self.temperature
headers = {"authorization": f"Bearer {self.key}"} if self.key else {}
body.update(self.extra)
headers = {"authorization": "Bearer " + self.secret} if self.secret else {}
r = _post(self.url, headers, body, self.timeout)
choice = r["choices"][0]
msg = choice["message"]
@@ -170,7 +183,7 @@ class Scripted:
name = "scripted"
def __init__(self, model, max_tokens=8192, temperature=None, base_url=None, timeout=0):
def __init__(self, model, max_tokens=8192, temperature=None, base_url=None, timeout=0, **_):
self.model = model
with open(model) as f:
self.turns = json.load(f)
+6 -13
View File
@@ -71,7 +71,8 @@ def cost(pricing, model, m):
def run_one(task_dir, lang_name, provider_name, model, out_dir, model_class=None, seed=0, sandbox_kind="bwrap",
evaluator=None, evaluator_hash_path=None, pricing=None, base_url=None, max_tokens=8192, temperature=None, limits=None):
evaluator=None, evaluator_hash_path=None, pricing=None, base_url=None, max_tokens=8192, temperature=None, limits=None,
provider_options=None):
task = task_mod.Task(task_dir)
profile = languages.load(lang_name)
lang = task.language(lang_name)
@@ -85,19 +86,11 @@ def run_one(task_dir, lang_name, provider_name, model, out_dir, model_class=None
agent.copy_workspace(lang["workspace"], workspace)
_, binds = languages.resolve_binaries(profile)
docs = languages.docs_path(profile)
docs_src = docs
if docs is None:
docs = languages.docs_mounts(profile)
if not docs:
print(f"warning: no local documentation for {lang_name} (set {profile.get('docs', {}).get('env')}); protocol §4 requires pinned docs", file=sys.stderr)
if docs and os.path.isfile(docs):
# A single documentation file is staged into a directory so that
# /docs is a read-only mount as a whole.
staged = os.path.join(run_dir, "docs")
os.makedirs(staged)
shutil.copy(docs, staged)
docs = staged
sb = sandbox.Sandbox(sandbox_kind, workspace, binds, languages.sandbox_path(binds), docs, profile.get("env"))
kw = {"max_tokens": max_tokens, "temperature": temperature, "base_url": base_url}
kw = {"max_tokens": max_tokens, "temperature": temperature, "base_url": base_url, **(provider_options or {})}
prov = providers.make(provider_name, model, **kw)
rec = Recorder(run_dir)
@@ -126,7 +119,7 @@ def run_one(task_dir, lang_name, provider_name, model, out_dir, model_class=None
"started": started,
"task": {"id": task.id, "version": task.version, "set": task.set, "family": task.spec.get("family"), "hash": task.hash(), "concurrency": bool(task.spec.get("concurrency"))},
"evaluator": None if not evaluator else {"command": evaluator, "hash": util.sha256_path(evaluator_hash_path or evaluator[0])},
"language": {"name": lang_name, "profile_hash": profile["profile_hash"], "toolchain": languages.versions(profile), "docs": docs_src, "docs_hash": util.sha256_path(docs) if docs else None},
"language": {"name": lang_name, "profile_hash": profile["profile_hash"], "toolchain": languages.versions(profile), "docs": [{"mount": "/docs/" + n, "path": p, "hash": util.sha256_path_cached(p)} for n, p in docs]},
"model": {"provider": provider_name, "id": model, "class": model_class, "params": prov.params(), "base_url": base_url},
"scaffold": {"version": __version__, "commit": util.git_commit(), "sandbox": sb.describe()},
"system_prompt_hash": util.sha256_text(a.system),
+9 -5
View File
@@ -16,18 +16,18 @@ LINKS = [("usr/lib", "/lib"), ("usr/lib64", "/lib64"), ("usr/bin", "/bin"), ("us
class Sandbox:
def __init__(self, kind, workspace, toolchain_binds, path_dirs, docs=None, env=None):
def __init__(self, kind, workspace, toolchain_binds, path_dirs, docs=(), env=None):
if kind == "bwrap" and shutil.which("bwrap") is None:
raise SystemExit("sandbox bwrap requested but bubblewrap is not installed")
self.kind = kind
self.workspace = os.path.realpath(workspace)
self.binds = toolchain_binds
self.path = ":".join(path_dirs + ["/usr/bin", "/bin"])
self.docs = os.path.realpath(docs) if docs else None
self.docs = [(name, os.path.realpath(p)) for name, p in docs]
self.env = dict(env or {})
def describe(self):
return {"kind": self.kind, "network": self.kind != "bwrap", "toolchain_binds": self.binds, "docs": self.docs}
return {"kind": self.kind, "network": self.kind != "bwrap", "toolchain_binds": self.binds, "docs": [{"mount": "/docs/" + n, "path": p} for n, p in self.docs]}
def argv(self, command):
if self.kind == "none":
@@ -43,8 +43,12 @@ class Sandbox:
for d in self.binds:
a += ["--ro-bind", d, d]
if self.docs:
target = "/docs" if os.path.isdir(self.docs) else "/docs/" + os.path.basename(self.docs)
a += ["--ro-bind", self.docs, target]
# A tmpfs mount point, remounted read-only after the binds, keeps
# /docs read-only as a whole.
a += ["--tmpfs", "/docs"]
for name, p in self.docs:
a += ["--ro-bind", p, "/docs/" + name if name else "/docs"]
a += ["--remount-ro", "/docs"]
a += ["--bind", self.workspace, "/work", "--chdir", "/work", "--clearenv"]
env = {"PATH": self.path, "HOME": "/tmp", "TMPDIR": "/tmp", "LANG": "C.UTF-8"}
env.update(self.env)
+22
View File
@@ -36,6 +36,28 @@ def sha256_path(path):
return "sha256:" + h.hexdigest()
def sha256_path_cached(path):
"""`sha256_path` for large documentation trees, cached on disk by the
tree's path, file count, total size and newest modification time."""
count, size, newest = 0, 0, 0.0
for root, dirs, files in os.walk(path) if os.path.isdir(path) else [(os.path.dirname(path), [], [os.path.basename(path)])]:
dirs[:] = [d for d in dirs if d not in (".git", "__pycache__")]
for name in files:
st = os.stat(os.path.join(root, name))
count, size, newest = count + 1, size + st.st_size, max(newest, st.st_mtime)
key = f"{os.path.realpath(path)}|{count}|{size}|{newest}"
cache_file = os.path.join(os.path.expanduser("~"), ".cache", "ajieval", "hashes.json")
try:
cache = read_json(cache_file)
except (OSError, ValueError):
cache = {}
if key not in cache:
cache[key] = sha256_path(path)
os.makedirs(os.path.dirname(cache_file), exist_ok=True)
write_json(cache_file, cache)
return cache[key]
def git_commit(path=REPO):
"""`<commit>` or `<commit>+dirty` for the repository containing `path`."""
try:
+41 -7
View File
@@ -2,12 +2,46 @@
"name": "rust",
"display": "Rust",
"toolchain": {
"bind_command": ["rustc", "--print", "sysroot"],
"version": [["rustc", "--version"], ["cargo", "--version"]]
"bind_command": [
"rustc",
"--print",
"sysroot"
],
"version": [
[
"rustc",
"--version"
],
[
"cargo",
"--version"
]
]
},
"docs": {"env": "AJI_EVAL_RUST_DOCS", "default": ""},
"source_extensions": [".rs"],
"instructions": "Language: Rust (stable toolchain, standard library only; no network, so no crates.io dependencies).\nToolchain: `cargo build`, `cargo test`, `cargo run`, `rustc`. Cargo works offline (`--offline` is implied by the environment).\nDocumentation: pinned local Rust documentation is in /docs (read-only), if present.",
"env": {"CARGO_NET_OFFLINE": "true"},
"classify": {"check": ["cargo check"], "build": ["cargo build", "rustc"], "test": ["cargo test", "cargo run"]}
"docs": {
"env": "AJI_EVAL_RUST_DOCS",
"from_toolchain": [
"share/doc/rust/html"
]
},
"source_extensions": [
".rs"
],
"instructions": "Language: Rust (stable toolchain, standard library only; no network, so no crates.io dependencies).\nToolchain: `cargo build`, `cargo test`, `cargo run`, `rustc`. Cargo works offline (`--offline` is implied by the environment).\nDocumentation: the offline documentation of this toolchain (standard library API, the Reference, the Book) is in /docs (read-only).",
"env": {
"CARGO_NET_OFFLINE": "true"
},
"classify": {
"check": [
"cargo check"
],
"build": [
"cargo build",
"rustc"
],
"test": [
"cargo test",
"cargo run"
]
}
}
+35 -6
View File
@@ -2,11 +2,40 @@
"name": "zig",
"display": "Zig",
"toolchain": {
"binaries": ["zig"],
"version": [["zig", "version"]]
"binaries": [
"zig"
],
"version": [
[
"zig",
"version"
]
]
},
"docs": {"env": "AJI_EVAL_ZIG_DOCS", "default": ""},
"source_extensions": [".zig"],
"instructions": "Language: Zig (the pinned toolchain below; standard library only; no network).\nToolchain: `zig build`, `zig build test`, `zig build run`, `zig run FILE.zig`, `zig test FILE.zig`.\nDocumentation: pinned local Zig documentation is in /docs (read-only), if present.",
"classify": {"check": ["zig ast-check"], "build": ["zig build-exe", "zig build"], "test": ["zig build test", "zig test", "zig build run", "zig run"]}
"docs": {
"env": "AJI_EVAL_ZIG_DOCS",
"from_toolchain": [
"doc",
"lib/std"
]
},
"source_extensions": [
".zig"
],
"instructions": "Language: Zig (the pinned toolchain below; standard library only; no network).\nToolchain: `zig build`, `zig build test`, `zig build run`, `zig run FILE.zig`, `zig test FILE.zig`.\nDocumentation: the language reference matching this compiler is in /docs/doc and the matching standard library source in /docs/std (read-only).",
"classify": {
"check": [
"zig ast-check"
],
"build": [
"zig build-exe",
"zig build"
],
"test": [
"zig build test",
"zig test",
"zig build run",
"zig run"
]
}
}
+4 -2
View File
@@ -37,13 +37,15 @@ class SandboxTest(unittest.TestCase):
@unittest.skipUnless(SANDBOX == "bwrap", "bubblewrap unavailable")
def test_isolation(self):
ws = tempfile.mkdtemp()
sb = sandbox.Sandbox("bwrap", ws, [], [], docs=TASK)
sb = sandbox.Sandbox("bwrap", ws, [], [], docs=[("", TASK), ("prompt.md", os.path.join(TASK, "prompt.md"))])
code, out, _ = sb.run("echo hi > f && cat f", 30, 1000)
self.assertEqual((code, out.strip()), (0, "hi"))
code, out, _ = sb.run("getent hosts example.com || echo NO_NET", 30, 1000)
self.assertIn("NO_NET", out)
code, _, _ = sb.run("touch /docs/x", 30, 1000)
self.assertNotEqual(code, 0)
code, out, _ = sb.run("cat /docs/prompt.md/../task.json >/dev/null 2>&1; head -c 6 /docs/prompt.md", 30, 1000)
self.assertIn("# Task", out)
code, out, _ = sb.run("ls " + os.path.expanduser("~") + " 2>&1 || echo NO_HOME", 30, 1000)
self.assertIn("NO_HOME", out)
self.assertTrue(os.path.exists(os.path.join(ws, "f")))
@@ -60,7 +62,7 @@ class SandboxTest(unittest.TestCase):
class PathTest(unittest.TestCase):
def test_confinement(self):
ws = tempfile.mkdtemp()
a = agent.Agent(None, {"instructions": ""}, None, {}, None, ws, None, None, {"tool_calls": 1, "total_tokens": 1, "output_chars": 100})
a = agent.Agent(None, {"instructions": ""}, None, {}, None, ws, [], None, {"tool_calls": 1, "total_tokens": 1, "output_chars": 100})
for bad in ["/etc/passwd", "../x", "/work/../etc/passwd", "/docs/x"]:
with self.assertRaises(agent.ToolError):
a.host_path(bad)