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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .agents/skills/docs-drift/scripts/check_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
8 changes: 4 additions & 4 deletions .agents/skills/import-module/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ 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.

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/<key>/` and use the repository gates
files into `app/nullius/catalogue/modules/<key>/` and use the repository gates
below. CLI mutations protect bundled resources in source checkouts too.

## The rule: facilitator, not re-implementer
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .agents/skills/import-standard/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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/<group>/KEY/`: author and prove in a writable user or
scratch catalogue, then copy only the intended entry files into the checkout.
Expand Down Expand Up @@ -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` |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`;
Expand Down
3 changes: 2 additions & 1 deletion .agents/skills/remove-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/` |
Expand Down
16 changes: 12 additions & 4 deletions app/nullius/catalogue/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions app/nullius/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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():
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion app/nullius/recipes/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
6 changes: 3 additions & 3 deletions app/nullius/standard/__init__.py
Original file line number Diff line number Diff line change
@@ -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``),
Expand Down
6 changes: 3 additions & 3 deletions app/nullius/standard/backends/boat.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions app/nullius/standard/backends/container.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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`).
Expand Down Expand Up @@ -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`."""
Expand Down
2 changes: 1 addition & 1 deletion app/nullius/standard/calls/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
4 changes: 2 additions & 2 deletions app/nullius/standard/calls/relay.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Loading
Loading