@floless/app 0.109.0 → 0.109.2

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.
@@ -99,6 +99,48 @@ callouts reached only a small minority of the connection-detail sheets directly
99
99
  only on a second or third hop, and the sheet carrying the plate schedule was two hops from the plan. Let
100
100
  the graph tell you the real extent; the plans' own callout list is a starting point, not an inventory.
101
101
 
102
+ ### Having reached the sheet, locate the detail ON it
103
+
104
+ Resolving a callout to a sheet is half the job: a detail sheet holds many details, and *where on the sheet*
105
+ detail N sits is what makes the reference openable — a crop of the right detail — instead of a whole sheet
106
+ the reader still has to search.
107
+
108
+ - **Two different things to record: the tag and the extent.** The **tag** (the number) establishes which
109
+ detail this is; the **extent** (its cell / panel on the sheet) is what a crop needs. A tag point alone
110
+ does not yield an openable crop. Find how THIS set tags a detail before you look for one — a title rule
111
+ carrying title/scale/number, a bubble, a boxed or side-set title — and where the tag sits relative to the
112
+ drawing it titles. Sets differ, a set may mix conventions, and the layout is the set's to declare, not
113
+ yours to remember.
114
+ - **Tags may sit on a LATTICE.** Where a set lays details on a repeating column/row grid, the tags land on
115
+ the same fractional positions sheet after sheet — it is a property of the drafting template, so it holds
116
+ across the sheets sharing that template and no further. *On a set measured while writing this rule, one
117
+ lattice covered every detail sheet; treat that as a thing to test for, not a thing to expect.* Exploit
118
+ it: confirm a few tags by eye on one or two sheets, derive the lattice, then **crop the lattice cells
119
+ directly on the remaining sheets** rather than re-deriving tags per sheet. **Validate before you trust
120
+ it** — check the derived cells against a sheet you already confirmed, and re-check wherever the template
121
+ changes: an enlarged detail spanning cells, a schedule or notes sheet, a sheet from another package or
122
+ discipline, a revised sheet. Where it holds it is near-complete; where it does not, read that sheet.
123
+ (A rotated sheet breaks your coordinate *mapping*, not the layout — see the `/Rotate` bullet in Tools.)
124
+ - **Reconcile what you found against what the callouts ask for**, whichever method you used — this is the
125
+ check that makes a silent miss visible. An unmatched reference has three different causes and they route
126
+ differently: your method missed the tag (re-read that sheet), the referenced sheet is not in the set (a
127
+ FINDING — see the missing-link rule above), or the sheet is there and the number genuinely is not on it
128
+ (a stale or superseded callout — a set defect worth naming, not a crop to re-tune). Deciding which is
129
+ part of the job; assuming the first burns effort on the other two.
130
+ - **Why prefer the lattice to a per-sheet rule filter:** not accuracy, but the failure MODE. Both break on
131
+ an off-template sheet. A lattice cell still hands you a crop you can look at and reject; a per-sheet
132
+ filter returns nothing, and a sheet with a missed tag is indistinguishable from a sheet with fewer
133
+ details.
134
+ - **Batch the reading, up to legibility.** Cropping cells is deterministic and cheap; only *"which number
135
+ is in this cell"* needs a model. Tile the candidate crops into labelled contact sheets and read them in
136
+ one pass instead of a pass per sheet — but keep each digit above the legibility floor this skill sets
137
+ for tiling (see Pass 3), and use as many contact sheets as that takes. Over-tiling downsamples the digits
138
+ and the failure is a misread number, not an obvious blank.
139
+ - **Never record a position whose number you did not actually read.** Inferring "the next one along must be
140
+ the next number" is fabrication wearing a plausible shape — and the stored position is precisely what a
141
+ later reader will open, so a wrong one silently serves the WRONG detail. That is worse than storing
142
+ nothing, which at least shows the whole sheet honestly. Confirm the digit, or leave it unset.
143
+
102
144
  ## Symbols mean what THIS set's legend says — never a remembered mapping
103
145
 
104
146
  A framing plan draws several things as "a line with marks on its ends", and they are not the same kind
@@ -152,8 +194,30 @@ to double the tonnage in a take-off while every individual sheet still looks rig
152
194
  ## Tools — use the deterministic layer; the AI interprets, never measures
153
195
 
154
196
  - **Render/extract with PyMuPDF (`fitz`)** — prefer it over `pdftoppm` (which may not be installed).
155
- `page.get_text("words")` gives positioned text (grid bubbles, sizes) **losslessly** on vector PDFs;
197
+ `page.get_text("words")` gives positioned text (grid bubbles, sizes) **losslessly** on vector PDFs
198
+ *where a text layer actually exists* (see the boilerplate-only trap below);
156
199
  `page.get_drawings()` gives every line with real coordinates. Read vectors before you OCR pixels.
200
+ - **A sheet may be `/Rotate`d — check `page.rotation`, then transform.** `get_drawings()`/`get_text()`
201
+ answer in the page's **unrotated** coordinate system while `get_pixmap()` renders in DISPLAY orientation,
202
+ so a coordinate carried straight from the vectors to something measured off the render is wrong *and
203
+ still plausible* — it lands on the page, just in the wrong place. Send every extracted point through
204
+ `page.rotation_matrix` first. Two things that will burn you:
205
+ - **Read `page.rotation`; do not infer rotation from the page shape.** 90/270 transpose the axes, so the
206
+ aspect flips and `page.rect` differs from the mediabox. **180 does neither** — it reflects both axes,
207
+ and `page.rect` matches the mediabox exactly. On a 180 sheet a "did the aspect flip?" check reports
208
+ "not rotated" while every point is 180° wrong.
209
+ - **An in-range coordinate is NOT evidence you got it right.** A wrong-space point usually still
210
+ normalises inside 0..1 (measured on a 90 sheet: the wrong answer landed at ~0.08/0.05, the right one at
211
+ ~0.93/0.06), and on a 180 sheet an out-of-range value cannot occur at all. Out-of-range is a useful
212
+ smell worth checking; in-range means nothing. Verify against ink you can see in the render instead.
213
+
214
+ Rotation is also only the orientation half: mapping to actual pixmap PIXELS additionally needs the render
215
+ scale/DPI and any clip or CropBox offset.
216
+ - **Don't assume a text layer covers the drawing.** A set can carry text for the boilerplate (consultant
217
+ block, notes) while every title, sheet number and detail number is vector outline or raster — so
218
+ extraction returns the same few lines on every page and identifies nothing. Test it early: if page text
219
+ is identical page-to-page, **identify sheets by rendering the title block and reading it**, not by
220
+ extracting text. One contact sheet of every page's sheet-number cell indexes the whole set in one pass.
157
221
  - **AWARE `vision` agent** (`aware agent describe vision`) — image/PDF → **fixed-schema** structured
158
222
  JSON via a model. Use it for the structured extraction passes below; the FIXED schema is the point
159
223
  (it constrains hallucination). The terminal AI / `vision` *interprets and assembles*; AWARE's
@@ -238,6 +302,12 @@ Only then build the scene / overlay / IFC. If unsure, present the **massing + gr
238
302
  - [ ] A member spanning two levels emitted on both plans (doubles the tonnage).
239
303
  - [ ] A size left as an RFI when the set does show it — a lazy RFI is as wrong as a fabricated number.
240
304
  - [ ] A built-up shape (double angle, etc.) taken off as its single component (half the steel).
305
+ - [ ] Vector coordinates compared against a render without applying the page rotation — silently transposed
306
+ at 90/270, silently point-reflected at 180 (where the page shape gives no hint at all).
307
+ - [ ] Sheets identified by extracting text, on a set whose text layer is boilerplate only.
308
+ - [ ] A detail's stored position guessed from its neighbours rather than read — it opens the wrong detail.
309
+ - [ ] A referenced detail with no tag found assumed to be a method miss, when the sheet is absent from the
310
+ set or the number is genuinely not on it (a set defect, not a crop to re-tune).
241
311
 
242
312
  ## Companion skills
243
313
  - After this reading produces a verified structure, hand to the **`floless-app-steel-takeoff`** reader
@@ -102,6 +102,75 @@ export function planDetailRefs(plan) {
102
102
  return out;
103
103
  }
104
104
 
105
+ /**
106
+ * Callout kinds that are NOT details for scoring purposes.
107
+ *
108
+ * A section or an elevation is a more GENERAL drawing than a detail — it is a cut or a face of the
109
+ * structure, and it typically carries detail callouts of its own rather than being one. So the
110
+ * confidence report should not score it as a detail. (Product call, 2026-07-24, answering the question
111
+ * #401 was opened to ask.)
112
+ *
113
+ * Denying these two is the exact complement of `detail-ref`: the schema's callout enum is
114
+ * section | elevation | detail-ref and nothing else, and every writeback goes through validateContract,
115
+ * so no third general kind can reach here in a document that validates.
116
+ *
117
+ * It is nonetheless a DENY list rather than an allow list of `detail-ref`, because `callouts[]` is not
118
+ * the only input. The schema requires `kind` on a CALLOUT, but a `details[]` entry is a bare `{text}`
119
+ * with no kind at all — that is every detail written before callouts existed. Allow-listing would
120
+ * score ZERO of them and silently empty the report for models that score fine today. An entry that
121
+ * does not say it is a section is treated as a detail: the safe direction, since the failure it risks
122
+ * is one row too many rather than a whole model's worth missing.
123
+ */
124
+ export const NON_DETAIL_KINDS = ['section', 'elevation'];
125
+
126
+ /**
127
+ * The callouts on this plan that COUNT AS DETAILS for confidence scoring — the same `details[]` +
128
+ * `callouts[]` union every other surface reads since #397, minus NON_DETAIL_KINDS.
129
+ *
130
+ * Not deduplicated and not sorted, unlike planDetailTexts: the scorer emits one row per callout, and
131
+ * the same detail referenced twice on a sheet is two things to resolve, not one. Entries with no
132
+ * resolvable name are KEPT with an empty text — the scorer bands those `low` with "no sheet reference
133
+ * parsed", which is a real finding about the drawing, not a row to hide.
134
+ *
135
+ * Both scorers read this one function — server/steel-confidence.ts (the authority) and the editor's own
136
+ * scoreContractJS — so THIS rule cannot drift between them. The banding either side of it is still two
137
+ * hand-mirrored copies; what pins the editor's is the pair of #401 tests in steel-editor-draft.test.ts,
138
+ * which boot the real page and assert its detail row count. See the note above the loop in
139
+ * steel-confidence.ts for exactly what that does and does not cover.
140
+ */
141
+ export function planScoredDetails(plan) {
142
+ const skip = new Set(NON_DETAIL_KINDS);
143
+ const seen = new Set(), out = [];
144
+ for (const entry of entries(plan)) {
145
+ if (!entry || typeof entry !== 'object') continue;
146
+ if (skip.has(text(entry.kind).toLowerCase())) continue;
147
+ const name = calloutRefText(entry) || '';
148
+ // The sheet the callout STRUCTURALLY points at, carried alongside the printed mark. The scorer
149
+ // parses the mark first, but a mark need not contain its sheet — the schema documents "A" and
150
+ // "A-A" as legal text and makes `target` required — and on those the parse yields nothing while
151
+ // the navigation bubble, which reads target.sheet, jumps to the right sheet regardless. Without
152
+ // this the two surfaces disagree: one resolves the reference, the other calls it unparseable.
153
+ const t = entry.target;
154
+ const targetSheet = (t && typeof t === 'object' && text(t.sheet)) || '';
155
+ // One row per distinct REFERENCE, not per bubble. The band asks only whether the referenced sheet
156
+ // is in the set, which is a property of the reference — so the same detail called out five times on
157
+ // a sheet (the demo model does exactly this: 42 bubbles naming 21 distinct references, one of them
158
+ // five times) is ONE thing to resolve, repeated. Left un-deduplicated it padded the Details
159
+ // worklist with byte-identical rows and let a single dangling reference count five times against
160
+ // the category. planDetailRefs is right NOT to dedupe — it draws a hot-zone per physical bubble —
161
+ // but that is the placement question, not the resolution question this scorer asks.
162
+ // Keyed on mark AND target sheet, because two sheets can both print "7". Deduplication is PER PLAN,
163
+ // which is the scope this function has: the same detail referenced from two different plans stays
164
+ // two rows, and each row names its own plan's sheet, so the worklist still says where to look. On
165
+ // the demo model that takes 42 bubbles to 32 rows over three plans, for 21 distinct references.
166
+ const key = name + '' + targetSheet;
167
+ if (seen.has(key)) continue;
168
+ seen.add(key);
169
+ out.push({ text: name, targetSheet: targetSheet || null, kind: text(entry.kind) || 'detail' });
170
+ }
171
+ return out;
172
+ }
173
+
105
174
  /**
106
175
  * Every detail this plan can bind to, unique and sorted — the plan's own callouts plus the model's
107
176
  * custom details. Numeric-aware ordering, so detail 2 sorts before detail 10 the way a detailer reads
@@ -1347,8 +1347,61 @@ function showEmpty(icon, headline, bodyText, appIdText, opts) {
1347
1347
  }
1348
1348
  document.body.replaceChildren(wrap);
1349
1349
  }
1350
+ /*
1351
+ * A 2D/3D click that lands while boot() is still loading.
1352
+ *
1353
+ * #vt2d/#vt3d ship in the STATIC markup (:808), so they paint and accept clicks the moment the page
1354
+ * does — but their real handlers are assigned near the end of main(), which boot() only reaches after four
1355
+ * awaits: the dynamic module imports, GET /api/contract/:app, GET /api/app/:app and GET
1356
+ * /api/aisc-shapes. A click landing in that window hit a button with NO listener and the browser
1357
+ * dropped it: no error, no failed request, no toast, nothing — which is exactly why it read as "the 3D
1358
+ * tab does nothing" (#379). The window widens with contract size and a cold start, so it is not a
1359
+ * local-dev curiosity; it was reported from a real install and reproduces intermittently.
1360
+ *
1361
+ * Record the intent rather than losing it, and reflect the press immediately so the click visibly
1362
+ * registers — which is what a segmented control does when you pick a segment; the canvas then catches
1363
+ * up. Deliberately NOT a disabled button: a control that does nothing is no better dead than missing,
1364
+ * and this one CAN honour the click, just not yet.
1365
+ *
1366
+ * The reflection is optimistic, and main() is what makes it truthful: it routes the pending click
1367
+ * through setView(), whose own failure path (a renderer that did not load) calls applyViewState(false)
1368
+ * and puts the toggle back on 2D. Every early return in boot() is a showEmpty(), which replaces the
1369
+ * whole body — so a queued intent can never outlive the toggle it belongs to.
1370
+ */
1371
+ let pendingView = null; // null = untouched; true = 3D; false = 2D
1372
+ let viewHandlersLive = false; // main() sets it once the real onclick handlers are assigned
1373
+ function armEarlyViewToggle() {
1374
+ const t2 = document.getElementById('vt2d'), t3 = document.getElementById('vt3d');
1375
+ if (!t2 || !t3) return;
1376
+ // Silent by default — nothing is announced and nothing is styled — but it is the correct ARIA for
1377
+ // "this group's state is mid-update", which is exactly the window a queued press sits in. Cleared at
1378
+ // the hand-over in main().
1379
+ const group = document.getElementById('viewToggle');
1380
+ if (group) group.setAttribute('aria-busy', 'true');
1381
+ const arm = (el, want) => el.addEventListener('click', () => {
1382
+ // Inert once main() has wired the real handlers. Going inert rather than DETACHING is deliberate:
1383
+ // an AbortController signal is the tidier idiom, but the characterization harness's DOM stub has
1384
+ // no AbortController and ignores the signal option, so the removal it implies would not be
1385
+ // modelled there — a guard that reads the same in both is worth more than the tidier spelling.
1386
+ // It matters that these stop acting: left live they would keep flipping the toggle on every later
1387
+ // click, including when setView REFUSES the switch, leaving the control claiming 3D over a 2D
1388
+ // canvas.
1389
+ if (viewHandlersLive) return;
1390
+ pendingView = want;
1391
+ // The VISUAL press only. aria-pressed stays where it is until applyViewState sets it for real,
1392
+ // because the two audiences are not in the same position: a sighted user sees the whole header
1393
+ // still sitting at its static zeros and reads the flip as "loading", while a screen-reader user
1394
+ // gets none of that context and would simply be told "pressed" about a view that is not on screen.
1395
+ // aria-busy on the group above says "mid-update" instead, which is true.
1396
+ t2.classList.toggle('on', !want);
1397
+ t3.classList.toggle('on', want);
1398
+ });
1399
+ arm(t2, false); arm(t3, true);
1400
+ }
1401
+
1350
1402
  async function boot() {
1351
1403
  if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
1404
+ armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
1352
1405
  [SteelCore, ViewGen, ModelCmd, DetailRefs] = await Promise.all([import('./steel-3d-core.js'), import('./steel-view-generation.js'), import('./steel-model-commands.js'), import('./steel-detail-refs.js')]); // await BEFORE main()/restoreSaved(): both draft-state sanitisers must exist at the load boundary, and render() reads DetailRefs
1353
1406
  const res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + PROJECT_QS);
1354
1407
  if (!res.ok) {
@@ -7107,7 +7160,9 @@ function applyViewState(on){ // flip the toggle + swap the canvases (
7107
7160
  document.getElementById('ptrBars').classList.toggle('s3d',on); // in 3D the pointer-behaviour bars shift clear of the world-axis triad (bottom-right); see #ptrBars.s3d
7108
7161
  if(!on)document.getElementById('m3dLegend').style.display='none'; // panel is shown by setView (showLegendPanel) when entering 3D
7109
7162
  }
7163
+ let viewSeq=0; // monotonic per view switch — see the staleness check after the awaited rebuild below
7110
7164
  async function setView(on){
7165
+ const seq=++viewSeq;
7111
7166
  drawDraft=null;drawPrevClear(); // any view switch drops an in-progress 2D Add-member start — it's a plan-pixel point, meaningless after the switch (else a stale point finishes a member on return)
7112
7167
  // B6: cancel the 2D-only panel-takeover / armed-pick tools on any view switch. They have no 3D counterpart, so if
7113
7168
  // left armed they take over the panel while you're in 3D or silently resume on return to 2D (the "active command
@@ -7125,18 +7180,36 @@ async function setView(on){
7125
7180
  if(disarmed2d)render(); // repaint the 2D SVG + inspector ONCE, now that EVERY 2D-only tool is disarmed and view3d is still false (2D render path): they suppress callouts / draw pick hotspots (:2061,:2069) and take over #panel, and the return-to-2D path never render()s — so a render here (like the Esc paths) un-stales the canvas + panel. Deferred past the dim/dim-style disarm so it can't paint a still-armed Dimension panel (dimMode can coexist with grid/pick) that then goes stale.
7126
7181
  if(cmTool){cmDraft=null;cmPrevClear();cmHudClose();} // Move/Copy stays armed across the view switch — only the in-progress 2D pick is dropped (it's in plan px)
7127
7182
  if(selIds.size)sel3dDimIds.clear(); // a member selected in 2D wins over a stale 3D-dim selection
7128
- if(!window.Steel3DView){toast('3D view unavailable (renderer failed to load)');return;} // stay in 2D
7183
+ // applyViewState(false) before bailing, not just `return`: on the ordinary click path the toggle was
7184
+ // never touched, so this is a resync that changes nothing visible (it does also clear an active snap
7185
+ // override, which a switch attempt reasonably ends), but a click captured DURING LOAD has already flipped
7186
+ // the segment optimistically (see armEarlyViewToggle) — so returning here would strand the control
7187
+ // claiming 3D over a 2D canvas, permanently, with nothing to correct it. The catch below already
7188
+ // reverts for the same reason once the renderer exists; this branch is the path where it never did.
7189
+ if(!window.Steel3DView){applyViewState(false);toast('3D view unavailable (renderer failed to load)');return;} // stay in 2D
7129
7190
  try{
7130
7191
  if(!view3dReady){window.Steel3DView.init(document.getElementById('stage3d'),view3dApi);view3dReady=true;}
7131
7192
  applyViewState(true);
7132
7193
  window.Steel3DView.show();
7133
7194
  updCS();if(typeof csSyncF3d==='function')csSyncF3d(); // reflect the (persisted) 3D local frame in the Axes chip IMMEDIATELY — before the awaited rebuild, else the chip shows a stale "Global" for the rebuild's duration (QA F14)
7134
7195
  await window.Steel3DView.rebuild(true); // fit the camera on entering 3D
7196
+ // Nobody awaits setView — both toggle handlers and the queued-click path fire and forget — so a
7197
+ // switch BACK to 2D can complete while this one is suspended on the rebuild above. Resuming would
7198
+ // then reopen 3D chrome over a 2D canvas: showLegendPanel() carries no view3d guard of its own.
7199
+ // Same monotonic-sequence discipline as the landing's projectsLoadSeq and the editor's saveSeq —
7200
+ // only the newest switch may finish. applyViewState has already run for the newer one, so there is
7201
+ // nothing to undo here; just stop.
7202
+ if(seq!==viewSeq)return;
7135
7203
  window.Steel3DView.setSelection(selIds);
7136
7204
  if(window.Steel3DView.setGridSelection)window.Steel3DView.setGridSelection(selGridIds); // carry the shared 2D grid selection across the rebuild; rebuild replaces the line objects/materials
7137
7205
  wire3DBar();wireLegendTabs();loadSteelFavourites();build3DLegend();showLegendPanel(); // build the Objects body + load the (global) favourites library, then open the panel on the last-used tab
7138
7206
  reflectProj();reflectMode(); // reflect persisted projection + display mode into the Camera/Display dropdown triggers
7139
7207
  }catch(e){ // a failed open must not strand the UI in 3D with a blank canvas
7208
+ // …but only if this switch is still the current one. rebuild() awaits a POST to /scene, so it can
7209
+ // REJECT late, after the user has already moved on; without this, a stale rejection would drag a
7210
+ // newer, healthy view back to 2D and toast about a view they had left. Same reason as the guard on
7211
+ // the success path above — a staleness check on only one of the two exits is not a check.
7212
+ if(seq!==viewSeq)return;
7140
7213
  applyViewState(false);if(window.Steel3DView)window.Steel3DView.hide();
7141
7214
  toast('Could not open 3D view: '+((e&&e.message)||e));
7142
7215
  }
@@ -7148,8 +7221,50 @@ async function setView(on){
7148
7221
  refreshPropLabels3d();updatePropHint(); // push the label set to whichever view is now live (3D shows them; 2D hides the 3D host) + refresh the corner note
7149
7222
  updCS();if(typeof csSyncF3d==='function')csSyncF3d(); // the Axes chip is view-scoped (2D=P.frame, 3D=frame3d) — resync it + the 3D-frame fields on every switch (applyViewState alone doesn't; Codex MAJOR 6)
7150
7223
  }
7151
- document.getElementById('vt2d').onclick=()=>{if(view3d)setView(false);};
7152
- document.getElementById('vt3d').onclick=()=>{if(!view3d)setView(true);};
7224
+ // ONE entry point per direction, shared by the real buttons and by a click captured during load.
7225
+ // They MUST agree about a renderer that has not arrived yet: steel-3d-view.js is a separate module
7226
+ // script boot() never awaits, and setView treats a missing window.Steel3DView as terminal. If the
7227
+ // button called setView directly it would refuse instantly — so the single most likely reaction to the
7228
+ // bug this fix exists to remove (click 3D, see nothing yet, click again) would turn "still loading"
7229
+ // into a false "renderer failed to load", which is worse than the silent drop it replaced.
7230
+ //
7231
+ // Bounded by a WALL-CLOCK deadline rather than a tick count: setTimeout is clamped to >=1s in a
7232
+ // background tab, which would stretch a counted 5 s into roughly a hundred.
7233
+ let viewWantSeq=0; // any newer request supersedes an outstanding wait
7234
+ function setViewBusy(on){const g=document.getElementById('viewToggle');if(g){if(on)g.setAttribute('aria-busy','true');else g.removeAttribute('aria-busy');}}
7235
+ function requestView2d(){viewWantSeq++;setViewBusy(false);if(view3d)setView(false);}
7236
+ function requestView3d(){
7237
+ const want=++viewWantSeq,deadline=Date.now()+5000;
7238
+ const tick=()=>{
7239
+ if(want!==viewWantSeq)return; // superseded — a later click won
7240
+ if(view3d){setViewBusy(false);return;}
7241
+ if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView(true);return;} // past the bound, setView gives its honest refusal
7242
+ setTimeout(tick,50);
7243
+ };
7244
+ tick();
7245
+ }
7246
+ // Each clears pendingView: between the hand-over below and its deferred start, view3d is still false,
7247
+ // so a REAL 2D click landing in that gap is a no-op AND would then be overridden by the queued 3D
7248
+ // switch — silently doing the opposite of the last thing the user asked for.
7249
+ document.getElementById('vt2d').onclick=()=>{pendingView=null;requestView2d();};
7250
+ document.getElementById('vt3d').onclick=()=>{pendingView=null;requestView3d();};
7251
+ // Hand over from the pre-load capture (see armEarlyViewToggle). Retire it FIRST, so the two cannot
7252
+ // both act on the same click, and drop aria-busy now that the group's state is authoritative again.
7253
+ // A pending 2D needs no action: it is the default the toggle already shows. A pending 3D is applied on
7254
+ // the next tick rather than inline, because main() is still wiring the state setView() acts on, and
7255
+ // main() is not async so there is no await point to hang it off.
7256
+ // Retire the pre-load capture FIRST, so the two cannot both act on the same click. aria-busy is NOT
7257
+ // dropped here: with a 3D click queued, the group stays mid-update for the whole wait below — the
7258
+ // visual segment says 3D, aria-pressed still says 2D and the canvas is still 2D — so clearing it now
7259
+ // would announce "settled" over exactly the stretch it exists to describe. Each terminal path clears it.
7260
+ viewHandlersLive=true;
7261
+ // A pending 2D needs no switch — it is the default already on screen — but it does end the busy state.
7262
+ // A pending 3D goes through requestView3d like any other, one tick later: main() is still wiring the
7263
+ // state setView acts on, and main() is not async so there is no await point to hang it off. It
7264
+ // re-reads pendingView at that point, so a real click in between still cancels it; requestView3d's own
7265
+ // viewWantSeq then covers every later change of mind, and clears aria-busy when it settles.
7266
+ if(pendingView===true)setTimeout(()=>{if(pendingView!==true)return;pendingView=null;requestView3d();},0);
7267
+ else{pendingView=null;setViewBusy(false);}
7153
7268
  // Block the browser's Ctrl+wheel page-zoom anywhere in the app (fires even when the pointer isn't over the canvas). Canvas zoom below still runs.
7154
7269
  window.addEventListener('wheel',e=>{if(e.ctrlKey)e.preventDefault();},{passive:false});
7155
7270
  // wheel = zoom at cursor (matches 3D; Ctrl+wheel too). Pan is middle-drag, below.
@@ -7582,9 +7697,12 @@ function scoreContractJS(){const plans=C.plans||[];const byMember=[],byDetail=[]
7582
7697
  const known=new Set();for(const p of plans)if(p.sheet)known.add(p.sheet.toUpperCase());for(const s of Object.keys(C.detail_bubbles||{}))known.add(s.toUpperCase());
7583
7698
  plans.forEach((plan,pi)=>{segs+=(plan.segments||[]).length;const ms=plan.members||[];const dup=_confDupIds(ms);
7584
7699
  for(const m of ms){const r=_scoreMember(m,dup);byMember.push({id:m.id,planIdx:pi,sheet:plan.sheet||'',role:m.role==='column'?'column':'beam',isBrace:isBrace(m)||undefined,profile:m.profile||'',band:r.band,tons:r.band==='rfi'?0:_mTons(m,plan.pt_per_ft,plan.default_tos),factors:r.factors});} // isBrace mirrors the server MemberScore so the report can label it Brace
7585
- // DELIBERATELY details[] only, for now — see #401 and the matching note in steel-confidence.ts, which
7586
- // this mirrors (contract-score.test.ts holds the two in parity, so they move together or not at all).
7587
- for(const d of (plan.details||[])){const sh=_detSheet(d.text);const ok=sh!=null&&known.has(sh.toUpperCase());byDetail.push({text:d.text||'',planIdx:pi,sheet:plan.sheet||'',band:ok?'high':'low',reason:ok?('references '+sh+' (in the set)'):sh?('references '+sh+' — not found in the set'):'no sheet reference parsed'});}});
7700
+ // The details[]+callouts[] union minus sections/elevations (#401). Both scorers call the SAME helper
7701
+ // in steel-detail-refs.js rather than each spelling the rule out, because a rule written twice is a
7702
+ // rule that drifts. The banding below still mirrors steel-confidence.ts BY HAND; what keeps this call
7703
+ // site honest is the pair of #401 tests in steel-editor-draft.test.ts, which boot the real page and
7704
+ // assert the row count this produces. See the note at its matching loop for what is still unpinned.
7705
+ for(const d of DetailRefs.planScoredDetails(plan)){const sh=_detSheet(d.text)??d.targetSheet;const ok=sh!=null&&known.has(sh.toUpperCase());byDetail.push({text:d.text,planIdx:pi,sheet:plan.sheet||'',band:ok?'high':'low',reason:ok?('references '+sh+' (in the set)'):sh?('references '+sh+' — not found in the set'):'no sheet reference parsed'});}});
7588
7706
  const roll=(arr,cw)=>{const c=_cnt0();let n=0,d=0,t=0;for(const m of arr){c[m.band]++;if(m.band==='rfi')continue;const w=cw?1:m.tons;n+=w*BANDW[m.band];d+=w;t+=m.tons;}return {score:d>0?Math.round(n/d*100):null,tons:t,counts:c};};
7589
7707
  const dRoll=arr=>{const c=_cnt0();let n=0,d=0;for(const x of arr){c[x.band]++;n+=BANDW[x.band];d++;}return {score:d>0?Math.round(n/d*100):null,tons:0,counts:c};};
7590
7708
  const beams=roll(byMember.filter(m=>m.role==='beam'));const columns=roll(byMember.filter(m=>m.role==='column'));const details=dRoll(byDetail);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.109.0",
3
+ "version": "0.109.2",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {