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
2 changes: 1 addition & 1 deletion .agents/skills/import-benchmark/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ When they do, write it locally:
above, named after the key, mirroring an existing Harbor benchmark's:
`harness: ["harbor"]`, its `origin` per the docstring of
`app/nullius/catalogue/catalog.py` (`official`, the publisher's benchmark,
or `community`, adapted by the community), its `scoring` in two or three words (the
or `experiment`, another source or someone's fixes), its `scoring` in two or three words (the
card's tag: `Tests`, `Lean compiler`), and its `datasets` nested in it, one by
registry or Hub name (or local path) with its task count, `official` link,
and `verifier` - and its `citation` and `citation_source`. The builder takes a benchmark's first dataset as its default: a second
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/import-standard/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ prints the writable folder under the active user catalogue. Work there, then:
commit, any repository (a private one is fetched with this machine's git
credentials) - is an Experiment version, never a second folder and never a patch
of ours: `cli new version KEY NAME`, then `versions.NAME.upstream` =
`{repository, tag?, tested}` (a branch pinned by its commit). Fetch it into
`{repository, tag?, tested, origin: "experiment"}` (a branch pinned by its commit). Fetch it into
the scratchpad, diff it against the pinned upstream (`git diff
<tested>..<fork commit> --stat`, then what changed in the code the driver
calls) and say what the fork changes; hash each dataset again (its own
Expand Down
1 change: 1 addition & 0 deletions app/nullius/catalogue/agents/digitalmate/agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"upstream": {
"repository": "https://github.com/aitianshi/DigitalMate",
"branch": "nullius/v0.1.13",
"origin": "experiment",
"tested": "5a2a3b9fb539978accc4e37fc5e6e81d824c58f7",
"license": "Apache-2.0",
"core": "Bundled WorkSwarm 0d6857507236d1299276caf0f6fe09e5baaa4c23 and agent-core 8f9f112698d5580b749158b21b1a89a54e16a8f9, verified and installed by the release installer",
Expand Down
21 changes: 14 additions & 7 deletions app/nullius/catalogue/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
benchmark headline only; every dataset keeps its own count.

Every entry says where it comes from (``origin``): ``official``, the
publisher's own benchmark, or
``community``, adapted by the community.
publisher's own benchmark, or ``experiment``, another source or someone's
fixes. It is the origin of its default version and of every version on the
standard that does not say its own (``definitions.origin_of``).

Routes: a benchmark reaches a run through a harness, and ``Benchmark.routes``
says, for each harness in ``HARNESSES``, whether that route is usable here.
Expand All @@ -44,7 +45,7 @@
from nullius import paths
from . import storage

ORIGINS = ("official", "community")
ORIGINS = ("official", "experiment")
ROOT = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS = "benchmarks"
ENTRY = "benchmark.json"
Expand Down Expand Up @@ -92,7 +93,7 @@ class Benchmark:
#: agent_run, verify) as recorded from a real run; empty when no run has
#: recorded them
timeouts: dict = field(default_factory=dict)
#: the publisher's benchmark or a community adaptation (ORIGINS)
#: the publisher's benchmark, or an experiment (ORIGINS)
origin: str = "official"
#: how it runs as published when Harbor runs it: the upstream's own agent, by
#: the name Harbor registers it (``agent``), and why it is the published one
Expand Down Expand Up @@ -354,14 +355,20 @@ def load(root: str | None = None) -> Catalog:
)


def origin_of(entry: dict) -> str:
"""An entry's origin as written, its older words (``community``, an ``experiment`` flag) read as ``experiment``."""
if entry.get("experiment") or entry.get("origin") == "community":
return "experiment"
return entry.get("origin") or "official"


def _entry(path: str, name: str) -> tuple:
"""(Benchmark, [Dataset]) of one ``benchmark.json``; ValueError or
TypeError when it is not JSON, not an object or lacks a field."""
entry = _read(path)
if not isinstance(entry, dict):
raise ValueError("not a JSON object")
if entry.get("experiment") or entry.get("origin") == "experiment":
entry = {**entry, "origin": "official"}
entry = {**entry, "origin": origin_of(entry)}
nested = [d for d in entry.get("datasets", []) if isinstance(d, dict)]
return (_pick(Benchmark, {**entry, "datasets": [d.get("key") for d in nested]}),
[_pick(Dataset, {**d, "benchmark": name}) for d in nested])
Expand Down Expand Up @@ -426,7 +433,7 @@ def validate(cat: Catalog) -> list:
claimed.setdefault(s.strip().lower(), b.key)
for b in cat.benchmarks:
if b.origin not in ORIGINS:
bad.append(f"{b.key}: origin is official or community")
bad.append(f"{b.key}: origin is official or experiment")
if b.task_count is not None:
if type(b.task_count) is not int or b.task_count < 1:
bad.append(f"{b.key}: task_count must be a positive integer")
Expand Down
3 changes: 1 addition & 2 deletions app/nullius/catalogue/harbor_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ def values_of(entry: dict) -> dict:
t = entry.get("timeouts") or {}
values = {"key": entry.get("key", ""), "title": entry.get("title", ""), "category": entry.get("category", ""),
"domain": entry.get("domain", ""), "scoring": entry.get("scoring", ""),
"origin": "official" if entry.get("experiment") or entry.get("origin") == "experiment"
else entry.get("origin", "official"), "upstream_limitations": "\n".join(entry.get("upstream_limitations") or []),
"origin": catalog.origin_of(entry), "upstream_limitations": "\n".join(entry.get("upstream_limitations") or []),
"limitations": "\n".join(entry.get("limitations") or []),
"citation": entry.get("citation", ""),
"citation_source": entry.get("citation_source", ""),
Expand Down
14 changes: 11 additions & 3 deletions app/nullius/standard/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def cmd_list(a):
print(definitions.KINDS[kind]["dir"] + ":")
for d in got[kind]:
side = d.get("needs") if kind == "benchmark" else d.get("offers")
print(f" {d.get('_ref') or d['key']:<18} {('needs ' if kind == 'benchmark' else 'offers ') + ', '.join(side or []) or 'nothing proven yet'}")
print(f" {d.get('_ref') or d['key']:<18} {('needs ' if kind == 'benchmark' else 'offers ') + ', '.join(side or []) or 'nothing proven yet'}"
+ (f" · {definitions.origin_of(d).capitalize()}" if kind != "capability" else ""))
up = d.get("upstream") or {}
if up.get("repository"):
print(f" {'':<18} upstream {up['repository'].removeprefix('https://')} @ "
Expand Down Expand Up @@ -223,8 +224,11 @@ def catalogue_problems(benches) -> list:
bad.append(f"benchmark {b['key']}: no benchmark.json beside standard.json (the catalogue's entry)")
continue
with open(entry) as f:
if "standard" not in (json.load(f).get("harness") or []):
bad.append(f"benchmark {b['key']}: benchmark.json does not name 'standard' in harness")
said = json.load(f)
if "standard" not in (said.get("harness") or []):
bad.append(f"benchmark {b['key']}: benchmark.json does not name 'standard' in harness")
if b.get("_version") == b.get("_default") and catalog.origin_of(said) != definitions.origin_of(b):
bad.append(f"benchmark {b['key']}: benchmark.json says origin {catalog.origin_of(said)}, its default version is {definitions.origin_of(b)}")
# each benchmark's settings inventory, against every version of it (definitions.settings_problems)
every = definitions.load("benchmark", every=True)[0]
for key in dict.fromkeys(b["key"] for b in benches):
Expand Down Expand Up @@ -414,6 +418,8 @@ def check(d):
proofs.write(folder, evidence)
ondisk.write_whole(path, json.dumps(d, indent=2) + "\n")
print(f"wrote {path}: {key}@{version} beside {', '.join(v for v in d['versions'] if v != version)} (default still {old})")
if kind != "capability":
print('a fork, or someone\'s fixes: say "origin": "experiment" in its upstream')
if kind == "benchmark":
print(f"next: say what differs in it (upstream, datasets, driver, score, limits, controls, environments), then: "
f"cli check, and cli prove {key}@{version} --limit 3; make it the default by setting \"default\": \"{version}\"")
Expand Down Expand Up @@ -460,6 +466,8 @@ def cmd_new(a):
then = f"cli run {key} reference --model gpt-5-mini --limit 2 --unsandboxed"
else:
then = f"cli conform {key} --model gpt-5-mini" + (" --unsandboxed" if kind == "agent" else "")
if kind != "capability":
print("recommended: an official version first (a tag, branch or commit of the official source), an experiment after it")
print(f"next: fill in the CAPITALS{', add benchmark.json beside it (the catalogue entry)' if kind == 'benchmark' else ''}, "
f"then: cli check, and {then}")
return 0
Expand Down
35 changes: 31 additions & 4 deletions app/nullius/standard/contract/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
version offers exactly the ports it has proven. A file without ``versions``
is one version, its ``upstream.version``.

Each version is official or an experiment (:func:`origin_of`): another
source, or someone's fixes (``upstream.origin``, ``upstream.fixes``).

The conformance kits are benchmarks too, kept inside this package
(``standard/kits/<name>/standard.json``), so a kit is run the way any
benchmark is.
Expand Down Expand Up @@ -100,7 +103,7 @@

from nullius.standard.contract import ports
from nullius import ondisk, paths
from nullius.catalogue import storage
from nullius.catalogue import catalog, storage
from . import names, proofs

STANDARD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # the standard's folder, which holds this one
Expand Down Expand Up @@ -237,8 +240,9 @@ def resolve(d: dict, version: Optional[str] = None) -> Optional[dict]:
out["proven"] = dict(block.get("proven") or {})
if not bench: # a benchmark offers nothing: it needs
out["offers"] = [p for p in ports.PORTS if p in out["proven"]]
labels = {x: version_label({"upstream": _version_upstream(d, x), "_version": x}) for x in vs if isinstance(vs[x], dict)}
return dict(out, _version=v, _versions=list(vs), _default=d.get("default"), _ref=f"{d.get('key')}@{v}", _labels=labels)
every = {x: dict(d, upstream=_version_upstream(d, x), _version=x) for x in vs if isinstance(vs[x], dict)}
return dict(out, _version=v, _versions=list(vs), _default=d.get("default"), _ref=f"{d.get('key')}@{v}",
_labels={x: version_label(e) for x, e in every.items()}, _origins={x: origin_of(e) for x, e in every.items()})


def _version_upstream(d: dict, v: str) -> dict:
Expand All @@ -247,9 +251,18 @@ def _version_upstream(d: dict, v: str) -> dict:
own = (d["versions"][v] or {}).get("upstream") or {}
if ("repository" in own or "tested" in own) and "tag" not in own:
up.pop("tag", None) # another repository or commit: the shared tag is not its
if own.get("repository", up.get("repository")) != up.get("repository") and "repository" in up:
up["origin"] = "experiment" # another source, unless it says its own origin
return dict(up, **own, version=v)


def origin_of(d: dict) -> str:
"""Where a resolved version comes from (``catalog.ORIGINS``): what its ``upstream.origin`` says, else
``experiment`` when its upstream lists ``fixes``, else its entry's (a benchmark's ``benchmark.json``), else official."""
up = d.get("upstream") or {}
return up.get("origin") or ("experiment" if up.get("fixes") else d.get("_origin") or "official")


def version_label(d: dict) -> str:
"""A version as a reader names it: its release tag, else its branch and short commit
(``main (044bc33)``), else its key."""
Expand Down Expand Up @@ -798,6 +811,8 @@ def _upstream(u) -> List[str]:
bad.append("upstream.tag: a tag of upstream.repository, which is not set")
if "branch" in u and (not tag_ok(u["branch"]) or "tag" in u or "repository" not in u):
bad.append("upstream.branch: the branch an untagged tested commit is on (main), with upstream.repository and no tag")
if "origin" in u and u["origin"] not in catalog.ORIGINS:
bad.append(f"upstream.origin: one of {catalog.ORIGINS}")
if not u.get("license"):
bad.append("upstream.license: say it, or 'unknown'")
return bad
Expand Down Expand Up @@ -1423,7 +1438,7 @@ def _own_entry(bench: dict, key: str, e: dict) -> dict:
benchmark it runs derived from its folder."""
return dict(e, schema=KINDS["agent"]["schema"], only_for=[bench.get("key")], benchmark=bench.get("key"),
benchmark_label=bench.get("label"), _kind="agent", _here=bench.get("_here", ""),
_ref=f"{bench.get('key')}:{key}", _version="", _versions=[""], _default="", **{"from": "benchmark"})
_ref=f"{bench.get('key')}:{key}", _version="", _versions=[""], _default="", _origin=origin_of(bench), **{"from": "benchmark"})


def own_agents(bench: dict) -> List[dict]:
Expand Down Expand Up @@ -1750,12 +1765,24 @@ def _read(path: str, kind: str, key: str) -> Tuple[Optional[dict], List[str]]:
if bad:
return None, bad
d = dict(d, _here=os.path.dirname(path), _kind=kind)
if kind == "benchmark":
d["_origin"] = _entry_origin(os.path.dirname(path))
if kind == "agent": # where it comes from: the user's catalogue, or the bundle
user = os.path.realpath(paths.catalogue_dir())
d["from"] = "yours" if os.path.realpath(path).startswith(user + os.sep) else "bundled"
return d, []


def _entry_origin(folder: str) -> str:
"""The origin a benchmark's catalogue entry says; official without one that reads."""
try:
with open(os.path.join(folder, catalog.ENTRY)) as f:
origin = catalog.origin_of(json.load(f))
except (OSError, ValueError, AttributeError):
return "official"
return origin if origin in catalog.ORIGINS else "official"


def load(kind: str, root: Optional[str] = None, every: bool = False) -> Tuple[List[dict], List[str]]:
"""Every definition of ``kind``, in folder order, and errors in those left out.
With no root the user catalogue overlays the bundle, by whole folder;
Expand Down
12 changes: 10 additions & 2 deletions app/nullius/standard/pages/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def benchmarks(cat) -> List[dict]:
entries (``Catalog.listed_benchmarks``, whichever runner runs it) as ``b``, with its ``datasets``, its ``tasks``
and their ``unit`` (``Catalog.tasks_of``), what some of its options need of a machine (``host``, by label, None for nothing),
what it is run with: ``family`` agent or capability (a benchmark only Harbor runs runs agents) and, for a
capability, its ``kind``; and ``versions``, another version's tasks and unit by version."""
capability, its ``kind``; ``versions``, another version's tasks and unit by version; and ``origins``, its versions'
origins, each once, the default version's first."""
defs = {d["key"]: d for d in definitions.load("benchmark")[0]}
out = []
for b in cat.listed_benchmarks:
Expand All @@ -133,11 +134,18 @@ def benchmarks(cat) -> List[dict]:
out.append({"b": b, "datasets": cat.datasets_of(b), "tasks": tasks, "unit": unit,
"host": [hostreq.label(d, n) for n in sorted(d["host"])] if d.get("host") else None,
"family": d.get("family") or "agent", "kind": _capability_kind(d),
"origins": origins(d) if d else [b.origin],
# another version's tasks, when its datasets count differently (``Catalog.in_version``)
"versions": {v: cat.tasks_of(b, cat.in_version(b, v)[1]) for v in b.versions}})
return out


def origins(d: dict) -> List[str]:
"""The origins of a definition's versions, each once, its default version's first."""
every = d.get("_origins") or {}
return list(dict.fromkeys([every.get(d["_default"]) or definitions.origin_of(d), *every.values()]))


def _bench_page(b: dict) -> dict:
"""A benchmark as a page shows it. ``controls``: the ones it declares,
each with who wrote it and where it comes from - what the builder offers
Expand All @@ -153,7 +161,7 @@ def _bench_page(b: dict) -> dict:
"version": b["_version"] if versioned else "",
# its versions, each by the ref a recipe names it with (the bare key: the default)
"versions": [{"ref": b["key"] if v == b.get("_default") else f"{b['key']}@{v}", "version": v, "default": v == b.get("_default"),
"label": (b.get("_labels") or {}).get(v) or v}
"label": (b.get("_labels") or {}).get(v) or v, "origin": (b.get("_origins") or {}).get(v) or "official"}
for v in b.get("_versions") or []] if versioned else [],
"environments": {n: {"summary": e.get("summary", ""), "local_ok": bool(e.get("local_ok")), "network": e.get("network"),
"needs_secrets": [{"name": s["name"], "to": s["to"], "kind": s.get("kind") or "value",
Expand Down
2 changes: 1 addition & 1 deletion app/static/builder/command-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
const benchmarkStep = rec => {
const sb = C.standardBase(rec);
const versions = C.isStandard(rec) && sb && (sb.versions || []).length > 1
? `<label class="nb-field">Version of ${esc(sb.label)}<select data-std-version>${sb.versions.map(v => `<option value="${esc(v.ref)}" ${v.ref === rec.benchmark || (v.default && rec.benchmark === sb.key) ? 'selected' : ''}>${esc(v.label || v.version)}${v.default ? ' (the default)' : ''}</option>`).join('')}</select><small>Each version pins its own upstream, datasets and proofs.</small></label>` : '';
? `<label class="nb-field">Version of ${esc(sb.label)}<select data-std-version>${sb.versions.map(v => `<option value="${esc(v.ref)}" ${v.ref === rec.benchmark || (v.default && rec.benchmark === sb.key) ? 'selected' : ''}>${esc(v.label || v.version)}${v.origin === 'experiment' ? ' · Experiment' : ' · Official'}${v.default ? ' (the default)' : ''}</option>`).join('')}</select><small>Each version pins its own upstream, datasets and proofs.</small></label>` : '';
return `<div class="nb-sectionhead"><h2>Choose a benchmark.</h2></div><div id="nb-bench-grid"></div>` + versions;
};
// Put the recipe on a runner, keeping the one each runner had: the benchmark follows.
Expand Down
Loading