From 76b07151f0578225fc6d25fad862fd8f63b7f5d1 Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Fri, 27 Nov 2026 17:45:14 +0100 Subject: [PATCH] refactor(catalogue): name the capability kind module in code, folders and commands --- .../skills/docs-drift/scripts/check_docs.py | 8 +- .agents/skills/import-module/SKILL.md | 8 +- .agents/skills/import-standard/SKILL.md | 10 +-- .agents/skills/remove-integration/SKILL.md | 3 +- AGENTS.md | 2 +- .../keyword-memory/capability.json | 0 .../keyword-memory/capability.py | 0 .../keyword-memory/proofs.json | 0 .../mem0/capability.json | 0 .../mem0/capability.py | 0 .../mem0/proofs.json | 0 app/nullius/catalogue/storage.py | 16 +++- app/nullius/migrate.py | 11 ++- app/nullius/recipes/launch.py | 2 +- app/nullius/standard/__init__.py | 6 +- app/nullius/standard/backends/boat.py | 6 +- app/nullius/standard/backends/container.py | 6 +- app/nullius/standard/calls/ledger.py | 2 +- app/nullius/standard/calls/relay.py | 4 +- app/nullius/standard/cli.py | 47 ++++++----- app/nullius/standard/contract/definitions.py | 41 ++++----- app/nullius/standard/contract/match.py | 14 ++-- app/nullius/standard/contract/names.py | 12 ++- app/nullius/standard/contract/ports.py | 6 +- app/nullius/standard/contract/proofs.py | 6 +- app/nullius/standard/pages/howto.py | 20 ++--- app/nullius/standard/pages/recipe.py | 52 ++++++------ app/nullius/standard/proofs/conform.py | 4 +- app/nullius/standard/proofs/prove.py | 6 +- app/nullius/standard/protocols/jsonl.py | 4 +- app/nullius/standard/requirements/hostreq.py | 2 +- app/nullius/standard/requirements/install.py | 8 +- app/nullius/standard/runner/job.py | 22 ++--- app/nullius/standard/runner/merge.py | 2 +- app/nullius/standard/runner/payload.py | 7 +- app/nullius/standard/runner/run.py | 44 +++++----- app/nullius/standard/runner/shard.py | 2 +- app/static/builder/command-builder-core.js | 14 ++-- app/static/builder/command-builder.js | 10 +-- app/static/catalogue/catalogue.css | 4 +- app/templates/_icons.svg | 2 +- app/templates/agents/entry.html | 6 +- app/templates/agents/standard.html | 2 +- app/templates/base.html | 2 +- app/templates/builder/agents.html | 2 +- app/templates/builder/benchmarks.html | 2 +- app/templates/catalogue/add_dialog.html | 4 +- app/templates/settings/settings.html | 2 +- app/tests/catalogue_docs.py | 30 +++---- .../catalogue/benchmarks/fakememo/driver.py | 2 + .../fakemem/capability.json | 0 .../fakemem/capability.py | 0 app/tests/test_audit_regressions.py | 2 +- app/tests/test_benchmark_agents.py | 6 +- app/tests/test_benchmark_listing.py | 4 +- app/tests/test_capability_names.py | 84 +++++++++++++++---- app/tests/test_catalogue_docs.py | 8 +- app/tests/test_catalogue_overlay.py | 57 ++++++++----- app/tests/test_computer_merge.py | 2 +- app/tests/test_constraints.py | 2 +- app/tests/test_dataset_subsets.py | 4 +- app/tests/test_dependency_surface.py | 2 +- app/tests/test_execution.py | 2 +- ...mem0_capability.py => test_mem0_module.py} | 6 +- app/tests/test_migrate.py | 31 +++++++ app/tests/test_network_requirements.py | 2 +- app/tests/test_settings.py | 4 +- app/tests/test_standard_bench_options.py | 2 +- app/tests/test_standard_conform.py | 10 +-- app/tests/test_standard_controls.py | 8 +- app/tests/test_standard_definitions.py | 42 +++++----- app/tests/test_standard_driver_hooks.py | 24 +++--- app/tests/test_standard_exchanges.py | 2 +- app/tests/test_standard_howto.py | 24 +++--- app/tests/test_standard_install.py | 10 +-- ...trace.py => test_standard_module_trace.py} | 6 +- app/tests/test_standard_options.py | 12 +-- app/tests/test_standard_own_image.py | 2 +- app/tests/test_standard_parts.py | 2 +- app/tests/test_standard_payload.py | 2 +- app/tests/test_standard_proofs.py | 8 +- app/tests/test_standard_recipe.py | 12 +-- app/tests/test_standard_recipe_served_by.py | 2 +- app/tests/test_standard_relay.py | 2 +- app/tests/test_standard_run.py | 19 +++-- app/tests/test_standard_setups.py | 4 +- app/tests/test_standard_skills.py | 4 +- app/tests/test_standard_trace.py | 4 +- app/tests/test_standard_ui.py | 6 +- app/tests/test_standard_versions.py | 4 +- app/tests/test_task_set_recipe.py | 2 +- app/ui_tests/test_add_dialog.py | 4 +- app/ui_tests/test_agents.py | 22 ++--- app/ui_tests/test_api.py | 1 + app/ui_tests/test_builder_agents.py | 2 +- app/ui_tests/test_builder_benchmarks.py | 2 +- app/ui_tests/test_every_route.py | 4 +- app/ui_tests/test_licences_page.py | 2 +- app/ui_tests/test_page_checks.py | 2 +- app/ui_tests/test_use_bundled.py | 10 ++- app/web/__init__.py | 2 +- app/web/agents.py | 20 ++--- app/web/api.py | 4 +- app/web/builder.py | 6 +- app/web/catalogue.py | 12 +-- app/web/core.py | 2 +- app/web/filters.py | 2 +- app/web/runs.py | 2 +- docs/cli/definitions.md | 6 +- docs/modules/add-manually.md | 12 +-- docs/standard.md | 34 ++++---- pyproject.toml | 2 +- 112 files changed, 597 insertions(+), 450 deletions(-) rename app/nullius/catalogue/{capabilities => modules}/keyword-memory/capability.json (100%) rename app/nullius/catalogue/{capabilities => modules}/keyword-memory/capability.py (100%) rename app/nullius/catalogue/{capabilities => modules}/keyword-memory/proofs.json (100%) rename app/nullius/catalogue/{capabilities => modules}/mem0/capability.json (100%) rename app/nullius/catalogue/{capabilities => modules}/mem0/capability.py (100%) rename app/nullius/catalogue/{capabilities => modules}/mem0/proofs.json (100%) rename app/tests/fixtures/standard/catalogue/{capabilities => modules}/fakemem/capability.json (100%) rename app/tests/fixtures/standard/catalogue/{capabilities => modules}/fakemem/capability.py (100%) rename app/tests/{test_mem0_capability.py => test_mem0_module.py} (84%) rename app/tests/{test_standard_capability_trace.py => test_standard_module_trace.py} (84%) diff --git a/.agents/skills/docs-drift/scripts/check_docs.py b/.agents/skills/docs-drift/scripts/check_docs.py index 9c06d1152..2fc6f44ae 100755 --- a/.agents/skills/docs-drift/scripts/check_docs.py +++ b/.agents/skills/docs-drift/scripts/check_docs.py @@ -25,10 +25,10 @@ "docs/agents/add-manually.md: created by the preceding worked-copy command", "app/nullius/catalogue/benchmarks/my-benchmark/standard.json": "docs/benchmarks/add-manually.md: created by the preceding new benchmark command", - "app/nullius/catalogue/capabilities/my-memory/capability.py": - "docs/modules/add-manually.md: created by the preceding new capability command", - "app/nullius/catalogue/capabilities/my-memory/capability.json": - "docs/modules/add-manually.md: created by the preceding new capability command", + "app/nullius/catalogue/modules/my-memory/capability.py": + "docs/modules/add-manually.md: created by the preceding new module command", + "app/nullius/catalogue/modules/my-memory/capability.json": + "docs/modules/add-manually.md: created by the preceding new module command", ".claude/environment.local.md": "AGENTS.md: gitignored and per checkout, so absent by design", "app/.env": diff --git a/.agents/skills/import-module/SKILL.md b/.agents/skills/import-module/SKILL.md index 9fb1cf53b..42c7c1fc2 100644 --- a/.agents/skills/import-module/SKILL.md +++ b/.agents/skills/import-module/SKILL.md @@ -48,9 +48,9 @@ PY ``` For an installation, resolve `app/nullius/` references to installed modules. -In the same settings-loaded interpreter, `definitions.entry_dir("capability", key)` +In the same settings-loaded interpreter, `definitions.entry_dir("module", key)` locates the selected entry. Before editing it, use -`definitions.writable_dir("capability", key)` to copy the entire bundled folder +`definitions.writable_dir("module", key)` to copy the entire bundled folder to the user catalogue. A user folder replaces its bundled counterpart in full; keep its wrapper, JSON and other resources together. Never edit `site-packages` or the private `_nullius_app` UI package. @@ -58,7 +58,7 @@ full; keep its wrapper, JSON and other resources together. Never edit Default to a personal import: no source checkout, repository tests, generated docs or sprite edits are needed. For a requested bundled contribution, author/prove in a user or scratch catalogue, then copy only the intended entry -files into `app/nullius/catalogue/capabilities//` and use the repository gates +files into `app/nullius/catalogue/modules//` and use the repository gates below. CLI mutations protect bundled resources in source checkouts too. ## The rule: facilitator, not re-implementer @@ -131,7 +131,7 @@ See `docs/standard.md`, "Native capabilities and composition". ## 2. Scaffold, wrap, fill in -1. `cli new capability KEY` writes `capabilities/KEY/capability.json` under the active +1. `cli new module KEY` writes `modules/KEY/capability.json` under the active user catalogue, and a `capability.py` that already speaks `cap.memory/v1`. Use the writable paths the command prints. 2. **Wrap** in `capability.py` (the shape `FEATURE_PY` in diff --git a/.agents/skills/import-standard/SKILL.md b/.agents/skills/import-standard/SKILL.md index 54d75aaaa..db816a93e 100644 --- a/.agents/skills/import-standard/SKILL.md +++ b/.agents/skills/import-standard/SKILL.md @@ -68,7 +68,7 @@ References below to `app/nullius/` mean those modules in a checkout, or their resolved installed files for reading. Path APIs return **strings**; use `os.path.join` or `Path(value)` when joining. Resolve the selected entry with `definitions.entry_dir(kind, key)` (`kind` is `benchmark`, `agent` or -`capability`); do not derive it from the package directory. Before a manual edit, +`module`); do not derive it from the package directory. Before a manual edit, call `definitions.writable_dir(kind, key)` in the same settings-loaded interpreter: it copies a bundled entry's whole folder to the user catalogue and returns the writable path. For a new key, create the returned directory, @@ -79,7 +79,7 @@ copies too. Never edit `site-packages`. Default to a personal import in `paths.catalogue_dir()` (Linux default: `~/.local/share/nullius/catalogue/`), in `benchmarks/KEY`, `agents/KEY` or -`capabilities/KEY`. It needs no source checkout, repository tests, generated docs +`modules/KEY`. It needs no source checkout, repository tests, generated docs or sprite edit. A requested **bundled contribution** instead ends in `app/nullius/catalogue//KEY/`: author and prove in a writable user or scratch catalogue, then copy only the intended entry files into the checkout. @@ -118,7 +118,7 @@ subagent), report it as an open question and leave it unwritten. | what the user has | kind | route | |---|---|---| | tasks and a way to score them, meant for any agent | benchmark, `agent` family | driver + `standard.json` | -| questions over a history, meant for a memory or retriever | benchmark, `capability` family | driver with `produce` + `standard.json` | +| questions over a history, meant for a memory or retriever | benchmark, `module` family | driver with `produce` + `standard.json` | | a program that does tasks with a model (CLI agent, coding agent) | agent | the `import-agent` skill (`.agents/skills/import-agent/SKILL.md`); its Agent part below if invoked here | | a component a benchmark calls (memory, retriever) | Module | the `import-module` skill (`.agents/skills/import-module/SKILL.md`); its Module part below if invoked here | | a benchmark Harbor already runs, for Harbor agents | not this skill | `import-benchmark` | @@ -154,7 +154,7 @@ never a second key. Preserve both routes when it already runs through Harbor. ## 3. Build -**Benchmark.** `cli new benchmark KEY [--family capability --port cap.memory/v1]` +**Benchmark.** `cli new benchmark KEY [--family module --port cap.memory/v1]` prints the writable folder under the active user catalogue. Work there, then: - pin `upstream.repository`, `upstream.tag` (its latest release, when it has one) and `upstream.tested` (the tag's full commit, else a commit of the @@ -319,7 +319,7 @@ prints the writable folder under the active user catalogue. Work there, then: --unsandboxed` (`docs/standard.md`, "Options", "Fidelity"). **Module** (the `import-module` skill has the full procedure). -`cli new capability KEY`, then wrap the real component in `capability.py`, calls +`cli new module KEY`, then wrap the real component in `capability.py`, calls into its library and nothing of its logic rewritten: `add` stores, `recall` returns text. Packages pinned in `install.pip`; one that lives in a repository installs from it (`upstream` + `install.project`, `extras`, `python`, `indexes`, `prefetch`; diff --git a/.agents/skills/remove-integration/SKILL.md b/.agents/skills/remove-integration/SKILL.md index 4066ae47a..063d3af08 100644 --- a/.agents/skills/remove-integration/SKILL.md +++ b/.agents/skills/remove-integration/SKILL.md @@ -19,7 +19,8 @@ the user's requested scope, including logs and stored data when requested. `--hidden --no-ignore`, excluding `.git`; include bytecode and archive contents where relevant. Print matching paths rather than private log contents. - Catalogue entries live under `app/nullius/catalogue/`. Modules can also - have leftover folders under the legacy `features/` directory. Remove the + have leftover folders under the legacy `features/` and `capabilities/` + directories. Remove the whole entry folder: an empty folder can still be selected by the loader. - A benchmark's own agents are entries of its folder's `agents.json`: they go with the benchmark. Removing one agent alone is removing its entry, and its diff --git a/AGENTS.md b/AGENTS.md index 05255397d..eae7003c3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -60,7 +60,7 @@ is: `grep -m1 '"""' app/nullius/*.py app/nullius/runs/*.py`. | `app/nullius/` itself | What all share: settings, paths, providers, hosts, running a recipe | | `app/nullius/runs/`, `traces/`, `compare/` | Reading one job tree, a trial's trace, several runs | | `app/nullius/leaderboard/` | Composite scoring, selected task evidence and profile scoring documents | -| `app/nullius/catalogue/` | A folder per entry under `benchmarks/`, `agents/`, `capabilities/`: its definition and code | +| `app/nullius/catalogue/` | A folder per entry under `benchmarks/`, `agents/`, `modules/`: its definition and code | | `app/nullius/recipes/`, `harbor/` | What the builder offers and saves; the Harbor a recipe pins | | `app/nullius/importers/`, `judge/` | Foreign results in; questions to a judge model | | `app/nullius/standard/` | The standard: `contract/`, `requirements/`, `protocols/`, `calls/`, `backends/`, `runner/`, `proofs/`, `pages/`, whose imports never loop, and the conformance `kits/` | diff --git a/app/nullius/catalogue/capabilities/keyword-memory/capability.json b/app/nullius/catalogue/modules/keyword-memory/capability.json similarity index 100% rename from app/nullius/catalogue/capabilities/keyword-memory/capability.json rename to app/nullius/catalogue/modules/keyword-memory/capability.json diff --git a/app/nullius/catalogue/capabilities/keyword-memory/capability.py b/app/nullius/catalogue/modules/keyword-memory/capability.py similarity index 100% rename from app/nullius/catalogue/capabilities/keyword-memory/capability.py rename to app/nullius/catalogue/modules/keyword-memory/capability.py diff --git a/app/nullius/catalogue/capabilities/keyword-memory/proofs.json b/app/nullius/catalogue/modules/keyword-memory/proofs.json similarity index 100% rename from app/nullius/catalogue/capabilities/keyword-memory/proofs.json rename to app/nullius/catalogue/modules/keyword-memory/proofs.json diff --git a/app/nullius/catalogue/capabilities/mem0/capability.json b/app/nullius/catalogue/modules/mem0/capability.json similarity index 100% rename from app/nullius/catalogue/capabilities/mem0/capability.json rename to app/nullius/catalogue/modules/mem0/capability.json diff --git a/app/nullius/catalogue/capabilities/mem0/capability.py b/app/nullius/catalogue/modules/mem0/capability.py similarity index 100% rename from app/nullius/catalogue/capabilities/mem0/capability.py rename to app/nullius/catalogue/modules/mem0/capability.py diff --git a/app/nullius/catalogue/capabilities/mem0/proofs.json b/app/nullius/catalogue/modules/mem0/proofs.json similarity index 100% rename from app/nullius/catalogue/capabilities/mem0/proofs.json rename to app/nullius/catalogue/modules/mem0/proofs.json diff --git a/app/nullius/catalogue/storage.py b/app/nullius/catalogue/storage.py index c54eaf157..43c48c3d8 100644 --- a/app/nullius/catalogue/storage.py +++ b/app/nullius/catalogue/storage.py @@ -13,6 +13,9 @@ from nullius import paths +# A Module's folders, earliest name first: within one root the later one wins. +LEGACY = ("features", "capabilities", "modules") + def roots(bundled: str, root: str | None = None) -> tuple: if root is not None: @@ -25,7 +28,7 @@ def folders(group: str, bundled: str, root: str | None = None) -> dict: """Selected entry folders, sorted by key; an empty folder still wins.""" found = {} for base in roots(bundled, root): - for directory in (("features", "capabilities") if group == "capabilities" else (group,)): + for directory in (LEGACY if group == "modules" else (group,)): parent = os.path.join(base, directory) try: names = os.listdir(parent) @@ -75,6 +78,11 @@ def writable_dir(group: str, key: str, bundled: str, root: str | None = None) -> source = entry_dir(group, key, bundled, root) if source is None or os.path.realpath(source) == os.path.realpath(target): return target + try: + ensure_writable(source, bundled) + return source # a user's entry under an earlier folder name is edited where it is + except ValueError: + pass parent = os.path.dirname(target) os.makedirs(parent, exist_ok=True) with tempfile.TemporaryDirectory(prefix=".catalogue-", dir=parent) as stage: @@ -91,14 +99,14 @@ def writable_dir(group: str, key: str, bundled: str, root: str | None = None) -> def _restore_targets(group: str, key: str, bundled: str) -> list[str]: - if group not in ("benchmarks", "agents", "capabilities"): + if group not in ("benchmarks", "agents", "modules"): raise ValueError("unknown catalogue") if not key or key in (".", "..") or "/" in key or "\\" in key: raise ValueError("an entry key is a folder name") if entry_dir(group, key, bundled, root=bundled) is None: raise ValueError("this entry has no bundled copy") user = writable_root(bundled) - groups = ("features", "capabilities") if group == "capabilities" else (group,) + groups = LEGACY if group == "modules" else (group,) targets = [os.path.join(user, directory, key) for directory in groups if os.path.isdir(os.path.join(user, directory, key))] if not targets: @@ -117,7 +125,7 @@ def can_restore(group: str, key: str, bundled: str) -> bool: def use_bundled(group: str, key: str, bundled: str) -> None: - """Remove complete user overrides, including a capability's legacy alias.""" + """Remove complete user overrides, including a Module's legacy aliases.""" for target in _restore_targets(group, key, bundled): if os.path.islink(target): os.unlink(target) diff --git a/app/nullius/migrate.py b/app/nullius/migrate.py index a7a7ab6d7..aa59bf934 100644 --- a/app/nullius/migrate.py +++ b/app/nullius/migrate.py @@ -15,6 +15,7 @@ import sys from nullius import ondisk, paths, settings +from nullius.catalogue import storage SKIP = {".git", "__pycache__", ".pytest_cache", ".venv"} PATH_SETTINGS = {"RUNS_DIR", "WORKSPACES_DIR", "HARBOR_PINS", "STANDARD_DIR", "STANDARD_DATA_DIR", @@ -152,7 +153,7 @@ def add(dest, data, mode=0o600): bundled = Path(__file__).resolve().parent / "catalogue" source_catalogue = checkout / "app" / "nullius" / "catalogue" pending.catalogue_snapshot = source_catalogue.resolve() == bundled.resolve() - for kind in ("benchmarks", "agents", "features", "capabilities", "sets"): + for kind in ("benchmarks", "agents", "features", "capabilities", "modules", "sets"): parent = source_catalogue / kind _no_symlinks(parent) if not parent.exists(): @@ -164,11 +165,17 @@ def add(dest, data, mode=0o600): inventory = _inventory(entry, skip=SKIP) if any(p.name == ".env" for p in inventory): raise ValueError("A catalogue entry contains .env; move its credentials to Settings before migration.") - expected = bundled / kind / entry.name + expected = bundled / ("modules" if kind == "capabilities" else kind) / entry.name if not pending.catalogue_snapshot and inventory == _inventory(expected, skip=SKIP): continue counts["catalogue_entries"] += 1 dest = catalogue_target / kind / entry.name + for alias in storage.LEGACY if kind in storage.LEGACY else (): # one Module, whichever name its folder has + other = catalogue_target / alias / entry.name + # absent too: one made before apply would hide this copy + pending.catalogue_entries[other] = _inventory(other) + if other != dest and pending.catalogue_entries[other] is not None: + dest = other destination(dest) existing = _inventory(dest) if existing is not None and inventory != existing: diff --git a/app/nullius/recipes/launch.py b/app/nullius/recipes/launch.py index f1acf6eda..18e5dda90 100644 --- a/app/nullius/recipes/launch.py +++ b/app/nullius/recipes/launch.py @@ -67,7 +67,7 @@ def payload(cat, jobs): "runnerGone": providers.GONE, # the providers a run is sent to, from the registry "providers": providers.run_choices(), - # the standard's benchmarks, agents and capabilities, and why a pair does not fit (standard/pages/recipe.py, choices) + # the standard's benchmarks, agents and Modules, and why a pair does not fit (standard/pages/recipe.py, choices) "standard": standard.choices(), "parameters": PARAMETERS, "benchmarks": [asdict(b) | {"label": b.label} for b in cat.benchmarks], "datasets": [asdict(d) | LAUNCH.get(d.key, {}) for d in cat.datasets], diff --git a/app/nullius/standard/__init__.py b/app/nullius/standard/__init__.py index 1c21c4714..e7532f12d 100644 --- a/app/nullius/standard/__init__.py +++ b/app/nullius/standard/__init__.py @@ -1,9 +1,9 @@ -"""The Nullius standard: benchmarks, agents and capabilities, matched by ports. +"""The Nullius standard: benchmarks, agents and Modules, matched by ports. -A benchmark *needs* ports, an agent or a capability *offers* them, and a pair fits +A benchmark *needs* ports, an agent or a Module *offers* them, and a pair fits when every port the benchmark needs is offered and proven (``contract.match``). A port is a versioned contract (``contract.ports``) with a conformance kit, a tiny benchmark -run against the agent or capability before its claim is written down +run against the agent or Module before its claim is written down (``proofs.conform``). The definitions are files in the catalogue (``contract.definitions``). A run (``runner.run``) sets each unit up with the benchmark's driver (``protocols.jsonl``), diff --git a/app/nullius/standard/backends/boat.py b/app/nullius/standard/backends/boat.py index 939592ecd..86a1bed8a 100644 --- a/app/nullius/standard/backends/boat.py +++ b/app/nullius/standard/backends/boat.py @@ -1,9 +1,9 @@ -"""The ``boat`` backend: each unit's agent or capability in a boat.dev VM of its own. +"""The ``boat`` backend: each unit's agent or Module in a boat.dev VM of its own. A boat VM is a cloud Ubuntu machine created by its API (``API``) and reached over plain OpenSSH. Everything that holds an answer or a key stays on this machine: the driver, the unit's relay, the spending cap, the scoring. Only -the process of the agent (or the capability) runs in the VM, as ``USER``, a +the process of the agent (or the Module) runs in the VM, as ``USER``, a user of its own whose only way out is the VM's loopback (``LOCK``): no public address, no DNS. Its model calls reach the unit's relay through a reverse tunnel on the same port (``ssh -R``), so the address it is given is @@ -496,7 +496,7 @@ def most(self) -> Optional[int]: @contextmanager def unit(self, trial: str, ws: str, home: str, stopped: Optional[threading.Event] = None, *, inst: Optional[str] = None, here: Optional[str] = None, seconds: float = 0): - """The unit's VM while its agent or capability runs, given before it starts, each at its own + """The unit's VM while its agent or Module runs, given before it starts, each at its own path: the install (``inst``) and the runtimes it links to outside itself, and the definition (``here``). ``agent/boat.json`` says which VM, and how long it took to come up and be sent all that. Its workspace and home (sent by :meth:`place`) are brought back diff --git a/app/nullius/standard/backends/container.py b/app/nullius/standard/backends/container.py index 46a69dcca..02d8261f8 100644 --- a/app/nullius/standard/backends/container.py +++ b/app/nullius/standard/backends/container.py @@ -1,4 +1,4 @@ -"""The container backend: each unit's agent, or capability, in a container of its +"""The container backend: each unit's agent, or Module, in a container of its own, and its relay in another beside it. This module shells out to the engine's program (:data:`DOCKER`) and imports nothing outside the standard library. That is ``docker``, or ``podman`` on a machine without Docker or @@ -38,7 +38,7 @@ removed from this machine once the relay listens: never on an argument list (``ps``) or in the container's environment (``docker inspect``). The relay publishes its port on 127.0.0.1 so the driver (on the machine for -agent/capability runs) reaches the judge's route and a capability +agent/Module runs) reaches the judge's route and a Module benchmark's reader. Its record folder is mounted read-write, so the host reads each call as the local relay's are read. On podman the default bridge is Nullius's own (:data:`BRIDGE`, :func:`way_out`). A model endpoint on this machine's loopback is reached by the relays alone (:class:`Loopback`). @@ -625,7 +625,7 @@ def env_args(env: Dict[str, str], path: str) -> Tuple[List[str], List[str]]: def run_argv(image: str, cmd: List[str], *, name: str, network: str, job: str, workdir: str, mounted: List[Tuple[str, bool]], env: Dict[str, str], path: str, interactive: bool = True, binds: Iterable[Tuple[str, str]] = ()) -> List[str]: - """``docker run`` for a unit's agent or capability, its environment as + """``docker run`` for a unit's agent or Module, its environment as :func:`env_args` gives it. ``binds``: (a file on this machine, its path inside), each read-only - a licence file where its environment says the software looks for it. The machine's constraints: :func:`capped`.""" diff --git a/app/nullius/standard/calls/ledger.py b/app/nullius/standard/calls/ledger.py index 975251401..89d74cf8e 100644 --- a/app/nullius/standard/calls/ledger.py +++ b/app/nullius/standard/calls/ledger.py @@ -70,7 +70,7 @@ class Unavailable(Exception): def models(other: dict, model, judge, simulator, embed, control: bool = False) -> list: """Every model a run's relays may send a call to, as sent: the run's own, the judge's, the simulated user's (never a control's: it holds no conversation), an option's embeddings and the side models of - ``other`` (the agent, capability or setup). What a capped run must have a price for.""" + ``other`` (the agent, Module or setup). What a capped run must have a price for.""" side = [(to or name) for name, _, to in (str(m).partition("=") for m in (other.get("model") or {}).get("side_models") or ())] return [m for m in dict.fromkeys([model, judge, None if control else simulator, embed, *side]) if m] diff --git a/app/nullius/standard/calls/relay.py b/app/nullius/standard/calls/relay.py index a442a6ad6..cca8e9a75 100644 --- a/app/nullius/standard/calls/relay.py +++ b/app/nullius/standard/calls/relay.py @@ -1,4 +1,4 @@ -"""The model endpoint every agent, driver and capability of a run is given. +"""The model endpoint every agent, driver and Module of a run is given. It listens on 127.0.0.1, holds the real key and adds it on the way out, so what it relays for never holds one: their requests carry a placeholder. Each @@ -19,7 +19,7 @@ What the relay changes on the way is kept small, so a call through it costs what the same call made directly would: the connection to the provider is kept open between calls; the caller's headers go on as they came - an agent's session -and capability headers are the provider's to read - except the credentials, +and Module headers are the provider's to read - except the credentials, which the relay replaces with its own key, and the headers of the hop itself; the provider's headers come back the same way (its request id, its rate limits). It never answers for the provider: a 429 reaches the caller and the diff --git a/app/nullius/standard/cli.py b/app/nullius/standard/cli.py index e7dbf5596..b3459f6ed 100644 --- a/app/nullius/standard/cli.py +++ b/app/nullius/standard/cli.py @@ -4,10 +4,10 @@ PYTHONPATH=app python3 -m nullius.standard.cli check [PATH] PYTHONPATH=app python3 -m nullius.standard.cli fit BENCHMARK[@VERSION] PYTHONPATH=app python3 -m nullius.standard.cli pins BENCHMARK[@VERSION] [--tag TAG] [--limit N] - PYTHONPATH=app python3 -m nullius.standard.cli new benchmark|agent|capability KEY [--family F] [--port P] + PYTHONPATH=app python3 -m nullius.standard.cli new benchmark|agent|module KEY [--family F] [--port P] PYTHONPATH=app python3 -m nullius.standard.cli new version KEY VERSION - PYTHONPATH=app python3 -m nullius.standard.cli conform AGENT|CAPABILITY --model M [--provider P] [--port PORT ...] [--attempts K] [--option NAME=VALUE ...] [--unsandboxed | --backend container | --backend boat] - PYTHONPATH=app python3 -m nullius.standard.cli run BENCHMARK[@VERSION] AGENT|CAPABILITY --model M [--provider P] [--units FILE] [--limit N] [-j N] [--option NAME=VALUE ...] [--bench-option NAME=VALUE ...] [--price MODEL=INPUT,OUTPUT[,CACHED,WRITE,WRITE_1H][/TOKENS=INPUT,OUTPUT...] ...] [--max-usd USD] [--max-usd-per-unit USD] [--timeout PHASE=SECONDS ...] [--max-turns N] [--max-calls N] [--constraint KEY=VALUE ...] [--served-by [MODEL=]SLUG[,SLUG...] ...] [--exchanges whole|text|off] [--exchanges-max-mb N] [--unsandboxed | --backend container | --backend boat [--boat-size SIZE]] + PYTHONPATH=app python3 -m nullius.standard.cli conform AGENT|MODULE --model M [--provider P] [--port PORT ...] [--attempts K] [--option NAME=VALUE ...] [--unsandboxed | --backend container | --backend boat] + PYTHONPATH=app python3 -m nullius.standard.cli run BENCHMARK[@VERSION] AGENT|MODULE --model M [--provider P] [--units FILE] [--limit N] [-j N] [--option NAME=VALUE ...] [--bench-option NAME=VALUE ...] [--price MODEL=INPUT,OUTPUT[,CACHED,WRITE,WRITE_1H][/TOKENS=INPUT,OUTPUT...] ...] [--max-usd USD] [--max-usd-per-unit USD] [--timeout PHASE=SECONDS ...] [--max-turns N] [--max-calls N] [--constraint KEY=VALUE ...] [--served-by [MODEL=]SLUG[,SLUG...] ...] [--exchanges whole|text|off] [--exchanges-max-mb N] [--unsandboxed | --backend container | --backend boat [--boat-size SIZE]] PYTHONPATH=app python3 -m nullius.standard.cli run BENCHMARK[@VERSION] nop|oracle [--dataset D] [--units FILE] [--limit N] PYTHONPATH=app python3 -m nullius.standard.cli prove BENCHMARK[@VERSION] [--dataset D] [--limit N] [--bench-option NAME=VALUE ...] [--job nop|oracle=JOB_DIR ...] PYTHONPATH=app python3 -m nullius.standard.cli run ... --shard I/N [--launch ID] @@ -23,10 +23,10 @@ An agent runs commands as you on the local backend, which is not a sandbox: an agent's run or conformance check there is refused without ``--unsandboxed``. -``--backend container`` (``docker`` alias) runs each unit's agent or capability in a container whose +``--backend container`` (``docker`` alias) runs each unit's agent or Module in a container whose only way out is the unit's relay, or a public web proxy when its environment declares ``network`` (``standard/backends/container.py``), and needs no such yes. -``--backend boat`` runs each unit's agent or capability in a boat.dev VM of its +``--backend boat`` runs each unit's agent or Module in a boat.dev VM of its own, whose only way out is a tunnel to the unit's relay on this machine (``standard/backends/boat.py``); its API key is Settings → Sandbox's, or ``BOAT_API_KEY``. A benchmark's control (``nop``, ``oracle``: its ``controls``) runs no agent @@ -34,11 +34,11 @@ ``prove`` runs a benchmark's controls and checks its units and that nothing leaks, and writes what passed into its ``proven`` (``standard/proofs/prove.py``). -A benchmark, an agent or a capability is named by its key (its default +A benchmark, an agent or a Module is named by its key (its default version) or ``key@version``. ``list`` shows every definition - each version - and which pairs fit; ``check`` checks the definitions (or one file); ``new`` writes a definition to fill in, or a new -version of an agent or a capability (``new version``: the default's pins, with +version of an agent or a Module (``new version``: the default's pins, with the version replaced, and nothing proven); ``fit`` says, for one benchmark, what can run it and why the rest cannot; ``conform`` runs the kits and writes what passed into ``proofs.json`` - the port, and each skill of its kit shown or not (``--attempts K``: @@ -59,7 +59,7 @@ made (``standard/runner/sets.py``), and ``run --set NAME`` runs one: its dataset taken from it, the job recording which set ran. ``units`` lists a dataset's tasks, searched and counted by category (``standard/runner/units.py``). ``--option`` -sets one of the agent's or capability's options (``options`` in its definition); +sets one of the agent's or Module's options (``options`` in its definition); the rest keep the vendor's defaults, and the job's config records them all. ``--served-by [MODEL=]SLUG[,SLUG...]`` lets only those serving providers answer a model on OpenRouter, in that order (``run.served_by``); each call's record @@ -119,9 +119,9 @@ def _all(): def _other(key): - o = definitions.get("agent", key) or definitions.get("capability", key) + o = definitions.get("agent", key) or definitions.get("module", key) if not o: - sys.exit(f"no agent or Module {key!r}: {[d['_ref'] for k in ('agent', 'capability') for d in definitions.load(k, every=True)[0]]}") + sys.exit(f"no agent or Module {key!r}: {[d['_ref'] for k in ('agent', 'module') for d in definitions.load(k, every=True)[0]]}") return o @@ -207,11 +207,11 @@ def cmd_pins(a): def cmd_list(a): got, bad = _all() for kind in definitions.KINDS: - print(("Modules" if kind == "capability" else definitions.KINDS[kind]["dir"]) + ":") + print(("Modules" if kind == "module" else 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'}" - + (f" · {definitions.origin_of(d).capitalize()}" if kind != "capability" else "")) + + (f" · {definitions.origin_of(d).capitalize()}" if kind != "module" else "")) up = d.get("upstream") or {} if up.get("repository"): print(f" {'':<18} upstream {up['repository'].removeprefix('https://')} @ " @@ -220,7 +220,7 @@ def cmd_list(a): print(f" {'':<18} and the skills " + "; ".join(f"{', '.join(s)} of {p}" for p, s in d["needs_skills"].items())) for note in ([] if kind == "benchmark" else older(d) + skills(d)): print(f" {'':<18} {note}") - t = match.table(got["benchmark"], got["agent"], got["capability"]) + t = match.table(got["benchmark"], got["agent"], got["module"]) print("pairs:") for b, row in t.items(): print(f" {b}: " + ", ".join(f"{o} {'fits' if not why else 'no'}" for o, why in row.items())) @@ -288,7 +288,7 @@ def cmd_fit(a): have = definitions.port_skills(p) for s in (b.get("needs_skills") or {}).get(p) or []: print(f" and its {s} skill: {have.get(s, '')}") - others = definitions.load("agent" if b["family"] == "agent" else "capability", every=True)[0] + others = definitions.load("agent" if b["family"] == "agent" else "module", every=True)[0] for o in others: why = match.fit(b, o) notes = [] if why else older(o, b["needs"]) + skills(o, b["needs"]) @@ -352,7 +352,7 @@ def score(unit, dir, transcript, answer): "model": {"apis": ["chat"], "env": {"OPENAI_BASE_URL": "{base_url}", "OPENAI_API_KEY": "{key}", "MODEL": "{model}"}}, }, }, - "capability": { + "module": { "capability.json": { "schema": "nullius.capability/v1", "key": "", "label": "", "summary": "SAY WHAT THE MODULE KEEPS AND WHAT IT GIVES BACK.", "kind": "memory", "start": {"command": ["python3", "{here}/capability.py"]}, @@ -391,14 +391,14 @@ def produce(unit, dir, recalled, model, base_url, key): def new_version(key: str, version: str) -> str: - """Add ``version`` to an agent's or a capability's file: a copy of its default + """Add ``version`` to an agent's or a Module's file: a copy of its default version's block with the old version replaced in its pins, nothing proven. A file without ``versions`` is turned into one first, its one version kept as it was. Existing evidence stays in ``proofs.json``; the new version has none. Returns the definition's path.""" if not definitions._KEY.match(key): sys.exit(f"no agent, Module or benchmark {key!r}") - kind = next((k for k in ("agent", "capability", "benchmark") + kind = next((k for k in ("agent", "module", "benchmark") if (folder := definitions.entry_dir(k, key)) and os.path.isfile(definitions.definition_path(folder, k))), None) if not kind: @@ -434,9 +434,11 @@ def check(d): # Old-version evidence is valid for both manifests; publish it first so # interruption cannot discard proofs while stripping their legacy fields. proofs.write(folder, evidence) + if "family" in d: + d["family"] = definitions.names.wire(d["family"]) 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": + if kind != "module": 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: " @@ -457,9 +459,8 @@ def cmd_new(a): kind, key = a.kind, a.key if not definitions._KEY.match(key): sys.exit("a key is lower case letters, digits and dashes") - name = definitions.KINDS[kind]["file"] selected_dir = definitions.entry_dir(kind, key) - selected = os.path.join(selected_dir, name) if selected_dir else None + selected = definitions.definition_path(selected_dir, kind) if selected_dir else None if selected and os.path.exists(selected): sys.exit(f"{selected} exists already") folder = definitions.writable_dir(kind, key) @@ -468,10 +469,10 @@ def cmd_new(a): port = a.port or ("agent.task/v1" if family == "agent" else "cap.memory/v1") for fname, body in TEMPLATES[kind].items(): if isinstance(body, dict): - text = json.dumps(body, indent=2).replace('""', json.dumps(key)).replace('"{family}"', json.dumps(family)) \ + text = json.dumps(body, indent=2).replace('""', json.dumps(key)).replace('"{family}"', json.dumps(definitions.names.wire(family))) \ .replace('"{port}"', json.dumps(port)) else: - feat = family == "capability" + feat = family == "module" text = body.format(key=key, extra=PRODUCE.format() if feat else "", handlers=', "produce": produce' if feat else "") path = os.path.join(folder, fname) if os.path.exists(path): @@ -484,7 +485,7 @@ def cmd_new(a): then = f"cli run {key} goose --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": + if kind != "module": 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}") diff --git a/app/nullius/standard/contract/definitions.py b/app/nullius/standard/contract/definitions.py index a6ace7c9d..11b1863cd 100644 --- a/app/nullius/standard/contract/definitions.py +++ b/app/nullius/standard/contract/definitions.py @@ -3,9 +3,9 @@ - a **benchmark**: ``catalogue/benchmarks//standard.json`` (``nullius.benchmark/v1``) beside the catalogue's own ``benchmark.json``; - an **agent**: ``catalogue/agents//agent.json`` (``nullius.agent/v1``); -- a **capability**: ``catalogue/capabilities//capability.json`` (``nullius.capability/v1``). +- a **Module**: ``catalogue/modules//capability.json`` (``nullius.capability/v1``). -An agent or a capability may hold several **versions** in its one file: +An agent or a Module may hold several **versions** in its one file: ``versions`` maps each version to what differs in it - its ``upstream`` (package, licence), ``install``, and optionally ``start``, ``model``, ``env``, ``options`` (added to the shared ones), ``fidelity``; ``default`` names the @@ -33,7 +33,7 @@ says who wrote it - ``source``, one of ``SOURCES`` - and where it comes from (``from``, a sentence), and may hold it to a bound (``expect``). A control is run as the other side of a pair (:func:`control`), with no agent, no -capability and no model of its own; ``nop`` and ``oracle`` are the words Harbor +Module and no model of its own; ``nop`` and ``oracle`` are the words Harbor calls its controls by, so the runs pages read the jobs as controls. A benchmark's ``proven`` is what ``cli prove`` found, per dataset (``standard/proofs/prove.py``). @@ -74,7 +74,7 @@ dataset with its sha256. The placeholders a command may hold are named here (``SLOTS``) and filled by the runner, quoted, never by a shell. -An agent or a capability may have **options** (``options``): what a run may set +An agent or a Module may have **options** (``options``): what a run may set of its own behaviour, each with its allowed values and a default that is the vendor's own, filled into its templates as ``{opt_}`` (:func:`options_of`). An agent may name its own non-interactive command (``fidelity.command``), which @@ -113,7 +113,7 @@ KINDS = { "benchmark": {"schema": "nullius.benchmark/v1", "dir": "benchmarks", "file": "standard.json"}, "agent": {"schema": "nullius.agent/v1", "dir": "agents", "file": "agent.json"}, - "capability": {"schema": "nullius.capability/v1", "dir": "capabilities", "file": "capability.json"}, + "module": {"schema": "nullius.capability/v1", "dir": "modules", "file": "capability.json"}, } # What a command word may be: a literal from a safe alphabet, or one slot. @@ -134,7 +134,7 @@ _NPM = re.compile(r"^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*@[0-9][A-Za-z0-9.+-]*$") _PIP = re.compile(r"^[A-Za-z0-9_.-]+==[A-Za-z0-9_.+!-]+$") _PIP_GIT = re.compile(r"[A-Za-z0-9_.-]+ @ git\+https://[A-Za-z0-9.-]+/(?:[A-Za-z0-9_.-]+/)*[A-Za-z0-9_.-]+@[0-9a-fA-F]{40}") -FAMILIES = ("agent", "capability") +FAMILIES = ("agent", "module") _MODEL_NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._:/@+-]{0,127}$") APIS = ("chat", "responses", "messages") SCORES = ("pass", "score") @@ -193,7 +193,7 @@ def setup_label(bench, which): _ABS = re.compile(r"^(?:/[A-Za-z0-9_@+-][A-Za-z0-9_.@+-]*)+$") _NOT_UNDER = ("/proc", "/sys", "/dev") # where a licence file is never mounted: the kernel's own BASE_ENV = "base" # the name no environment may take: the base image itself -# An option of an agent or a capability (``options``): a name a template may +# An option of an agent or a Module (``options``): a name a template may # carry as ``{opt_}``, its values a plain word each - they are written # into variables and config files, so never a quote, a space or a newline. _OPTION = re.compile(r"^[a-z][a-z_]{0,39}$") @@ -339,7 +339,7 @@ def _in_home(path) -> bool: def _caches(d: dict) -> List[str]: - """``caches``: what the agent or capability fills its home with and no one + """``caches``: what the agent or Module fills its home with and no one reads after the unit (a package cache, a synced repository) - removed when the unit ends, so a job keeps its evidence and not a copy of the same download per unit. Paths under ``{home}/``, nowhere else.""" @@ -572,7 +572,7 @@ def _bench_options(d: dict) -> List[str]: ``when`` it applies: another option's values (a retriever's, only with a retrieval). ``limit``: a bound the upstream has of its own (its steps, its errors), offered with the run's limits; ``by``: its default under each value of another option (an agent's own steps), for a default of ``default``; ``yours``: the value - an agent's or a capability's run gets for it (the steps of a port's loop). ``names``: a name for some of its values, shown in their place. ``step``: ``where`` for a choice of where the work runs, ``dataset`` for one its datasets need, the builder step that asks it.""" + an agent's or a Module's run gets for it (the steps of a port's loop). ``names``: a name for some of its values, shown in their place. ``step``: ``where`` for a choice of where the work runs, ``dataset`` for one its datasets need, the builder step that asks it.""" opts = d.get("options") if opts is None: return [] @@ -701,11 +701,11 @@ def _host(d: dict) -> List[str]: def bench_options_of(bench: dict, dataset: str, given: Optional[dict] = None, setup: str = "yours", kind: Optional[str] = None) -> Tuple[dict, List[str]]: """The benchmark's options for one run on ``dataset`` in ``setup`` (original, model, or yours: an - agent or a capability in its port): each that applies to both, at the value ``given`` or its default; + agent or a Module in its port): each that applies to both, at the value ``given`` or its default; and what is wrong with the given ones. An option given for a dataset or a setup it does not apply to is ignored - a run of several carries one choice for all. An option applies to an agent's or a - capability's run unless its ``setups`` say otherwise; one whose ``setups`` name ``agent`` applies to a run - whose ``kind`` is an agent, never to a capability's or a control's.""" + Module's run unless its ``setups`` say otherwise; one whose ``setups`` name ``agent`` applies to a run + whose ``kind`` is an agent, never to a Module's or a control's.""" opts = {n: o for n, o in (bench.get("options") or {}).items() if dataset in (o.get("datasets") or [dataset]) and (setup in (o.get("setups") or ["yours"]) or (kind == "agent" and setup == "yours" and "agent" in (o.get("setups") or [])))} @@ -1788,7 +1788,7 @@ def problems(d: dict, kind: str) -> List[str]: bad += _own_agents(d) bad += _environments(d.get("environments"), d.get("_here")) envs = d.get("environments") if isinstance(d.get("environments"), dict) else {} - if d.get("family") == "capability": + if d.get("family") == "module": bad += [f"environments.{n}.image: an own image holds an agent's work; a Module benchmark has none" for n, e in envs.items() if own_image(e)] for i, x in enumerate(ds if isinstance(ds, list) else []): @@ -1838,13 +1838,13 @@ def problems(d: dict, kind: str) -> List[str]: if not _KEY.match(str(d.get("kind", ""))): bad.append("kind: what kind of Module (memory, ...)") bad += _command("start.command", (d.get("start") or {}).get("command"), {"here", "install"}) - bad += _ports("offers", d.get("offers") or [], "capability") + bad += _ports("offers", d.get("offers") or [], "module") bad += _proven(d) bad += _install(d) bad += _env(d.get("env")) bad += _options(d) bad += _caches(d) - if d.get("model") is not None: # a capability that calls a model of its own: the relay, as an agent's + if d.get("model") is not None: # a Module that calls a model of its own: the relay, as an agent's bad += _model(d["model"], d.get("_here")) for p in d.get("offers") or []: if ports.known(p) and p.split(".", 1)[1].split("/")[0] != d.get("kind"): @@ -1915,7 +1915,7 @@ def load(kind: str, root: Optional[str] = None, every: bool = False) -> Tuple[Li back to the bundled definition. A loaded definition carries ``_here``, its folder, and ``_kind``, and is resolved (:func:`resolve`) to its default version, or, with ``every``, to - each of its versions in turn - a benchmark as an agent or a capability.""" + each of its versions in turn - a benchmark as an agent or a Module.""" kind = names.kind(kind) name = KINDS[kind]["file"] selected = storage.folders(KINDS[names.kind(kind)]["dir"], CATALOGUE, root) @@ -2061,14 +2061,14 @@ def _skills(d: dict) -> List[str]: def said(kind: str) -> str: """A kind as a message names it.""" - return "Module" if kind == "capability" else kind + return "Module" if kind == "module" else kind def definition_path(folder: str, kind: str) -> str: kind = names.kind(kind) path = os.path.join(folder, KINDS[kind]["file"]) legacy = os.path.join(folder, "feature.json") - return legacy if kind == "capability" and not os.path.exists(path) and os.path.isfile(legacy) else path + return legacy if kind == "module" and not os.path.exists(path) and os.path.isfile(legacy) else path def path_of(d: dict) -> str: @@ -2098,8 +2098,9 @@ def save(d: dict, change: Optional[Callable[[dict], None]] = None) -> None: # Explicit fixture roots remain local. Only a loaded bundled entry needs # copying; helpers and model files beside its definition must follow it. folder = d["_here"] - bundled = os.path.join(CATALOGUE, KINDS[d["_kind"]]["dir"], d["key"]) - if os.path.realpath(folder) == os.path.realpath(bundled): + inside = os.path.realpath(folder).startswith(os.path.join(os.path.realpath(CATALOGUE), "")) # never scan the bundle for a user entry + bundled = inside and entry_dir(d["_kind"], d["key"], root=CATALOGUE) # under any of a Module's folder names + if bundled and os.path.realpath(folder) == os.path.realpath(bundled): d["_here"] = writable_dir(d["_kind"], d["key"]) storage.ensure_writable(d["_here"], CATALOGUE) path = path_of(d) diff --git a/app/nullius/standard/contract/match.py b/app/nullius/standard/contract/match.py index 7665baebb..72f526d2e 100644 --- a/app/nullius/standard/contract/match.py +++ b/app/nullius/standard/contract/match.py @@ -1,7 +1,7 @@ """Which pairs fit, and why the others do not. -A benchmark of the agent family takes an agent, one of the capability family a -capability, and the pair fits when the other side offers - and has proven - +A benchmark of the agent family takes an agent, one of the Module family a +Module, and the pair fits when the other side offers - and has proven - every port the benchmark needs - and, for a port whose kit has skills, has shown each skill the benchmark relies on (``needs_skills``). An agent with ``only_for`` - a benchmark's own reference agent - fits those benchmarks @@ -18,11 +18,11 @@ def fit(bench: dict, other: dict) -> List[str]: - """Why ``other`` (an agent or a capability definition, or a control) cannot + """Why ``other`` (an agent or a Module definition, or a control) cannot run ``bench``; empty when it can. A control fits the benchmark that declares it, whatever its family: it needs no port, it answers itself.""" side = bench.get("family") - kind = other.get("_kind") or ("agent" if other.get("schema", "").startswith("nullius.agent") else "capability") + kind = other.get("_kind") or ("agent" if other.get("schema", "").startswith("nullius.agent") else "module") if kind == "upstream": return [] if other.get("key") in (bench.get("setups") or {}) else [f"{bench['label']} has no {other.get('key')} setup"] if kind == "control": @@ -56,8 +56,8 @@ def fit(bench: dict, other: dict) -> List[str]: return why -def table(benches: List[dict], agents: List[dict], capabilities: List[dict]) -> Dict[str, Dict[str, List[str]]]: - """For every benchmark, every agent or capability of its family - each +def table(benches: List[dict], agents: List[dict], modules: List[dict]) -> Dict[str, Dict[str, List[str]]]: + """For every benchmark, every agent or Module of its family - each version by its ``key@version`` when it has several - and the reasons it does not fit (empty: offered); then the controls it declares, ``nop`` and ``oracle``, which always fit. A benchmark is keyed as an agent is: its @@ -65,7 +65,7 @@ def table(benches: List[dict], agents: List[dict], capabilities: List[dict]) -> out = {} agents = agents + definitions.benchmark_agents(benches) for b in benches: - others = agents if b.get("family") == "agent" else capabilities + others = agents if b.get("family") == "agent" else modules k = ref_of(b) if "_version" in b else b["key"] out[k] = {(o.get("_ref") or o["key"]): fit(b, o) for o in others} out[k].update({c: [] for c in CONTROLS if c in (b.get("controls") or {})}) diff --git a/app/nullius/standard/contract/names.py b/app/nullius/standard/contract/names.py index d54fa174d..e5b08f098 100644 --- a/app/nullius/standard/contract/names.py +++ b/app/nullius/standard/contract/names.py @@ -10,7 +10,13 @@ def backend(value): def kind(value: str) -> str: - return "capability" if value == "feature" else value + """``feature`` and ``capability``, a Module's earlier names, read as ``module``.""" + return "module" if value in ("feature", "capability") else value + + +def wire(value): + """``module`` as files, job records and drivers are given it: ``capability``, the word version 1 fixed.""" + return "capability" if value == "module" else value def port(value: str) -> str: @@ -24,8 +30,8 @@ def definition(value): result = dict(value) if result.get("schema") == "nullius.feature/v1": result["schema"] = "nullius.capability/v1" - if result.get("family") == "feature": - result["family"] = "capability" + if "family" in result: + result["family"] = kind(result["family"]) for field in ("needs", "offers"): if isinstance(result.get(field), list): result[field] = [port(p) for p in result[field]] diff --git a/app/nullius/standard/contract/ports.py b/app/nullius/standard/contract/ports.py index 1022ea328..9b27b4343 100644 --- a/app/nullius/standard/contract/ports.py +++ b/app/nullius/standard/contract/ports.py @@ -60,7 +60,7 @@ }, "cap.memory/v1": { "label": "Memory", - "family": "capability", + "family": "module", "summary": "add {session} then recall {question, date} -> {memory}: what it kept that bears on the question, " "asked on date when the benchmark gives one.", "kit": "cap-memory-v1", @@ -69,8 +69,8 @@ def family(port: str) -> str: - """``agent`` or ``capability``: the side of a pairing a port belongs to.""" - return "capability" if names.port(port).startswith("cap.") else port.split(".", 1)[0] + """``agent`` or ``module``: the side of a pairing a port belongs to.""" + return "module" if names.port(port).startswith("cap.") else port.split(".", 1)[0] def known(port: str) -> bool: diff --git a/app/nullius/standard/contract/proofs.py b/app/nullius/standard/contract/proofs.py index 27038b402..2021e95cb 100644 --- a/app/nullius/standard/contract/proofs.py +++ b/app/nullius/standard/contract/proofs.py @@ -2,7 +2,7 @@ One document owns one entry's evidence, keyed by the declared version (the empty string for a definition without a version). A version block holds -``proven`` and, for a flat agent or capability, its generated ``offers``. +``proven`` and, for a flat agent or Module, its generated ``offers``. Versioned participants derive offers from their own proven ports as before. An existing document replaces all embedded evidence; an absent document keeps @@ -34,7 +34,7 @@ def blocks(d: dict) -> dict: def document(d: dict, kind: str) -> dict: """Extract evidence without modifying the combined definition.""" - return {"schema": SCHEMA, "kind": names.kind(kind), "key": d["key"], + return {"schema": SCHEMA, "kind": names.wire(names.kind(kind)), "key": d["key"], "versions": {v: {f: copy.deepcopy(b[f]) for f in FIELDS if f in b} for v, b in blocks(d).items()}} @@ -58,7 +58,7 @@ def refuse(message): refuse("a JSON object") expected = {"schema": SCHEMA, "kind": names.kind(kind), "key": d.get("key")} for field, wanted in expected.items(): - if value.get(field) != wanted: + if (names.kind(value.get(field)) if field == "kind" else value.get(field)) != wanted: refuse(f"{field}: expected {wanted!r}") if set(value) != {*expected, "versions"}: refuse("only schema, kind, key and versions are allowed") diff --git a/app/nullius/standard/pages/howto.py b/app/nullius/standard/pages/howto.py index ccf7c7f80..5db2e4d7d 100644 --- a/app/nullius/standard/pages/howto.py +++ b/app/nullius/standard/pages/howto.py @@ -1,4 +1,4 @@ -"""How to add an agent or a capability, as the Agents and Capabilities tabs show it: +"""How to add an agent or a Module, as the Agents and Modules tabs show it: the commands to type and the files to write, in order. Each step is ``{title, text, code, lang, file}``: ``code`` is what is typed or @@ -107,9 +107,9 @@ def _json(d) -> str: def steps(kind: str) -> list: agent = os.path.join(paths.catalogue_dir(), "agents", "my-agent", "agent.json") - capability = os.path.join(paths.catalogue_dir(), "capabilities", "my-memory") - definition = os.path.join(capability, "capability.json") - wrapper = os.path.join(capability, "capability.py") + module = os.path.join(paths.catalogue_dir(), "modules", "my-memory") + definition = os.path.join(module, "capability.json") + wrapper = os.path.join(module, "capability.py") if kind == "agent": return [ {"title": "Create its folder and definition", "lang": "shell", @@ -159,7 +159,7 @@ def steps(kind: str) -> list: return [ {"title": "Create its folder, definition and wrapper", "lang": "shell", "text": "The key is lower case letters, digits and dashes; it names the folder in your catalogue.", - "code": f"{CLI} new capability my-memory\n# wrote {definition}\n# wrote {wrapper}"}, + "code": f"{CLI} new module my-memory\n# wrote {definition}\n# wrote {wrapper}"}, {"title": "Write capability.py around your memory", "lang": "python", "file": wrapper, "text": "Nullius sends add once per session of the history, then recall with the question, " "and gives what comes back to the benchmark's reader. Replace the three marked calls with your library's.", @@ -189,22 +189,22 @@ def steps(kind: str) -> list: # with what was typed: {name}, {source}, {remark} - what the assistant should # know beyond what it reads from the source; the Remark line is left out when # there is none (``static/catalogue/add.js``). -_KINDS = ("benchmark", "agent", "capability") +_KINDS = ("benchmark", "agent", "module") def prompt(kind: str) -> str: if kind not in _KINDS: raise ValueError(f"unknown catalogue kind: {kind}") - folder = "capabilities" if kind == "capability" else kind + "s" + folder = "modules" if kind == "module" else kind + "s" target = os.path.join(paths.catalogue_dir(), folder, "") specific = { "benchmark": "First ask me how it should run: Harbor or the Nullius standard (its Original setup). Recommend a route.\n", "agent": "Ask before running unsandboxed. Verify native capabilities and supported extensions.\n", - "capability": "Verify its callable operations and proven ports.\n", + "module": "Verify its callable operations and proven ports.\n", }[kind] - word, skill = ("Module", "module") if kind == "capability" else (kind, kind) + word = "Module" if kind == "module" else kind return (f'Add the {word} "{{name}}" to Nullius.\nSource: {{source}}\nRemark: {{remark}}\n\n' - f"Follow /import-{skill}, or .agents/skills/import-{skill}/SKILL.md in the source checkout, " + f"Follow /import-{kind}, or .agents/skills/import-{kind}/SKILL.md in the source checkout, " "with docs/standard.md and AGENTS.md. If unavailable, ask for the checkout.\n" f"Write to {target}, even when the skill names package paths. " "For an existing bundled entry, copy its whole folder there first; never edit installed files. " diff --git a/app/nullius/standard/pages/recipe.py b/app/nullius/standard/pages/recipe.py index 00e78a448..99c6ef748 100644 --- a/app/nullius/standard/pages/recipe.py +++ b/app/nullius/standard/pages/recipe.py @@ -1,7 +1,7 @@ """The standard in the run builder: its choices, its recipe, its compile. A recipe for it carries *choices* - a benchmark, one of its -datasets, an agent or a capability and any of its options (``options``, name -> +datasets, an agent or a Module and any of its options (``options``, name -> value; the rest keep the vendor's defaults), a provider and a model, a limit, how many units at a time, and for an agent the explicit yes to running it unsandboxed - and :func:`compile` turns them into one command, here, on the server: @@ -24,9 +24,9 @@ machine (``shard.py``), each its own run with its own job (``-shard-of``), all under one launch id, the recipe's name. A shard's ``limit`` is its own. ``backend``: ``local`` processes, or ``container`` - each -unit's agent or capability in a container, also accepted as ``docker`` - which a +unit's agent or Module in a container, also accepted as ``docker`` - which a host must have Docker or Podman for (``docker`` in the result: the run checks it -before anything is sent), or ``boat`` - each unit's agent or capability in a +before anything is sent), or ``boat`` - each unit's agent or Module in a boat.dev VM of its own (``boat.py``), started where the run runs, with this machine's key. Each machine's constraints in Settings (``nullius.constraints``) go on its @@ -102,21 +102,21 @@ def _script(command: str) -> str: def _all() -> Dict[str, List[dict]]: - return {k: definitions.load(k, every=True)[0] for k in ("benchmark", "agent", "capability")} + return {k: definitions.load(k, every=True)[0] for k in ("benchmark", "agent", "module")} def _shown(o: dict, v: str, values: dict) -> str: """An option's value as Review shows it: its name, or for ``default`` under ``by`` the value it stands for (an - agent's or a capability's run, which takes no value of that other option, gets ``yours``).""" + agent's or a Module's run, which takes no value of that other option, gets ``yours``).""" by = next(iter((o.get("by") or {}).items()), None) if v == "default" and by: v = by[1].get(values.get(by[0]), v) if by[0] in values else o.get("yours") or v return (o.get("names") or {}).get(v) or v -def _capability_kind(b: dict) -> str: - """The kind of capability a benchmark runs (``memory``), read from the ports it needs; empty for an agent benchmark.""" - kinds = sorted({p.split(".", 1)[1].split("/")[0] for p in b.get("needs") or []}) if b.get("family") == "capability" else [] +def _module_kind(b: dict) -> str: + """The kind of Module a benchmark runs (``memory``), read from the ports it needs; empty for an agent benchmark.""" + kinds = sorted({p.split(".", 1)[1].split("/")[0] for p in b.get("needs") or []}) if b.get("family") == "module" else [] return kinds[0] if kinds else "" @@ -125,8 +125,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 it needs of a machine (``host``, each name's label, None for nothing: what its options need, and Docker when its tasks run in images or Harbor runs it), - what it is run with: ``family`` agent or capability (a benchmark only Harbor runs runs agents) and, for a - capability, its ``kind``; ``versions``, another version's tasks and unit by version; and ``origins``, its versions' + what it is run with: ``family`` agent or Module (a benchmark only Harbor runs runs agents) and, for a + Module, 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 = [] @@ -135,7 +135,7 @@ def benchmarks(cat) -> List[dict]: tasks, unit = cat.tasks_of(b) out.append({"b": b, "datasets": cat.datasets_of(b), "tasks": tasks, "unit": unit, "host": _machine_needs(b, d), - "family": d.get("family") or "agent", "kind": _capability_kind(d), + "family": d.get("family") or "agent", "kind": _module_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}}) @@ -170,7 +170,7 @@ def procedure_label(b: dict) -> str: 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 - beside the agents or capabilities. Each dataset carries the same controls, + beside the agents or Modules. Each dataset carries the same controls, each with its ``proven`` record on that dataset (None: not proven), and ``proofs``, the units and leak checks the same way (``prove.status``).""" status = prove.status(b) @@ -178,7 +178,7 @@ def _bench_page(b: dict) -> dict: for c in (definitions.control(b, w) for w in definitions.CONTROLS) if c] versioned = definitions.version_of(b) is not None task_sets = sets.rows(b["key"]) - return {"key": b["key"], "label": b["label"], "summary": b["summary"], "family": b["family"], "kind": _capability_kind(b), + return {"key": b["key"], "label": b["label"], "summary": b["summary"], "family": b["family"], "kind": _module_kind(b), "procedure": procedure_label(b), "origin": definitions.origin_of(b), "ref": definitions.ref_of(b) if "_version" in b else b["key"], @@ -251,7 +251,7 @@ def protocol(o: dict) -> str: """How Nullius talks to it, in a word or two for a page, in sentence case as its filter names it.""" if o["_kind"] == "control": return "No agent" - if o["_kind"] == "capability": + if o["_kind"] == "module": return "JSON lines" st = o.get("start") or {} return "ACP" if "acp" in st else "Its own script" if "driver" in st else "A command" @@ -314,7 +314,7 @@ def _install_words(o: dict) -> list: def entries(kind: str, benches: Optional[List[dict]] = None, every: bool = False, own: bool = False) -> dict: - """The agents (or capabilities) as the Agents page and the builder's Agent step list them, each with its ports + """The agents (or Modules) as the Agents page and the builder's Agent step list them, each with its ports and its fits (``match.fit``) on ``benches`` (default: every benchmark of its family, default versions), and the definitions with problems. ``own``: and the benchmarks' own agents (``definitions.benchmark_agents``).""" from nullius.standard.proofs import conform @@ -329,7 +329,7 @@ def entries(kind: str, benches: Optional[List[dict]] = None, every: bool = False cand = set() if driver else set(conform.candidates(o)) rows = [] for p, spec in ports.PORTS.items() if not driver else (): - if ports.family(p) != kind or (kind == "capability" and p.split(".", 1)[1].split("/")[0] != o.get("kind")): + if ports.family(p) != kind or (kind == "module" and p.split(".", 1)[1].split("/")[0] != o.get("kind")): continue rec = (o.get("proven") or {}).get(p) if p in (o.get("offers") or []) else None state = "proven" if rec else ("not offered" if p in cand else ("no kit yet" if not spec["kit"] else "not for it")) @@ -360,8 +360,8 @@ def choices() -> dict: return {"benchmarks": [_with_versions(b) for b in defaults], # an example (the example memory) is there to read or copy, never to choose "agents": [_other_page(o) for o in d["agent"] + definitions.benchmark_agents(d["benchmark"]) if not o.get("example")], - "capabilities": [_other_page(o) for o in d["capability"] if not o.get("example")], - "fits": match.table(d["benchmark"], d["agent"], d["capability"]), + "modules": [_other_page(o) for o in d["module"] if not o.get("example")], + "fits": match.table(d["benchmark"], d["agent"], d["module"]), "ports": {p: s["summary"] for p, s in ports.PORTS.items()}, "providers": list(PROVIDERS)} @@ -395,7 +395,7 @@ def page_of(benchmark: str) -> Optional[dict]: def chosen_of(recipe: dict) -> List[str]: - """The agents, capabilities and controls a recipe runs, each once, in its order: + """The agents, Modules and controls a recipe runs, each once, in its order: ``others``, or the one ``other``.""" picked = recipe.get("others") if not isinstance(picked, list): @@ -545,8 +545,8 @@ def add(step, message, shown=False, field=None, unset=False): f"{', '.join(sets.datasets_of(entry))}, not {ds_id}.") continue set_of[ds_id] = {"name": set_name, "label": sets.label_of(entry), "units": len(part), "ids": set(part)} - side = "agent" if b["family"] == "agent" else "capability" - # A control the benchmark declares (nop, oracle) is a choice beside the agents or capabilities: it runs + side = "agent" if b["family"] == "agent" else "module" + # A control the benchmark declares (nop, oracle) is a choice beside the agents or Modules: it runs # nothing as you and calls no model - a judged benchmark's judge only - so it asks for neither. # Several may be chosen: each is its own job of the one run, one after the other. backend = definitions.names.backend(recipe.get("backend") or "local") @@ -831,7 +831,7 @@ def add(step, message, shown=False, field=None, unset=False): guest = max([definitions.vm_memory_gb(b, v) for v in per_ds.values()] or [0]) if backend == "boat" and not boat.fits(boat_size, guest): add("where", f"A {boat.SIZES[boat_size]['label']} VM is too small for {b['label']}, whose units boot a {guest:g} GB VM: choose a larger size.") - # on Boat each unit's agent or capability runs in its VM (run.Run refuses the rest): a setup or a check runs + # on Boat each unit's agent or Module runs in its VM (run.Run refuses the rest): a setup or a check runs # on a machine, and the computer port's socket is on this one, out of a VM's reach # A benchmark booting VMs of its own runs each unit whole in a VM (boat_units), with a relay container in each VM computer = run.computer_port(b) @@ -974,7 +974,7 @@ def command_for(d: dict, p: dict, index: int) -> str: *(["--max-usd-per-unit", f"{per_unit:.6f}".rstrip("0").rstrip(".")] if per_unit and spends(p) else []), *[w for k, v in forced.items() for w in ("--timeout", f"{k}={v:g}")], *(["--max-turns", str(turns)] if turns else []), - *(["--max-calls", str(calls)] if calls and spends(p) and o.get("_kind") != "capability" else []), + *(["--max-calls", str(calls)] if calls and spends(p) and o.get("_kind") != "module" else []), *(["--exchanges", keep] if keep != exchanges.DEFAULT else []), *(["--exchanges-max-mb", str(keep_mb)] if keep_mb != exchanges.MAX_MB else []), *(["--simulator-model", sim_model] if sim_model and not p["control"] else []), @@ -1155,11 +1155,11 @@ def where_label(target: str) -> str: def conformance(kind: str, key: str, *, model: str, provider: str, unsandboxed: bool, stamp: str, backend: str = "local") -> dict: - """The check an Agents or Capabilities page starts: every kit the agent or - capability can take, as one command (``cli conform``), the jobs it will + """The check an Agents or Modules page starts: every kit the agent or + Module can take, as one command (``cli conform``), the jobs it will write named ahead (``conform.job_name``). {errors, script, jobs, label}.""" from nullius.standard.proofs import conform - o = definitions.get(kind, key) if kind in ("agent", "capability") else None + o = definitions.get(kind, key) if kind in ("agent", "module") else None errors = [] if o is None: return {"errors": [f"no {definitions.said(kind)} {key!r}"], "script": "", "jobs": [], "label": key} diff --git a/app/nullius/standard/proofs/conform.py b/app/nullius/standard/proofs/conform.py index d62317331..1f639303d 100644 --- a/app/nullius/standard/proofs/conform.py +++ b/app/nullius/standard/proofs/conform.py @@ -1,4 +1,4 @@ -"""Conformance: run a port's kit against an agent or a capability, and write down +"""Conformance: run a port's kit against an agent or a Module, and write down what passed. A port is offered only once its kit has passed (``definitions.problems`` @@ -44,7 +44,7 @@ def candidates(other: dict) -> List[str]: can only ever offer the ports its form allows.""" fam = other["_kind"] out = [p for p, s in ports.PORTS.items() if ports.family(p) == fam and s["kit"]] - if fam == "capability": + if fam == "module": out = [p for p in out if p.split(".", 1)[1].split("/")[0] == other.get("kind")] if fam == "agent" and "command" in (other.get("start") or {}): out = [p for p in out if p in ("agent.task/v1", "agent.workspace/v1", "agent.search/v1")] diff --git a/app/nullius/standard/proofs/prove.py b/app/nullius/standard/proofs/prove.py index dd3e46634..f85be4cdb 100644 --- a/app/nullius/standard/proofs/prove.py +++ b/app/nullius/standard/proofs/prove.py @@ -16,7 +16,7 @@ - ``leak``: after ``setup``, the reference is not already there to read. For each unit the driver sets a workspace up, the oracle is run on a copy of it, and what the oracle gives - its answer, and the lines it writes into - files - is looked for in the prompt (a capability benchmark's: its recall + files - is looked for in the prompt (a Module benchmark's: its recall questions, since the sessions it adds are meant to hold the evidence) and in every file setup wrote. A text shorter than ``SHORT`` characters (a number, a name) is not looked for - it would be found by chance - and the @@ -183,10 +183,10 @@ def leak_check(driver: _Driver, units: List[str], family: str, in_prompt: str = continue after = _files(b) asked = {str(q.get("id")): q.get("question", "") for q in (s.get("memory") or {}).get("recall") or []} - shown = _flat(" ".join(asked.values()) if family == "capability" else s.get("prompt") or "") + shown = _flat(" ".join(asked.values()) if family == "module" else s.get("prompt") or "") files = _flat("\n".join(x.decode("utf-8", "replace") for x in before.values())) needles = [] - each = _each(o.get("answer"), asked) if family == "capability" else None + each = _each(o.get("answer"), asked) if family == "module" else None if each: needles += [(f"{q}'s answer", a, _flat(asked[q]), q) for q, a in each.items() if a.strip()] elif str(o.get("answer") or "").strip(): diff --git a/app/nullius/standard/protocols/jsonl.py b/app/nullius/standard/protocols/jsonl.py index b710e9440..c5fa3c17f 100644 --- a/app/nullius/standard/protocols/jsonl.py +++ b/app/nullius/standard/protocols/jsonl.py @@ -1,6 +1,6 @@ """A program spoken to in JSON lines: one request, one reply. -The benchmark's driver and a capability are both this: a process started from +The benchmark's driver and a Module are both this: a process started from its definition's command, a request written as one JSON line on its stdin (``{"op": ..., ...}``), one JSON line back on its stdout. A reply carrying ``error`` is raised as :class:`Failed`; anything that is not one JSON object @@ -117,7 +117,7 @@ def close(self): def serve(handlers: dict, out=None) -> None: - """The other side, for a driver or a capability written in Python: read + """The other side, for a driver or a Module written in Python: read requests from stdin, answer each with ``handlers[op](**request)``. An exception becomes ``{"error": ...}`` and the loop goes on. diff --git a/app/nullius/standard/requirements/hostreq.py b/app/nullius/standard/requirements/hostreq.py index 6611ddf1b..d2d3e63fb 100644 --- a/app/nullius/standard/requirements/hostreq.py +++ b/app/nullius/standard/requirements/hostreq.py @@ -1,6 +1,6 @@ """A benchmark's host requirements (``host`` in its ``standard.json``): what the machine its driver runs on must have for some of its options - programs on -PATH, installed by ``apt`` and ``npm``. Drivers for agent/capability runs stay +PATH, installed by ``apt`` and ``npm``. Drivers for agent/Module runs stay on the machine; Docker Original setups install those with an ``install`` in their image and are refused the rest (a GPU). diff --git a/app/nullius/standard/requirements/install.py b/app/nullius/standard/requirements/install.py index bada1c6a1..a048caf52 100644 --- a/app/nullius/standard/requirements/install.py +++ b/app/nullius/standard/requirements/install.py @@ -2,7 +2,7 @@ Everything goes under ``STANDARD_DIR`` (``standard/`` in the persistent user data directory): -- ``agents///`` and ``capabilities///``: the packages a +- ``agents///`` and ``capabilities///`` (a Module's): the packages a definition's ``install`` names (``npm`` into ``node_modules``, ``pip`` and ``wheels`` - a wheel by its URL, checked by its sha256 - into a ``uv`` environment, then its ``commands``, the upstream's own install steps), the digest taken over that list so a re-pin installs @@ -18,7 +18,7 @@ - ``datasets//``: a dataset or auxiliary file served outside its upstream, under ``STANDARD_DATA_DIR`` instead when that is set. -On the container backend an agent's or a capability's packages are installed in +On the container backend an agent's or a Module's packages are installed in the base image (``container.install_argv``), and the base image's tag is part of their folder's digest. A driver's packages, and all packages on the local backend, are installed with this machine's ``npm`` and ``uv``. Git always runs @@ -110,7 +110,7 @@ def _digest(obj) -> str: def packages(d: dict, home: str = HOME, run_in: Optional[Callable[..., List[str]]] = None, src: Optional[str] = None, image: Optional[str] = None) -> str: - """The folder an agent's or a capability's packages are installed in, + """The folder an agent's or a Module's packages are installed in, installing them first when they are not. A definition installing nothing gets an empty folder all the same, so ``{install}`` always names one. @@ -140,7 +140,7 @@ def packages(d: dict, home: str = HOME, run_in: Optional[Callable[..., List[str] def packages_dir(d: dict, home: str = HOME, image: Optional[str] = None) -> str: """Where ``packages`` installs a definition's packages, installed or not.""" inst = d.get("install") or {} - kind = {"agent": "agents", "driver": "drivers"}.get(d.get("_kind"), "capabilities") + kind = {"agent": "agents", "driver": "drivers"}.get(d.get("_kind"), "capabilities") # a Module's earlier name: installs made under it stay in use up = (d.get("upstream") or {}) if inst.get("project") else {} key = dict(inst, _at=up.get("tested")) if up else inst return os.path.join(home, kind, d["key"], _digest(dict(key, _image=image) if image else key)) diff --git a/app/nullius/standard/runner/job.py b/app/nullius/standard/runner/job.py index 944e39015..c9abff8c4 100644 --- a/app/nullius/standard/runner/job.py +++ b/app/nullius/standard/runner/job.py @@ -1,7 +1,7 @@ """A run written as a job in Harbor's shape, so every page reads it unchanged. ``//``: ``config.json`` (what was run: the benchmark, the agent or -capability, the model), ``result.json`` (the counts), and one folder per unit - +Module, the model), ``result.json`` (the counts), and one folder per unit - a trial - holding: - ``result.json``: the unit, the agent, the timings, the verdict @@ -9,7 +9,7 @@ the cost the relay recorded; - ``agent/trajectory.json``: ATIF, built from what Nullius saw - the session's events over ACP (the prompt, the agent's messages and thoughts, each tool - call with its result) or, for a capability, each request it was sent and its + call with its result) or, for a Module, each request it was sent and its reply - with the model calls' tokens and cost from the relay; - ``agent/trace.json``: the same run as a timeline, ``harbor-trace-v1``: each model call as the relay timed it, each tool call as Nullius saw it start and @@ -151,11 +151,11 @@ def add(source, t, **kw): "total_cached_tokens": tot["cached"], "total_cost_usd": tot["cost"], "total_steps": len(steps)}} -REPLY_CHARS = 100_000 # a capability's reply in its trajectory: its memory and its trace, one request's +REPLY_CHARS = 100_000 # a Module's reply in its trajectory: its memory and its trace, one request's -def trajectory_from_exchanges(exchanges: List[dict], calls: List[dict], capability: dict, model: str, session: str) -> dict: - """ATIF for a capability: each request Nullius sent it (``add``, ``recall``) +def trajectory_from_exchanges(exchanges: List[dict], calls: List[dict], module: dict, model: str, session: str) -> dict: + """ATIF for a Module: each request Nullius sent it (``add``, ``recall``) as a tool call and its reply as the observation, whole up to ``REPLY_CHARS`` (a reply's ``trace`` is what the library did); then the benchmark's own model calls, from the relay, as the reader's steps.""" @@ -163,7 +163,7 @@ def trajectory_from_exchanges(exchanges: List[dict], calls: List[dict], capabili for i, x in enumerate(exchanges): cid = f"{x['op']}-{i + 1}" steps.append({"step_id": len(steps) + 1, "timestamp": iso(x.get("t0")), "source": "agent", - "message": "", "tool_calls": [{"tool_call_id": cid, "function_name": f"{capability['key']}.{x['op']}", + "message": "", "tool_calls": [{"tool_call_id": cid, "function_name": f"{module['key']}.{x['op']}", "arguments": x.get("request") or {}}], "extra": {"ended_at": iso(x.get("t1"))}, "observation": {"results": [{"source_call_id": cid, "content": json.dumps(x.get("reply"))[:REPLY_CHARS]}]}}) @@ -184,7 +184,7 @@ def trajectory_from_exchanges(exchanges: List[dict], calls: List[dict], capabili steps.append(st) tot = _usage_total(calls) return {"schema_version": "ATIF-v1.6", "session_id": session, - "agent": {"name": capability.get("key"), "version": "", "model_name": model}, + "agent": {"name": module.get("key"), "version": "", "model_name": model}, "steps": steps, "final_metrics": {"total_prompt_tokens": tot["input"], "total_completion_tokens": tot["output"], "total_cached_tokens": tot["cached"], "total_cost_usd": tot["cost"], "total_steps": len(steps)}} @@ -326,7 +326,7 @@ def _step_spans(n: int, st: dict, source: str) -> List[dict]: def trace_from_run(trajectory: dict, calls: List[dict], other: dict, produce: tuple) -> Optional[dict]: """``agent/trace.json``: the agent's window as one session, its turns in it - (an agent's only: a capability's and a setup's user steps are the benchmark's + (an agent's only: a Module's and a setup's user steps are the benchmark's own model calls), each holding the model calls and tool calls that began in it. Nothing recorded, no trace: a control has none to show.""" agent = other.get("_kind") == "agent" @@ -526,7 +526,7 @@ def write_trial(trial_dir: str, *, job: str, bench: dict, other: dict, model: st "verifier": {"started_at": iso(checking[0]), "finished_at": iso(checking[1])} if checking and checking[0] and checking[1] else None, "agent_result": {"n_input_tokens": tot["input"], "n_output_tokens": tot["output"], "n_cache_tokens": tot["cached"], "cost_usd": tot["cost"], "cost_from": tot["cost_from"], "n_model_calls": tot["n_calls"]}, - "standard": {"benchmark": bench["key"], "family": bench["family"], "needs": bench["needs"], "unit": unit, + "standard": {"benchmark": bench["key"], "family": definitions.names.wire(bench["family"]), "needs": bench["needs"], "unit": unit, "plugged": other.get("_ref") or other["key"], "job": job, **_version(bench), **_control(other), **_setup(other), **({"environment": environment} if environment else {}), **({"image": image} if image else {}), **({"served": who} if (who := served(calls if served_calls is None else served_calls, serving)) else {}), @@ -581,7 +581,7 @@ def write_trial(trial_dir: str, *, job: str, bench: dict, other: dict, model: st def job_uuid(job_dir: str, *, benchmark: str, plugged: str, model: str, dataset: str) -> Optional[str]: """The identity a job already in ``job_dir`` keeps when the run is the same job: its - ``config.json`` names the same benchmark, plugged agent or capability, model and dataset. + ``config.json`` names the same benchmark, plugged agent or Module, model and dataset. The uid it is read under (``nullius.runs.uid``): its declared ``standard.uuid`` when that is a UUID, else the derived one, so what was recorded against it still finds it. None otherwise: another job under the same name is a job of its own.""" @@ -649,7 +649,7 @@ def write_config(job_dir: str, *, job: str, bench: dict, other: dict, model: str uid = job_uuid(job_dir, benchmark=bench["key"], plugged=other.get("_ref") or other["key"], model=model, dataset=f"{bench['key']}/{dataset}") or str(uuid.uuid4()) ondisk.write_whole(os.path.join(job_dir, "config.json"), json.dumps({"job_name": job, "runner": "standard", "runner_label": "Nullius", - "standard": {"uuid": uid, "benchmark": bench["key"], **_version(bench), "plugged": other.get("_ref") or other["key"], "kind": other["_kind"], "provider": provider, + "standard": {"uuid": uid, "benchmark": bench["key"], **_version(bench), "plugged": other.get("_ref") or other["key"], "kind": definitions.names.wire(other["_kind"]), "provider": provider, "needs": bench["needs"], "permissions_granted": granted, "unsandboxed": granted and backend == "local", "backend": backend, **({"image": image} if image else {}), **({"boat_size": boat_size} if boat_size else {}), diff --git a/app/nullius/standard/runner/merge.py b/app/nullius/standard/runner/merge.py index 04c10fd7d..1d6732197 100644 --- a/app/nullius/standard/runner/merge.py +++ b/app/nullius/standard/runner/merge.py @@ -9,7 +9,7 @@ the shards' with ``shard`` taken out and ``merged_from`` put in. What is merged must be one launch: the same launch id, benchmark and -version, dataset, agent or capability and model, the same serving providers +version, dataset, agent or Module and model, the same serving providers pinned for each model (``served_by``), the same reasoning (``reasoning``) and the same number of shards - else it is refused, naming what differs, unless ``force``. Two trials of one unit are always refused, with the units named: one of them would be diff --git a/app/nullius/standard/runner/payload.py b/app/nullius/standard/runner/payload.py index dd1b6ecc2..a084d5683 100644 --- a/app/nullius/standard/runner/payload.py +++ b/app/nullius/standard/runner/payload.py @@ -19,13 +19,14 @@ from pathlib import Path from nullius import paths +from nullius.catalogue import storage from nullius.standard.contract import definitions from nullius.standard.runner import sets as task_sets PACKAGE = Path(__file__).resolve().parents[2] FORMAT = 1 _KINDS = {"benchmarks": ("benchmark.json", "standard.json"), - "agents": ("agent.json",), "capabilities": ("capability.json",)} + "agents": ("agent.json",), "modules": ("capability.json",)} _DOCUMENTS = {"feature.json", "benchmark.json", "standard.json", "agent.json", "capability.json", "proofs.json", "upstream-settings.json", "images.json", "data-source.json"} _PRIVATE = {"credentials", "credentials.json", "secret", "secret.json", "secrets", "secrets.json", "settings.json", @@ -225,7 +226,7 @@ def build(cache: str, *, package: Path | None = None, catalogue: str | None = No files = {} for relative in _python(package): pieces = Path(relative).parts - if ((len(pieces) > 2 and pieces[0] == "catalogue" and pieces[1] in _KINDS) + if ((len(pieces) > 2 and pieces[0] == "catalogue" and pieces[1] in (*_KINDS, *storage.LEGACY)) or pieces[:2] == ("standard", "kits")): continue files[relative] = _read(package, relative) @@ -238,7 +239,7 @@ def build(cache: str, *, package: Path | None = None, catalogue: str | None = No for kind in _KINDS: entries = {} for catalogue_root in (bundled, user): - for directory in (("features", "capabilities") if kind == "capabilities" else (kind,)): + for directory in (storage.LEGACY if kind == "modules" else (kind,)): base = catalogue_root / directory if base.is_symlink(): raise ValueError("catalogue folders cannot be symlinks") diff --git a/app/nullius/standard/runner/run.py b/app/nullius/standard/runner/run.py index 81b2f4a96..5ef3fcb3a 100644 --- a/app/nullius/standard/runner/run.py +++ b/app/nullius/standard/runner/run.py @@ -1,11 +1,11 @@ -"""A run: a benchmark, an agent or a capability, a model - units, then a job. +"""A run: a benchmark, an agent or a Module, a model - units, then a job. The plan is units × stages. The driver names the units (``units``); each is set up (``setup``: its workspace filled, its prompt and environment returned), produced - the agent driven over ACP in that workspace, or the -capability driven through its port - and scored (``score``). Units run +Module driven through its port - and scored (``score``). Units run ``concurrency`` at a time, each with a driver process per worker, an agent or -capability process of its own, a home of its own, and a relay of its own. +Module process of its own, a home of its own, and a relay of its own. A relay per unit, not one for the run: a shared relay is one more thing whose failure stops every unit, and a network hop for a unit sandboxed elsewhere. @@ -16,12 +16,12 @@ Backends (``backend``). ``local``: processes on this machine, which are not a sandbox - what an agent runs, it runs as the user (``docs/standard.md``, -"Safety"). ``docker``: the agent or the capability in a container of its own on +"Safety"). ``docker``: the agent or the Module in a container of its own on an internal network with the unit's relay beside it (``container``); an own-image task may grant a public-address proxy with ``internet: true``, and an agent whose environment declares ``network`` gets a public web proxy. -On docker the agent's or capability's packages are installed in the base image, on the libc and tools its container runs on. -A third, ``boat``: the agent's or capability's process alone in a Boat VM of +On docker the agent's or Module's packages are installed in the base image, on the libc and tools its container runs on. +A third, ``boat``: the agent's or Module's process alone in a Boat VM of its own, its relay still here, reached through the VM's tunnel (``boat.Backend``); a check or a setup on it runs on local processes. The driver, its environment installed here, stays on this machine either @@ -142,13 +142,13 @@ def computer_port(bench: dict) -> bool: def setup_request(bench: dict, kind: str, attempt: Optional[int] = None) -> tuple: """What a unit's ``setup`` is sent besides the unit and its folder, and how long it may take, for a unit that - ``kind`` runs (agent, capability, control): ``attempt`` when the benchmark tells attempts apart + ``kind`` runs (agent, Module, control): ``attempt`` when the benchmark tells attempts apart (``limits.attempts``), ``participant`` when its driver asks (``driver.participant``); the benchmark's ``limits.setup_seconds``, else ``DRIVER_SECONDS``, whoever runs the unit: a control's setup stages what an agent's does.""" limits, drv = bench.get("limits") or {}, bench.get("driver") or {} sent = {"attempt": attempt} if attempt and limits.get("attempts") else {} if drv.get("participant"): - sent["participant"] = kind + sent["participant"] = definitions.names.wire(kind) return sent, limits.get("setup_seconds") or DRIVER_SECONDS @@ -217,7 +217,7 @@ def forced_timeouts(given: Optional[dict]) -> Dict[str, float]: def key_header(provider: str, other: dict, env=os.environ) -> str: - """How the agent's relay sends the key: by the protocol the agent (or capability) speaks on this + """How the agent's relay sends the key: by the protocol the agent (or Module) speaks on this provider. Refused on a provider that serves none of them.""" apis = (other.get("model") or {}).get("apis") or ["chat"] if provider not in providers.offered(apis, env): @@ -348,7 +348,7 @@ def _render(template: str, slots: Dict[str, str]) -> str: def agent_env(agent: dict, inst: str, home: str, base_url: str, model: str, options: Optional[dict] = None) -> dict: - """The environment of an agent - or of a capability that calls a model - and + """The environment of an agent - or of a Module that calls a model - and its config files written into its home, from its definition's ``model`` templates; then its own ``env`` (``install.process_env``). ``options``: the run's value of each option (``definitions.options_of``), the slots @@ -753,7 +753,7 @@ def __init__(self, bench: dict, other: dict, *, model: str, provider: str, datas ``boat_size``: its VMs' machine type (``boat.SIZES``), refused when the account cannot start it. ``options``: the - agent's or capability's options set for this run, by name; the rest keep + agent's or Module's options set for this run, by name; the rest keep their defaults, and the job's config records every value. ``shard``: (I, N), only the units of shard I of N (``shard``), before ``limit``, ``shard_by`` its units' id (by hash) or place (``shard.BY``); ``launch``: the id every @@ -826,7 +826,7 @@ def __init__(self, bench: dict, other: dict, *, model: str, provider: str, datas backend = definitions.names.backend(backend) if backend not in BACKENDS: raise Refused(f"backend {backend!r} is not one of {list(BACKENDS)}") - if backend == "boat" and other.get("_kind") not in ("agent", "capability"): + if backend == "boat" and other.get("_kind") not in ("agent", "module"): # a setup or a check runs on the machine; on Boat it would run here unasked, beside the VMs raise Refused(f"{other['label']} runs on a machine, not in a Boat VM: run it on this machine or a host " "(--backend local or container)") @@ -1042,8 +1042,8 @@ def __init__(self, bench: dict, other: dict, *, model: str, provider: str, datas self.forced_turns = max_turns if max_calls is not None and (isinstance(max_calls, bool) or not isinstance(max_calls, int) or not 1 <= max_calls <= 1000000): raise Refused(f"--max-calls {max_calls!r}: a whole number of model calls, at least 1") - if max_calls is not None and other.get("_kind") == "capability": - # a capability's route carries the benchmark's reader too (produce): the cap would charge its calls to the capability + if max_calls is not None and other.get("_kind") == "module": + # a Module's route carries the benchmark's reader too (produce): the cap would charge its calls to the Module raise Refused("--max-calls caps an agent's model calls: a Module's unit route carries the benchmark's reader too") self.max_calls = max_calls if exchanges not in exchange_store.MODES: @@ -1505,7 +1505,7 @@ def ready(self) -> None: """What the run needs before its first unit, each a stage said as it goes - or as there already: the base image (docker), the benchmark's upstream, its dataset when it is downloaded, its driver's environment - when it declares one (``driver.install``), the agent's or capability's + when it declares one (``driver.install``), the agent's or Module's packages. Refused when one cannot be had.""" from ..requirements import network_requirements p = self.progress @@ -1672,7 +1672,7 @@ def watch(self, name: str, unit: str, trial: str, setup: dict, rl, tag: str) -> def over_acp(self) -> bool: """Whether the unit's other is an agent driven over ACP: the one kind with a setup of its own, its start and its session. A command agent starts and runs in one call, an upstream setup and a - control are the driver's, and a capability's process answers nothing until its first request.""" + control are the driver's, and a Module's process answers nothing until its first request.""" return self.other["_kind"] == "agent" and "command" not in self.other["start"] def unit(self, i: int, unit: str, r: int = 1, retry: int = 0) -> Optional[dict]: @@ -2152,7 +2152,7 @@ def unit_relay(self, tag: str, trial: str, setup: dict, env_def: Optional[dict] """The unit's own relay, started: in this process on the local backend, else a sidecar container. Either answers ``url`` (the driver's way in, on this machine), ``calls`` and ``stop``; - ``unit_url`` is the address the agent or capability is given. ``own``: + ``unit_url`` is the address the agent or Module is given. ``own``: the unit runs in its own image (:meth:`own_box`), not one of the benchmark's layers on the base.""" if not self.base: @@ -2329,7 +2329,7 @@ def control_answer(self, unit, ws, box=None, name: str = "") -> str: wrote into the workspace, or, in an own image (``box``), the step its reply names (``solve``: the reference solution copied in and run in the unit's container). Either goes to ``score`` as an agent's answer - would; a capability benchmark's skips ``produce``.""" + would; a Module benchmark's skips ``produce``.""" if self.other["key"] != "oracle": return "" try: @@ -2355,8 +2355,8 @@ def control_answer(self, unit, ws, box=None, name: str = "") -> str: # -- an own image: the unit's container ------------------------------------ @contextmanager def unit_vm(self, ws: str, home: str, trial: str, setup: dict): - """On the boat backend, the unit's VM while its agent or capability runs (``boat.Backend.unit``), - living as long as its work may take: an agent's limit is its whole unit's, a capability's each add's and recall's.""" + """On the boat backend, the unit's VM while its agent or Module runs (``boat.Backend.unit``), + living as long as its work may take: an agent's limit is its whole unit's, a Module's each add's and recall's.""" if getattr(self, "boat", None) is None: yield return @@ -2804,7 +2804,7 @@ def _command_agent(self, a, env, ws, home, setup, transcript, log, tag, unit, rl {"t": time.time(), "update": {"sessionUpdate": "agent_message_chunk", "content": {"type": "text", "text": r.stdout}}}] return r.stdout.strip(), job.trajectory_from_events(events, rl.calls(tag), a, self.model, f"{self.name}/{unit}"), {} - # -- a capability, through its port ------------------------------------------- + # -- a Module, through its port ------------------------------------------- def drive_feature(self, unit, ws, home, tag, setup, transcript, rl): f = self.other cmd = install.words(f["start"]["command"], {"here": f["_here"], "install": self.inst}) @@ -2847,7 +2847,7 @@ def send(op, **kw): except jsonl.Failed as e: raise _Ended("VerifierError", "the benchmark's reader: " + str(e), job.trajectory_from_exchanges(exchanges, rl.calls(tag), f, self.model, f"{self.name}/{unit}"), retryable=not isinstance(e, jsonl.NoReply)) - transcript.append({"role": "capability", "recalled": recalled}) + transcript.append({"role": "capability", "recalled": recalled}) # the word a driver's score reads return out.get("answer"), job.trajectory_from_exchanges(exchanges, rl.calls(tag), f, self.model, f"{self.name}/{unit}") diff --git a/app/nullius/standard/runner/shard.py b/app/nullius/standard/runner/shard.py index c09993fdd..3b676ca22 100644 --- a/app/nullius/standard/runner/shard.py +++ b/app/nullius/standard/runner/shard.py @@ -24,7 +24,7 @@ the dataset's units gives each shard exactly one. Every shard of one launch records the same ``launch`` id: ``--launch``, or by -default the day (UTC), the benchmark, the agent or capability and the model, so +default the day (UTC), the benchmark, the agent or Module and the model, so shards started separately still say they belong together. Two launches of the same pair on the same day need ``--launch`` to stay apart. diff --git a/app/static/builder/command-builder-core.js b/app/static/builder/command-builder-core.js index fd072ce5d..93540ac3d 100644 --- a/app/static/builder/command-builder-core.js +++ b/app/static/builder/command-builder-core.js @@ -27,7 +27,7 @@ const RUNNER_GONE = schema.runnerGone || 'Only Harbor and Nullius recipes are supported.'; // The standard's choices and why a pair does not fit come with the schema; the server compiles the recipe. const isStandard = r => !!(r && r.harness === 'standard'); - const standard = () => schema.standard || {benchmarks: [], agents: [], capabilities: [], fits: {}, ports: {}}; + const standard = () => schema.standard || {benchmarks: [], agents: [], modules: [], fits: {}, ports: {}}; // A recipe names a benchmark by its key (its default version) or key@version, one of the page's versions. // The entry is the default version's; another version's own page (its upstream, datasets, proofs, setups) is what a // recipe naming it reads. standardBase is the entry itself, with the list of versions. @@ -38,7 +38,7 @@ const v = b && (b.versions || []).find(x => x.ref === r.benchmark && !x.default && x.page); return v ? v.page : b; }; - // Every agent (or capability) a benchmark of the standard could take, each with the reasons it does not fit: none, it fits. + // Every agent (or Module) a benchmark of the standard could take, each with the reasons it does not fit: none, it fits. // Then the controls it declares (nop, oracle): no agent, no model, always runnable - each with its source // (official, adapter, nullius) and, per dataset, its proof. // A benchmark's own agents (recipe.py, _other_page: its `benchmark`), each run by its driver as its Original setup. @@ -49,18 +49,18 @@ const why = standard().fits[r.benchmark] || standard().fits[b.key] || {}; const controls = (b.controls || []).map(c => ({key: c.key, label: c.label, summary: c.from, protocol: 'no agent', source: c.source, version: '', offers: [], proven: {}, options: {}, control: true, why: []})); - // its setups (recipe.py, _bench_page): the benchmark as published, run by its own code - beside the agents or capabilities; + // its setups (recipe.py, _bench_page): the benchmark as published, run by its own code - beside the agents or Modules; // a benchmark with agents of its own runs them in its Original setup instead, first among the agents const own = ownAgentsOf(b).map(o => ({...o, why: why[o.key] || [], setup: true, own: true})); const setups = own.length ? [] : (b.setups || []).map(x => ({...x, protocol: 'its own code', version: '', offers: [], proven: {}, options: {}, setup: true, why: []})); - const rest = b.family === 'agent' ? standard().agents.filter(o => o.benchmark !== b.key) : standard().capabilities; + const rest = b.family === 'agent' ? standard().agents.filter(o => o.benchmark !== b.key) : standard().modules; return own.concat(rest.map(o => ({...o, why: why[o.key] || []})), setups, controls); } // the chosen ones of a benchmark's own agents, and what each choice runs as: its own agent, its Original setup const ownChosen = r => ownAgentsOf(standardBench(r)).filter(a => chosenOf(r).includes(a.key)); const runsOf = r => { const own = ownAgentsOf(standardBench(r)); return [...new Set(chosenOf(r).map(k => own.some(a => a.key === k) ? 'original' : k))]; }; // A control that calls no model at all - on a benchmark with no judge - needs no key to run. - // The agents, capabilities and controls a standard recipe runs, each its own job of the one run. + // The agents, Modules and controls a standard recipe runs, each its own job of the one run. const chosenOf = r => Array.isArray(r.others) ? r.others : (r.other ? [r.other] : []); // A participant ticked or unticked; the selected version's procedure is one of them, on by default and back when // none is left. @@ -395,7 +395,7 @@ // chat, an agent of the standard its definition's apis. A provider is offered when it may serve every part. function consumersOf(r) { if (!isStandard(r)) return [['chat']]; - const b = standardBench(r), all = standard().agents.concat(standard().capabilities); + const b = standardBench(r), all = standard().agents.concat(standard().modules); const out = chosenOf(r).filter(k => !((b && b.controls) || []).some(c => c.key === k)).map(k => (all.find(o => o.key === k) || {}).apis || ['chat']); if (judgesRun(r)) out.push(['chat']); return out.length ? out : [['chat']]; @@ -895,7 +895,7 @@ ...(lost.length ? ['Not carried: ' + lost.join('; ') + '.'] : []), ...notes]}; } function prefill(query) { - // ?standard=[&other=]: the standard's recipe for that pair (the Agents and Capabilities pages link here). + // ?standard=[&other=]: the standard's recipe for that pair (the Agents and Modules pages link here). if(query.standard) { const r = createStandard(query.standard, query.other || ''); if ((standardBench(r)?.datasets || []).some(d => d.id === query.dataset)) { diff --git a/app/static/builder/command-builder.js b/app/static/builder/command-builder.js index 01d7f628b..35936e88c 100644 --- a/app/static/builder/command-builder.js +++ b/app/static/builder/command-builder.js @@ -509,7 +509,7 @@ if (blocked) return note('Not set in Settings', esc(blocked) + ' ' + at(C.needsOf(C.choiceOf(rec)))); return ''; }; - // The Nullius standard (C.isStandard): a benchmark, then an agent or a capability among every one there is - the + // The Nullius standard (C.isStandard): a benchmark, then an agent or a Module among every one there is - the // ones that have not proved the ports it needs shown greyed, with the reasons - a model and a scope. // what a unit is: the benchmark's, or a setup's own when only setups run (a conversation, where the paper batches its questions) const unitsOf = rec => { const b = C.standardBench(rec) || {}, runs = C.runsOf(rec), own = (b.setups || []).filter(x => runs.includes(x.key)); @@ -665,7 +665,7 @@ renderForm(); } // A benchmark's own options (a search, a mode), for the chosen datasets they apply to, and what a value needs of this - // machine. Those an agent's or capability's run takes ('yours') on the Agent step, with the agents; those only a setup + // machine. Those an agent's or Module's run takes ('yours') on the Agent step, with the agents; those only a setup // takes (a retriever, a top-k of the paper's pipeline) in the procedure's tab, while it runs. // A benchmark with agents of its own: its agent option is each one's own choice, and an option whose `when` names // agents is in the tab of each of them (scope 'own', `agent` the one); else the options of `scope`. @@ -893,7 +893,7 @@ ? field('Turns per conversation', 'turns', rec.turns ?? '', {type: 'number', min: 1, placeholder: String((b.timeouts || {}).turns || ''), declared: ((b.timeouts || {}).catalogue || []).includes('turns')}) : '') // the most model calls a unit's agent may make, the whole unit through (recipe.py: run --max-calls); none calls no model - // an agent's alone: a capability's route carries the benchmark's reader too (run.py refuses it) + // an agent's alone: a Module's route carries the benchmark's reader too (run.py refuses it) + (C.standardKeyless(rec) || (b.needs || []).some(n => n.startsWith('cap.')) ? '' : field('Model calls per ' + u.noun, 'max_calls', rec.max_calls ?? '', {type: 'number', min: 1, placeholder: 'none'})) // the whole run's, shared by its jobs (recipe.py); a run that calls no model spends nothing: no cap to offer + (C.standardKeyless(rec) ? '' : field('Spending cap (USD)', 'max_usd', rec.max_usd ?? '', {type: 'number', min: 0, placeholder: 'none'}) @@ -969,7 +969,7 @@ .filter(([, o]) => (o.setups || ['yours']).some(s => s === 'yours' ? yours : chosen.includes(s))) .map(([n, o]) => { const [k, by] = Object.entries(o.by || {})[0] || []; - // an agent's or a capability's run alone gets the benchmark's value for it (``yours``), the benchmark's own agents theirs + // an agent's or a Module's run alone gets the benchmark's value for it (``yours``), the benchmark's own agents theirs const def = yours ? (!theirs && o.yours) || o.default : (k && by[of(k)]) || o.default; return ``; }); @@ -1367,7 +1367,7 @@ // Review's link to an error a field holds: to that field, not the step's heading const f=d.errorField&&$(`#nb-form [data-field="${d.errorField}"]`);if(f){f.focus({preventScroll:true});f.scrollIntoView({block:'center'});} }); - // a benchmark chosen on the Benchmark step's grid, or an agent or capability picked or let go on the + // a benchmark chosen on the Benchmark step's grid, or an agent or Module picked or let go on the // Agent step's; the page stays where it is and the focus on its card root.addEventListener('nullius-pick',event=>{const k=event.detail.value;if(event.target.closest('#nb-bench-grid')){toRunner(C.runnerFor(r(),k),k);}else{C.toggleParticipant(r(),k);}inPlace(()=>render());event.target.focus({preventScroll:true});}); root.addEventListener('input',event=>{ diff --git a/app/static/catalogue/catalogue.css b/app/static/catalogue/catalogue.css index 25c0e0ea4..b10e678d7 100644 --- a/app/static/catalogue/catalogue.css +++ b/app/static/catalogue/catalogue.css @@ -227,7 +227,7 @@ tr:has([data-pick]:not(:disabled)) { cursor: pointer; } .nb-route { margin: 0 0 18px; } .bench-new .nb-entry[hidden] { display: none; } -/* The Agents and Capabilities tabs (agents/standard.html): one card per definition of the standard. */ +/* The Agents and Modules tabs (agents/standard.html): one card per definition of the standard. */ .std-index { width: 100%; max-width: 1120px; margin: 0 auto; } .std-problems { border: 1px solid var(--bad); border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; font-size: 13px; } .std-problems strong { color: var(--bad); } @@ -309,7 +309,7 @@ dialog.std-how::backdrop { background: rgba(0, 0, 0, .45); } .std-prooftable .std-ctls { margin-top: 0; } .std-joblink { display: inline-block; font-size: 11.5px; margin: 6px 10px 0 0; } @media (max-width: 760px) { .std-prooftable th, .std-prooftable td { display: block; width: auto; } .std-prooftable td { border-top: 0; padding-top: 0; } } -/* The Add dialog on the Agents and Capabilities tabs. */ +/* The Add dialog on the Agents and Modules tabs. */ .std-how-tabs { display: flex; gap: 4px; margin: 14px 0 4px; border-bottom: 1px solid var(--border); } .std-how-tabs [role=tab] { font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text-dim); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 12px; min-height: 40px; cursor: pointer; } .std-how-tabs [role=tab][aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); } diff --git a/app/templates/_icons.svg b/app/templates/_icons.svg index 762d1492e..298ab39a2 100644 --- a/app/templates/_icons.svg +++ b/app/templates/_icons.svg @@ -21,7 +21,7 @@ - + diff --git a/app/templates/agents/entry.html b/app/templates/agents/entry.html index fb87ea9e0..db51d673a 100644 --- a/app/templates/agents/entry.html +++ b/app/templates/agents/entry.html @@ -6,17 +6,17 @@ {% block crumb %}/ {{ 'agents' if kind == 'agent' else 'Modules' }} / {{ e.d.key }}{% endblock %} {% block head %}{% endblock %} {% block body %} -{# One of the standard's agents (or capabilities): its definition, the ports it proved, what it can run. docs/standard.md #} +{# One of the standard's agents (or Modules): its definition, the ports it proved, what it can run. docs/standard.md #}
{% set d = e.d %} {% set tags %} - {% if kind == 'capability' %}{{ d.kind }}{% endif %} + {% if kind == 'module' %}{{ d.kind }}{% endif %} {{ e.protocol }} {% if kind == 'agent' %}{{ origin|capitalize }}{% endif %} {% if d.example %}example{% endif %} {% if versions %}{{ 'default version' if d._version == d._default else 'not the default version' }}{% endif %} {% endset %} - {% set actions %}{% if restore_bundle and local %}{{ use_bundle('agents' if kind == 'agent' else 'capabilities', d.key, csrf) }}{% endif %}{% endset %} + {% set actions %}{% if restore_bundle and local %}{{ use_bundle('agents' if kind == 'agent' else 'modules', d.key, csrf) }}{% endif %}{% endset %} {% set mark %}{{ agent_mark(kind, d.key, d.label) }}{% endset %} {{ page_head(d.label, sub=tags, actions=actions, mark=mark, id='std-' ~ d.key) }}
diff --git a/app/templates/agents/standard.html b/app/templates/agents/standard.html index 7132076ca..dfa62e7d7 100644 --- a/app/templates/agents/standard.html +++ b/app/templates/agents/standard.html @@ -8,7 +8,7 @@ {% endblock %} {% from '_cards.html' import cards %} {% block body %} -{# The standard's agents (or capabilities) as cards. docs/standard.md #} +{# The standard's agents (or Modules) as cards. docs/standard.md #}
{% set actions %}{% endset %} {{ page_head(plural, sub=items|length ~ ' ' ~ (many if items|length != 1 else one), actions=actions) }} diff --git a/app/templates/base.html b/app/templates/base.html index 959c17b60..2c5fdd573 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -127,7 +127,7 @@ {% endfor %}
- {% for kind, label, list_ep, entry_ep, icon in [('agent', 'Agents', 'agents_page', 'agent_page', 'agent'), ('capability', 'Modules', 'features_page', 'feature_page', 'capability')] %} + {% for kind, label, list_ep, entry_ep, icon in [('agent', 'Agents', 'agents_page', 'agent_page', 'agent'), ('module', 'Modules', 'features_page', 'feature_page', 'module')] %} {% set tree_open = ep in (list_ep, entry_ep) %}