diff --git a/.zenodo.json b/.zenodo.json
index 43a0bdc0..95dbd376 100644
--- a/.zenodo.json
+++ b/.zenodo.json
@@ -1,8 +1,8 @@
{
- "title": "Catalog of Second Chances (CSC) - Digital Database and Corresponding Interfaces for ReUse of Architectural Components (v0.6.4.0)",
- "version": "0.6.4.0",
+ "title": "Catalog of Second Chances (CSC) - Digital Database and Corresponding Interfaces for ReUse of Architectural Components (v0.6.4.1)",
+ "version": "0.6.4.1",
"upload_type": "software",
- "description": "
The Catalog of Second Chances (CSC) is a prototypical digital component database. It catalogs digital representations of uniquely identifiable architectural components for reuse. Furthermore, it provides corresponding interfaces and tools to leverage them via a backend REST-API, a web-frontend as well as a interface for direct interaction within Rhino Grasshopper.
Changes in v0.6.4.0 (2026-10-23)
Search and the location map.
Added
\"What fits?\": a Fits section in Browse's More filters finds pieces by size, whatever their orientation: about this size (within a tolerance in mm or %, default 10 %, closest first) or can hold this size (every side at least the asked one, least waste first). Each row shows how far off it is or how much it wastes, as a share of the piece and in m3 (per piece on batches). The list can also sort by volume, and the card view has a sort menu.
Near: a Near section in Browse's More filters finds pieces around a point (a pasted \"lat, lon\"), by their current location or by their origin, within a radius in km or simply nearest first. Each row shows its distance, and the list sorts by it. A component page links to \"Near this piece\".
Origin coordinates: the origin form of a piece takes the latitude and longitude of its origin place; until now they could be set only when the piece was created. In every location form a pasted \"lat, lon\" fills both boxes, and a comma after the latitude moves on to the longitude.
Location Map: a new page next to the Similarity Map shows the pieces on a map, by their current location or by their origin, in clusters with counts. It takes the filters of Browse (with a \"Show as list\" link back), colours the pieces like the Similarity Map, opens a piece's preview on a click, and offers \"Search near here\" on a click into the map. The map images come from the tile server of FOSSGIS e.V. (tile.openstreetmap.de); only this page loads them.
Similar pieces: a card on the component page shows the six pieces nearest in shape, over the whole shape descriptor rather than on the two-dimensional Similarity Map; size counts as well as the outline. \"Show more\" brings up to 24. The nearest pieces are also available at GET /identities/{id}/similar, with every Browse filter applied before the ranking.
MCP:search_components takes fit_mode, size_mm and tolerance, near_lat, near_lon, near_layer and radius_km (each result with its distance), and sort and order; its description now says what the text query matches (name, id prefix, catalog number). The new tool catalog_overview counts the pieces of a search by material, original function, dataset, shape class and circulation, with the range of each side in mm, how many have a location and how many are not public. similar_components now ranks by the shape descriptor (with basis, count and the filters of search_components) instead of the distance on the Similarity Map.
Grasshopper: the new FetchSimilarComponents returns the pieces nearest in shape to a piece, with their distance, and takes the filters, the dimension search and the near search of FetchFilteredComponents. FetchFilteredComponents gains the dimension search (FitMode, FitSize, FitTolerance) and the near search (NearPoint, NearLayer, RadiusKm), with the deviation or waste (Fit) and the distance (DistanceKm) per result.
Grasshopper, texture colours:CreateComponentIdentity and CreateComponentSnapshot give a mesh the colours of its texture when it is staged: when the mesh comes from a Rhino object whose material has a base-colour image, each vertex takes the colour at its texture coordinate, on every level of detail. The texture replaces vertex colours the mesh already has, with a remark. Meshes without such a texture are staged as before. Grasshopper library 261022: run CSC_Update.
Changed
Registration: without open domains the catalog is invite only, and the register page then asks for an invitation code and suggests no open sign-up. With open domains the page says that registration is open to certain domains and lists them behind a \"?\"; no page names a fixed university any more. CSC_OPEN_REGISTRATION_DOMAINS is now empty by default: a server that keeps open registration must set it explicitly.
Privacy page and imprint: they state that the maintainer runs the catalog in person and is its sole controller, and that TU Darmstadt does not operate it and is not responsible for it. The privacy page names the tile server of the Location Map and what it receives, and no longer claims that nothing is loaded from other sites; the imprint cites the DDG instead of the repealed TMG. The Content-Security-Policy allows images from that one tile host in addition.
No Google map preview: pointing at a location in the Browse table no longer loads an embedded Google map; the location is a link that opens Google Maps in a new tab on a click. With no embed left, the Content-Security-Policy allows no frames (frame-src 'none').
Fixed
Browse table: at middle widths its columns no longer run into each other; the table keeps a minimum width for the columns shown and scrolls sideways inside its frame. The same for the admin Materials table.
Statistics: one piece with a malformed size in the database can no longer make the statistics (and with them Analytics) fail for everyone.
Security
Next.js 16.4.1: the web app moves from Next.js 16.4.0 to 16.4.1, which fixes two critical advisories (GHSA-2464-fhr4-w9xw, code execution through the image optimizer with SVG files; GHSA-p3m5-59mp-jv5r, denial of service through Server Actions). The catalog was not reachable through either: it does not use the image optimizer and has no Server Actions. Upgraded as a precaution; npm audit is clean again.
Server notes
After the deploy, run scripts/db_maintenance/backfill_geo_points.py --apply once: it stores the location points the near search uses for the existing pieces (new and edited pieces get them on their own). Without --apply it only reports, and it exits with 4 while points are missing or out of date.
After the deploy, run the map job once (main_component_map.py, or --knn-only for the similarity data alone): until it has run, similar pieces answer 409 and the card stays hidden. The similarity data is then rebuilt with the map on every scheduled run; a new or reshaped piece joins at the next run.
The Catalog of Second Chances (CSC) is a prototypical digital component database. It catalogs digital representations of uniquely identifiable architectural components for reuse. Furthermore, it provides corresponding interfaces and tools to leverage them via a backend REST-API, a web-frontend as well as a interface for direct interaction within Rhino Grasshopper.
Changes in v0.6.4.1 (2026-10-27)
Hardening: the MCP connector, the component page and dependencies.
Added
Search by evidence method: the catalog list takes evidence_method=<method> (one name of the evidence vocabulary, an unknown name is a 422) and keeps only pieces with at least one published, current record of that method, for example reinforcement_layout for the pieces with a reinforcement layout. It combines with every other filter, also with fit and near. The MCP tools search_components, catalog_overview and similar_components take it as has_evidence. A filter in Browse follows later.
A reinforcement layout in the viewer: the card of a reinforcement layout in the evidence list has \"Show in viewer\", for every status, so a submitted draft can be seen before it is published. The viewer opens the version the bars belong to and draws that layout on top of the published ones, which turn faint; the legend names it with its status, and an x takes it out again. The link can be sent on: whoever may not see the record gets a short note and no bars.
Changed
MCP connector: the server introduces itself as the Catalog of Second Chances, with a link to the website and an icon, and its instructions tell a chat to use these tools for reused building components before a web search (in English and German). Every tool has a title and is marked read-only, and the descriptions name the evidence methods.
MCP, reinforcement:get_component and get_version count the reinforcement layouts of the version from its evidence records (records, bars, diameters) instead of the old inline field, which always gave 0. In get_evidence a layout record carries a summary of its bars, and performed_by shows the organization.
Similar pieces: on a wide screen the card sits in the left rail below Provenance, with smaller tiles, three to a row, so it no longer pushes the evidence records down. On a narrow screen it keeps its place after Photos and location. \"Show more\" appears only when there are more than six similar pieces.
Statistics: the size facet of /identities/stats (bbxX) buckets the largest side of each piece in millimetres (0, 100, 250, 500, 1000, 2000, 5000, 10000 and more); the old edges came from the metre era and put nearly every piece in the last bucket. Pieces without a size are left out instead of counting as the largest.
Write model: creating or changing a version rejects the old inline field geometry.reinforcements; a reinforcement layout is an evidence record.
Security
E-mail verification accepts only the hashed token. The fallback to a token stored in plain text is gone (such tokens expired a day after 0.6.1.1); an account that is still unverified can ask for a new mail.
Dependencies: the frontend lockfile takes undici 7.30.1 and fast-uri 3.1.9 (one high, two medium and two low advisories; both come only through the development tool shadcn, the production install was not affected). The local import scripts move to Pillow 13.0.0.
Server notes
No step needed: no new setting, collection or index.
In claude.ai the connector can be renamed to \"Catalog of Second Chances\" (Settings, Connectors); the name the server gives itself is shown when it is added again.
",
"creators": [
{
"name": "Eschenbach, Max Benjamin",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31eb3f49..3d43c277 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,60 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.6.4.1] - 2026-10-27
+
+Hardening: the MCP connector, the component page and dependencies.
+
+### Added
+
+- **Search by evidence method:** the catalog list takes `evidence_method=` (one name of the
+ evidence vocabulary, an unknown name is a 422) and keeps only pieces with at least one
+ published, current record of that method, for example `reinforcement_layout` for the pieces
+ with a reinforcement layout. It combines with every other filter, also with fit and near. The
+ MCP tools `search_components`, `catalog_overview` and `similar_components` take it as
+ `has_evidence`. A filter in Browse follows later.
+- **A reinforcement layout in the viewer:** the card of a reinforcement layout in the evidence
+ list has "Show in viewer", for every status, so a submitted draft can be seen before it is
+ published. The viewer opens the version the bars belong to and draws that layout on top of the
+ published ones, which turn faint; the legend names it with its status, and an x takes it out
+ again. The link can be sent on: whoever may not see the record gets a short note and no bars.
+
+### Changed
+
+- **MCP connector:** the server introduces itself as the Catalog of Second Chances, with a link to
+ the website and an icon, and its instructions tell a chat to use these tools for reused building
+ components before a web search (in English and German). Every tool has a title and is marked
+ read-only, and the descriptions name the evidence methods.
+- **MCP, reinforcement:** `get_component` and `get_version` count the reinforcement layouts of the
+ version from its evidence records (records, bars, diameters) instead of the old inline field,
+ which always gave 0. In `get_evidence` a layout record carries a summary of its bars, and
+ `performed_by` shows the organization.
+- **Similar pieces:** on a wide screen the card sits in the left rail below Provenance, with
+ smaller tiles, three to a row, so it no longer pushes the evidence records down. On a narrow
+ screen it keeps its place after Photos and location. "Show more" appears only when there are
+ more than six similar pieces.
+- **Statistics:** the size facet of `/identities/stats` (`bbxX`) buckets the largest side of each
+ piece in millimetres (0, 100, 250, 500, 1000, 2000, 5000, 10000 and more); the old edges came
+ from the metre era and put nearly every piece in the last bucket. Pieces without a size are
+ left out instead of counting as the largest.
+- **Write model:** creating or changing a version rejects the old inline field
+ `geometry.reinforcements`; a reinforcement layout is an evidence record.
+
+### Security
+
+- **E-mail verification** accepts only the hashed token. The fallback to a token stored in plain
+ text is gone (such tokens expired a day after 0.6.1.1); an account that is still unverified can
+ ask for a new mail.
+- **Dependencies:** the frontend lockfile takes `undici` 7.30.1 and `fast-uri` 3.1.9 (one high, two
+ medium and two low advisories; both come only through the development tool `shadcn`, the
+ production install was not affected). The local import scripts move to Pillow 13.0.0.
+
+### Server notes
+
+- No step needed: no new setting, collection or index.
+- In claude.ai the connector can be renamed to "Catalog of Second Chances" (Settings, Connectors);
+ the name the server gives itself is shown when it is added again.
+
## [0.6.4.0] - 2026-10-23
Search and the location map.
diff --git a/README.md b/README.md
index 5ab02022..f90a21c3 100644
--- a/README.md
+++ b/README.md
@@ -29,8 +29,8 @@ framework
## Current Versions
-- **CSC**: 0.6.4.0 --- backend, web frontend and Grasshopper interface are released together
- under one version (tag `v0.6.4.0`); the single source is the `VERSION` file.
+- **CSC**: 0.6.4.1 --- backend, web frontend and Grasshopper interface are released together
+ under one version (tag `v0.6.4.1`); the single source is the `VERSION` file.
See `CHANGELOG.md` for release notes.
@@ -548,15 +548,18 @@ sent back to) before you press Allow, and press Deny when it is not the tool you
just connected.
**What it can do.** Ten read-only tools: `search_components` (the filters of
-Browse, a page at a time), `catalog_overview` (how many pieces, counted by
-material, original function, dataset, shape class and circulation, the range of
-each sorted side in millimetres, and how many have a location; it takes the same
-filters), `get_component`, `list_versions`, `get_version` (geometry as counts
-and a link, never the meshes), `get_evidence`, `list_datasets`, `get_dataset`,
-`get_timeline` and `similar_components` (the pieces nearest in shape over the
-whole descriptor, not on the two-dimensional similarity map, with their distance
-in standardised units; it takes the same filters, which apply before the
-ranking). Every answer
+Browse and `has_evidence`, which keeps only pieces with a published, current
+record of one evidence method, for example `reinforcement_layout` for "with
+reinforcement", a page at a time), `catalog_overview` (how many pieces, counted
+by material, original function, dataset, shape class and circulation, the range
+of each sorted side in millimetres, and how many have a location; it takes the
+same filters), `get_component` (with the reinforcement layouts of the current
+version as counts), `list_versions`, `get_version` (geometry as counts and a
+link, never the meshes; the reinforcement layouts of the version as counts),
+`get_evidence`, `list_datasets`, `get_dataset`, `get_timeline` and
+`similar_components` (the pieces nearest in shape over the whole descriptor, not
+on the two-dimensional similarity map, with their distance in standardised
+units; it takes the same filters, which apply before the ranking). Every answer
carries the web link of the record, and a record that is not public is marked
(`visibility` private, `status` other than published). There are no write tools
and no tool for users, invitations or tokens; no answer holds an e-mail address
diff --git a/VERSION b/VERSION
index 31d34d20..f4362155 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.6.4.0
+0.6.4.1
diff --git a/docs/adr/DESIGN_DECISIONS.md b/docs/adr/DESIGN_DECISIONS.md
index ee0dbe0e..a73aff43 100644
--- a/docs/adr/DESIGN_DECISIONS.md
+++ b/docs/adr/DESIGN_DECISIONS.md
@@ -308,9 +308,11 @@ into one **metadata object**.
| 8.171 | **Location map: Leaflet with the tiles of openstreetmap.de** (user 2026-10-22; 0.6.4 (c), amends 8.164). Leaflet and `leaflet.markercluster` come from npm and are bundled with the web app (no CDN, the script rules of the CSP unchanged). The basemap is `https://tile.openstreetmap.de/{z}/{x}/{y}.png` of FOSSGIS e.V. (Germany), keyless, with the attribution to OpenStreetMap contributors and FOSSGIS. The CSP adds `https://tile.openstreetmap.de` to `img-src`, nothing else. Only the location map page loads tiles; the privacy page names FOSSGIS e.V. as the receiver of the visitor's IP address when that page is opened. The page (user 2026-10-22): the filter bar of Browse with its state in the URL and a "Show as list" link to Browse with the same filters; the Current / Origin layer switch (8.170) with clustered markers that show a count; colour-by and legend shared with the Similarity Map (`lib/mapColors`); a click on a marker opens the shared preview panel; a click on an empty spot offers "Search near here", which opens Browse with the Near filter set; visibility as on Browse. Amended by 8.176. | Same choice as the ReCreate digital map of precast concrete systems (D1.1, https://doi.org/10.5281/zenodo.19492868): a self-hosted Leaflet with an EU tile server. Rejected: MapLibre with self-hosted PMTiles (no third party at all, but some GB of extract on the server and about a day more); the public `tile.openstreetmap.org` of the OpenStreetMap Foundation (UK; light use only). The traffic of the map page stays light, within the fair use of the FOSSGIS servers. The privacy page change goes into the legal check of the privacy page that is pending with the university's data protection office. |
| 8.172 | **Invite-only registration, and the open domains named instead of TU Darmstadt** (user 2026-10-22; 0.6.4, amends 8.14). (a) `CSC_OPEN_REGISTRATION_DOMAINS` without a domain means invite only: the default becomes empty instead of `tu-darmstadt.de`, so an empty or missing variable no longer brings an open domain back (until now `env_ignore_empty` let an empty value fall back to the default, and only a value such as `,` closed registration). (b) A public endpoint tells the web app the open domains (an empty list = invite only); the domains are not secret. (c) With no open domain the register page is an invite-only page: it says registration is by invitation only (ask a dataset moderator), and the registration form shows only with an invitation code (from the link `?code=...` or typed in); nothing suggests open registration, and the "Register" links in the sign-in form and the sidebar lead to that page in words that fit (for example "Have an invitation?"). (d) With open domains the current register page stays, but its texts no longer name TU Darmstadt: "Registration is open only to addresses of certain domains", with a question-mark tooltip (hover and tap) that lists the domains currently set; the invitation code field is labelled for addresses outside those domains. (e) The placeholders with a TU Darmstadt address on the register and verification-pending pages become neutral (`name@example.org`); the admin users page names the open domains or "invite only". Default confirmed (user 2026-10-22): empty, invite only unless the variable is set; the 0.6.4 release steps name setting it in the production backend environment. | The setting can now be closed by emptying it, as one would expect. Release step for the maintainer: production keeps open registration only if `CSC_OPEN_REGISTRATION_DOMAINS` is set explicitly in the backend environment before the deploy; without it production becomes invite only. |
| 8.173 | **Sorting: volume, distance and match** (user 2026-10-22; 0.6.4 (d)). The list gains three sort keys: `volume` (the product of the three `bbx` sides), `distance` (only while a near search is set, 8.170) and `match` (only while a dimension search is set, 8.169: closest first for *about this size*, least waste first for *can hold*). A dimension search sorts by `match` by default, a near search by `distance`; with both, the dimension search filters and `distance` sorts; any other sort stays one choice away. The web keeps the sortable table headers and gives the card view a sort menu with the same keys. MCP `search_components` gets `sort` (`catalog_number`, `date`, `created`, `volume`, `distance`, `match`) and `order` (`asc` or `desc`). Overview (user 2026-10-22): an MCP tool `catalog_overview` on `GET /identities/stats` as the token's owner, with the filters of `search_components`; it returns the total, counts by material (with labels), function, dataset, shape class and circulation, the range (smallest and largest) of each sorted side, and how many pieces have a current and an origin location; the answer says how many of the counted pieces are not public. | Until now MCP always sorted by catalog number, and the card view had no sort. A piece without `bbx` sorts last under `volume`. |
-| 8.174 | **True similarity: kNN on the descriptors, behind a retrieval check** (user 2026-10-22; 0.6.4 (e)). Similarity is the distance in the full descriptor space, not on the 2D map: the bases of the Similarity Map (`radial_signature` by default, `scalars`, `hks`), each dimension standardised over the catalog, a NumPy kNN over a cached feature matrix rebuilt by the same cron as the map cache. MCP `similar_components` switches to it: a `basis` parameter, the descriptor distance per result, and the filters of `search_components` including the dimension and near search ("similar in shape, can hold 1200 x 600 x 200, within 50 km"). The component page gets a "Similar pieces" card with the 6 nearest visible pieces (thumbnails) and a link to more. Stop point: before the card ships the implementer checks the neighbours of a few pieces of every dataset by eye and reports them; if they do not look right, only MCP gets the kNN. Visibility as on Browse. Grasshopper (user 2026-10-22): the kNN search is also exposed in Grasshopper, through a REST endpoint that the MCP tool and the GH client share; the GH component is grilled before its task. GH components (user 2026-10-22; T6, after T4): a new `FetchSimilarComponents` in "2 Catalog Interface" (inputs `IdentityID`, `Basis` default `radial_signature`, `Count` default 10, and optionally the filters of `FetchFilteredComponents`; outputs `ComponentPassport` and `Distance` in the same order); `FetchFilteredComponents` gains the dimension search (mode, size, tolerance) and the near search (point, layer, radius) so it keeps mirroring the web filter menu, with the deviation or distance per result. The changed user objects need the maintainer's export in Rhino 8 and `bump-version --gh`; the Session is unchanged; the server is deployed before users run `CSC_Update`. Amended (user 2026-10-22, after the T4 check): instead of a link to more, the card has a "Show more" button that loads up to 24 nearest pieces into the card and a "Show fewer" button that returns to 6, since no list sorts by similarity. Near-identical pieces of a series (the SAS bricks, same size to 0.1 mm, distance rounding to 0.00) stay separate tiles: for a piece of a series its siblings are the honest answer. | Until now `similar_components` ranked by the distance on the cached UMAP layout, which distorts distances. About 2300 pieces keep a query in milliseconds without Atlas Vector Search. The same retrieval rule as for HKS v2 in 0.6.7; HKS gains from this kNN later. |
+| 8.174 | **True similarity: kNN on the descriptors, behind a retrieval check** (user 2026-10-22; 0.6.4 (e)). Similarity is the distance in the full descriptor space, not on the 2D map: the bases of the Similarity Map (`radial_signature` by default, `scalars`, `hks`), each dimension standardised over the catalog, a NumPy kNN over a cached feature matrix rebuilt by the same cron as the map cache. MCP `similar_components` switches to it: a `basis` parameter, the descriptor distance per result, and the filters of `search_components` including the dimension and near search ("similar in shape, can hold 1200 x 600 x 200, within 50 km"). The component page gets a "Similar pieces" card with the 6 nearest visible pieces (thumbnails) and a link to more. Stop point: before the card ships the implementer checks the neighbours of a few pieces of every dataset by eye and reports them; if they do not look right, only MCP gets the kNN. Visibility as on Browse. Grasshopper (user 2026-10-22): the kNN search is also exposed in Grasshopper, through a REST endpoint that the MCP tool and the GH client share; the GH component is grilled before its task. GH components (user 2026-10-22; T6, after T4): a new `FetchSimilarComponents` in "2 Catalog Interface" (inputs `IdentityID`, `Basis` default `radial_signature`, `Count` default 10, and optionally the filters of `FetchFilteredComponents`; outputs `ComponentPassport` and `Distance` in the same order); `FetchFilteredComponents` gains the dimension search (mode, size, tolerance) and the near search (point, layer, radius) so it keeps mirroring the web filter menu, with the deviation or distance per result. The changed user objects need the maintainer's export in Rhino 8 and `bump-version --gh`; the Session is unchanged; the server is deployed before users run `CSC_Update`. Amended (user 2026-10-22, after the T4 check): instead of a link to more, the card has a "Show more" button that loads up to 24 nearest pieces into the card and a "Show fewer" button that returns to 6, since no list sorts by similarity. Near-identical pieces of a series (the SAS bricks, same size to 0.1 mm, distance rounding to 0.00) stay separate tiles: for a piece of a series its siblings are the honest answer. Amended (user 2026-10-27, 0.6.4.1): the card took too much room next to the records. On a wide screen it sits in the left rail below Provenance, with smaller tiles (three to a row, a lower preview, the name and one line); on a narrow screen it keeps its place in the order, after Photos and location. | Until now `similar_components` ranked by the distance on the cached UMAP layout, which distorts distances. About 2300 pieces keep a query in milliseconds without Atlas Vector Search. The same retrieval rule as for HKS v2 in 0.6.7; HKS gains from this kNN later. |
| 8.175 | **Vertex colours from the texture when a mesh is staged** (user 2026-10-22; added to 0.6.4). When CreateComponentIdentity or CreateComponentSnapshot stages a mesh, it computes vertex colours from the texture of the mesh, so a textured scan keeps its look in the Preview, Reduced and Original files. The texture comes only from the render material of the Rhino object the Geometry input references; there is no extra input. Precedence (user 2026-10-22): the texture wins over vertex colours the mesh already has; the component says in a remark that it replaced them. Sampling (user 2026-10-22): bilinear at each vertex's texture coordinate; the Preview, Reduced and Original levels are each coloured from their own texture coordinates. Build (user 2026-10-22): part of T6, the Grasshopper task after T4, so one Rhino 8 export and one `bump-version --gh` cover both. | Until now staging kept only a mesh's own vertex colours (`export_mesh` in `csc_gh/rhino.py`) and ignored textures: a textured scan was staged in the flat piece colour. A Grasshopper mesh carries its texture coordinates but not the image; the image belongs to the material of the Rhino object, reachable only while the input references that object. An internalised or Grasshopper-made mesh therefore keeps the old behaviour. |
| 8.176 | **Privacy and imprint: the maintainer is the controller; no Google map preview** (user 2026-10-23; added to 0.6.4, amends 8.164 and 8.171). The privacy page and the imprint state that the catalog, part of a doctoral project at the DDU of TU Darmstadt, is run by the maintainer in person, who alone is the controller; TU Darmstadt does not operate the site and is not responsible for it. The hover preview of a location in the Browse table, an embedded Google map, is removed; the location stays a link that opens Google Maps in a new tab only on a click. With no Google frame left, the CSP drops its `frame-src` hosts. The cookies row no longer claims that nothing is loaded from other sites (the Location Map loads tiles from FOSSGIS, 8.171), and the imprint cites the DDG instead of the repealed TMG. | The embedded map sent every visitor who pointed at a location to Google (Ireland and USA) without a click and was not named on the privacy page; in Germany such an embed is widely held to need consent first. The Location Map (8.171) now covers seeing pieces on a map, so the only third party a visitor reaches without a click is the tile server of FOSSGIS, on that page. |
+| 8.177 | **Search by evidence method** (user 2026-10-27; 0.6.4.1). The catalog list takes `evidence_method=` (one name of the evidence vocabulary; an unknown name is a 422): only pieces with at least one published, current evidence record of that method are listed (current: not superseded by a later record, `superseded_by` empty; user 2026-10-27). It combines with every other filter, also with fit and near. The MCP tools `search_components`, `catalog_overview` and `similar_components` take it as `has_evidence`. The match runs on the identity: the ids come from the evidence collection (status `published`, not superseded, the method), which has an index on status and method; the access of the list to the pieces stays as it is. A filter in Browse follows later. | Asking for pieces "with reinforcement" took one `get_evidence` call per piece (chat report, 2026-10-27). `properties.rebar_diameter` is no substitute: an archival claim sets it without any bars. A general method filter serves every method, not only `reinforcement_layout`. |
+| 8.178 | **A reinforcement layout in the viewer, whatever its status** (user 2026-10-27; 0.6.4.1). The card of a `reinforcement_layout` record in the evidence list has "Show in viewer". It opens the component page on `?snapshot=&layout=`: the viewer shows the version the bars belong to and draws that one record in addition to the published layouts, whatever its status (draft, pending, rejected, superseded, published). The legend names the record and its status, and its bars stand out from the others. The server decides who may load the record, as for any record (7.0); a link to a record the caller may not see draws nothing more and says so. Without `layout=` the viewer stays as it is: published layouts only. Only reinforcement layouts for now; the same link for other positioned records later, if needed. | A submitted draft layout could be read as a card but not seen: the viewer draws published layouts only, while a draft version of a piece opens in the viewer through `?snapshot=`. A global "Show drafts" toggle was rejected: it mixes moderation states into the view of the piece, cannot tell several drafts apart, and would have to cover marks and versions too. One record per link can be sent to a moderator for review. |
**Facts confirmed (user, 2026-09-28):** the 35 ZirKuS reinforcement bars were modelled after the
original drawing --> `basis: drawing` (step 6d). The 2024-07-24 deinstallation applies to all 16
diff --git a/docs/adr/IMPLEMENTATION_PLAN_0.6.md b/docs/adr/IMPLEMENTATION_PLAN_0.6.md
index 914fab8c..0315d71f 100644
--- a/docs/adr/IMPLEMENTATION_PLAN_0.6.md
+++ b/docs/adr/IMPLEMENTATION_PLAN_0.6.md
@@ -980,11 +980,17 @@ fold (once it is clear which quantities are searched); Atlas Search for typo-tol
**0.6.4 decided (grilling from 2026-10-21):** (a) dimensions (8.169): two modes on the sorted sides of the current `bbx`, *about this size* (within a tolerance, closest first by the largest relative deviation) and *can hold this size* (every side at least the asked one, least waste first); the per-axis filters and `bbx` sorts stay. Tolerance: one per query, mm or %, default 10 %. Web: a "Fits" section in Browse's "More filters" (size in any order, mode, tolerance), the list sorted by the match with deviation or waste per row, state in the URL. MCP: `fit_mode`, `size_mm`, `tolerance` on `search_components`, no `find_fitting` tool. (b) and (c) location (8.170): the current and the origin location both as GeoJSON points with a `2dsphere` index each; near search names which one; the map has both as layers, Current by default; filling in origin coordinates is a separate data task. Web: latitude and longitude of the origin place editable in the origin form (a pasted "lat, lon" accepted). Map (8.171): Leaflet and `leaflet.markercluster` bundled from npm, tiles from `tile.openstreetmap.de` (FOSSGIS e.V.), CSP `img-src` plus that host, one paragraph on the privacy page. Near: `near_lat`, `near_lon`, `near_layer`, `radius_km` on `search_components` (no `find_near`), a "Near" section in Browse (point, layer, radius; "Near this piece" from a component page), sorted by distance. Registration (8.172, added by the user): an empty `CSC_OPEN_REGISTRATION_DOMAINS` (the new default) means invite only, with an invite-only register page; with domains set the register page says it is open to certain domains and lists them in a tooltip; no TU Darmstadt texts or placeholders. Map page: Browse's filter bar (URL state, "Show as list"), layer switch, clusters with counts, colour-by and legend of the Similarity Map, marker click opens the preview panel, empty-spot click offers "Search near here". (d) Sorting (8.173): keys `volume`, `distance`, `match`; Fits sorts by match, Near by distance, both: distance; a sort menu in the card view; `sort` and `order` on `search_components`. Overview: MCP `catalog_overview` (stats with the search filters: total, counts by material, function, dataset, shape class, circulation, side ranges, location coverage, non-public count). (e) Similarity (8.174): kNN on the standardised descriptors (basis `radial_signature` by default), `similar_components` with `basis` and the search filters, a "Similar pieces" card behind a retrieval check. Build order (user 2026-10-22): the registration task (8.172) first as hardening, then dimensions and sorting, location, the location map, overview and similarity; the kNN search also in Grasshopper. T6 (GH, after T4): `FetchSimilarComponents` (IdentityID, Basis, Count, filters; ComponentPassport, Distance) and Fit and Near in `FetchFilteredComponents`. Waste share (8.169, user 2026-10-22): at most 99 % unless exactly 100 %. Vertex colours from the texture (8.175, added by the user 2026-10-22): the Create components compute vertex colours from the texture of the referenced Rhino object's render material when they stage a mesh; no extra input. The texture wins over existing vertex colours, with a remark. Bilinear sampling at each vertex's texture coordinate, each level from its own coordinates. Built inside T6 (one Rhino 8 export, one `bump-version --gh`). Coordinate boxes (8.170 amended, user 2026-10-22): one shared latitude and longitude pair in every location form, a pasted pair fills both, a comma jumps to longitude, no separate paste field. Similar pieces card (8.174 amended): "Show more" up to 24 in the card with "Show fewer"; series siblings stay separate tiles. Privacy and imprint (8.176, user 2026-10-23): the maintainer is the controller, TU Darmstadt is not; the Google map hover preview in Browse goes (the link stays), the CSP drops frame-src; cookies row corrected; imprint on the DDG.
+**0.6.4.1 --- hardening (user 2026-10-27, before 0.6.5):** first the MCP connector, from two chat reports. (a) Search by evidence method (8.177): `evidence_method` on the catalog list, `has_evidence` on the MCP search tools; Browse later. (b) Recognizable connector: instructions that name the domain in English and German (reused and salvaged building components, Bauteile, Wiederverwendung, concrete walls and beams, reinforcement / Bewehrung) and say to use these tools before a web search for such pieces; `website_url` and `icons` on the server; a title and `readOnlyHint` on every tool; tool descriptions that name the evidence methods. (c) The geometry summary drops the `reinforcements` count (always 0 since step 6d moved the bars to evidence, 7.8) and gains the reinforcement layouts of the version (records and bars) with a pointer to `get_evidence`. (d) The evidence list rows of a `reinforcement_layout` carry the bar count, basis, specs, diameters and cover; `performed_by` shows an organization instead of `null`. (e) The write model no longer accepts `geometry.reinforcements` (7.8). (b) to (e) confirmed by the user 2026-10-27; the server icon is the web app's `favicon.ico` until there is a CSC logo. (f) The "Similar pieces" card (8.174 amended): in the left rail on a wide screen, smaller tiles. (g) The `bbx` facet of `/identities/stats` buckets the largest side with edges from the metre era (0 to 1000, then ">=1000"), so in millimetres nearly every piece lands in the last bucket: edges in millimetres instead (for example 100, 250, 500, 1000, 2000, 5000, 10000), checked against the analytics page. (h) The Similar pieces card offers "Show more" only when the first answer says there are more than 6 neighbours, not when there are exactly 6. (g) and (h) added by the user 2026-10-27. (i) Frontend advisories: `undici` (high, fixed in 7.30.1) and `fast-uri` (two medium, two low, fixed in 3.1.9) come only through `shadcn`, the component generator, which is a `devDependency` already; the lockfile takes the fixed versions. (j) The import scripts (`scripts/import/requirements-import.txt`) move to Pillow 13.0.0 (20 alerts); they run locally, the accepted risk of the backend pin stays as it is. (k) E-mail verification drops the fallback to a token stored in plain text (the TODO for 0.6.2 in `auth.py`; such tokens expired 24 hours after 0.6.1.1). (i) to (k) added by the user 2026-10-27. (e) stays with `geometry.reinforcements` only (user 2026-10-27): `geometry.marker_points` is still written by the robot rubble scan pipeline, which is not in use now; both go to the backlog below. (l) Seven tests in `tests/grasshopper` hard-code the client `gh-userobjects/0.6.3.0` and fail since the version bump of 0.6.4.0 (CI does not run `tests/grasshopper`): they read the expected client from the `CSC_CLIENT` line of `DDU_CSC_Session.py` and check that it is not newer than `VERSION` (the rule of `check_version.py`), so a bump with or without `--gh` no longer breaks them; found during T1, built with T3 and a fix round after the bump. (m) "Show in viewer" on the card of a reinforcement layout (8.178, user 2026-10-27): the viewer draws that one record on its version whatever its status, so a submitted draft can be seen and checked; built as T4.
+
**0.6.5 --- reinforcement from Grasshopper (about 6--8 days; moved from 0.6.4 by the user 2026-10-21):** (a) units
in GH: every component scales by the document unit (a prerequisite for placing scans); (b) RL8, a GH builder
for the `rebar_spec` claim and its display, grilled together with (c); (c) Ferroscan to reinforcement layout,
parts (a) report reader, detection, placement and a draft through `AddEvidence`, (b) the report image and PDF
-as attachments, (d) several scans of one face; (c) "the image in 3D" later.
+as attachments, (d) several scans of one face; (c) "the image in 3D" later. (e) `ApplyFrame` stays as it
+is (user 2026-10-27): its `Frame` output is the frame used, in the stored coordinates (where the piece
+sat before the move), not the frame of the moved piece. The descriptions of the component and of the
+output say so plainly and point to `DisassembleComponent`, whose `Frame` applies `csc_placement` and so
+gives the frame where the moved piece sits; exported with the user objects of 0.6.5.
**0.6.6 --- interoperability (about 5--7 days):** the IFC export (`compose?format=ifc`; first the `ifcopenshell`
wheel check for the server, then IFC4 vs IFC4x3 and single piece vs selection); the timeline as PROV-O /
@@ -1005,8 +1011,12 @@ a canvas has the inputs its source declares. The access and the type hint of an
annotation in the source's `RunScript` signature (`FitSize: list[object]` is list access without a type hint), but
`CSC_Update` leaves the inputs of a component already on a canvas as they were, so new inputs are missing there.
+**Later, not yet scheduled --- the robot rubble scan pipeline (user 2026-10-27):** `src/py_modules/csc_robot_rubble_scan_processing` still builds the 0.5 shape (`type`, `assembly`, `processes`, `iframe`) and puts the scan markers into `geometry.marker_points`, which `upload_robot_scan.py` posts unchanged to `POST /identities`. Before it runs again: the 0.6 create request, the markers as `capture.markers` with role `rig` (7.7), a trial upload against the local stack; then the write model rejects `geometry.marker_points`, as it rejects `geometry.reinforcements` since 0.6.4.1.
+
**Outside a release (the maintainer):** the Atlas traffic measurement of 0.6.1.0 (c); the backend CI job back to `ubuntu-latest` once MongoDB
-8.0 starts on the runner's kernel (SERVER-121912).
+8.0 starts on the runner's kernel (SERVER-121912); `shadcn` (dev only) lifted to >=4.22.1 once that
+version is about two weeks old, which clears the six remaining dev findings of `npm audit` (found in the
+review of 0.6.4.1).
**Later or ideas:** the GH sign-in on macOS (Keychain); Ferroscan "the image in 3D"; MCP opened to members
(after 0.6.3.1); the CSC logo and brand, then the logo in mails, Open Graph and the favicon; the partners on
diff --git a/scripts/backup/pull_production.ps1 b/scripts/backup/pull_production.ps1
new file mode 100644
index 00000000..97975c67
--- /dev/null
+++ b/scripts/backup/pull_production.ps1
@@ -0,0 +1,53 @@
+# Pull a backup of production to this computer over ssh.
+#
+# .\scripts\backup\pull_production.ps1 -Server @ -What json
+# the collections as JSON into mongodb_collections_local\
+# .\scripts\backup\pull_production.ps1 -Server @ -What archive -Dest D:\backups
+# mongodump archive (gzip) to \\csc_db_.archive.gz
+# .\scripts\backup\pull_production.ps1 -Server @ -What assets -Dest D:\backups
+# the asset folders as \\csc_assets_.tgz
+#
+# Needs ~/bin/csc_dump.sh on the server (uberspaceconfig/bin/csc_dump.sh).
+# Binary streams go through cmd.exe so PowerShell does not re-encode them.
+
+param(
+ [Parameter(Mandatory = $true)][string]$Server,
+ [Parameter(Mandatory = $true)][ValidateSet('json', 'archive', 'assets')][string]$What,
+ [string]$Dest = ''
+)
+
+$ErrorActionPreference = 'Stop'
+$day = Get-Date -Format yyMMdd
+$repo = Resolve-Path (Join-Path $PSScriptRoot '..\..')
+
+function Pull([string]$remote, [string]$file) {
+ cmd /c "ssh $Server $remote > `"$file`""
+ if ($LASTEXITCODE -ne 0) { throw "ssh failed ($LASTEXITCODE): $remote" }
+ $size = (Get-Item $file).Length
+ if ($size -eq 0) { throw "empty download: $file" }
+ Write-Host "$file ($size bytes)"
+}
+
+if ($What -eq 'json') {
+ $target = Join-Path $repo "mongodb_collections_local\$day"
+ if (Test-Path $target) { throw "$target exists already; move it away first" }
+ New-Item -ItemType Directory -Force $target | Out-Null
+ $tgz = Join-Path $env:TEMP "csc_json_$day.tgz"
+ Pull 'bin/csc_dump.sh json' $tgz
+ tar xzf $tgz -C $target
+ Remove-Item $tgz
+ Get-ChildItem $target | Select-Object Name, Length | Format-Table -AutoSize
+ exit 0
+}
+
+if (-not $Dest) { throw '-Dest is required for archive and assets' }
+$folder = Join-Path $Dest $day
+New-Item -ItemType Directory -Force $folder | Out-Null
+
+if ($What -eq 'archive') {
+ Pull 'bin/csc_dump.sh archive' (Join-Path $folder "csc_db_$day.archive.gz")
+} else {
+ $file = Join-Path $folder "csc_assets_$day.tgz"
+ Pull 'tar czf - -C ~ csc_assets_private html/csc_assets' $file
+ tar tzf $file | Select-Object -First 3
+}
diff --git a/scripts/import/requirements-import.txt b/scripts/import/requirements-import.txt
index 475122f1..f08fea51 100644
--- a/scripts/import/requirements-import.txt
+++ b/scripts/import/requirements-import.txt
@@ -30,7 +30,7 @@ cycler==0.12.1
fonttools==4.67.0
kiwisolver==1.5.1
packaging==26.3
-pillow==12.3.0
+pillow==13.0.0
pyparsing==3.3.3
python-dateutil==2.9.0.post0
six==1.17.0
diff --git a/src/backend/apps/catalog/api/auth.py b/src/backend/apps/catalog/api/auth.py
index cd07ac2d..8eb06cab 100644
--- a/src/backend/apps/catalog/api/auth.py
+++ b/src/backend/apps/catalog/api/auth.py
@@ -395,7 +395,7 @@ async def register_user(
'_id': new_id, 'username': username, 'full_name': full_name,
'email': email, 'hashed_password': get_password_hash(password),
'disabled': False, 'role': 'user', 'email_verified': True,
- 'verification_token': None, 'verification_token_expires': None,
+ 'verification_token_expires': None,
'invitation_id': invitation['_id'],
}
await _insert_account(users, doc)
@@ -451,14 +451,10 @@ async def verify_email(
if not token:
raise HTTPException(400, 'Verification token is required')
- # Find the user by the hash of the token (stored since 0.6.1.1); a token
- # mailed before that is stored as it is and works until it expires, at
- # most 24 hours. TODO 0.6.2: drop the plain-token fallback.
+ # Find the user by the hash of the token; the plain token is never stored
user = await users.find_one({
'verification_token_sha256': token_sha256(token),
})
- if not user:
- user = await users.find_one({'verification_token': token})
if not user:
raise HTTPException(400, 'Invalid or expired verification token')
diff --git a/src/backend/apps/catalog/api/catalog_list.py b/src/backend/apps/catalog/api/catalog_list.py
index 7b49db6f..894c425d 100644
--- a/src/backend/apps/catalog/api/catalog_list.py
+++ b/src/backend/apps/catalog/api/catalog_list.py
@@ -130,11 +130,21 @@ def _format_list_rows(
async def _pipelines_args(request: Request, filters: CatalogFilters,
user: Optional[User]) -> Dict[str, Any]:
"""The filters plus the visibility rule (3.6) for this caller."""
+ identity_match = and_match(
+ filters.identity_match(),
+ await visible_identity_match(request, viewer_of(user)))
+ if filters.evidence_method:
+ # 8.177: the pieces with a published, current record of this method
+ # (not superseded; None matches a missing field too), matched on the
+ # identity (the evidence collection has an index on status and
+ # method); the rest of the match keeps the access rules
+ ids = await request.app.mongodb_component_evidence.distinct(
+ 'identity_id', {'status': 'published', 'superseded_by': None,
+ 'method': filters.evidence_method})
+ identity_match = and_match(identity_match, {'_id': {'$in': ids}})
return {
'snapshots_collection': request.app.mongodb_component_snapshots.name,
- 'identity_match': and_match(
- filters.identity_match(),
- await visible_identity_match(request, viewer_of(user))),
+ 'identity_match': identity_match,
'snapshot_match': filters.snapshot_match(),
'fit_stages': filters.fit_pipeline_stages(),
'near': filters.near,
diff --git a/src/backend/apps/catalog/api/identity_filters.py b/src/backend/apps/catalog/api/identity_filters.py
index bbcfdd62..908cff16 100644
--- a/src/backend/apps/catalog/api/identity_filters.py
+++ b/src/backend/apps/catalog/api/identity_filters.py
@@ -14,6 +14,7 @@
from fastapi import HTTPException, Query
+from ..vocab import EvidenceMethod
from .dimension_fit import (
DEFAULT_TOLERANCE,
FitError,
@@ -85,6 +86,10 @@ class CatalogFilters:
bbx_max_y: Optional[float] = None
bbx_max_z: Optional[float] = None
q: str = ''
+ # evidence method (8.177): only pieces with a published, current evidence
+ # record (not superseded) of this method; the ids come from the evidence collection, see
+ # ``catalog_list._pipelines_args``
+ evidence_method: Optional[str] = None
# dimension search (8.169): the mode, the asked sides (largest first) and
# the tolerance of ``about`` as (``percent`` | ``mm``, value)
fit_mode: Optional[str] = None
@@ -222,6 +227,11 @@ def catalog_filters(
bbx_max_z: Optional[float] = Query(None),
q: str = Query('', max_length=FILTER_MAX_LENGTH,
description='name, catalogue number or id'),
+ evidence_method: Optional[EvidenceMethod] = Query(
+ None, description='only pieces with at least one published, current '
+ 'evidence record of this method (8.177), for example '
+ 'reinforcement_layout; combines with every other '
+ 'filter'),
fit_mode: Optional[FitMode] = Query(
None, description='dimension search (8.169): about = every side '
'within fit_tol of fit_size; can_hold = every side '
diff --git a/src/backend/apps/catalog/api/identity_query.py b/src/backend/apps/catalog/api/identity_query.py
index c744db36..b6fceab4 100644
--- a/src/backend/apps/catalog/api/identity_query.py
+++ b/src/backend/apps/catalog/api/identity_query.py
@@ -225,8 +225,6 @@ def build_count_pipeline(
return pipeline
-_BBX_ARRAY = {'$cond': [{'$isArray': '$bbx'}, '$bbx', []]}
-
_STATS_FACET_TEMPLATE: Dict[str, Any] = {
'total': [{'$count': 'count'}],
'byOriginalFunction': [
@@ -339,22 +337,19 @@ def build_count_pipeline(
}},
],
'bbx': [
- {
- '$project': {
- # a bbx that is no array reads as an empty one: $arrayElemAt
- # fails on it, and one bad document must not 500 the stats
- 'x': {'$arrayElemAt': [_BBX_ARRAY, 0]},
- 'y': {'$arrayElemAt': [_BBX_ARRAY, 1]},
- 'z': {'$arrayElemAt': [_BBX_ARRAY, 2]},
- }
- },
+ # the largest side (``_sides``, sorted largest first, as in the
+ # ``sides`` facet); a piece without three numbers has no size and is
+ # in no bucket, not in the default one
+ {'$match': {'_sides': {'$type': 'array'}}},
{
'$bucket': {
- 'groupBy': '$x',
+ 'groupBy': {'$arrayElemAt': ['$_sides', 0]},
+ # millimetres, as bbx is stored: a bucket is labelled with
+ # its lower edge, the rest is '>=10000'
'boundaries': [
- 0, 0.5, 1, 2, 5, 10, 20, 50, 100, 1000,
+ 0, 100, 250, 500, 1000, 2000, 5000, 10000,
],
- 'default': '>=1000',
+ 'default': '>=10000',
'output': {'count': {'$sum': 1}},
}
},
diff --git a/src/backend/apps/catalog/documents.py b/src/backend/apps/catalog/documents.py
index cd046275..e0b1e29d 100644
--- a/src/backend/apps/catalog/documents.py
+++ b/src/backend/apps/catalog/documents.py
@@ -599,11 +599,25 @@ def _params_and_fit(self) -> 'Proxy':
return self
+# what a write that still sends ``geometry.reinforcements`` is told (7.8)
+REINFORCEMENT_IS_EVIDENCE = (
+ 'geometry.reinforcements is not accepted: reinforcement is evidence, '
+ 'post it as a reinforcement_layout evidence record that names this '
+ 'snapshot in position.snapshot_id (decision 7.8)')
+
+
class Geometry(_Block):
meshes: List[Mesh] = Field(default_factory=list)
point_clouds: List[PointCloud] = Field(default_factory=list)
proxies: List[Proxy] = Field(default_factory=list)
+ @model_validator(mode='before')
+ @classmethod
+ def _reinforcement_is_evidence(cls, data: Any) -> Any:
+ if isinstance(data, dict) and 'reinforcements' in data:
+ raise ValueError(REINFORCEMENT_IS_EVIDENCE)
+ return data
+
@model_validator(mode='after')
def _representation(self) -> 'Geometry':
authored = any(p.fit.method == 'authored' for p in self.proxies)
diff --git a/src/backend/apps/catalog/mcp_server.py b/src/backend/apps/catalog/mcp_server.py
index 8b321938..5d1ae99b 100644
--- a/src/backend/apps/catalog/mcp_server.py
+++ b/src/backend/apps/catalog/mcp_server.py
@@ -32,6 +32,7 @@
from mcp.server.fastmcp.exceptions import ToolError
from mcp.server.fastmcp.server import StreamableHTTPASGIApp
from mcp.server.transport_security import TransportSecuritySettings
+from mcp.types import Icon, ToolAnnotations
from pydantic import AnyHttpUrl, Field
from starlette.middleware.authentication import AuthenticationMiddleware
from starlette.requests import Request
@@ -39,7 +40,12 @@
import limiter as lim
from apps.catalog import access_tokens as tk
from apps.catalog.api.near_search import NearError, parse_near
-from apps.catalog.vocab import ORIGINAL_FUNCTION_LABELS, SHAPE_CLASS_LABELS
+from apps.catalog.vocab import (
+ EVIDENCE_METHOD_LABELS,
+ EVIDENCE_METHODS,
+ ORIGINAL_FUNCTION_LABELS,
+ SHAPE_CLASS_LABELS,
+)
from apps.catalog.internal_call import InternalError, rest_get
from apps.catalog.models import UserInDB
from apps.catalog.oauth_server import AccessTokenVerifier
@@ -53,15 +59,39 @@
_EMAIL = re.compile(r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}')
_DROP_KEYS = {'email', 'etag', 'hashed_password', 'password'}
+# the evidence methods as "name (Label)", one source for the tool texts
+EVIDENCE_METHOD_TEXT = ', '.join(
+ f'{m} ({EVIDENCE_METHOD_LABELS[m]})' for m in EVIDENCE_METHODS)
+
INSTRUCTIONS = (
- 'The Catalog of Second Chances (CSC) describes reused building components '
- '(panels, beams, stones ...) with their shape, origin, versions and '
- 'measurements ("evidence"). These tools only read. You see what the '
- 'signed-in owner of this connection sees on the website. Start with '
- 'search_components, then get_component. Every answer carries a web link '
- 'to give to the user. A record marked visibility "private" or a status '
- 'other than "published" is not public: say so when you quote it. '
- 'Lengths are in millimetres unless a unit is given.')
+ 'The Catalog of Second Chances (CSC) is a catalog of reused and '
+ 'salvaged building components (German: wiederverwendete Bauteile, '
+ 'Wiederverwendung, Bauteilboerse): concrete walls and beams '
+ '(Betonwaende, Traeger), stone, timber and other pieces, each '
+ 'with its shape, origin, versions and measurements ("evidence"). Use '
+ 'these tools before a web search when the user looks for such pieces, '
+ 'for example "Betontraeger mit Bewehrung" or reused beams with '
+ 'reinforcement (Bewehrung): search_components with the filters below, '
+ 'and has_evidence=reinforcement_layout for "with reinforcement". '
+ 'These tools only read. You see what the signed-in owner of this '
+ 'connection sees on the website. Start with search_components, then '
+ 'get_component. Every answer carries a web link to give to the user. A '
+ 'record marked visibility "private" or a status other than "published" '
+ 'is not public: say so when you quote it. Lengths are in millimetres '
+ 'unless a unit is given.')
+
+GET_EVIDENCE_TEXT = (
+ 'Measurements and other evidence about a component. The methods are: '
+ + EVIDENCE_METHOD_TEXT + '. A list gives short rows: method, source '
+ 'tier, when observed, who performed it, summary, status, verification; '
+ 'a reinforcement_layout row also gives a summary of its bars (count, '
+ 'basis, specs, diameters, cover, the version it refers to). Filter with '
+ 'method. Pass evidence_id for one record in full, with its payload (the '
+ 'bars of a layout).')
+
+# every tool reads, never writes, and never reaches outside the catalog
+READ_ONLY = ToolAnnotations(readOnlyHint=True, idempotentHint=True,
+ openWorldHint=False)
# ANSWERS -----------------------------------------------------------------------
@@ -165,10 +195,65 @@ def geometry_summary(geometry: Optional[dict]) -> dict:
'mesh_faces': sum(len(m.get('faces') or []) for m in meshes),
'point_clouds': len(geometry.get('point_clouds') or []),
'proxies': len(geometry.get('proxies') or []),
- 'reinforcements': len(geometry.get('reinforcements') or []),
'note': 'Geometry is not sent; open the web link to see it.'}
+def layout_bars(record: dict) -> list:
+ """The bars of a ``reinforcement_layout`` record, as dicts."""
+ bars = (record.get('payload') or {}).get('bars') or []
+ return [b for b in bars if isinstance(b, dict)]
+
+
+def layouts_of_version(rows: list, snapshot_id: Optional[str]) -> dict:
+ """The reinforcement of one version, from the published
+ ``reinforcement_layout`` evidence that names it in ``position.snapshot_id``
+ (decision 7.8: the bars are evidence, not geometry): how many records and
+ how many bars, and where to read them."""
+ records = [r for r in rows or []
+ if isinstance(r, dict)
+ and r.get('method') == 'reinforcement_layout'
+ and r.get('status') == 'published'
+ and (r.get('position') or {}).get('snapshot_id') == snapshot_id]
+ return {
+ 'records': len(records),
+ 'bars': sum(len(layout_bars(r)) for r in records),
+ 'note': 'get_evidence with method=reinforcement_layout lists the '
+ 'layouts of the component; pass an evidence_id for the '
+ 'bars of one.'}
+
+
+def layout_summary(record: dict) -> dict:
+ """A reinforcement layout in one row: the number of bars, the basis, the
+ steel specs, the distinct diameters in mm, the cover range when known and
+ the version the bars refer to."""
+ bars = layout_bars(record)
+ covers = [b['cover_mm'] for b in bars
+ if isinstance(b.get('cover_mm'), (int, float))]
+ summary = {
+ 'bars': len(bars),
+ 'basis': (record.get('payload') or {}).get('basis'),
+ 'specs': sorted({b['spec'] for b in bars if b.get('spec')}),
+ 'diameters_mm': sorted({b['diameter_mm'] for b in bars
+ if isinstance(b.get('diameter_mm'),
+ (int, float))}),
+ 'version_id': (record.get('position') or {}).get('snapshot_id')}
+ if covers:
+ summary['cover_mm'] = {'min': min(covers), 'max': max(covers)}
+ return summary
+
+
+def performers(record: dict) -> list:
+ """Who did the work: a person's name, else the organization; an actor
+ with neither is left out (never ``null``)."""
+ names = []
+ for actor in record.get('performed_by') or []:
+ if isinstance(actor, dict):
+ name = actor.get('name') or actor.get('organization')
+ if name:
+ names.append(name)
+ return names
+
+
def limited(answer: dict) -> dict:
"""A cap on the size of one answer, said in the answer: the longest list
is halved until the answer fits."""
@@ -215,6 +300,11 @@ def size() -> int:
'pending and other states you may see.'))]
WithdrawnArg = Annotated[bool, Field(description=(
'Also withdrawn components, if you may see them.'))]
+HasEvidenceArg = Annotated[str, Field(description=(
+ 'Only components with at least one published, current evidence record '
+ 'of this method: ' + EVIDENCE_METHOD_TEXT + '. Use reinforcement_layout for '
+ '"with reinforcement" (Bewehrung); it combines with every other '
+ 'filter. Leave empty for all.'))]
FitModeArg = Annotated[str, Field(description=(
'Search by size, with size_mm: about = every side within the '
'tolerance of the asked side (which pieces are about this '
@@ -247,14 +337,17 @@ def size() -> int:
def search_params(*, query: str, original_function: str, material: str,
dataset: str, shape_class: str, circulation: str,
- status: str, include_withdrawn: bool, fit_mode: str,
- size_mm: Optional[list], tolerance: str,
+ status: str, include_withdrawn: bool, has_evidence: str,
+ fit_mode: str, size_mm: Optional[list], tolerance: str,
near_lat: Optional[float], near_lon: Optional[float],
near_layer: str, radius_km: Optional[float]
) -> Tuple[dict, dict, dict]:
"""The REST filters of one search (the list, count, stats and similar
routes read the same names), the fit part and the near part of it. A
combination the routes would refuse is a ToolError in words."""
+ if has_evidence and has_evidence not in EVIDENCE_METHODS:
+ raise ToolError('has_evidence is one of '
+ + ', '.join(EVIDENCE_METHODS) + '.')
fit = {}
if fit_mode or size_mm or tolerance:
if fit_mode not in FIT_MODES:
@@ -278,7 +371,7 @@ def search_params(*, query: str, original_function: str, material: str,
'material': material, 'dataset': dataset,
'shape_class': shape_class, 'circulation': circulation,
'status': status, 'include_withdrawn': include_withdrawn or None,
- **fit, **near}
+ 'evidence_method': has_evidence, **fit, **near}
return filters, fit, near
@@ -287,6 +380,9 @@ def build_mcp(app, frontend_url: str) -> FastMCP:
web = frontend_url.rstrip('/')
mcp = FastMCP(
'Catalog of Second Chances', instructions=INSTRUCTIONS,
+ website_url=web,
+ icons=[Icon(src=f'{web}/favicon.ico', mimeType='image/x-icon',
+ sizes=['any'])],
stateless_http=True, json_response=True,
streamable_http_path='/mcp',
transport_security=TransportSecuritySettings(
@@ -329,7 +425,7 @@ def page_args(page: int, size: int):
return max(1, page), min(max(1, size), PAGE_MAX)
# 1 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Search reused building components', annotations=READ_ONLY)
async def search_components(
query: QueryArg = '',
original_function: FunctionArg = '',
@@ -339,6 +435,7 @@ async def search_components(
circulation: CirculationArg = 'active',
status: StatusArg = 'published',
include_withdrawn: WithdrawnArg = False,
+ has_evidence: HasEvidenceArg = '',
fit_mode: FitModeArg = '',
size_mm: SizeArg = None,
tolerance: ToleranceArg = '',
@@ -364,14 +461,17 @@ async def search_components(
visibility) with its web link, and the total. With fit_mode and
size_mm each row also carries its deviation (about, in per cent) or
waste (can_hold, in m3 and in per cent of the piece); with near_lat
- and near_lon each row carries its distance_km. Use get_component for
- the details of one."""
+ and near_lon each row carries its distance_km. has_evidence keeps
+ only components with a published, current evidence record of one
+ method, for example reinforcement_layout for "with reinforcement". Use
+ get_component for the details of one."""
page, size = page_args(page, size)
filters, fit, near = search_params(
query=query, original_function=original_function,
material=material, dataset=dataset, shape_class=shape_class,
circulation=circulation, status=status,
- include_withdrawn=include_withdrawn, fit_mode=fit_mode,
+ include_withdrawn=include_withdrawn, has_evidence=has_evidence,
+ fit_mode=fit_mode,
size_mm=size_mm, tolerance=tolerance, near_lat=near_lat,
near_lon=near_lon, near_layer=near_layer, radius_km=radius_km)
sort = sort or ('distance' if near
@@ -399,16 +499,19 @@ async def search_components(
for r in rows]})
# 2 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Get one component', annotations=READ_ONLY)
async def get_component(
component_id: Annotated[str, Field(description=(
'The component id (a UUID) from search_components.'))],
) -> dict:
"""One component: what it is, where it comes from, how it left
circulation, its derived properties with confidence, its current
- version in short, and links. Geometry is a summary only."""
+ version in short (with the count of its reinforcement layouts and
+ bars), and links. Geometry is a summary only."""
passport = await get(f'/identities/{component_id}/compose')
versions = await get(f'/identities/{component_id}/snapshots')
+ layouts = await get(f'/identities/{component_id}/evidence',
+ {'method': 'reinforcement_layout'})
identity = passport.get('identity') or {}
snapshots = passport.get('snapshots') or []
current = next((s for s in snapshots
@@ -450,14 +553,16 @@ async def get_component(
'quantity': current.get('quantity'),
'effective_from': current.get('effective_from'),
'location': current.get('location'),
- 'geometry': geometry_summary(current.get('geometry'))},
+ 'geometry': geometry_summary(current.get('geometry')),
+ 'reinforcement_layouts': layouts_of_version(
+ layouts, current.get('_id'))},
'version_count': len(versions),
'web_link': link_component(identity.get('_id') or component_id),
'next': ('list_versions, get_evidence and get_timeline take '
'this id.')}))
# 3 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='List the versions of a component', annotations=READ_ONLY)
async def list_versions(
component_id: Annotated[str, Field(description='The component id.')],
) -> dict:
@@ -480,16 +585,20 @@ async def list_versions(
for r in rows]}))
# 4 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Get one version of a component', annotations=READ_ONLY)
async def get_version(
version_id: Annotated[str, Field(description=(
'The version id (a UUID) from list_versions.'))],
) -> dict:
"""One version of a component: size, shape class, descriptors,
derived properties, status and notes. The geometry is only a summary
- (counts); the web link opens the viewer."""
+ (counts); the web link opens the viewer. The reinforcement layouts
+ of the version are counted from the evidence."""
s = await get(f'/snapshots/{version_id}')
identity_id = s.get('identity_id')
+ layouts = await get(f'/identities/{identity_id}/evidence',
+ {'method': 'reinforcement_layout'}
+ ) if identity_id else []
return limited(clean({
'id': s.get('_id'), 'component_id': identity_id,
'version': s.get('version'), 'status': s.get('status'),
@@ -507,11 +616,15 @@ async def get_version(
'supersedes': s.get('supersedes'),
'superseded_by': s.get('superseded_by'),
'geometry': geometry_summary(s.get('geometry')),
+ 'reinforcement_layouts': layouts_of_version(
+ layouts, s.get('_id')),
'web_link': link_component(identity_id, s.get('_id'))
if identity_id else None}))
# 5 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Get the evidence of a component',
+ annotations=READ_ONLY,
+ description=GET_EVIDENCE_TEXT)
async def get_evidence(
component_id: Annotated[str, Field(description=(
'The component id. Leave empty when you pass evidence_id.'))] = '',
@@ -524,10 +637,6 @@ async def get_evidence(
page: Annotated[int, Field(description='Page, from 1.')] = 1,
size: Annotated[int, Field(description='Records per page, 1 to 25.')] = 10,
) -> dict:
- """Measurements and other evidence about a component (rebound hammer,
- cores, visual inspection, archive documents ...): method, source tier,
- when observed, summary, status, verification. A list gives short rows;
- pass evidence_id for one record in full."""
if evidence_id:
record = await get(f'/evidence/{evidence_id}')
identity_id = record.get('identity_id')
@@ -555,15 +664,16 @@ async def get_evidence(
'verification': (r.get('verification') or {}).get('state')
if isinstance(r.get('verification'), dict) else None,
'recorded_by': r.get('recorded_by_username'),
- 'performed_by': [p.get('name') for p in r.get('performed_by') or []
- if isinstance(p, dict)],
+ 'performed_by': performers(r),
+ **({'reinforcement': layout_summary(r)}
+ if r.get('method') == 'reinforcement_layout' else {}),
'notes': r.get('notes'), 'warnings': r.get('warnings'),
'withdrawn': r.get('withdrawn_at') is not None
if 'withdrawn_at' in r else None}
for r in window]}))
# 6 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='List datasets', annotations=READ_ONLY)
async def list_datasets() -> dict:
"""The datasets (collections of components, each with its own access)
you can see: name, id, visibility (public or members only), whether an
@@ -578,7 +688,7 @@ async def list_datasets() -> dict:
for d in rows]}))
# 7 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Get one dataset', annotations=READ_ONLY)
async def get_dataset(
dataset_id: Annotated[str, Field(description=(
'The dataset id from list_datasets.'))],
@@ -596,7 +706,7 @@ async def get_dataset(
'web_link': f'{web}/components?dataset={d.get("_id")}'}))
# 8 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Get the timeline of a component', annotations=READ_ONLY)
async def get_timeline(
component_id: Annotated[str, Field(description='The component id.')],
) -> dict:
@@ -613,7 +723,7 @@ async def get_timeline(
for e in body.get('events') or []]}))
# 9 -------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Find similar components', annotations=READ_ONLY)
async def similar_components(
component_id: Annotated[str, Field(description='The component id.')],
basis: Annotated[str, Field(description=(
@@ -630,6 +740,7 @@ async def similar_components(
circulation: CirculationArg = 'active',
status: StatusArg = 'published',
include_withdrawn: WithdrawnArg = False,
+ has_evidence: HasEvidenceArg = '',
fit_mode: FitModeArg = '',
size_mm: SizeArg = None,
tolerance: ToleranceArg = '',
@@ -655,7 +766,8 @@ async def similar_components(
query=query, original_function=original_function,
material=material, dataset=dataset, shape_class=shape_class,
circulation=circulation, status=status,
- include_withdrawn=include_withdrawn, fit_mode=fit_mode,
+ include_withdrawn=include_withdrawn, has_evidence=has_evidence,
+ fit_mode=fit_mode,
size_mm=size_mm, tolerance=tolerance, near_lat=near_lat,
near_lon=near_lon, near_layer=near_layer, radius_km=radius_km)
body = await get(f'/identities/{component_id}/similar',
@@ -674,7 +786,7 @@ async def similar_components(
for r in body.get('results') or []]}))
# 10 ------------------------------------------------------------------------
- @mcp.tool()
+ @mcp.tool(title='Overview of the catalog in numbers', annotations=READ_ONLY)
async def catalog_overview(
query: QueryArg = '',
original_function: FunctionArg = '',
@@ -684,6 +796,7 @@ async def catalog_overview(
circulation: CirculationArg = 'active',
status: StatusArg = 'published',
include_withdrawn: WithdrawnArg = False,
+ has_evidence: HasEvidenceArg = '',
fit_mode: FitModeArg = '',
size_mm: SizeArg = None,
tolerance: ToleranceArg = '',
@@ -708,7 +821,8 @@ async def catalog_overview(
query=query, original_function=original_function,
material=material, dataset=dataset, shape_class=shape_class,
circulation=circulation, status=status,
- include_withdrawn=include_withdrawn, fit_mode=fit_mode,
+ include_withdrawn=include_withdrawn, has_evidence=has_evidence,
+ fit_mode=fit_mode,
size_mm=size_mm, tolerance=tolerance, near_lat=near_lat,
near_lon=near_lon, near_layer=near_layer, radius_km=radius_km)
# limit_dim 0: every value, not the ten most frequent and "others"
diff --git a/src/backend/apps/catalog/models.py b/src/backend/apps/catalog/models.py
index 72287f30..cf7ea91b 100644
--- a/src/backend/apps/catalog/models.py
+++ b/src/backend/apps/catalog/models.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3.13
# PYTHON STANDARD LIBRARY IMPORTS ---------------------------------------------
-from typing import Optional, List, Dict, Literal
+from typing import Any, Optional, List, Dict, Literal
import uuid
from datetime import datetime
@@ -15,6 +15,9 @@
model_validator,
)
+# PROJECT IMPORTS -------------------------------------------------------------
+from apps.catalog.documents import REINFORCEMENT_IS_EVIDENCE
+
# AUTH ------------------------------------------------------------------------
Role = Literal["user", "admin"]
@@ -35,7 +38,6 @@ class User(BaseModel):
disabled: Optional[bool] = None
role: Role = "user"
email_verified: bool = False
- verification_token: Optional[str] = None # tokens before 0.6.1.1
verification_token_sha256: Optional[str] = None
verification_token_expires: Optional[datetime] = None
# a token issued before this moment is refused (8.124 a)
@@ -312,52 +314,14 @@ class SnapshotExtrusion(BaseModel):
height: float = Field(description="Extrusion length along Z")
-class SnapshotReinforcement(BaseModel):
- """Inline reinforcement bar centerline on a snapshot.
-
- Fully encoded on the snapshot document (no file companion). A snapshot
- may hold multiple bars in ``geometry.reinforcements``. Does not satisfy
- the primary geometry representation requirement on its own.
- """
- spec: str = Field(
- description="Reinforcement steel specification (e.g. B500B)"
- )
- diameter: float = Field(
- gt=0,
- description="Bar diameter in mm",
- )
- points: List[List[float]] = Field(
- min_length=2,
- description=(
- "Open centerline polyline as [x, y, z] coordinate triplets; "
- "same coordinate frame as meshes/extrusions/marker_points"
- ),
- )
-
- @field_validator('spec')
- @classmethod
- def _strip_spec(cls, v: str) -> str:
- v = v.strip()
- if not v:
- raise ValueError('spec must be non-empty')
- return v
-
- @field_validator('points')
- @classmethod
- def _validate_points(cls, v: List[List[float]]) -> List[List[float]]:
- for pt in v:
- if len(pt) != 3:
- raise ValueError('each point must be [x, y, z]')
- return v
-
-
class SnapshotGeometry(BaseModel):
"""Multi-representation geometry block for one snapshot.
A single snapshot may hold simultaneous representations (multiple
meshes + multiple point clouds + multiple extrusions) of the same
physical state. Marker points are shared across all representations
- within the snapshot (same coordinate frame).
+ within the snapshot (same coordinate frame). Reinforcement bars are not
+ geometry: they are ``reinforcement_layout`` evidence (decision 7.8).
"""
meshes: Optional[List[SnapshotMesh]] = Field(
None,
@@ -385,14 +349,13 @@ class SnapshotGeometry(BaseModel):
"same coordinate frame as the meshes/point_clouds/extrusions"
)
)
- reinforcements: Optional[List[SnapshotReinforcement]] = Field(
- None,
- description=(
- "Inline reinforcement bar centerlines (spec + diameter + open "
- "polyline); ancillary to primary mesh/point_cloud/extrusion "
- "representations"
- )
- )
+
+ @model_validator(mode='before')
+ @classmethod
+ def _reinforcement_is_evidence(cls, data: Any) -> Any:
+ if isinstance(data, dict) and 'reinforcements' in data:
+ raise ValueError(REINFORCEMENT_IS_EVIDENCE)
+ return data
@model_validator(mode='after')
def _require_at_least_one_representation(self) -> 'SnapshotGeometry':
@@ -596,9 +559,9 @@ class ComponentSnapshot(BaseModel):
geometry: SnapshotGeometry = Field(
description=(
"Multi-representation geometry block for this snapshot "
- "(meshes, point clouds, extrusions, marker_points, "
- "reinforcements). At least one of meshes / point_clouds / "
- "extrusions must be non-empty."
+ "(meshes, point clouds, extrusions, marker_points; reinforcement "
+ "is evidence, not geometry). At least one of meshes / "
+ "point_clouds / extrusions must be non-empty."
)
)
descriptors: Optional[Dict] = Field(
diff --git a/src/backend/csc_version.py b/src/backend/csc_version.py
index 413d0531..c4bc9997 100644
--- a/src/backend/csc_version.py
+++ b/src/backend/csc_version.py
@@ -6,7 +6,7 @@
against VERSION, package.json and the release tag by scripts/ci/check_version.py.
"""
-CSC_VERSION = '0.6.4.0'
+CSC_VERSION = '0.6.4.1'
def release_tag(version: str = CSC_VERSION) -> str:
diff --git a/src/backend/requirements.txt b/src/backend/requirements.txt
index adaa1ada..4be1e6c2 100644
--- a/src/backend/requirements.txt
+++ b/src/backend/requirements.txt
@@ -29,8 +29,9 @@ limits
# --- MCP layer and OAuth server for Claude's connectors (apps/catalog/mcp_server.py,
# oauth_server.py; decision 8.168): the MCP Python SDK (pure Python; its
-# pyjwt[crypto] pulls cryptography, which has a glibc 2.17 wheel) ---
-mcp
+# pyjwt[crypto] pulls cryptography, which has a glibc 2.17 wheel); website_url and
+# icons of the server need 1.30 ---
+mcp>=1.30
# --- HTTP client (GitHub service) ---
httpx
diff --git a/src/frontend/app/components/[component_id]/page.tsx b/src/frontend/app/components/[component_id]/page.tsx
index 9f101f93..5e344f70 100644
--- a/src/frontend/app/components/[component_id]/page.tsx
+++ b/src/frontend/app/components/[component_id]/page.tsx
@@ -15,7 +15,7 @@ export const runtime = 'nodejs'
export const dynamic = 'force-dynamic'
type PageParams = { component_id: string }
-type PageSearchParams = { snapshot?: string; snapshots?: string }
+type PageSearchParams = { snapshot?: string; snapshots?: string; layout?: string }
export default async function ComponentDetailPage({
params,
@@ -44,7 +44,10 @@ export default async function ComponentDetailPage({
// a piece the viewer cannot see is explained, not hidden (8.11, 8.17)
if (res.status === 401) {
const callback = requestedSnapshotId
- ? `/components/${component_id}?snapshot=${encodeURIComponent(requestedSnapshotId)}`
+ ? `/components/${component_id}?${new URLSearchParams({
+ snapshot: requestedSnapshotId,
+ ...(query.layout ? { layout: query.layout } : {}),
+ })}`
: `/components/${component_id}`
return
}
@@ -144,6 +147,7 @@ export default async function ComponentDetailPage({
liveVersion={liveVersion}
isViewingLive={isViewingLive}
snapshotStatus={isPublished(snapshot) ? 'published' : snapshot.status}
+ layoutId={typeof query.layout === 'string' && query.layout ? query.layout : undefined}
/>
)
}
diff --git a/src/frontend/components/components/ComponentViewer.tsx b/src/frontend/components/components/ComponentViewer.tsx
index cf706284..711c4b13 100644
--- a/src/frontend/components/components/ComponentViewer.tsx
+++ b/src/frontend/components/components/ComponentViewer.tsx
@@ -17,7 +17,7 @@ import {
import { Card } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { Scan, Grid3x3, Rotate3d, SlidersHorizontal } from 'lucide-react'
+import { Scan, Grid3x3, Rotate3d, SlidersHorizontal, X } from 'lucide-react'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { Bounds, OrbitControls, Html, useBounds } from '@react-three/drei'
import { cn, rgbToHex } from '@/lib/utils'
@@ -38,7 +38,9 @@ import {
barLegend,
defaultColourMode,
diameterRange,
- layoutsOnSnapshot,
+ layoutsWithPicked,
+ type LayoutRecord,
+ type PickedProblem,
type BarColourMode,
type BarLayout,
} from '@/lib/reinforcementColors'
@@ -750,8 +752,12 @@ CaptureFixtures.displayName = 'CaptureFixtures'
/** A bar with the index of the layout record it comes from (RL3). */
type ViewerBar = ReinforcementBar & { layout: number }
-const ReinforcementBarMesh = React.memo(({ bar, colour }: { bar: ReinforcementBar; colour: string | null }) => {
- const material = reinforcementMaterial(colour)
+const ReinforcementBarMesh = React.memo(({ bar, colour, dimmed }: {
+ bar: ReinforcementBar
+ colour: string | null
+ dimmed: boolean
+}) => {
+ const material = reinforcementMaterial(colour, dimmed)
const { segments, cornerJoints } = useMemo(
() => buildReinforcementBarMeshes(bar.points),
[bar.points],
@@ -787,17 +793,21 @@ const ReinforcementBars = React.memo(({
bars,
visible,
mode,
+ picked,
}: {
bars: ViewerBar[]
visible: boolean
mode: BarColourMode
+ /** The layout opened by the link: the others are drawn faint (8.178). */
+ picked: number | null
}) => {
const range = useMemo(() => diameterRange(bars), [bars])
if (!visible || bars.length === 0) return null
return (
{bars.map((bar, index) => (
-
+
))}
)
@@ -1114,6 +1124,51 @@ export type ComponentViewerProps = {
* zoom, without a toolbar or the settings panel.
*/
bare?: boolean
+ /**
+ * `?layout=` (decision 8.178): one reinforcement layout record,
+ * whatever its status, is drawn in addition to the published ones when it is
+ * positioned on the version shown.
+ */
+ layoutId?: string
+ /** Removes `layout=` from the page's address (the legend's close button). */
+ onClearLayout?: () => void
+}
+
+/** The small close button of the opened layout (legend entry and note): removes `layout=`. */
+function ClearLayoutButton({ onClick }: { onClick: () => void }) {
+ return (
+
+ )
+}
+
+/** The opened layout as a line of its own while the legend does not list layouts. */
+function LayoutEntry({ label, status, onClear }: { label: string; status?: string | null; onClear?: () => void }) {
+ return (
+