@floless/app 0.110.0 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -245,10 +245,21 @@ native/display coords):
245
245
  exact-equality). Mark `steel: true` on layers whose name reads as steel framing (e.g.
246
246
  `*BEAM*STEL*`, `*COL*`, `*BRACE*`, `*JOIST*`) → default **on**; others off. Mark
247
247
  `drawable: false` on pure text/dimension/title-block layers.
248
- 5. Set `filter.mode: "layer"`, `filter.active: 0`. **PUT** the contract
249
- (`PUT /api/contract/steel-model`) **with a precondition header** — `If-Match: <the ETag from your
250
- GET>`, or `If-None-Match: *` if the GET returned no ETag (§5 has the full rule). A PUT carrying
251
- neither is refused with `428`. On a re-read, preserve any existing per-facet `on` flags.
248
+ 5. Set `filter.mode: "layer"`, `filter.active: 0`, then write it back **with a precondition header**
249
+ (§5 has the full rule; a write carrying neither precondition is refused with `428`). Which route
250
+ depends on whether the project already has a contract, and that is the whole rule:
251
+ - **The GET returned a contract** → send only the pre-read blocks to
252
+ **`PUT /api/projects/<projectId>/steel-prepass`** with `{ filter }` and `If-Match: <that ETag>`.
253
+ - **The GET returned nothing** (a project created by dropping a drawing) → this is the create case,
254
+ so compose the whole document and `PUT /api/contract/steel-model` with `If-None-Match: *`.
255
+
256
+ The prepass verb takes `filter`, `datum` and per-sheet `{ grid, datum_at, datum_ref, control2_at,
257
+ control2_ref, elevation_in }` and **refuses `members`, `connections` and `joints` by name**, so it
258
+ cannot replace the model you are about to read. It also cannot create a document or add a sheet — an
259
+ unknown sheet is a `400`, never a new plan — and a sheet name the project holds twice is a `400` too,
260
+ since there is no single plan to write to. `If-Match` must be the **exact** ETag: `If-Match: *` is
261
+ refused, because this verb patches the document you read and `*` cannot detect a write that landed
262
+ since your GET. On a re-read, preserve any existing per-facet `on` flags.
252
263
 
253
264
  ### 1c. Grid lines — read the printed grid (quick, per sheet)
254
265
 
@@ -269,9 +280,12 @@ text layer. You CAN read them: you already have vision on the sheet. So:
269
280
  fractional values. Labels remain whitespace-separated
270
281
  overrides in line order (X: left→right; Y: bottom→up). Sanity-check a bay or two against the
271
282
  printed dimension strings between grid lines — a mismatch means the sheet scale (`pt_per_ft`) is
272
- wrong, which corrupts the whole takeoff, not just the grid. **Then PUT the contract again** —
273
- the 1b PUT already happened, and the user's next Filter-node Save writes back the contract *it
274
- loaded*; an un-PUT grid (and its vision-read labels) would be silently dropped.
283
+ wrong, which corrupts the whole takeoff, not just the grid. **Then write the grid back** — send
284
+ `{ "sheets": { "<sheet>": { "grid": … } } }` to `PUT /api/projects/<projectId>/steel-prepass` with
285
+ `If-Match: <the ETag from the write in 1b>`. The body is **keyed by sheet name, never a positional
286
+ list**: a positional array against a differently-ordered stored document writes each sheet's grid
287
+ onto the other, silently. The 1b write already happened, and the user's next Filter-node Save writes
288
+ back the contract *it loaded*; an unwritten grid (and its vision-read labels) would be silently dropped.
275
289
 
276
290
  Skip silently only when the sheet genuinely has no grid bubbles (rare for framing plans); say so.
277
291
 
@@ -360,6 +374,19 @@ Same flat shape as the datum above — a point plus which intersection it is:
360
374
  re-read later; which intersection the project calls 0,0 is the user's intent and cannot be recovered
361
375
  after the fact.
362
376
 
377
+ **Write the datum block back** through the same verb as the grid — one call carries both:
378
+
379
+ ```
380
+ PUT /api/projects/<projectId>/steel-prepass If-Match: <the current ETag>
381
+ { "datum": { "axis_x": "A", "axis_y": "1" },
382
+ "sheets": { "<sheet>": { "grid": …, "datum_at": [x, y], "datum_ref": …,
383
+ "control2_at": [x, y], "control2_ref": …, "elevation_in": 144 } } }
384
+ ```
385
+
386
+ Those six per-sheet keys and `datum` are the complete set the verb accepts alongside `filter`; anything
387
+ else — `members`, `memberRefs`, `title`, `raster_b64` — is refused **by name** with a `400`, so a write
388
+ that thinks it saved the model will hear about it rather than silently succeeding.
389
+
363
390
  **Then STOP and hand off — checkpoint before the member read.** Tell the user to open the **Filter**
364
391
  node, flip through the sheets, narrow to the steel, and **Save**. The saved `on` flags + `mode` are
365
392
  what step 2 reads — **per sheet** (each sheet's elements passing `mode` + the global `on` flags). Only
@@ -900,7 +927,26 @@ Key field rules:
900
927
 
901
928
  ### 5. Write to the contract store
902
929
 
903
- **Read first, then write.** `GET` the contract before you PUT and keep its `ETag` response header —
930
+ **Two routes, and which one you use is decided by WHAT you are writing, not by preference.**
931
+
932
+ | you are writing | route |
933
+ |---|---|
934
+ | the pre-read blocks — §1b `filter`, §1c `grid`, §1d `datum` + the per-sheet registration keys | **`PUT /api/projects/<projectId>/steel-prepass`** |
935
+ | the finished takeoff (§4's whole document: `members`, profiles, elevations) | `PUT /api/contract/steel-model` |
936
+ | a project's FIRST document, when the `GET` returned nothing at all | `PUT /api/contract/steel-model` with `If-None-Match: *` |
937
+
938
+ The prepass verb exists because the pre-read pass used to GET the contract and PUT the **whole document**
939
+ back. That is a full-document replacement: it can overwrite members, joints and connections that the
940
+ user has already reviewed, and an ETag does not stop it — an ETag makes a write not *stale*, not not
941
+ *canonical*. The verb accepts `filter`, `datum` and per-sheet `{ grid, datum_at, datum_ref, control2_at,
942
+ control2_ref, elevation_in }`, and refuses everything else **by name** with a `400`. It cannot create a
943
+ document and it cannot add a sheet (an unknown sheet is a `400`, never a new plan), so the create case
944
+ above genuinely does belong to the contract route.
945
+
946
+ Both routes take the same preconditions, the same `412`/`428` answers, and the same lock — they share one
947
+ implementation, so the rules below apply to whichever you use.
948
+
949
+ **Read first, then write.** `GET` the contract before you write and keep its `ETag` response header —
904
950
  that tag is what makes the write safe, and you need it even when you are replacing the document
905
951
  wholesale.
906
952
 
package/dist/web/app.css CHANGED
@@ -1250,23 +1250,23 @@
1250
1250
  .fm-select .fm-select-note strong { color: var(--text); font-weight: 600; }
1251
1251
  /* Consent checkbox (fork liability terms) — inline label + fully themed box (no native
1252
1252
  default leaks the dark baseline). Custom checkmark via clip-path, accent on check. */
1253
- .modal-check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); margin: 2px 0 4px; }
1254
- .modal-check input[type="checkbox"] {
1253
+ .modal-check, .rev-check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); margin: 2px 0 4px; }
1254
+ .modal-check input[type="checkbox"], .rev-check input[type="checkbox"] {
1255
1255
  appearance: none; -webkit-appearance: none; flex: none;
1256
1256
  width: 16px; height: 16px; margin: 1px 0 0;
1257
1257
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2);
1258
1258
  cursor: pointer; display: grid; place-content: center;
1259
1259
  transition: border-color 0.12s, background 0.12s;
1260
1260
  }
1261
- .modal-check input[type="checkbox"]::before {
1261
+ .modal-check input[type="checkbox"]::before, .rev-check input[type="checkbox"]::before {
1262
1262
  content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform 0.12s ease;
1263
1263
  background: var(--accent-bright);
1264
1264
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
1265
1265
  }
1266
- .modal-check input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent-soft); }
1267
- .modal-check input[type="checkbox"]:checked::before { transform: scale(1); }
1268
- .modal-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
1269
- .modal-check span { user-select: none; }
1266
+ .modal-check input[type="checkbox"]:checked, .rev-check input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent-soft); }
1267
+ .modal-check input[type="checkbox"]:checked::before, .rev-check input[type="checkbox"]:checked::before { transform: scale(1); }
1268
+ .modal-check input[type="checkbox"]:focus-visible, .rev-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
1269
+ .modal-check span, .rev-check span { user-select: none; }
1270
1270
  .modal-categories { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
1271
1271
  .modal-categories button {
1272
1272
  background: var(--surface-2);
@@ -3945,9 +3945,69 @@ table.hist tr.current td { background:var(--accent-soft); }
3945
3945
  .hist-change-list li::marker { color:var(--text-dim); }
3946
3946
  .hist-change-list .hist-change-more { color:var(--text-dim); font-style:italic; }
3947
3947
  .hist-change-caution { margin-top:5px; color:var(--warn); font-size:11px; }
3948
- .hist .btn-mini, .ws-drawings-bar .btn-mini, .ws-revision-card .btn-mini { background:none; border:1px solid var(--border-strong); color:var(--text-muted); border-radius:6px;
3948
+ .hist .btn-mini, .ws-drawings-bar .btn-mini, .ws-revision-card .btn-mini, .modal.revreview .btn-mini { background:none; border:1px solid var(--border-strong); color:var(--text-muted); border-radius:6px;
3949
3949
  padding:4px 10px; font-size:11px; cursor:pointer; white-space:nowrap; }
3950
- .hist .btn-mini:hover, .ws-drawings-bar .btn-mini:hover, .ws-revision-card .btn-mini:hover { color:var(--text); border-color:var(--accent); }
3950
+ .hist .btn-mini:hover, .ws-drawings-bar .btn-mini:hover, .ws-revision-card .btn-mini:hover, .modal.revreview .btn-mini:hover { color:var(--text); border-color:var(--accent); }
3951
+
3952
+ /* ── Revision review (unit 5, P6e) — the grouped accept/reject list ──────────────
3953
+ Every rule below is built from existing tokens; no new colour, font or shadow. The
3954
+ modal reuses .modal wholesale and only overrides width and the column layout it needs
3955
+ to keep the counts pinned while the list scrolls. */
3956
+ .modal.revreview { width:720px; max-width:92vw; max-height:86vh; display:flex; flex-direction:column; }
3957
+ /* The inner scroll container. A long proposal list IS a scroll container, and it is exactly where a
3958
+ native white scrollbar leaks into the dark theme — themed here in the same pass that creates it. */
3959
+ .revreview-body { flex:1 1 auto; min-height:0; overflow-y:auto; padding-right:2px; margin:4px 0 2px;
3960
+ scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent; }
3961
+ .revreview-body::-webkit-scrollbar { width:8px; }
3962
+ .revreview-body::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:5px; }
3963
+ .revreview-body::-webkit-scrollbar-track { background:transparent; }
3964
+
3965
+ /* Counts: informational, and the ABSENCE of chrome is what says so — no border, no card,
3966
+ no icon, no hover. Everything actionable below has at least one. */
3967
+ .rev-counts { font-size:11px; color:var(--text-dim); margin:0 0 10px; }
3968
+ .rev-counts b { color:var(--text-muted); font-weight:600; font-family:var(--mono); }
3969
+
3970
+ /* `flex-wrap` matters here and its absence was a real defect: the banner is a <b> lead plus a trailing
3971
+ text node, i.e. TWO flex items, and without wrapping they lay out as two nowrap columns instead of one
3972
+ flowing paragraph. `.hist-working` carries it for exactly this reason and this copied everything but. */
3973
+ .rev-changed { margin:0 0 11px; padding:9px 12px; display:flex; gap:8px; align-items:flex-start; flex-wrap:wrap;
3974
+ border:1px solid var(--warn); border-radius:8px; background:var(--surface-2); font-size:12px; color:var(--text-muted); }
3975
+ .rev-changed[hidden] { display:none; }
3976
+ .rev-changed b { color:var(--text); font-weight:600; }
3977
+
3978
+ .rev-group { margin:0 0 16px; }
3979
+ .rev-group:last-child { margin-bottom:0; }
3980
+ .rev-group-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 7px; }
3981
+ /* Title and count are ONE flex child, so `space-between` still sees exactly two — the label group and
3982
+ the bulk bar — rather than pushing the count into the middle. */
3983
+ .rev-group-label { display:inline-flex; align-items:center; gap:7px; min-width:0; }
3984
+ .rev-group-title { font-size:10px; text-transform:uppercase; letter-spacing:.14em; color:var(--text-muted); }
3985
+ .rev-group-actions { display:flex; gap:6px; flex:none; }
3986
+
3987
+ .rev-row { display:flex; gap:9px; align-items:flex-start; padding:9px 11px; margin-bottom:6px;
3988
+ border:1px solid var(--border); border-left:3px solid var(--border-strong); border-radius:8px; background:var(--surface-2); }
3989
+ .rev-row:last-child { margin-bottom:0; }
3990
+ .rev-row.k-added { border-left-color:var(--ok); }
3991
+ .rev-row.k-removed { border-left-color:var(--err); }
3992
+ .rev-row.k-changed { border-left-color:var(--accent-bright); }
3993
+ .rev-row.k-binding { border-left-color:var(--info); }
3994
+ .rev-row-main { min-width:0; flex:1 1 auto; }
3995
+ .rev-row-head { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
3996
+ .rev-kind-badge { font-size:9.5px; text-transform:uppercase; letter-spacing:.1em; color:var(--text-dim);
3997
+ border:1px solid var(--border-strong); border-radius:4px; padding:1px 5px; flex:none; }
3998
+ .rev-row-title { font-size:12.5px; font-weight:600; color:var(--text); font-family:var(--mono); overflow-wrap:anywhere; }
3999
+ .rev-row-sub { font-size:11px; color:var(--text-dim); margin-top:3px; }
4000
+ .rev-row-note { font-size:11px; color:var(--text-dim); font-style:italic; margin-top:4px; }
4001
+ .rev-fields { margin:6px 0 0; display:flex; flex-direction:column; gap:3px; }
4002
+ .rev-field { font-size:11.5px; color:var(--text-muted); overflow-wrap:anywhere; }
4003
+ .rev-field-key { font-family:var(--mono); color:var(--text-dim); margin-right:6px; }
4004
+
4005
+ /* The refused list reuses the file's own collapsed-detail idiom (.ws-archived*), and --warn
4006
+ rather than --err: a refusal is the registry correctly declining an out-of-policy change. */
4007
+ .rev-issues { margin-top:4px; }
4008
+ .rev-issue { font-size:11.5px; color:var(--text-muted); padding:6px 0; border-bottom:1px solid var(--border); }
4009
+ .rev-issue:last-child { border-bottom:none; }
4010
+ .rev-issue-path { font-family:var(--mono); font-size:10.5px; color:var(--text-dim); display:block; margin-top:2px; }
3951
4011
 
3952
4012
  /* ── Workspaces: revision re-read (Slice 4b) — attach band + pending/failed card ── */
3953
4013
  .ws-drawings-bar { flex:none; display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid var(--border); background:var(--surface); }
@@ -3962,6 +4022,10 @@ table.hist tr.current td { background:var(--accent-soft); }
3962
4022
  .ws-revision-card.state-failed { border-left:3px solid var(--err); }
3963
4023
  .ws-revision-card.state-failed .wrc-err-ico { color:var(--err); flex:none; }
3964
4024
  .ws-revision-card.state-failed .wrc-err-detail { color:var(--text-dim); }
4025
+ /* Staged: resolved and waiting on the user. A STATIC dot, not the pending spinner — nothing is in
4026
+ flight and an animation would say otherwise. */
4027
+ .ws-revision-card.state-staged { border-left:3px solid var(--accent); }
4028
+ .ws-revision-card.state-staged .wrc-dot { flex:none; width:8px; height:8px; border-radius:50%; background:var(--accent); }
3965
4029
  .ws-revision-card .wrc-actions { display:flex; gap:6px; flex:none; }
3966
4030
  @media (prefers-reduced-motion: reduce) { .ws-revision-card .wrc-spin { animation:none; } }
3967
4031
  .hist .gate-badge.ai-read { background:var(--accent-soft); border-color:var(--accent-dim); color:var(--accent-bright); }
package/dist/web/aware.js CHANGED
@@ -5891,7 +5891,7 @@
5891
5891
  : '';
5892
5892
  const note = req.instruction ? `\nMy note: ${req.instruction}` : '';
5893
5893
  const messageHint = isInitialRead ? '<plain-English what was read>' : '<plain-English what changed>';
5894
- const post = `Only after the review checkpoint is complete, POST /api/projects/${req.project}/revision-read with { contract, message: "${messageHint}", requestId: "${req.id}" }. The server derives the base version + source provenance from this queued request, records a "revision-read" version, and clears the request — do NOT DELETE the request yourself. If you can't read the set, POST /api/projects/${req.project}/revision-requests/${req.id}/fail with { error }.`;
5894
+ const post = `Only after the review checkpoint is complete, POST /api/projects/${req.project}/revision-read with { contract, message: "${messageHint}", requestId: "${req.id}" }. The server derives the base version + source provenance from this queued request. For a steel.takeoff/v1 contract it records a "revision-read" version and clears the request. For a steel.model/v2 model it answers 202 and STAGES the read for the user to review instead — the request stays open until they confirm it in the app, and the version appears then. Either way, do NOT DELETE the request yourself. If you can't read the set, POST /api/projects/${req.project}/revision-requests/${req.id}/fail with { error }.`;
5895
5895
  // App-aware: the target contract shape differs per workspace app. A vectorize project holds a
5896
5896
  // drawing.vector/v1 (clean editable 2D linework), NOT a steel takeoff — instructing the AI to
5897
5897
  // read steel members would produce the wrong contract for the vector editor (spec §3.3g).
@@ -5906,9 +5906,9 @@
5906
5906
  return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing was attached — re-read (vectorize) it into the SAME project as a new version (do NOT create a new project). Vectorize the drawing per the floless-app-vectorize skill into a drawing.vector/v1 contract: emit clean, editable 2D vector geometry (sheets → elements: lines / polylines / curves / text, each on its layer), NOT steel members or a takeoff. A vector PDF is read deterministically (exact geometry, no guessing); a photo, scan or hand sketch is traced by a fenced vision extraction that flags every uncertain stroke (low confidence) for the user's review. ${post}${snaps}${note}`;
5907
5907
  }
5908
5908
  if (isInitialRead) {
5909
- return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} and KEEP its ETag response header. A 404 "no contract for this app yet" here is NORMAL and not an error — a project created by dropping a drawing starts empty; it simply means this is the create case, so you will send If-None-Match: * instead of an ETag. (A project seeded from an existing model does return a contract and an ETag.) Then do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, PUT that project contract back to /api/contract/${req.appId}?project=${req.project} (a contract PUT MUST carry a precondition: If-Match with the ETag from that GET, or If-None-Match: * ONLY if the GET returned no ETag at all — one with neither is refused with 428; on 412 re-GET, re-apply your changes to the new document, and retry rather than repeating the same body), then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
5909
+ return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} and KEEP its ETag response header. A 404 "no contract for this app yet" here is NORMAL and not an error — a project created by dropping a drawing starts empty; it simply means this is the create case, so you will send If-None-Match: * instead of an ETag. (A project seeded from an existing model does return a contract and an ETag.) Then do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, write it back — if that GET returned NO contract this is the create case, so PUT the whole document to /api/contract/${req.appId}?project=${req.project} with If-None-Match: * ; if it DID return one, send only the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag>. The prepass verb takes filter, datum and per-sheet { grid, datum_at, datum_ref, control2_at, control2_ref, elevation_in } and REFUSES members, connections and joints by name, so it cannot replace the model you are about to read. Either write is refused with 428 if it carries no precondition, and If-Match must be the exact ETag — If-Match: * is refused, because this verb patches the document you read. On 412 re-GET, re-apply your changes to the new document, and retry rather than repeating the same body. Then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
5910
5910
  }
5911
- return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT contract, then do the deterministic PyMuPDF steel-filter pass only for the revised drawing set: identify the framing-plan sheets, enumerate drawing elements by layer/thickness/color into contract.filter.sheets/facets, preserve any compatible existing filter selections, PUT that project contract back to /api/contract/${req.appId}?project=${req.project} (a contract PUT MUST carry a precondition: If-Match with the ETag from the GET you just did, or If-None-Match: * if that GET returned no ETag — one without either is refused with 428; on 412 re-GET, re-apply, and retry rather than repeating the same body), then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection, compose the updated steel.takeoff/v1 contract, and PRESERVE each still-present member's id AND its sheet label (mint a NEW id only for a genuinely new member; drop the id of a member the revision deleted) so the version comparison matches members — do NOT renumber the whole model. ${post}${snaps}${note}`;
5911
+ return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT contract, then do the deterministic PyMuPDF steel-filter pass only for the revised drawing set: identify the framing-plan sheets, enumerate drawing elements by layer/thickness/color into contract.filter.sheets/facets, preserve any compatible existing filter selections, send ONLY the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <the ETag from the GET you just did> — never the whole contract, because this project already holds a model and a full PUT would replace its members without review. The verb takes filter, datum and per-sheet { grid, datum_at, datum_ref, control2_at, control2_ref, elevation_in } and refuses everything else by name. A write with no precondition is refused with 428, and If-Match must be the exact ETag — If-Match: * is refused, because this verb patches the document you read. On 412 re-GET, re-apply, and retry rather than repeating the same body. Then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection, compose the updated steel.takeoff/v1 contract, and PRESERVE each still-present member's id AND its sheet label (mint a NEW id only for a genuinely new member; drop the id of a member the revision deleted) so the version comparison matches members — do NOT renumber the whole model. ${post}${snaps}${note}`;
5912
5912
  }
5913
5913
  // The Knowledge step's Organize verb. The lifecycle is SERVER-owned: start claims the organize
5914
5914
  // lock and mints the generation dir; finish publishes it and clears this request; fail releases
@@ -5969,7 +5969,7 @@
5969
5969
  // applied-then-DELETEd by the terminal AI.
5970
5970
  const clears = req.type === 'revision-read'
5971
5971
  ? ((req.appTemplateId || req.appId) === 'steel-model'
5972
- ? `apply it in two phases: first write the Steel Filter checkpoint to the project contract and stop for user Save; only after that checkpoint use the route in the line below (that POST clears this request — do NOT DELETE it separately).`
5972
+ ? `apply it in two phases: first write the Steel Filter checkpoint through the steel-prepass verb and stop for user Save; only after that checkpoint use the route in the line below (that POST clears this request, or stages it for the user's review — either way do NOT DELETE it separately).`
5973
5973
  : `apply it via the route in the line below (that POST clears this request — do NOT DELETE it separately).`)
5974
5974
  : req.type === 'knowledge-organize'
5975
5975
  ? `drive it through the start → finish/fail lifecycle routes in the line below (finish or fail clears this request — do NOT DELETE it separately, that would strand the organize lock).`
@@ -557,6 +557,25 @@
557
557
  </div>
558
558
  </div>
559
559
 
560
+ <!-- Revision review (unit 5, P6e) — the human decides what a re-read may change.
561
+ Bespoke rather than #form-modal: that modal renders a flat field list and has no
562
+ notion of grouped rows, per-bucket bulk actions, or re-rendering in place when the
563
+ model moves underneath the review. Same backdrop, same .modal chrome — no new look.
564
+ The counts line sits OUTSIDE .revreview-body so it stays pinned while the list scrolls. -->
565
+ <div class="modal-backdrop" id="revreview-modal" role="dialog" aria-modal="true" aria-labelledby="revreview-title">
566
+ <div class="modal revreview">
567
+ <div class="modal-title" id="revreview-title">Review this read</div>
568
+ <div class="modal-sub" id="revreview-sub"></div>
569
+ <div class="rev-changed" id="revreview-changed" role="status" aria-live="polite" hidden></div>
570
+ <div class="rev-counts" id="revreview-counts"></div>
571
+ <div class="revreview-body" id="revreview-body"></div>
572
+ <div class="modal-actions">
573
+ <button id="revreview-cancel">Cancel</button>
574
+ <button id="revreview-confirm" class="primary">Apply selected</button>
575
+ </div>
576
+ </div>
577
+ </div>
578
+
560
579
  <!-- Save-on-switch confirmation — shown when switching workflows with unsaved
561
580
  input changes. Reuses the shared modal styling; no new backdrop look. -->
562
581
  <div class="modal-backdrop" id="confirm-modal">
@@ -3351,7 +3351,7 @@ function updateConnCrumb(){
3351
3351
  const el=document.getElementById('connCrumb'); if(!el) return;
3352
3352
  const cs=view3d?connSelInfo():null;
3353
3353
  if(!cs){ el.style.display='none'; el.innerHTML=''; return; }
3354
- const name=(cs.kind==='base-plate'?'Base plate':cs.kind==='shear-plate'?'Shear plate':'Connection')+' · '+cs.main;
3354
+ const name=connKindLabel(cs.kind)+' · '+cs.main;
3355
3355
  let html='<button class=seg data-lvl=root data-tip="Back to the model (deselect)">Model</button><span class=sep>▸</span>';
3356
3356
  if(cs.whole){ html+='<span class="seg cur">'+esc(name)+'</span>'; }
3357
3357
  else{
@@ -3371,7 +3371,7 @@ async function connModifyRequest(j){
3371
3371
  if(!j) return;
3372
3372
  try{await window.flushContract();}catch(_){}
3373
3373
  try{persist();}catch(_){}
3374
- const kindName=j.kind==='base-plate'?'base plate':j.kind==='shear-plate'?'shear plate':j.kind==='custom'?'imported':'connection';
3374
+ const kindName=connKindLabel(j.kind).toLowerCase();
3375
3375
  const onMember=j.main?' on member '+j.main:'';
3376
3376
  const label=j.kind==='custom'&&j.name?' ("'+j.name+'")':'';
3377
3377
  const instruction='Modify the '+kindName+' connection "'+j.id+'"'+label+onMember+' (sheet '+((P&&P.sheet)||'?')+') — adjust, replace or move it per my request.';
@@ -3539,7 +3539,7 @@ function panel(){
3539
3539
  return;
3540
3540
  }
3541
3541
  const isBP=j.kind==='base-plate',pp=j.params||{};const savedFav=favMatch(j);
3542
- const plate=(partsById||{})[cs.conn+':plate']||null;
3542
+ const plate=(partsById||{})[cs.conn+':plate']||(partsById||{})[cs.conn+':plateA']||null; // a gusset carries plateA/plateB, not a single :plate
3543
3543
  const dim=(n)=>(n==null?'<span style="color:var(--mut)">auto</span>':esc(fmtFtIn(Number(n)/25.4)));
3544
3544
  const kv=(l,val)=>`<div style="display:flex;justify-content:space-between;gap:8px;font-size:12px;margin:3px 0"><span style="color:var(--mut)">${esc(l)}</span><span style="font-variant-numeric:tabular-nums">${val}</span></div>`;
3545
3545
  const sec=t=>`<div class=divrow><hr><span class=sect style="margin:0">${esc(t)}</span><hr></div>`;
@@ -3547,7 +3547,7 @@ function panel(){
3547
3547
  let body='';
3548
3548
  if(isBP)body=sec('Plate')+kv('Size',sz)+kv('Thickness',plate?dim(plate.thickness):dim(pp.thickness))+sec('Anchors')+kv('Grid (cols × rows)',esc(`${pp.boltCols||2} × ${pp.boltRows||2}`))+kv('Diameter',pp.boltDia?dim(pp.boltDia):dim(24));
3549
3549
  else body=sec('Plate')+kv('Size',sz)+kv('Thickness',plate?dim(plate.thickness):dim(pp.plateThickness))+sec('Bolts')+kv('Grid (cols × rows)',esc(`${pp.boltCols||1} × ${pp.boltRows||3}`))+kv('Diameter',pp.boltDia?dim(pp.boltDia):dim(20))+sec('Weld')+kv('Leg',pp.weldLeg?dim(pp.weldLeg):dim(6));
3550
- p.innerHTML=`<span class=badge>${isBP?'Base plate':'Shear plate'}</span>
3550
+ p.innerHTML=`<span class=badge>${connKindLabel(cs.kind)}</span>
3551
3551
  <div class=row style="margin:0 0 6px"><span class=chip style="border-color:var(--brand);color:#bfdbfe">Parametric — editable</span></div>
3552
3552
  <div class="row hint" style="margin:0 0 2px">On <button class=pilllink id=cmpMember data-tip="Select ${esc(j.main)}">${esc(j.main)}</button> · ${cs.childIds.length} parts</div>
3553
3553
  <div class="row hint" style="margin:0 0 6px;font-size:11px">Double-click to enter and pick a part · <b>Esc</b> steps back.</div>
@@ -3558,7 +3558,7 @@ function panel(){
3558
3558
  ${isBP?`<button class=ghostw id=cmpTrim data-tip="Pick a point on ${esc(j.main)} — trim or extend the column so its base seats there (snaps to framing levels)">⭶ Trim / Extend column to base…</button>`:''}
3559
3559
  <button class=ghostw id=cmpAsk data-tip="Record a request for your terminal AI to modify / replace / move this connection">Modify connection…</button>
3560
3560
  <button class=danger id=cmpDel data-tip="Remove this whole connection">Delete connection</button>
3561
- <button class="ghostw${savedFav?' faved':''}" id=cmpFav data-tip="${savedFav?'Edit this favourite’s name or category':('Save this connection to your Favourites — reusable on any '+(isBP?'column':'beam'))}">${savedFav?'★ Saved to Favourites':'★ Save to Favourites'}</button>
3561
+ <button class="ghostw${savedFav?' faved':''}" id=cmpFav data-tip="${savedFav?'Edit this favourite’s name or category':('Save this connection to your Favourites — reusable on any '+favHostNoun(cs.kind))}">${savedFav?'★ Saved to Favourites':'★ Save to Favourites'}</button>
3562
3562
  </div>`;
3563
3563
  const toMember=()=>{if(window.Steel3DView&&window.Steel3DView.clearConnSel)window.Steel3DView.clearConnSel();selIds=new Set([j.main]);selDimIds.clear();sel3dDimIds.clear();selGridIds.clear();render();};
3564
3564
  {const b=document.getElementById('cmpMember');if(b)b.onclick=toMember;}
@@ -3576,7 +3576,7 @@ function panel(){
3576
3576
  {const jids=selJointIds();
3577
3577
  if(jids.size>=2&&selIsConnOnly()){
3578
3578
  const js=(C.joints||[]).filter(j=>j&&jids.has(j.id));
3579
- const kinds=new Set(js.map(j=>j.kind==='base-plate'?'base plate':j.kind==='shear-plate'?'shear plate':j.kind==='custom'?'imported connection':'connection'));
3579
+ const kinds=new Set(js.map(j=>connKindLabel(j.kind).toLowerCase()));
3580
3580
  const noun=kinds.size===1?[...kinds][0]+'s':'connections';
3581
3581
  const nMem=new Set(js.map(j=>j.main)).size;
3582
3582
  p.innerHTML=`<h3>${js.length} connections selected</h3>
@@ -3597,7 +3597,7 @@ function panel(){
3597
3597
  const suf=ci>=0?selPart.slice(ci+1):'';const pp=j.params||{};const multi=selList.length>1;
3598
3598
  const loc=j.at==='base'?'Base':j.at==='end1'?'End end':'Start end';
3599
3599
  const pk=/^(bolt|head)/.test(suf)?'bolt':/^(fn|ln|nut)/.test(suf)?'nut':/^weld/.test(suf)?'weld':/^cope/.test(suf)?'cope':/^stiff/.test(suf)?'stiff':/^(rod|anchor)/.test(suf)?'rod':(((partsById||{})[selPart]||{}).group==='anchor-plate')?'aplate':/^wsh/.test(suf)?'washer':/^wp/.test(suf)?'wplate':'plate'; // the embedded bearing plate → keyed on its 'anchor-plate' GROUP, not an id prefix, so an imported custom-mesh part whose id happens to start "ap" isn't misread as one
3600
- const kindName=j.kind==='base-plate'?'Base plate':'Shear plate';
3600
+ const kindName=connKindLabel(j.kind);
3601
3601
  const head=({bolt:(multi?'Bolts':'Bolt'),nut:(multi?'Nuts':'Nut'),weld:'Weld',cope:'Cope',stiff:'Stiffener',rod:(multi?'Anchor rods':'Anchor rod'),washer:'Washer',wplate:'Washer plate',aplate:'Anchor plate'})[pk]||kindName;
3602
3602
  const el=(partsById||{})[selPart]||null;const lbl=el&&el.meta&&el.meta.label;
3603
3603
  const DEF={plateThickness:10,weldLeg:6,clearance:13,boltDia:20,boltPitch:70,copeRadius:12.7}; // engine defaults (mirror the member panel's spF defaults)
@@ -3609,7 +3609,10 @@ function panel(){
3609
3609
  const kv=(l,val)=>`<div style="display:flex;justify-content:space-between;gap:8px;font-size:12px;margin:3px 0"><span style="color:var(--mut)">${l}</span><span style="font-variant-numeric:tabular-nums">${val}</span></div>`;
3610
3610
  const sec=t=>`<div class=divrow><hr><span class=sect style="margin:0">${t}</span><hr></div>`;
3611
3611
  let body='';
3612
- if(pk==='plate'&&j.kind==='shear-plate')body=sec('Plate')+kv('Width',dim(el&&el.width))+kv('Height',dim(el&&el.depth))+kv('Thickness',dim(el&&el.thickness))+kv('Weld leg',v('weldLeg','mm'))+kv('Clearance',v('clearance','mm'));
3612
+ // A gusset has NO erection clearance row: its setback is derived from the real clash with the support,
3613
+ // so `clearance` is never read (steel-joints.ts — "the setback IS the clearance"). Showing it would put an
3614
+ // editable 1/2" default in front of the user that changes nothing.
3615
+ if(pk==='plate'&&(j.kind==='shear-plate'||j.kind==='brace-gusset'))body=sec('Plate')+kv('Width',dim(el&&el.width))+kv('Height',dim(el&&el.depth))+kv('Thickness',dim(el&&el.thickness))+kv('Weld leg',v('weldLeg','mm'))+(j.kind==='brace-gusset'?kv('Set back',dim(el&&el.meta&&el.meta.setbackMm)):kv('Clearance',v('clearance','mm')));
3613
3616
  else if(pk==='bolt')body=sec('Bolts')+kv('Grid (cols × rows)',esc(`${pp.boltCols||1} × ${pp.boltRows||3}`))+kv('Diameter',v('boltDia','mm'))+kv('Grade',pp.boltGrade?esc(pp.boltGrade):'A325'+dft)+kv('Row pitch',v('boltPitch','mm'))+((Number(pp.boltCols)||1)>1?kv('Column pitch',pp.boltColPitch!=null?v('boltColPitch','mm'):dim(Number(pp.boltPitch!=null?pp.boltPitch:70))):'')+kv('Length','<span style="color:var(--mut)">auto (from grip)</span>');
3614
3617
  else if(pk==='weld')body=sec('Weld')+kv('Leg',v('weldLeg','mm'));
3615
3618
  else if(pk==='cope')body=sec('Cope')+kv('Length',dim(el&&el.width))+kv('Depth',dim(el&&el.depth))+kv('Re-entrant radius',v('copeRadius','mm'));
@@ -3806,27 +3809,35 @@ function panel(){
3806
3809
  <div class="row f"><button class="ghostw" id=bpTrim data-tip="Pick a point on ${esc(m.id)} — trim or extend the column so its base seats there (snaps to framing levels)">⭶ Trim / Extend column to base…</button><button class="ghostw" id=bpRemove data-tip="Delete this column's base plate" style="color:#fca5a5;border-color:#7f1d1d">Remove base plate</button></div>`:'';
3807
3810
  // This BEAM's shear-plate joints — one params block per detailed END (start/end). Mirrors bpSect but
3808
3811
  // per-end (a beam can be detailed at both ends), and adds the clearance + web-side + stiffener controls.
3809
- const spjs=col?[]:[0,1].map(e=>({e,j:(C.joints||[]).find(j=>j&&j.kind==='shear-plate'&&j.main===m.id&&j.at==='end'+e)})).filter(x=>x.j);
3812
+ // Both parametric END kinds. A gusset reaching this panel and finding no section for it was a dead end:
3813
+ // the whole-connection inspector renders “✎ Edit parameters on <member> →” for every parametric kind.
3814
+ const spjs=col?[]:[0,1].map(e=>({e,j:(C.joints||[]).find(j=>j&&(j.kind==='shear-plate'||j.kind==='brace-gusset')&&j.main===m.id&&j.at==='end'+e)})).filter(x=>x.j);
3810
3815
  const spAllAuto=spjs.length>0&&spjs.every(x=>x.j.source==='auto');
3811
3816
  // DOM ids key on the END INDEX (0/1), NEVER the joint id (a free-string schema field) — so a crafted
3812
3817
  // joints[].id can't inject into an attribute position; the handlers below close over the real joint.
3813
3818
  const spF=(e,j,key,label,ph,unit)=>{const raw=j&&j.params&&j.params[key]!=null?j.params[key]:null;const val=raw==null?'':(unit==='mm'?esc(fmtFtIn(Number(raw)/25.4)):esc(String(raw)));
3814
3819
  return `<div class=elab>${label}</div><input id="spf_e${e}_${key}" inputmode=decimal placeholder="${esc(ph)}" value="${val}" autocomplete=off>${unit&&unit!=='mm'?`<span class=edec>${unit}</span>`:''}`;}; // mm params shown/entered in ft-in
3815
- const spBlock=({e,j})=>{const dot=e===1?dotE:dotS,lbl=e===1?'End':'Start',st=!!(j.params&&j.params.stiffener);
3816
- return `<div class=divrow><hr><span class=sect style="margin:0">${dot}${lbl} · Shear plate</span><hr></div>
3817
- ${spF(e,j,'plateWidth','Plate width','auto','mm')}${spF(e,j,'plateHeight','Plate height','auto','mm')}${spF(e,j,'plateThickness','Thickness','3/8"','mm')}${spF(e,j,'weldLeg','Weld leg','1/4"','mm')}${spF(e,j,'clearance','Clearance (beam gap)','1/2"','mm')}
3818
- <div class=elabrow><span class=elab>Web side</span></div>
3820
+ const spBlock=({e,j})=>{const dot=e===1?dotE:dotS,lbl=e===1?'End':'Start',st=!!(j.params&&j.params.stiffener);const gus=j.kind==='brace-gusset';
3821
+ return `<div class=divrow><hr><span class=sect style="margin:0">${dot}${lbl} · ${gus?'Gusset plate':'Shear plate'}</span><hr></div>
3822
+ ${spF(e,j,'plateWidth','Plate width','auto','mm')}${spF(e,j,'plateHeight','Plate height','auto','mm')}${spF(e,j,'plateThickness','Thickness','3/8"','mm')}${spF(e,j,'weldLeg','Weld leg','1/4"','mm')}${gus?spF(e,j,'plateCount','Plates (1 or 2)','2',''):spF(e,j,'clearance','Clearance (beam gap)','1/2"','mm')}
3823
+ <div class=elabrow><span class=elab>${gus?'Lapped side':'Web side'}</span></div>
3819
3824
  <div class=seg2 style="margin-top:0"><button id="spside_e${e}_n" class="${(j.params&&j.params.webSide<0)?'':'on'}">Near</button><button id="spside_e${e}_f" class="${(j.params&&j.params.webSide<0)?'on':''}">Far</button></div>
3820
- <div class=elabrow><span class=elab>Weld sides</span></div>
3821
- <div class=seg2 style="margin-top:0"><button id="spw_e${e}_n" class="${(j.params&&j.params.weldSide==='near')?'on':''}">Near</button><button id="spw_e${e}_f" class="${(j.params&&j.params.weldSide==='far')?'on':''}">Far</button><button id="spw_e${e}_b" class="${(!j.params||!j.params.weldSide||j.params.weldSide==='both')?'on':''}">Both</button></div>
3825
+ ${gus?'':`<div class=elabrow><span class=elab>Weld sides</span></div>
3826
+ <div class=seg2 style="margin-top:0"><button id="spw_e${e}_n" class="${(j.params&&j.params.weldSide==='near')?'on':''}">Near</button><button id="spw_e${e}_f" class="${(j.params&&j.params.weldSide==='far')?'on':''}">Far</button><button id="spw_e${e}_b" class="${(!j.params||!j.params.weldSide||j.params.weldSide==='both')?'on':''}">Both</button></div>`}
3822
3827
  <div class=elab style="margin-top:7px;opacity:.7">Bolts</div>
3823
3828
  ${spF(e,j,'boltCols','Bolt columns','1','')}${spF(e,j,'boltRows','Bolt rows','3','')}${spF(e,j,'boltDia','Bolt ⌀','3/4"','mm')}${spF(e,j,'boltPitch','Row spacing','2 3/4"','mm')}${(Number(j.params&&j.params.boltCols)>1)?spF(e,j,'boltColPitch','Column spacing',(j.params&&j.params.boltPitch!=null?fmtFtIn(Number(j.params.boltPitch)/25.4):'2 3/4"'),'mm'):''}
3824
3829
  <div class=elabrow><span class=elab>Bolt grade</span></div>
3825
3830
  <div class=seg2 style="margin-top:0"><button id="spg_e${e}_325" class="${(j.params&&j.params.boltGrade==='A490')?'':'on'}">A325</button><button id="spg_e${e}_490" class="${(j.params&&j.params.boltGrade==='A490')?'on':''}">A490</button></div>
3826
3831
  <div class=hint style="margin:4px 0 0">Bolt length auto-sizes from the grip (AISC) → shown on the bolt callout.</div>
3827
- <div class=elabrow><span class=elab>Opposite stiffener</span><label class=defck><input type=checkbox id="spck_e${e}"${st?' checked':''}>add</label></div>
3828
- <div class="row f"><button class="ghostw" id="sprm_e${e}" data-tip="Delete this end's shear plate" style="color:#fca5a5;border-color:#7f1d1d">Remove shear plate</button></div>`;};
3829
- const spSect=spjs.length?`<div class=hint style="margin:8px 0 0">${spAllAuto?'Auto-added — millimetres; empty = engine default. <b>Clearance</b> = the gap (≈½–¾") so the beam clears the support; <b>Web side</b> picks which face of the web the plate laps. Clear all via <b>Clear shear plates</b> in the toolbar (AI-tuned plates are kept).':'Tune this end&#39;s shear plate — millimetres; empty = engine default. <b>Clearance</b> = the gap (≈½–¾") so the beam clears the support; <b>Web side</b> picks which face of the web the plate laps.'}</div>${spjs.map(spBlock).join('')}`:'';
3832
+ ${gus?`<div class=hint style="margin:4px 0 0">The brace is set back to the support face automatically — a gusset has no erection gap to enter.</div>`:`<div class=elabrow><span class=elab>Opposite stiffener</span><label class=defck><input type=checkbox id="spck_e${e}"${st?' checked':''}>add</label></div>`}
3833
+ <div class="row f"><button class="ghostw" id="sprm_e${e}" data-tip="Delete this end's ${gus?'gusset':'shear plate'}" style="color:#fca5a5;border-color:#7f1d1d">Remove ${gus?'gusset':'shear plate'}</button></div>`;};
3834
+ // The intro reads per-KIND: a gusset has no erection clearance to explain and does not lap a web, so the
3835
+ // fin-plate wording above a gusset block was describing controls that are not there.
3836
+ const spAllGus=spjs.length>0&&spjs.every(x=>x.j.kind==='brace-gusset');
3837
+ const spIntro=spAllGus
3838
+ ? 'Tune this end&#39;s gusset — millimetres; empty = engine default. The brace is set back to the support face automatically; <b>Lapped side</b> picks which face of the angle leg the plates sandwich.'
3839
+ : (spAllAuto?'Auto-added — millimetres; empty = engine default. <b>Clearance</b> = the gap (≈½–¾") so the beam clears the support; <b>Web side</b> picks which face of the web the plate laps. Clear all via <b>Clear shear plates</b> in the toolbar (AI-tuned plates are kept).':'Tune this end&#39;s shear plate — millimetres; empty = engine default. <b>Clearance</b> = the gap (≈½–¾") so the beam clears the support; <b>Web side</b> picks which face of the web the plate laps.');
3840
+ const spSect=spjs.length?`<div class=hint style="margin:8px 0 0">${spIntro}</div>${spjs.map(spBlock).join('')}`:'';
3830
3841
  const _cps=(!col&&copesByMember[m.id])?copesByMember[m.id]:[]; // auto cope(s) on this beam (from the rendered scene)
3831
3842
  const copeSect=_cps.length?`<div class=divrow><hr><span class=sect style="margin:0">Cope (auto)</span><hr></div><div class=hint style="margin:0 0 2px">${_cps.map(esc).join(' · ')} — auto, clash-driven so the beam clears the support.</div>`:'';
3832
3843
  const rotN=((((+m.rot||0)%360)+360)%360); // [0,360) → drives the quick-chip highlight
@@ -4021,7 +4032,7 @@ function panel(){
4021
4032
  // DECOUPLED (else an absent boltColPitch silently inherits boltPitch and later row-pitch edits move both).
4022
4033
  if((Number(jj.params.boltCols)||1)>1&&jj.params.boltColPitch==null)jj.params.boltColPitch=jj.params.boltPitch!=null?jj.params.boltPitch:70;
4023
4034
  jj.source='user';});};};
4024
- ['plateWidth','plateHeight','plateThickness','weldLeg','clearance','boltDia','boltPitch','boltColPitch'].forEach(k=>wsp(k,false));['boltCols','boltRows'].forEach(k=>wsp(k,true));
4035
+ ['plateWidth','plateHeight','plateThickness','weldLeg','clearance','boltDia','boltPitch','boltColPitch'].forEach(k=>wsp(k,false));['boltCols','boltRows','plateCount'].forEach(k=>wsp(k,true));
4025
4036
  {const setSide=(s)=>edit(()=>{const jj=(C.joints||[]).find(x=>x&&x.id===jid);if(!jj)return;if(!jj.params)jj.params={};jj.params.webSide=s;jj.source='user';}); // which face of the web the plate laps
4026
4037
  const n=document.getElementById('spside_e'+e+'_n');if(n)n.onclick=()=>setSide(1);
4027
4038
  const f=document.getElementById('spside_e'+e+'_f');if(f)f.onclick=()=>setSide(-1);}
@@ -4443,11 +4454,11 @@ function openPropLabels(x,y){if(!selArr().length)return;propPopConn=null;const e
4443
4454
  // connection props onto the model is a member-keyed pipeline → deferred; this is a VIEW, not a picker. ----
4444
4455
  function connPropRows(cs){
4445
4456
  const j=cs.joint,isBP=cs.kind==='base-plate',pp=(j&&j.params)||{}; // tolerate a missing joint (orphaned part) rather than throw
4446
- const plate=(partsById||{})[cs.conn+':plate']||null;
4457
+ const plate=(partsById||{})[cs.conn+':plate']||(partsById||{})[cs.conn+':plateA']||null; // …same for the gusset pair
4447
4458
  const dim=mm=>(mm==null?'—':fmtFtIn(Number(mm)/25.4));
4448
4459
  const cols=pp.boltCols||(isBP?2:1),rows=pp.boltRows||(isBP?2:3);
4449
4460
  return [
4450
- {label:'Type', value:isBP?'Base plate':'Shear plate'},
4461
+ {label:'Type', value:connKindLabel(cs.kind)},
4451
4462
  {label:'On member', value:cs.main},
4452
4463
  {label:'Plate width', value:plate?dim(plate.width):'—'},
4453
4464
  {label:'Plate height', value:plate?dim(plate.depth):'—'},
@@ -4474,7 +4485,7 @@ function renderConnTree(el){
4474
4485
  el.querySelector('#ppList').innerHTML='<div class=ppempty>No connection selected.</div>';return; }
4475
4486
  const q=(el.querySelector('#ppSearch').value||'').trim().toLowerCase();
4476
4487
  const single=t.conns.length===1&&!t.members.length;
4477
- const kindName=k=>k==='base-plate'?'Base plate':k==='shear-plate'?'Shear plate':'Connection';
4488
+ const kindName=k=>connKindLabel(k);
4478
4489
  const nSel=t.conns.length+t.members.length, rowMatch=s=>!q||String(s).toLowerCase().includes(q), sw='<span class=tsw></span>';
4479
4490
  el.querySelector('#ppTitle').textContent=single?('Properties · '+kindName(t.conns[0].kind)):('Properties · '+nSel+' objects');
4480
4491
  el.querySelector('#ppScope').textContent=single?('On '+t.conns[0].main):(t.conns.length+' connection'+(t.conns.length===1?'':'s')+(t.members.length?(' · '+t.members.length+' member'+(t.members.length===1?'':'s')):''));
@@ -5629,7 +5640,11 @@ reflectOriginGrid();
5629
5640
  // retroactively deselect an already-selected object (render() paints from selIds as-is). Type lists are dynamic. ---
5630
5641
  const selBar=document.getElementById('selBar'),selFly=document.getElementById('selFly');
5631
5642
  var selFilterReady=false; // armed by the deferred first reflect below; render() checks it so its per-edit reflect only runs once the Select-bar is initialised. In the current flow the first paint runs after this line (reads false); `var` (not let/const) is defensive — render() is defined earlier, so if it ever ran before this line it would read undefined (falsy), not throw a TDZ error.
5632
- const CONN_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','custom':'Imported'};
5643
+ const CONN_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','brace-gusset':'Gusset plate','custom':'Imported'};
5644
+ // Every connection label in this file goes through here. They used to be open-coded ternaries whose ELSE
5645
+ // branch said 'Shear plate', so the moment a third parametric kind existed the inspector announced a
5646
+ // brace gusset as a shear plate — the right geometry under the wrong name, which is worse than no label.
5647
+ function connKindLabel(k){return CONN_KIND_LABEL[String(k||'').trim().toLowerCase()]||'Connection';}
5633
5648
  function connKindRecords(){const seen=new Map();for(const j of ((typeof C!=='undefined'&&C&&C.joints)||[])){const k=normConnKind(j&&j.kind);if(k&&!seen.has(k))seen.set(k,CONN_KIND_LABEL[k]||labelFromMemberTypeKey(k));}return [...seen].map(([k,label])=>({k,label}));}
5634
5649
  function selGroupDef(grp){return grp==='members'
5635
5650
  ? {title:'Members',all:'All member types',store:selFilter.mtype,records:memberTypeRecords(),empty:'No member types'}
@@ -5913,6 +5928,18 @@ const view3dApi={
5913
5928
  edit(()=>{C.joints=(Array.isArray(C.joints)?C.joints:[]).filter(x=>!(x&&x.kind==='shear-plate'&&x.main===beam.id&&x.at==='end'+endIdx));C.joints.push(joint);selIds=new Set();});
5914
5929
  toast((had?'Shear plate on '+beam.id+' '+(endIdx?'end':'start')+' replaced with “'+f.name+'”':'“'+f.name+'” applied to '+beam.id+' '+(endIdx?'end':'start'))+' — click another beam end, or Esc');return;
5915
5930
  }
5931
+ if(f.kind==='brace-gusset'){
5932
+ const _pk=pick.anchorId?P.members.find(m=>m&&m.id===pick.anchorId):null;
5933
+ const br=(_pk&&_pk.role==='beam'&&isBrace(_pk))?_pk:null; // the ONE kind whose host is a brace — a plain beam wants a shear plate instead
5934
+ if(!br){toast(_pk?'A gusset goes on a BRACE end — click a brace':'Click a brace end to place this gusset');return;}
5935
+ const id='cx'+Date.now().toString(36)+Math.floor(Math.random()*1e4).toString(36);
5936
+ const g=partsById[br.id],d3=(a,b)=>a&&b?Math.hypot(a[0]-b[0],a[1]-b[1],a[2]-b[2]):Infinity;
5937
+ const endIdx=(g&&g.from&&g.to&&d3(pick.point,g.to)<d3(pick.point,g.from))?1:0;
5938
+ const joint={id,kind:'brace-gusset',main:br.id,at:'end'+endIdx,params:Object.assign({},f.params||{}),source:'user'};
5939
+ pendingConnSel=id;const had=(C.joints||[]).some(x=>x&&x.kind==='brace-gusset'&&x.main===br.id&&x.at==='end'+endIdx);
5940
+ edit(()=>{C.joints=(Array.isArray(C.joints)?C.joints:[]).filter(x=>!(x&&x.kind==='brace-gusset'&&x.main===br.id&&x.at==='end'+endIdx));C.joints.push(joint);selIds=new Set();});
5941
+ toast((had?'Gusset on '+br.id+' '+(endIdx?'end':'start')+' replaced with “'+f.name+'”':'“'+f.name+'” applied to '+br.id+' '+(endIdx?'end':'start'))+' — the engine sets the brace back to the beam face; click another brace end, or Esc');return;
5942
+ }
5916
5943
  if(f.kind==='custom'&&Array.isArray(f.geometry)&&f.geometry.length){
5917
5944
  const id='cx'+Date.now().toString(36)+Math.floor(Math.random()*1e4).toString(36);
5918
5945
  const joint={id,kind:'custom',name:f.name||'Imported connection',place:pick.point,geometry:f.geometry,source:'user'};
@@ -6511,14 +6538,15 @@ let favQuery=''; // transient Favourites search filter — NOT per
6511
6538
  let favSearchOpen=false; // is the search input revealed?
6512
6539
  let favKindFilter=(()=>{try{const k=localStorage.getItem('floless.favKind');return (k==='portable'||k==='geometry')?k:'all';}catch{return 'all';}})();
6513
6540
  let armedFavId=null; // the favourite whose placement crosshair is armed (persistent .armed row) — transient
6514
- const FAV_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','custom':'Custom (imported)'};
6515
- const FAV_KIND_COLOR={'base-plate':'#6b7a8d','shear-plate':'#7d8ba0','custom':'#8a97a8'}; // mirror steel-joints.ts GROUPS
6516
- const FAV_CAT_SUGGEST={'base-plate':['Base plates','Columns'],'shear-plate':['Shear plates','Beams'],'custom':['Imported','Details']};
6517
- function favIsPortable(f){return !!f&&(f.kind==='base-plate'||f.kind==='shear-plate');}
6541
+ const FAV_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','brace-gusset':'Gusset plate','custom':'Custom (imported)'};
6542
+ const FAV_KIND_COLOR={'base-plate':'#6b7a8d','shear-plate':'#7d8ba0','brace-gusset':'#94a2b7','custom':'#8a97a8'}; // mirror steel-joints.ts GROUPS
6543
+ const FAV_CAT_SUGGEST={'base-plate':['Base plates','Columns'],'shear-plate':['Shear plates','Beams'],'brace-gusset':['Gusset plates','Braces'],'custom':['Imported','Details']};
6544
+ function favHostNoun(k){return k==='base-plate'?'column':k==='brace-gusset'?'brace':'beam';}
6545
+ function favIsPortable(f){return !!f&&(f.kind==='base-plate'||f.kind==='shear-plate'||f.kind==='brace-gusset');}
6518
6546
  // The saved-recipe payload captured from a selected whole connection: recipe scalars, or an opaque custom mesh.
6519
6547
  function favRecipeOf(j){if(!j)return null;
6520
6548
  if(j.kind==='custom')return {kind:'custom',geometry:Array.isArray(j.geometry)?j.geometry:[],name:j.name||'Imported connection'};
6521
- if(j.kind==='base-plate'||j.kind==='shear-plate')return {kind:j.kind,params:Object.assign({},j.params||{})};
6549
+ if(j.kind==='base-plate'||j.kind==='shear-plate'||j.kind==='brace-gusset')return {kind:j.kind,params:Object.assign({},j.params||{})};
6522
6550
  return null;}
6523
6551
  // A key-order-STABLE JSON of a params object, so the ★ Saved/Save match survives a disk round-trip (a reloaded
6524
6552
  // favourite's params can serialize its keys in a different order than the live joint's — which would flip the ★
@@ -6536,7 +6564,7 @@ let favModalEditId=null; // an existing favourite id (edit mode — rename/reca
6536
6564
  function favSuggestName(j){if(!j)return '';
6537
6565
  if(j.kind==='custom')return j.name||'Imported connection';
6538
6566
  const prof=((P.members||[]).find(m=>m&&m.id===j.main)||{}).profile||'';
6539
- return (j.kind==='base-plate'?'Base plate':'Shear plate')+(prof?' — '+prof:'');}
6567
+ return connKindLabel(j.kind)+(prof?' — '+prof:'');}
6540
6568
  function favFillModal({title,kind,name,category,portable,hint}){
6541
6569
  document.getElementById('favModalTitle').textContent=title;
6542
6570
  const kf=document.getElementById('favKind');kf.className='chip';kf.textContent=FAV_KIND_LABEL[kind]||kind;
@@ -6553,12 +6581,12 @@ function openFavModalFor(j){if(!j){toast('Select a connection first');return;}
6553
6581
  const existing=favMatch(j);favModalJoint=j;favModalEditId=existing?existing.id:null;
6554
6582
  const portable=j.kind!=='custom';
6555
6583
  const hint=j.kind==='custom'?'Imported geometry — drops in place at the clicked point; won’t parametrically re-fit.'
6556
- :'Parametric — re-fits any column or beam you apply it to.';
6584
+ :('Parametric — re-fits any '+favHostNoun(j.kind)+' you apply it to.');
6557
6585
  favFillModal({title:existing?'Edit favourite':'Save to Favourites',kind:j.kind,name:existing?existing.name:favSuggestName(j),category:existing?existing.category:'',portable,hint});}
6558
6586
  // From a Favourites row ⋯ → rename/recategorize an existing favourite (edit mode; no joint needed).
6559
6587
  function openFavModalEdit(f){if(!f)return;favModalJoint=null;favModalEditId=f.id;
6560
6588
  favFillModal({title:'Edit favourite',kind:f.kind,name:f.name,category:f.category,portable:favIsPortable(f),
6561
- hint:f.kind==='custom'?'Imported geometry — drops in place; won’t parametrically re-fit.':'Parametric — re-fits any column or beam.'});}
6589
+ hint:f.kind==='custom'?'Imported geometry — drops in place; won’t parametrically re-fit.':('Parametric — re-fits any '+favHostNoun(f.kind)+'.')});}
6562
6590
  function favModalClose(){document.getElementById('favConnModal').style.display='none';favModalJoint=null;favModalEditId=null;}
6563
6591
  function favModalIsOpen(){const m=document.getElementById('favConnModal');return !!m&&m.style.display==='flex';}
6564
6592
  async function favModalSave(){const name=(document.getElementById('favName').value||'').trim();