From c2e3b178d25d202c67dae05ee9da37e691f64b4f Mon Sep 17 00:00:00 2001
From: Harenome Ranaivoarivony-Razanajato
Date: Thu, 19 Nov 2026 14:53:54 +0100
Subject: [PATCH 1/5] feat(catalogue): sort the catalogue pages' cards
Benchmarks, Agents, Capabilities and Kits get the Sort by menu of the card toolkit: by name and by their counts (tasks and datasets, ports proven and benchmarks it runs, checks). A card collection's sort can name the fields it offers; Benchmarks sorts within each shelf.
---
app/templates/_cards.html | 4 ++--
app/templates/_tables.html | 5 +++--
app/templates/agents/kits.html | 4 ++--
app/templates/agents/standard.html | 6 +++---
app/templates/catalogue/benchmarks.html | 9 +++++----
app/ui_tests/test_agents.py | 9 +++++++++
app/ui_tests/test_catalogue_routes.py | 9 ++++++++-
app/web/catalogue.py | 2 +-
8 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/app/templates/_cards.html b/app/templates/_cards.html
index ec616128..72ac2e85 100644
--- a/app/templates/_cards.html
+++ b/app/templates/_cards.html
@@ -25,7 +25,7 @@
{# A collection of cards (NulliusTable.cards): its controls row, its cards, the note when none passes. `id` names it;
`search`, `choices`, `only`, `layout` and each field's `filter` as the table's controls; `sort` the Sort by menu, over
- the fields that are not blank; `noun` what the live region counts.
+ the fields that are not blank, or a list of their keys; `noun` what the live region counts.
The call block, when given, writes the cards instead (grid for each group, such as the Benchmarks' shelves); a
section in it marked data-group hides when none of its cards shows, and its data-group-n counts them. #}
{% macro cards(id, cols, items, search='', choices={}, only={}, empty='No items match.', noun='items', sort=false, layout=none) %}
@@ -49,7 +49,7 @@
{%- for item in items %}
+ {%- for f in fields if sort and not f.blank and (sort is sameas true or f.key in sort) %} data-s-{{ f.key }}="{% call(f, v) each(item, [f]) %}{{ v.get('value', v.text) }}{% endcall %}"{% endfor %}>
{%- set title = by.title[0] %}{% set v = item.get(title.key) %}{% set v = v if v is mapping else {'text': v} %}{% set name = v.text %}
{%- set cls = [title.class, v.class]|select|join(' ') %}
{% if icons %}{% set src = item.get(icon.key) %}
diff --git a/app/templates/_tables.html b/app/templates/_tables.html
index 7fbea968..78a86fc5 100644
--- a/app/templates/_tables.html
+++ b/app/templates/_tables.html
@@ -67,7 +67,8 @@
{# A table's controls row (static/tables.js `toolbar`) over the columns `cols`; each feature on only
when asked. `search`: the search box's name and placeholder, over each row's data-search text; `columns`: the
Columns menu; `choices`: column -> its (value, label) pairs to filter by; `only`: column -> the one value chosen
- at load; then the Sort by menu, unless `sort` is false. `views` and `actions`: macros writing a page's own
+ at load; then the Sort by menu, unless `sort` is false; a list of keys
+ offers those columns only. `views` and `actions`: macros writing a page's own
buttons, each any number of them, run by the page: views (how the table looks) before Columns, actions (on the
rows or the selection) after Sort by. `layout` 'table' or 'cards', the one shown: a toggle of links to the
page's other one (?view=cards), its other query kept, at the end. The search goes left, the buttons right. A column's
@@ -100,7 +101,7 @@
Column
Default
- {% for c in cols if not (c.blank or c.check) %} {{ c.label }} {% endfor %}
+ {% for c in cols if not (c.blank or c.check) and (sort is sameas true or c.key in sort) %} {{ c.label }} {% endfor %}
Order
diff --git a/app/templates/agents/kits.html b/app/templates/agents/kits.html
index 1ec9413a..5a04f954 100644
--- a/app/templates/agents/kits.html
+++ b/app/templates/agents/kits.html
@@ -44,8 +44,8 @@ Checks
{#- A card's fields (web/agents.py `_kit_card`); the family's pills filter them. #}
{% set cols = [dict(key='family', label='Family', card='tag', class='std-tag', filter='pills'), dict(key='version', label='Version', card='meta'),
dict(key='title', label='Name', card='title'), dict(key='port', label='Port', card='text', style='code'),
- dict(key='checks', label='Checks', card='stat')] %}
- {{ cards('kits', cols, items, search='Name, port, check', choices={'family': [('agent', 'Agents'), ('capability', 'Capabilities')]}, empty='No kits match.', noun='kits') }}
+ dict(key='checks', label='Checks', card='stat', type='num')] %}
+ {{ cards('kits', cols, items, search='Name, port, check', choices={'family': [('agent', 'Agents'), ('capability', 'Capabilities')]}, sort=['title', 'port', 'checks'], empty='No kits match.', noun='kits') }}
{% endif %}
{% endblock %}
diff --git a/app/templates/agents/standard.html b/app/templates/agents/standard.html
index 42c5b91e..8e9503b8 100644
--- a/app/templates/agents/standard.html
+++ b/app/templates/agents/standard.html
@@ -38,9 +38,9 @@
{% set cols = [dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag'),
dict(key='example', label='Example', card='tag', class='std-tag'), dict(key='version', label='Version', card='meta'),
dict(key='icon', label='Logo', card='icon', table=false, class='std-mark small'), dict(key='title', label='Name', card='title'),
- dict(key='summary', label='Summary', card='text', class='std-clamp'), dict(key='ports', label='Ports proven', card='stat'),
- dict(key='runs', label='Benchmarks it runs', card='stat'), dict(key='installs', label='Installs', card='stat', class='word')] %}
- {% if items %}{{ cards(plural|lower, cols, items, search='Name, protocol, summary', empty='No ' ~ kind ~ ' matches.', noun=plural|lower) }}{% endif %}
+ dict(key='summary', label='Summary', card='text', class='std-clamp'), dict(key='ports', label='Ports proven', card='stat', type='num'),
+ dict(key='runs', label='Benchmarks it runs', card='stat', type='num'), dict(key='installs', label='Installs', card='stat', class='word')] %}
+ {% if items %}{{ cards(plural|lower, cols, items, search='Name, protocol, summary', sort=['title', 'ports', 'runs'], empty='No ' ~ kind ~ ' matches.', noun=plural|lower) }}{% endif %}
{% endblock %}
{% block scripts %}{% endblock %}
diff --git a/app/templates/catalogue/benchmarks.html b/app/templates/catalogue/benchmarks.html
index b5f7085f..6b33145d 100644
--- a/app/templates/catalogue/benchmarks.html
+++ b/app/templates/catalogue/benchmarks.html
@@ -31,17 +31,18 @@
{% set cols = [dict(key='category', label='Category', card='tag', class='cat-tag', filter='pills'), dict(key='origin', label='Origin', card='tag', class='origin-tag', filter='dropdown', filter_icon='origin'),
dict(key='icon', label='Mark', card='icon', table=false, class='bench-mark'), dict(key='title', label='Name', card='title'),
dict(key='domain', label='Domain', card='text'), dict(key='runs', label='Runs with', card='badge', class='run-tag', filter='dropdown', filter_icon='runner'),
- dict(key='needs', label='Needs', card='note', icon='wrench'), dict(key='tasks', label='Tasks', card='stat'),
- dict(key='datasets', label='Datasets', card='stat'), dict(key='scoring', label='Scored by', card='stat', class='word'),
+ dict(key='needs', label='Needs', card='note', icon='wrench'), dict(key='tasks', label='Tasks', card='stat', type='num'),
+ dict(key='datasets', label='Datasets', card='stat', type='num'), dict(key='scoring', label='Scored by', card='stat', class='word'),
dict(key='blocker', label='Blocker', card='alert')] %}
{#- Two shelves: the official benchmarks, then the community benchmarks. A card opens the benchmark's own page. #}
- {% call cards('benchmarks', cols, items, search='Name, category, dataset', choices=choices, empty='No benchmark matches.', noun='benchmarks') %}
+ {% set sort = ['title', 'tasks', 'datasets'] %}
+ {% call cards('benchmarks', cols, items, search='Name, category, dataset', choices=choices, sort=sort, empty='No benchmark matches.', noun='benchmarks') %}
{% for state, heading in [('official', 'Official'), ('community', 'Community')] %}
{% set shelf = items|selectattr('shelf', 'equalto', state)|list %}
{% if shelf %}
{{ heading }} {{ shelf|length }}
- {{ grid(cols, shelf, every=items, choices=choices) }}
+ {{ grid(cols, shelf, every=items, choices=choices, sort=sort) }}
{% endif %}
{% endfor %}
diff --git a/app/ui_tests/test_agents.py b/app/ui_tests/test_agents.py
index 7dd77445..d30b9cd1 100644
--- a/app/ui_tests/test_agents.py
+++ b/app/ui_tests/test_agents.py
@@ -137,6 +137,7 @@ def test_kits_catalogue_and_proof_links(self):
self.assertIn('No kits match.
', page)
self.assertIn('
Checks 3 ', page)
self.assertNotIn('bench-card-title">")]) # the detail is on its page
self.assertEqual(self.get("/agents/nope").status_code, 404)
+ def test_agents_sort_by_name_and_their_counts(self):
+ html = self.get("/agents").get_data(as_text=True)
+ menu = html[html.index('data-tools="sort"'):]
+ self.assertEqual(re.findall(r'data-sort-col value="(\w*)"', menu), ["", "title", "ports", "runs"])
+ card = html[html.index('id="fake"'):]
+ self.assertIn('data-s-ports="2/7"', card[:card.index(">")])
+ self.assertIn('data-tools="sort"', self.get("/capabilities").get_data(as_text=True))
+
def test_the_add_dialog_builds_a_prompt_and_keeps_the_steps_by_hand_for_each_kind(self):
for url, a, skill, words in (
("/agents", "an agent", ".claude/skills/import-agent/SKILL.md",
diff --git a/app/ui_tests/test_catalogue_routes.py b/app/ui_tests/test_catalogue_routes.py
index 7e8430cf..f9556e3f 100644
--- a/app/ui_tests/test_catalogue_routes.py
+++ b/app/ui_tests/test_catalogue_routes.py
@@ -84,6 +84,14 @@ def test_the_list_filters_by_what_runs_it(self):
self.assertIn('data-f-runs="standard
harbor
"', self.card("swe-bench-verified")); self.assertIn('data-f-runs="standard
"', self.card("longmemeval"))
self.assertIn(' Nullius', html) # its value, by its label
+ def test_the_list_sorts_by_name_tasks_and_datasets_on_each_shelf(self):
+ html = self.get("/benchmarks")
+ menu = html[html.index('data-tools="sort"'):]
+ self.assertEqual(re.findall(r'data-sort-col value="(\w*)"', menu), ["", "title", "tasks", "datasets"])
+ self.assertIn('value="tasks" data-type="num"> Tasks', menu)
+ self.assertIn('data-s-title="SWE-bench Verified" data-s-tasks="500" data-s-datasets="1"', self.card("swe-bench-verified"))
+ self.assertIn('data-group-n>', html[html.index('data-shelf="official"'):html.index("data-s-title")]) # within its shelf
+
def test_the_list_filters_by_origin(self):
html = self.get("/benchmarks")
self.assertIn('', html)
@@ -109,7 +117,6 @@ def test_the_list_filters_by_category_pills_and_two_dropdowns(self):
def test_the_list_searches_by_name_category_and_dataset(self):
self.assertIn(' No benchmark matches. ', self.html)
diff --git a/app/web/catalogue.py b/app/web/catalogue.py
index ad00a25b..af5aee98 100644
--- a/app/web/catalogue.py
+++ b/app/web/catalogue.py
@@ -54,7 +54,7 @@ def _card(cat, b, needs, sheet) -> dict:
for way, (label, name) in RUNS_WITH.items() if way in b.harness],
"needs": needs and {"text": "needs " + ", ".join(needs),
"title": f"Some of its options need {', '.join(needs)} installed on the machine it runs on: see its page"},
- "tasks": {"text": tasks, "label": unit.capitalize()},
+ "tasks": {"text": tasks, "label": unit.capitalize(), "value": tasks.replace(",", "").split("–")[-1]},
"datasets": {"text": len(ds), "label": "Datasets" if len(ds) != 1 else "Dataset"},
"scoring": b.scoring, "blocker": b.blocker[:1].upper() + b.blocker[1:]}
From 23fdfaaee0221428192103f9b9b1a19b9b3b8d56 Mon Sep 17 00:00:00 2001
From: Harenome Ranaivoarivony-Razanajato
Date: Thu, 19 Nov 2026 14:54:02 +0100
Subject: [PATCH 2/5] feat(catalogue): filter the Agents page
Two dropdowns, as Benchmarks' Origin and Runs with: the agent's protocol (ACP or its own command) and the ports it has proven, the latter listing only ports some agent proves.
---
app/templates/agents/standard.html | 7 ++++---
app/ui_tests/test_agents.py | 13 ++++++++++---
app/web/agents.py | 12 +++++++++++-
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/app/templates/agents/standard.html b/app/templates/agents/standard.html
index 8e9503b8..2fbe2f90 100644
--- a/app/templates/agents/standard.html
+++ b/app/templates/agents/standard.html
@@ -34,13 +34,14 @@
{% if problems %}Not offered: a definition with problems {% for p in problems %}{{ p }} {% endfor %} {% endif %}
{% if not items %}No {{ kind }} yet.
{% endif %}
- {#- A card's fields (web/agents.py `_card`). #}
- {% set cols = [dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag'),
+ {#- A card's fields (web/agents.py `_card`); an agent's protocol and the ports it proves as dropdowns. #}
+ {% set cols = [dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag', filter='dropdown', filter_icon='plug'),
+ dict(key='proves', label='Proves', filter='dropdown', filter_icon='check'),
dict(key='example', label='Example', card='tag', class='std-tag'), dict(key='version', label='Version', card='meta'),
dict(key='icon', label='Logo', card='icon', table=false, class='std-mark small'), dict(key='title', label='Name', card='title'),
dict(key='summary', label='Summary', card='text', class='std-clamp'), dict(key='ports', label='Ports proven', card='stat', type='num'),
dict(key='runs', label='Benchmarks it runs', card='stat', type='num'), dict(key='installs', label='Installs', card='stat', class='word')] %}
- {% if items %}{{ cards(plural|lower, cols, items, search='Name, protocol, summary', sort=['title', 'ports', 'runs'], empty='No ' ~ kind ~ ' matches.', noun=plural|lower) }}{% endif %}
+ {% if items %}{{ cards(plural|lower, cols, items, search='Name, protocol, summary', choices=choices, sort=['title', 'ports', 'runs'], empty='No ' ~ kind ~ ' matches.', noun=plural|lower) }}{% endif %}
{% endblock %}
{% block scripts %}{% endblock %}
diff --git a/app/ui_tests/test_agents.py b/app/ui_tests/test_agents.py
index d30b9cd1..d9b9756c 100644
--- a/app/ui_tests/test_agents.py
+++ b/app/ui_tests/test_agents.py
@@ -175,16 +175,23 @@ def test_agents_is_a_card_per_agent_that_opens_its_page(self):
self.assertIn('href="/agents/fake"', card)
self.assertIn("Ports proven 2/7 ", card) # task and workspace, of the seven agent ports
self.assertIn("Benchmarks it runs 1/1 ", card)
- self.assertNotIn("agent.task/v1", card[:card.index("")]) # the detail is on its page
+ self.assertNotIn("agent.task/v1", card[card.index(">"):card.index("")]) # the detail is on its page
self.assertEqual(self.get("/agents/nope").status_code, 404)
- def test_agents_sort_by_name_and_their_counts(self):
+ def test_agents_sort_and_filter_by_protocol_and_the_ports_they_prove(self):
html = self.get("/agents").get_data(as_text=True)
menu = html[html.index('data-tools="sort"'):]
self.assertEqual(re.findall(r'data-sort-col value="(\w*)"', menu), ["", "title", "ports", "runs"])
+ self.assertIn('', html)
+ self.assertIn(' ACP', html)
+ self.assertIn('', html)
+ self.assertIn(' One task', html)
card = html[html.index('id="fake"'):]
+ self.assertIn('data-f-proves="agent.task/v1
agent.workspace/v1
"', card[:card.index(">")])
self.assertIn('data-s-ports="2/7"', card[:card.index(">")])
- self.assertIn('data-tools="sort"', self.get("/capabilities").get_data(as_text=True))
+ caps = self.get("/capabilities").get_data(as_text=True)
+ self.assertIn('data-tools="sort"', caps)
+ self.assertNotIn("data-filter-menu", caps) # one protocol: nothing to filter
def test_the_add_dialog_builds_a_prompt_and_keeps_the_steps_by_hand_for_each_kind(self):
for url, a, skill, words in (
diff --git a/app/web/agents.py b/app/web/agents.py
index 608e595f..a3a4f1f0 100644
--- a/app/web/agents.py
+++ b/app/web/agents.py
@@ -91,7 +91,16 @@ def _page(kind: str):
found = _entries(kind)
return render_template("agents/standard.html", kind=kind, how=howto.steps(kind), prompts=howto.prompts(),
catalogue_dir=paths.catalogue_dir(), example_dir=example, problems=found["problems"],
- items=[_card(kind, e) for e in found["entries"]])
+ items=[_card(kind, e) for e in found["entries"]], choices=_choices(kind, found["entries"]))
+
+
+def _choices(kind: str, entries: list) -> dict:
+ """An agent list's filters: how Nullius talks to it, and the ports it proves; none for capabilities."""
+ if kind != "agent":
+ return {}
+ proven = {p["port"] for e in entries for p in e["ports"] if p["state"] == "proven"}
+ return {"protocol": [(x, x[:1].upper() + x[1:]) for x in dict.fromkeys(e["protocol"] for e in entries)],
+ "proves": [(p, spec.get("label") or p) for p, spec in ports.PORTS.items() if p in proven]}
def _card(kind: str, e: dict) -> dict:
@@ -105,6 +114,7 @@ def _card(kind: str, e: dict) -> dict:
"version": ("v" + str(version) if version else "") + (f" · {n} versions" if n > 1 else ""),
"icon": agent_mark_url(d["key"]) if kind == "agent" else None, "title": d["label"],
"summary": d.get("summary"),
+ "proves": [{"text": p["label"], "value": p["port"]} for p in e["ports"] if p["state"] == "proven"],
"ports": "{}/{}".format(sum(p["state"] == "proven" for p in e["ports"]), len(e["ports"])),
"runs": "{}/{}".format(sum(not f["why"] for f in e["fits"]), len(e["fits"])),
"installs": "yes" if e["install"] else "no"}
From b88d83d6f96f632be82f1ad33bbcd39b83d860b6 Mon Sep 17 00:00:00 2001
From: Harenome Ranaivoarivony-Razanajato
Date: Thu, 19 Nov 2026 15:03:45 +0100
Subject: [PATCH 3/5] feat(catalogue): put the Agents page's filters in its one
Filter menu
---
app/templates/agents/standard.html | 4 ++--
app/ui_tests/test_agents.py | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/templates/agents/standard.html b/app/templates/agents/standard.html
index 2fbe2f90..3b013c63 100644
--- a/app/templates/agents/standard.html
+++ b/app/templates/agents/standard.html
@@ -35,8 +35,8 @@
{% if not items %}No {{ kind }} yet.
{% endif %}
{#- A card's fields (web/agents.py `_card`); an agent's protocol and the ports it proves as dropdowns. #}
- {% set cols = [dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag', filter='dropdown', filter_icon='plug'),
- dict(key='proves', label='Proves', filter='dropdown', filter_icon='check'),
+ {% set cols = [dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag'),
+ dict(key='proves', label='Proves'),
dict(key='example', label='Example', card='tag', class='std-tag'), dict(key='version', label='Version', card='meta'),
dict(key='icon', label='Logo', card='icon', table=false, class='std-mark small'), dict(key='title', label='Name', card='title'),
dict(key='summary', label='Summary', card='text', class='std-clamp'), dict(key='ports', label='Ports proven', card='stat', type='num'),
diff --git a/app/ui_tests/test_agents.py b/app/ui_tests/test_agents.py
index d9b9756c..f26b2200 100644
--- a/app/ui_tests/test_agents.py
+++ b/app/ui_tests/test_agents.py
@@ -182,9 +182,11 @@ def test_agents_sort_and_filter_by_protocol_and_the_ports_they_prove(self):
html = self.get("/agents").get_data(as_text=True)
menu = html[html.index('data-tools="sort"'):]
self.assertEqual(re.findall(r'data-sort-col value="(\w*)"', menu), ["", "title", "ports", "runs"])
- self.assertIn('', html)
+ self.assertIn('data-tools-btn="filter"', html) # both in the one Filter menu, no dropdown of their own
+ self.assertNotIn('data-dropdown', html)
+ self.assertIn('\n Protocol ', html)
self.assertIn(' ACP', html)
- self.assertIn('', html)
+ self.assertIn('\n Proves ', html)
self.assertIn(' One task', html)
card = html[html.index('id="fake"'):]
self.assertIn('data-f-proves="agent.task/v1
agent.workspace/v1
"', card[:card.index(">")])
From 7fb3f160b28d531ba87afa11560c37e3d2b81b2f Mon Sep 17 00:00:00 2001
From: Harenome Ranaivoarivony-Razanajato
Date: Thu, 19 Nov 2026 15:19:02 +0100
Subject: [PATCH 4/5] feat(catalogue): show the catalogue pages as cards or a
table
Benchmarks, Agents, Capabilities and Kits get the Table/Cards toggle that
Workspaces has, with cards as their default and ?view=table for the table.
The toolkits take a page's default view, so the default has no view in its
link and the other view carries it; Workspaces stays table by default.
The cards macro draws the same items as a table when asked: one column per
field a table takes that some item fills, the name pinned with its icon and
a link to the entry, the same search, filters and Sort by. Benchmarks are one
table in shelf order, their Origin being the shelf, since a controls row
drives one table. Secondary fields start hidden in the Columns menu.
---
app/static/catalogue/catalogue.css | 2 ++
app/templates/_cards.html | 43 ++++++++++++++++++++-----
app/templates/_tables.html | 15 +++++----
app/templates/agents/kits.html | 8 ++---
app/templates/agents/standard.html | 14 ++++----
app/templates/catalogue/benchmarks.html | 20 ++++++------
app/ui_tests/test_agents.py | 23 +++++++++++++
app/ui_tests/test_catalogue_routes.py | 20 ++++++++++++
app/ui_tests/test_run_routes.py | 4 +--
9 files changed, 111 insertions(+), 38 deletions(-)
diff --git a/app/static/catalogue/catalogue.css b/app/static/catalogue/catalogue.css
index 75459c86..fb7a61b7 100644
--- a/app/static/catalogue/catalogue.css
+++ b/app/static/catalogue/catalogue.css
@@ -41,6 +41,8 @@
.bench-card-name { min-width: 0; }
.bench-card-name > .icon-btn { vertical-align: middle; }
.bench-mark { flex: none; width: 22px; height: 22px; color: var(--accent); }
+/* a table row's name (_cards.html rows): its icon, then its link */
+.row-name { display: inline-flex; align-items: center; gap: 8px; }
.bench-card-domain { margin-top: -6px; font-size: 14px; line-height: 1.5; color: var(--text-dim); }
/* the stats in columns of one width, a column each, each its label then its value; on a card too narrow for one
line (a phone), two balanced rows: 4 as 2+2, 5 as 3+2, 6 as 3+3 */
diff --git a/app/templates/_cards.html b/app/templates/_cards.html
index 72ac2e85..3114aede 100644
--- a/app/templates/_cards.html
+++ b/app/templates/_cards.html
@@ -14,7 +14,7 @@
A field's `class` goes on each of its values; `card_label` names a stat when its column header does not, and a
value's `label` names it for that item; `style` 'code' sets the text as code; `icon` puts #i- before a
note. `icon` values are image URLs: when one item has one, the others show initials; when none has, no icon. -#}
-{% from '_tables.html' import controls, empty_note %}
+{% from '_tables.html' import controls, empty_note, table, cell %}
{#- Each value of `fields` in `item`, as a dict, to the call block with its field. #}
{% macro each(item, fields) %}{% for f in fields %}{% set v = item.get(f.key) %}
@@ -27,12 +27,42 @@
`search`, `choices`, `only`, `layout` and each field's `filter` as the table's controls; `sort` the Sort by menu, over
the fields that are not blank, or a list of their keys; `noun` what the live region counts.
The call block, when given, writes the cards instead (grid for each group, such as the Benchmarks' shelves); a
- section in it marked data-group hides when none of its cards shows, and its data-group-n counts them. #}
-{% macro cards(id, cols, items, search='', choices={}, only={}, empty='No items match.', noun='items', sort=false, layout=none) %}
-{{ controls(id, cols, search, choices=choices, only=only, sort=sort, layout=layout) }}
+ section in it marked data-group hides when none of its cards shows, and its data-group-n counts them.
+ `layout` 'table' shows the same items as a table instead (rows), `default` the page's view without ?view=. #}
+{% macro cards(id, cols, items, search='', choices={}, only={}, empty='No items match.', noun='items', sort=false, layout=none, default='table') %}
+{%- if layout == 'table' %}{{ rows(id, cols, items, search, choices, only, empty, noun, sort, default) }}{% else %}
+{{ controls(id, cols, search, choices=choices, only=only, sort=sort, layout=layout, default=default) }}
{% if caller is defined %}{{ caller() }}{% else %}{{ grid(cols, items, choices=choices, sort=sort) }}{% endif %}
{{ empty_note(id, empty) }}
+{%- endif %}
+{% endmacro %}
+
+{#- An item's icon: `src` an image URL or a sprite symbol, else the initials of `name`. #}
+{% macro mark(icon, src, name) %}
+ {%- if not src %}{{ name[:2]|upper }}
+ {%- elif '#' in src %}
+ {%- else %} {% endif %}{% endmacro %}
+
+{#- A row's attributes, written once per item by rows. #}
+{% macro attrs(r) %}{{ r.attrs }}{% endmacro %}
+
+{# The items of a cards collection as a table (the table toolkit's, with its Columns menu): a column per field the
+ table takes that some item fills (a filtered or 'num' one always), in the order of `cols`; the title pinned, its
+ icon before it and a link to `href`, the others as on the card. A field `off` starts hidden. #}
+{% macro rows(id, cols, items, search, choices, only, empty, noun, sort, default) %}
+{%- set icon = (cols|selectattr('card', 'equalto', 'icon')|list + [none])[0] %}
+{%- set icons = icon and items|selectattr(icon.key)|list|length > 0 %}
+{%- set shown = [] %}{% for c in cols if c.table is not sameas false and (c.key in choices or c.type == 'num' or items|selectattr(c.key)|list) %}{% set _ = shown.append(dict(c, sticky=c.card == 'title')) %}{% endfor %}
+{%- set rs = [] %}{% for item in items %}{% set a %}{% if item.get('id') %} id="{{ item.id }}"{% endif %} data-search="{{ item.get('search', '') }}"
+ {%- for f in cols if f.key in choices %} data-f-{{ f.key }}="{% call(f, v) each(item, [f]) %}{{ v.get('value', v.text) }}
{% endcall %}"{% endfor %}{% endset %}
+ {%- set _ = rs.append({'item': item, 'attrs': a}) %}{% endfor %}
+{% call(r, c) table(id, shown, rs, attrs, search=search, columns=true, choices=choices, only=only, empty=empty, noun=noun, sort=sort, layout='table', default=default) %}
+ {%- set v = r.item.get(c.key) %}{% set by %}{% call(f, x) each(r.item, [c]) %}{{ x.get('value', x.text) }} {% endcall %}{% endset %}
+ {%- call cell(c, sort=by|trim) %}{% if c.card == 'title' %}{% set name = v.text if v is mapping else v %}{% if icons %}{{ mark(icon, r.item.get(icon.key), name) }}{% endif %}{{ name }}
+ {%- elif c.style == 'code' %}{{ v }}
+ {%- else %}{% call(f, x) each(r.item, [c]) %}{{ pill(f, x) }} {% endcall %}{% endif %}{% endcall %}
+{%- endcall %}
{% endmacro %}
{# The cards of `items`. `every`: the collection the icon rule reads, when `items` is a part of it; `choices`: the
@@ -52,10 +82,7 @@
{%- for f in fields if sort and not f.blank and (sort is sameas true or f.key in sort) %} data-s-{{ f.key }}="{% call(f, v) each(item, [f]) %}{{ v.get('value', v.text) }}{% endcall %}"{% endfor %}>
{%- set title = by.title[0] %}{% set v = item.get(title.key) %}{% set v = v if v is mapping else {'text': v} %}{% set name = v.text %}
{%- set cls = [title.class, v.class]|select|join(' ') %}
- {% if icons %}{% set src = item.get(icon.key) %}
- {%- if not src %}
{{ name[:2]|upper }}
- {%- elif '#' in src %}
- {%- else %}
{% endif %}{% endif -%}
+
{% if icons %}{{ mark(icon, item.get(icon.key), name) }}{% endif -%}
{%- set link %}
{{ name }} {% endset %}
{%- if v.after %}
{{ link }} {{ v.after }} {% else %}{{ link }}{% endif %}
{%- set corner %}{% call(f, v) each(item, by.check) %}
{% endcall %}
diff --git a/app/templates/_tables.html b/app/templates/_tables.html
index 78a86fc5..5ead8bab 100644
--- a/app/templates/_tables.html
+++ b/app/templates/_tables.html
@@ -31,13 +31,13 @@
{# A whole table (static/tables.js `wire`): its controls row, its headers from `cols`, a row of `rows` each,
and its pages. `id` names it, and keys what a viewer chooses; `class` adds to its classes; `tr`: a macro writing a
row's attributes. The call block writes a cell: it is called with a row and a column, in the order of `cols`, and
- writes that cell with the cell macro. Opt-ins: `search`, `columns`, `choices`, `only`, `views`, `actions`, `layout`
- as controls'; `empty` and `noun` as pager's; `sticky_head`: its header row pinned while it scrolls down, and `tr`'s
+ writes that cell with the cell macro. Opt-ins: `search`, `columns`, `choices`, `only`, `views`, `actions`, `sort`,
+ `layout`, `default` as controls'; `empty` and `noun` as pager's; `sticky_head`: its header row pinned while it scrolls down, and `tr`'s
rows with data-sticky under it (tables.js `sticky`), the controls row with them up to the table's end. #}
-{% macro table(id, cols, rows, tr, class='', search='', columns=false, choices={}, only={}, empty='No rows match.', noun='rows', views=none, actions=none, layout=none, sticky_head=false) %}
+{% macro table(id, cols, rows, tr, class='', search='', columns=false, choices={}, only={}, empty='No rows match.', noun='rows', views=none, actions=none, layout=none, sticky_head=false, sort=true, default='table') %}
{%- if sticky_head %}
{% endif %}
{%- set cols = cols|rejectattr('table', 'sameas', false)|list %}
-{{ controls(id, cols, search, columns, choices, only, views, actions, layout=layout) }}
+{{ controls(id, cols, search, columns, choices, only, views, actions, sort=sort, layout=layout, default=default) }}
{%- for c in cols if c.width == 'expand' %}
{%- endfor %}
@@ -71,11 +71,12 @@
offers those columns only. `views` and `actions`: macros writing a page's own
buttons, each any number of them, run by the page: views (how the table looks) before Columns, actions (on the
rows or the selection) after Sort by. `layout` 'table' or 'cards', the one shown: a toggle of links to the
- page's other one (?view=cards), its other query kept, at the end. The search goes left, the buttons right. A column's
+ page's other one, its other query kept, at the end; `default` the view a page shows without ?view=, the other
+ one's link carrying ?view=
. The search goes left, the buttons right. A column's
`filter` says where its choices go, one form or a list of them: 'button' (the default), in the Filter menu;
'dropdown', a menu of its own; 'pills', a row of toggles under the controls. A column's `filter_icon`, a sprite id
without its `i-`, leads its dropdown's button and its pills. `id`: the table's. #}
-{% macro controls(id, cols, search='', columns=false, choices={}, only={}, views=none, actions=none, sort=true, layout=none) %}
+{% macro controls(id, cols, search='', columns=false, choices={}, only={}, views=none, actions=none, sort=true, layout=none, default='table') %}
{%- set by = {'button': [], 'dropdown': [], 'pills': []} %}{% for c in cols if c.key in choices %}{% for f in ([c.filter] if c.filter is string else c.filter or ['button']) %}{% set _ = by[f].append(c) %}{% endfor %}{% endfor %}
{% if search %} {% endif %}
@@ -112,7 +113,7 @@
{% endif %}
{{ slot('actions', actions) }}
{% if layout %}{% set q = dict(request.view_args, **request.args.to_dict(flat=false)) %}
- {%- for key, name in (('table', 'Table'), ('cards', 'Cards')) %}{% set _ = q.update(view=none if key == 'table' else key) %}
+ {%- for key, name in (('table', 'Table'), ('cards', 'Cards')) %}{% set _ = q.update(view=none if key == default else key) %}
{%- endfor %}
{% endif %}
diff --git a/app/templates/agents/kits.html b/app/templates/agents/kits.html
index 5a04f954..68a1a96b 100644
--- a/app/templates/agents/kits.html
+++ b/app/templates/agents/kits.html
@@ -42,10 +42,10 @@ Checks
{{ page_head('Kits', sub=items|length ~ ' conformance kits') }}
{#- A card's fields (web/agents.py `_kit_card`); the family's pills filter them. #}
- {% set cols = [dict(key='family', label='Family', card='tag', class='std-tag', filter='pills'), dict(key='version', label='Version', card='meta'),
- dict(key='title', label='Name', card='title'), dict(key='port', label='Port', card='text', style='code'),
- dict(key='checks', label='Checks', card='stat', type='num')] %}
- {{ cards('kits', cols, items, search='Name, port, check', choices={'family': [('agent', 'Agents'), ('capability', 'Capabilities')]}, sort=['title', 'port', 'checks'], empty='No kits match.', noun='kits') }}
+ {% set cols = [dict(key='title', label='Name', card='title'), dict(key='family', label='Family', card='tag', class='std-tag', filter='pills'),
+ dict(key='port', label='Port', card='text', style='code'), dict(key='checks', label='Checks', card='stat', type='num'),
+ dict(key='version', label='Version', card='meta')] %}
+ {{ cards('kits', cols, items, search='Name, port, check', choices={'family': [('agent', 'Agents'), ('capability', 'Capabilities')]}, sort=['title', 'port', 'checks'], empty='No kits match.', noun='kits', layout='table' if request.args.get('view') == 'table' else 'cards', default='cards') }}
{% endif %}
{% endblock %}
diff --git a/app/templates/agents/standard.html b/app/templates/agents/standard.html
index 3b013c63..47e12026 100644
--- a/app/templates/agents/standard.html
+++ b/app/templates/agents/standard.html
@@ -35,13 +35,13 @@
{% if not items %}No {{ kind }} yet.
{% endif %}
{#- A card's fields (web/agents.py `_card`); an agent's protocol and the ports it proves as dropdowns. #}
- {% set cols = [dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag'),
- dict(key='proves', label='Proves'),
- dict(key='example', label='Example', card='tag', class='std-tag'), dict(key='version', label='Version', card='meta'),
- dict(key='icon', label='Logo', card='icon', table=false, class='std-mark small'), dict(key='title', label='Name', card='title'),
- dict(key='summary', label='Summary', card='text', class='std-clamp'), dict(key='ports', label='Ports proven', card='stat', type='num'),
- dict(key='runs', label='Benchmarks it runs', card='stat', type='num'), dict(key='installs', label='Installs', card='stat', class='word')] %}
- {% if items %}{{ cards(plural|lower, cols, items, search='Name, protocol, summary', choices=choices, sort=['title', 'ports', 'runs'], empty='No ' ~ kind ~ ' matches.', noun=plural|lower) }}{% endif %}
+ {% set cols = [dict(key='icon', label='Logo', card='icon', table=false, class='std-mark small'), dict(key='title', label='Name', card='title'),
+ dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag'),
+ dict(key='proves', label='Proves', class='std-tag', off=true), dict(key='example', label='Example', card='tag', class='std-tag'),
+ dict(key='summary', label='Summary', card='text', class='std-clamp', width='expand', off=true), dict(key='ports', label='Ports proven', card='stat', type='num'),
+ dict(key='runs', label='Benchmarks it runs', card='stat', type='num'), dict(key='installs', label='Installs', card='stat', class='word'),
+ dict(key='version', label='Version', card='meta')] %}
+ {% if items %}{{ cards(plural|lower, cols, items, search='Name, protocol, summary', choices=choices, sort=['title', 'ports', 'runs'], empty='No ' ~ kind ~ ' matches.', noun=plural|lower, layout='table' if request.args.get('view') == 'table' else 'cards', default='cards') }}{% endif %}
{% endblock %}
{% block scripts %}{% endblock %}
diff --git a/app/templates/catalogue/benchmarks.html b/app/templates/catalogue/benchmarks.html
index 6b33145d..d081ea0c 100644
--- a/app/templates/catalogue/benchmarks.html
+++ b/app/templates/catalogue/benchmarks.html
@@ -28,16 +28,18 @@
{% endcall %}
{#- A card's fields (web/catalogue.py `_card`); the filters are the category's pills, and the origin and what runs it as dropdowns. #}
- {% set cols = [dict(key='category', label='Category', card='tag', class='cat-tag', filter='pills'), dict(key='origin', label='Origin', card='tag', class='origin-tag', filter='dropdown', filter_icon='origin'),
- dict(key='icon', label='Mark', card='icon', table=false, class='bench-mark'), dict(key='title', label='Name', card='title'),
- dict(key='domain', label='Domain', card='text'), dict(key='runs', label='Runs with', card='badge', class='run-tag', filter='dropdown', filter_icon='runner'),
- dict(key='needs', label='Needs', card='note', icon='wrench'), dict(key='tasks', label='Tasks', card='stat', type='num'),
- dict(key='datasets', label='Datasets', card='stat', type='num'), dict(key='scoring', label='Scored by', card='stat', class='word'),
+ {% set cols = [dict(key='icon', label='Mark', card='icon', table=false, class='bench-mark'), dict(key='title', label='Name', card='title'),
+ dict(key='category', label='Category', card='tag', class='cat-tag', filter='pills'), dict(key='origin', label='Origin', card='tag', class='origin-tag', filter='dropdown', filter_icon='origin'),
+ dict(key='domain', label='Domain', card='text', off=true), dict(key='runs', label='Runs with', card='badge', class='run-tag', filter='dropdown', filter_icon='runner'),
+ dict(key='tasks', label='Tasks', card='stat', type='num'), dict(key='datasets', label='Datasets', card='stat', type='num'),
+ dict(key='scoring', label='Scored by', card='stat', class='word'), dict(key='needs', label='Needs', card='note', icon='wrench', off=true),
dict(key='blocker', label='Blocker', card='alert')] %}
- {#- Two shelves: the official benchmarks, then the community benchmarks. A card opens the benchmark's own page. #}
- {% set sort = ['title', 'tasks', 'datasets'] %}
- {% call cards('benchmarks', cols, items, search='Name, category, dataset', choices=choices, sort=sort, empty='No benchmark matches.', noun='benchmarks') %}
- {% for state, heading in [('official', 'Official'), ('community', 'Community')] %}
+ {#- Two shelves: the official benchmarks, then the community benchmarks; the table is one table in that order, its
+ Origin the shelf. A card or a name opens the benchmark's own page. #}
+ {% set sort = ['title', 'tasks', 'datasets'] %}{% set shelves = [('official', 'Official'), ('community', 'Community')] %}
+ {% set rows = [] %}{% for state, _ in shelves %}{% set _ = rows.extend(items|selectattr('shelf', 'equalto', state)) %}{% endfor %}
+ {% call cards('benchmarks', cols, rows, search='Name, category, dataset', choices=choices, sort=sort, empty='No benchmark matches.', noun='benchmarks', layout='table' if request.args.get('view') == 'table' else 'cards', default='cards') %}
+ {% for state, heading in shelves %}
{% set shelf = items|selectattr('shelf', 'equalto', state)|list %}
{% if shelf %}
diff --git a/app/ui_tests/test_agents.py b/app/ui_tests/test_agents.py
index f26b2200..75d06cce 100644
--- a/app/ui_tests/test_agents.py
+++ b/app/ui_tests/test_agents.py
@@ -195,6 +195,29 @@ def test_agents_sort_and_filter_by_protocol_and_the_ports_they_prove(self):
self.assertIn('data-tools="sort"', caps)
self.assertNotIn("data-filter-menu", caps) # one protocol: nothing to filter
+ def test_agents_capabilities_and_kits_are_cards_by_default_and_a_table_on_request(self):
+ for url in ("/agents", "/capabilities", "/kits"):
+ html = self.get(url).get_data(as_text=True)
+ self.assertIn(f'href="{url}?view=table" aria-label="Table" title="Table" aria-current="false"', html)
+ self.assertIn(f'href="{url}" aria-label="Cards" title="Cards" aria-current="true"', html)
+ self.assertNotIn("data-table", html)
+ html = self.get(url + "?view=table&q=1").get_data(as_text=True)
+ self.assertIn(f'href="{url}?view=table&q=1" aria-label="Table" title="Table" aria-current="true"', html)
+ self.assertIn(f'href="{url}?q=1" aria-label="Cards" title="Cards" aria-current="false"', html)
+ self.assertNotIn("data-cards", html)
+ self.assertIn('data-col="title" data-type="text" class="sticky-col sticky-edge">Name', html)
+ html = self.get("/agents?view=table").get_data(as_text=True)
+ row = html[html.index('")]
+ self.assertIn('data-f-proves="agent.task/v1
agent.workspace/v1
"', row)
+ self.assertIn('', row)
+ self.assertIn(' 2/7 ', row)
+ self.assertIn(' Summary', html)
+ self.assertNotIn('data-col="kind"', html) # no agent has a kind: no column
+ kits = self.get("/kits?view=table").get_data(as_text=True)
+ self.assertEqual(re.findall(r']*data-f-origin="official
"[^>]*>(?:(?! ).)*href="/benchmarks/swe-bench-verified".*?', html, re.S).group(0)
+ self.assertIn('data-f-runs="standard
harbor
"', row)
+ self.assertIn('', row)
+ self.assertIn('data-pills="category"', html); self.assertIn('data-filter-menu="origin"', html)
+ self.assertEqual(re.findall(r'data-sort-col value="(\w*)"', html[html.index('data-tools="sort"'):]), ["", "title", "tasks", "datasets"])
+ self.assertIn(' Needs', html) # secondary: off until chosen
+ origins = re.findall(r'data-f-origin="(\w+)
"', html)
+ self.assertEqual(origins, sorted(origins, key=list(catalog.ORIGINS).index)) # the shelves' order
+
def test_the_list_filters_by_category_pills_and_two_dropdowns(self):
tools = self.html.split('id="benchmarks-tools"', 1)[1].split('id="benchmarks"', 1)[0]
self.assertIn('', tools)
diff --git a/app/ui_tests/test_run_routes.py b/app/ui_tests/test_run_routes.py
index c179c3a6..75fc5903 100644
--- a/app/ui_tests/test_run_routes.py
+++ b/app/ui_tests/test_run_routes.py
@@ -533,12 +533,10 @@ def test_the_page_is_a_table_or_cards_and_renders_only_the_one_chosen(self):
self.assertIn(f' ', card)
self.assertIn(f' ', card)
- def test_the_view_toggle_keeps_the_other_query_and_shows_only_where_asked(self):
+ def test_the_view_toggle_keeps_the_other_query(self):
html = self.page("/workspaces?view=cards&q=1")
self.assertIn('href="/workspaces?q=1" aria-label="Table"', html)
self.assertIn('href="/workspaces?view=cards&q=1" aria-label="Cards"', html)
- for url in ("/benchmarks", "/kits", "/agents"):
- self.assertNotIn('aria-label="Table" title="Table"', self.page(url), url)
def test_a_restart_with_the_same_paths_reopens_the_workspace_its_runs_went_into(self):
runs = self.tmp / "runs"
From d186b0bf9630ba19fd323a6f18dd68ada5b9c906 Mon Sep 17 00:00:00 2001
From: Harenome Ranaivoarivony-Razanajato
Date: Thu, 19 Nov 2026 15:37:11 +0100
Subject: [PATCH 5/5] feat(catalogue): hide the Agents table's Example column
until asked
---
app/templates/agents/standard.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/agents/standard.html b/app/templates/agents/standard.html
index 47e12026..3e72259f 100644
--- a/app/templates/agents/standard.html
+++ b/app/templates/agents/standard.html
@@ -37,7 +37,7 @@
{#- A card's fields (web/agents.py `_card`); an agent's protocol and the ports it proves as dropdowns. #}
{% set cols = [dict(key='icon', label='Logo', card='icon', table=false, class='std-mark small'), dict(key='title', label='Name', card='title'),
dict(key='kind', label='Kind', card='tag', class='cat-tag'), dict(key='protocol', label='Protocol', card='tag', class='std-tag'),
- dict(key='proves', label='Proves', class='std-tag', off=true), dict(key='example', label='Example', card='tag', class='std-tag'),
+ dict(key='proves', label='Proves', class='std-tag', off=true), dict(key='example', label='Example', card='tag', class='std-tag', off=true),
dict(key='summary', label='Summary', card='text', class='std-clamp', width='expand', off=true), dict(key='ports', label='Ports proven', card='stat', type='num'),
dict(key='runs', label='Benchmarks it runs', card='stat', type='num'), dict(key='installs', label='Installs', card='stat', class='word'),
dict(key='version', label='Version', card='meta')] %}