Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/nullius/catalogue/agents/claude-code/agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@
"max"
],
"default": "default"
},
"web_tools": {
"label": "Web tools",
"summary": "WebSearch and WebFetch, Claude Code's web tools: `off` denies both in its settings, `default` leaves them as it ships.",
"values": [
"default",
"off"
],
"default": "default",
"writes": {
"default": "",
"off": "\"WebSearch\", \"WebFetch\""
}
}
},
"fidelity": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"permissions": {
"defaultMode": "bypassPermissions"
"defaultMode": "bypassPermissions",
"deny": [{opt_web_tools}]
}
}
13 changes: 13 additions & 0 deletions app/nullius/catalogue/agents/codex/agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
"high"
],
"default": "medium"
},
"web_tools": {
"label": "Web tools",
"summary": "web_search, the search OpenAI runs for Codex: `off` writes web_search = \"disabled\" into its config.toml, `default` leaves Codex's own.",
"values": [
"default",
"off"
],
"default": "default",
"writes": {
"default": "",
"off": "web_search = \"disabled\""
}
}
},
"default": "2.2.2",
Expand Down
1 change: 1 addition & 0 deletions app/nullius/catalogue/agents/codex/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ model_reasoning_effort = "{opt_reasoning_effort}"
model_provider = "nullius"
approval_policy = "never"
sandbox_mode = "danger-full-access"
{opt_web_tools}

[features]
plugins = false
Expand Down
13 changes: 13 additions & 0 deletions app/nullius/catalogue/agents/opencode/agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@
"xhigh"
],
"default": "medium"
},
"web_tools": {
"label": "Web tools",
"summary": "webfetch, OpenCode's web tool: `off` denies it in its permissions, `default` allows it, as Nullius runs OpenCode without asking.",
"values": [
"default",
"off"
],
"default": "default",
"writes": {
"default": "allow",
"off": "deny"
}
}
}
}
2 changes: 1 addition & 1 deletion app/nullius/catalogue/agents/opencode/opencode.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"permission": {
"edit": "allow",
"bash": "allow",
"webfetch": "allow",
"webfetch": "{opt_web_tools}",
"external_directory": "deny"
},
"provider": {
Expand Down
35 changes: 34 additions & 1 deletion app/nullius/standard/contract/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def setup_label(bench, which):
MAX_RETRIES = 9 # the most retries of a failed attempt (runner.retries, cli run --retries)
# What a benchmark's version may say for itself: its data, its driver, how it scores, who plays its user, its environments.
BENCH_VERSIONED = ("upstream", "datasets", "task_parts", "files", "driver", "mcp_servers", "score", "simulator", "limits", "controls", "environments",
"options", "host", "setups", "proven", "leaderboard")
"options", "host", "setups", "proven", "leaderboard", "agent_options")
# What a benchmark option may need: embedding and reranker models through the relay,
# machine requirements (host), and digest-pinned auxiliary files.
NEED_KEYS = ("embeddings", "reranker", "host", "files")
Expand Down Expand Up @@ -546,6 +546,9 @@ def _options(d: dict) -> List[str]:
bad.append(f"{w}.example: a value its pattern allows besides its default, shown in its place")
if option_problem(o, o.get("default")):
bad.append(f"{w}.default: the vendor's own default, a value it allows")
wr = o.get("writes")
if wr is not None and not ("values" in o and isinstance(wr, dict) and wr and all(k in o["values"] and isinstance(t, str) for k, t in wr.items())):
bad.append(f"{w}.writes: {{value: the text its slot writes for it}}, for some of its values")
for where, n in _option_slots(d):
if n not in opts:
bad.append(f"{where}: {{opt_{n}}} is not an option (options.{n})")
Expand Down Expand Up @@ -759,6 +762,32 @@ def options_of(d: dict, given: Optional[dict] = None) -> Tuple[dict, List[str]]:
return {n: given.get(n, o.get("default")) for n, o in opts.items()}, bad


def agent_options_of(bench: dict, d: dict, given: Optional[dict] = None) -> Tuple[dict, List[str]]:
""":func:`options_of` for a run of ``bench``: an agent that has an option the benchmark sets for every
agent (``agent_options``, as its rules require) runs with that value; another value given is refused."""
vals, bad = options_of(d, given)
if d.get("_kind") != "agent":
return vals, bad
opts, given = d.get("options") or {}, given or {}
for n, v in (bench.get("agent_options") or {}).items():
if n not in opts:
continue # it has no such setting: nothing of it to set
if given.get(n, v) != v:
bad.append(f"{bench.get('label') or bench.get('key')} runs every agent with {n}={v}, not {given[n]}")
why = option_problem(opts[n], v)
if why:
bad.append(f"option {n}: {why}, and {bench.get('label') or bench.get('key')} runs every agent with {n}={v}")
vals[n] = v
return vals, bad


def option_slots(d: dict, values: dict) -> Dict[str, str]:
"""The ``{opt_<name>}`` slots of ``d``'s templates for the run's ``values``: what each option ``writes``
for its value, else the value itself."""
opts = d.get("options") or {}
return {"opt_" + n: str(((opts.get(n) or {}).get("writes") or {}).get(v, v)) for n, v in values.items()}


def _command(where: str, cmd, slots=SLOTS, word=_WORD) -> List[str]:
if not isinstance(cmd, list) or not cmd or not all(isinstance(w, str) for w in cmd):
return [f"{where}: a list of words"]
Expand Down Expand Up @@ -1624,6 +1653,10 @@ def problems(d: dict, kind: str) -> List[str]:
bad += _host(d)
bad += _files(d)
bad += _bench_options(d)
ao = d.get("agent_options")
if ao is not None and not (isinstance(ao, dict) and all(_OPTION.match(str(n)) and isinstance(v, str) and _OPTION_VALUE.match(v)
for n, v in ao.items())):
bad.append("agent_options: {an agent option's name: the value every agent that has it runs with}")
drv = d.get("driver") or {}
bad += _command("driver.command", drv.get("command") if isinstance(drv, dict) else None, {"here", "install"})
if isinstance(drv, dict):
Expand Down
9 changes: 7 additions & 2 deletions app/nullius/standard/pages/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def _bench_page(b: dict) -> dict:
"experiment_judge": {k: v for k, v in ((b.get("score") or {}).get("experiment_judge") or {}).items() if k in ("label", "model")} or None,
# what the upstream's leaderboard fixes besides the ranked model (Like the leaderboard)
"leaderboard": b.get("leaderboard") or None,
# what every agent that has the option runs with on this benchmark, as its rules require
"agent_options": b.get("agent_options") or {},
"attempts": (b.get("limits") or {}).get("attempts", ""),
"retries": (b.get("limits") or {}).get("retries", 0),
# what a unit's time limits and a conversation's length are when the recipe forces none
Expand Down Expand Up @@ -607,7 +609,8 @@ def add(step, message, shown=False, field=None, unset=False):
if not isinstance(given, dict) or not all(isinstance(v, str) for v in given.values()):
add("agent", "Options are names with a word each.")
given = {}
opts, bad = definitions.options_of(o, given)
given = {k: v for k, v in given.items() if k not in (b.get("agent_options") or {})} # the benchmark's own, shown fixed
opts, bad = definitions.agent_options_of(b, o, given)
for why_not in bad:
add("agent", f"{o['label']}: " + why_not)
picks.append({"o": o, "control": control, "given": given, "opts": opts})
Expand Down Expand Up @@ -1068,7 +1071,9 @@ def row(p: dict) -> list:
p.get("agent") and p["agent"]["start"]["driver"]["agent"] in b["options"][k]["when"]["agent"] for p in picks)],
*[row(p) for p in picks],
*[[STEP["agent"], "Options" + (f" of {p['o']['label']}" if several else ""),
", ".join(f"{(p['o'].get('options') or {}).get(k, {}).get('label') or k.replace('_', ' ').capitalize()} {v}" + ("" if k in p["given"] else " (its default)") for k, v in p["opts"].items())]
", ".join(f"{(p['o'].get('options') or {}).get(k, {}).get('label') or k.replace('_', ' ').capitalize()} {v}"
+ (f" ({b['label']}'s)" if k in (b.get("agent_options") or {}) else "" if k in p["given"] else " (its default)")
for k, v in p["opts"].items())]
for p in picks if p["opts"]],
[STEP["model"], "Model", "none: a control calls no model" if out["keyless"]
else f"{providers.label(providers.choice(provider, str(recipe.get('endpoint') or '')))} · " + (model if needs_model else ", ".join(p["o"]["sent"] for p in picks if p.get("setup")) or "the judge only")
Expand Down
2 changes: 1 addition & 1 deletion app/nullius/standard/requirements/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def process_env(d: dict, where: str, home: str, options: Optional[dict] = None)
``env`` rendered (``{opt_<name>}`` from ``options``, the run's values), and
``HF_HUB_CACHE`` when it prefetched models."""
slots = {"install": where, "home": home, "here": d.get("_here", ""),
**{"opt_" + k: v for k, v in (options or {}).items()}}
**definitions.option_slots(d, options or {})}
out = {}
if (d.get("install") or {}).get("prefetch"):
out["HF_HUB_CACHE"] = os.path.join(where, HF)
Expand Down
4 changes: 2 additions & 2 deletions app/nullius/standard/runner/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def agent_env(agent: dict, inst: str, home: str, base_url: str, model: str, opti
``{opt_<name>}``; an option left out is filled with its default."""
options = definitions.options_of(agent, options)[0]
slots = {"base_url": base_url, "base": base_url.removesuffix("/v1"), "key": relay.PLACEHOLDER_KEY, "model": model, "home": home,
**{"opt_" + k: v for k, v in options.items()}}
**definitions.option_slots(agent, options)}
m = agent.get("model") or {}
for dest, src in (m.get("files") or {}).items():
path = _render(dest, slots)
Expand Down Expand Up @@ -885,7 +885,7 @@ def __init__(self, bench: dict, other: dict, *, model: str, provider: str, datas
self.licences = licences or Licences(bench) # where a benchmark's environments find the licences they need
self.unsandboxed = bool(unsandboxed)
self.image = ""
self.options, bad = definitions.options_of(other, options)
self.options, bad = definitions.agent_options_of(bench, other, options)
if bad:
raise Refused("; ".join(bad))
# A benchmark scored by a model: its official judge, or the one asked for; its calls go through the relay
Expand Down
2 changes: 2 additions & 0 deletions app/static/builder/command-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@
const chosen = others.filter(o => C.chosenOf(rec).includes(o.key) && !o.why.length), mine = chosen.filter(o => !o.own);
const optionsOf = o => { const mine = (rec.options || {})[o.key] || {}, opts = Object.entries(o.options || {});
return !opts.length ? '' : `<div class="std-options">` + opts.map(([n, x]) => {
// one the benchmark sets for every agent that has it (recipe.py: agent_options), as its rules require
if ((b.agent_options || {})[n] !== undefined) return fixed(words(n), b.agent_options[n], b.label);
const cur = mine[n] ?? x.default;
return x.values
? `<label class="nb-field std-optselect" title="${esc(x.summary)}">${esc(words(n))}<select data-std-option="${esc(n)}" data-std-option-of="${esc(o.key)}">${x.values.map(v => `<option value="${esc(v)}" ${v === cur ? 'selected' : ''}>${esc(v === 'default' ? 'Default' : v + (v === x.default ? ' (its default)' : ''))}</option>`).join('')}</select></label>`
Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_standard_bench_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def test_a_setting_every_dataset_shares_names_no_dataset(self):

def test_an_agent_option_reads_by_its_label_not_its_key(self):
self.assertNotIn("reasoning_effort", self.rows()["Options of Codex 2.2.2"])
self.assertEqual(self.rows()["Options of Codex 2.2.2"], "Reasoning effort medium (its default)") # as the Agent step words it
self.assertEqual(self.rows()["Options of Codex 2.2.2"], "Reasoning effort medium (its default), Web tools default (its default)") # as the Agent step words it

def test_a_capability_option_reads_by_its_label_not_its_key(self):
out = recipe.compile(dict(GSM8K, benchmark="locomo", datasets=["locomo10"], others=["mem0"], options={}))
Expand Down
Loading