@floless/app 0.125.0 → 0.126.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.
@@ -662,11 +662,13 @@
662
662
  "propLabels": {
663
663
  "type": "object",
664
664
  "additionalProperties": false,
665
- "description": "Draft-only display state. CLOSED because `ids` holds member ids that identity migration must remap.",
665
+ "description": "Draft-only display state. CLOSED because `ids` holds member ids that identity migration must remap — closed to keep IDS accountable, never to withhold display state, which is why the two visibility flags below belong here rather than in a browser-local store (#614).",
666
666
  "properties": {
667
667
  "props": { "type": "array", "items": { "type": "string" }, "description": "Checked property registry keys to show as labels." },
668
668
  "placement": { "enum": ["start", "mid", "end"] },
669
669
  "selected_only": { "type": "boolean" },
670
+ "vis2d": { "type": "boolean", "description": "Show the label chips on the 2D plan. ABSENT MEANS ON — the default the MIGRATED case needs: v1 stores these flags, but only once its editor has saved, so a v1 document whose user never touched the toggle carries neither and migration has nothing to hand across. Reading that as 'off' would convert a project into one whose ticked properties draw nothing. (Not a claim about existing v2 documents: those had the feature disabled outright, and this is what turns it on.) The property SELECTION (`props`) stays shared across 2D and 3D — only show/hide is per view." },
671
+ "vis3d": { "type": "boolean", "description": "Show the label chips in the 3D view. Absent means on, for the same reason as vis2d." },
670
672
  "ids": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Member ids the labels pin to, used only when selected_only is true." }
671
673
  }
672
674
  },
@@ -2,7 +2,7 @@
2
2
  name: floless-app-steel-takeoff
3
3
  description: Read a structural steel drawing into an editable steel.takeoff/v1 contract in floless.app — the "Steel Takeoff" reader. Triggers on a pending floless `rebake` request for the `steel-model` app (queued from its "Re-read & re-bake ▸" button), or asks like "read this framing plan into a takeoff", "turn this structural drawing into a takeoff", "bake my drawing into steel-model", "extract members from this PDF". Teaches the host AI to READ a steel drawing (PDF/image) with its own vision at COMPOSE time, build a steel.takeoff/v1 contract (members + profiles + elevations + weights from AISC lookup), write it to the contract store, and hand control to the editor — no model in the run path, no API key.
4
4
  metadata:
5
- version: 0.16.2
5
+ version: 0.17.0
6
6
  ---
7
7
 
8
8
  # Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
@@ -488,12 +488,52 @@ Same flat shape as the datum above — a point plus which intersection it is:
488
488
  - Do NOT ask the user for this one — unlike the datum, it is not a project decision. It is a second
489
489
  reading of something already printed, so read it.
490
490
 
491
- - **Any intersection is a valid datum** — verified: the choice moves registration by under 1 mm. Pick
492
- one for the model and prefer it on every sheet that prints it, because a shared datum makes the set
493
- easiest to reason about. But sheets do NOT have to agree: `planTransform` resolves each sheet's own
494
- `datum_ref` against the model grid, so a sheet that cannot print the chosen intersection may name a
495
- different one and still register correctly. (An earlier version of this line said every sheet must use
496
- the same one, which contradicted the `datum_ref` mechanism three paragraphs above.)
491
+ - **Any intersection is a valid datum.** Pick one for the model and prefer it on every sheet that prints
492
+ it, because a shared datum makes the set easiest to reason about. But sheets do NOT have to agree:
493
+ `planTransform` resolves each sheet's own `datum_ref` against the model grid, so a sheet that cannot
494
+ print the chosen intersection may name a different one and still register correctly. (An earlier
495
+ version of this line said every sheet must use the same one, which contradicted the `datum_ref`
496
+ mechanism three paragraphs above. It also said "the choice moves registration by under 1 mm" — true of
497
+ the translation, and silent about the check below, which is the thing that actually refuses.)
498
+
499
+ ### What the two controls are FOR — and how accurately to read them
500
+
501
+ **The sheet is positioned by its own printed grid, not by your two picks.** Its grid spacings already
502
+ place every labelled intersection, so the server registers the sheet by matching that grid to the model
503
+ grid, and your `datum_at`/`control2_at` are **checked against it**. Two consequences worth knowing:
504
+
505
+ - **Ordinary reading error costs nothing.** A pick a pixel or three off the bubble does not move a single
506
+ member. Read them carefully, but do not agonise, and never invent a "cleaner" number.
507
+ - **They are the only thing that checks the sheet against the drawing.** The grid match compares one
508
+ spacing string with another; nothing in it can see `pt_per_ft` or `grid.origin`. Your two picks are the
509
+ one measurement that looks at the drawing, which is why a bad pair is refused rather than shrugged at.
510
+
511
+ The tolerance is stated in **display points — 1/72" of the printed sheet**, so it means the same thing at
512
+ every drawing scale:
513
+
514
+ | how far a pick lands from the intersection it names | what happens |
515
+ |---|---|
516
+ | under 2 pt (1/36" on paper) | nothing; ordinary reading |
517
+ | 2–9 pt | registers, and a `control-off-grid` note says how far out the reading was |
518
+ | over 9 pt (1/8" on paper) | **`sheet-registration-refused` with reason `control-pick-off-grid`** — the whole read fails |
519
+
520
+ **If a read is refused with `control-pick-off-grid`, do not just re-pick and retry.** Three different
521
+ faults produce it, and only one is the pick:
522
+
523
+ 1. **The pick is wrong** — you named `F/4` and clicked a different crossing. Re-read both points.
524
+ 2. **`pt_per_ft` is wrong for this sheet** — the commonest cause, because the picks and the grid then
525
+ disagree by a percentage rather than a wobble, and it grows with distance from the datum. Re-check the
526
+ sheet's stated drawing scale. Anything above about 0.4 % off will trip this.
527
+ 3. **`grid.origin` is wrong** — the grid you read is drawn in the wrong place on the sheet, so every
528
+ intersection is offset by the same amount. Check where the origin lands against a printed bubble.
529
+
530
+ The offset is printed in the message in both points and mm on the ground, so the size of the number tells
531
+ you which fault it is: a few points is a pick, tens of points over a long baseline is a scale.
532
+
533
+ **Pick `control2_at` as far from the datum as the sheet prints — this is why.** The two controls bound a
534
+ drawing-scale error to roughly ±(9 pt ÷ the baseline in points). A 2000 pt baseline catches a scale wrong
535
+ by 0.45 %; a 200 pt baseline only catches 4.5 %. Diagonally opposite corners are not a style preference,
536
+ they are a measurement.
497
537
  - Never guess a datum, and never substitute an unlabelled crossing. When a sheet prints no labelled
498
538
  intersection at all, see *Registration is mandatory* below — you cannot simply leave `datum_at` unset
499
539
  and continue.
@@ -1689,6 +1729,15 @@ Then post the contract against that id, exactly as step 3 above. Notes that bite
1689
1729
  (It is not rendered in the History table today — send it because it is the record, not for display.)
1690
1730
  - **The queue stamps the ledger head as the read's base.** If a version lands between the queue and the
1691
1731
  post, `revision-read` answers `409` — re-GET and re-read rather than retrying the same body.
1732
+ - **A `200` may carry `notes: string[]` — READ THEM.** A read can succeed and still have something to
1733
+ say. Each line is one thing the migration noticed, locating its sheet as data (`control-off-grid
1734
+ [sheet S-201]: …`), capped at eight with an `and N more note(s)` tail. The one to act on is
1735
+ **`control-off-grid`**: it means your two registration controls were read further off the
1736
+ intersections they name than a good reading allows, and it prints the offset in display points *and*
1737
+ mm on the ground. Nothing moved — the sheet is positioned by its grid — but the size of that number
1738
+ tells you what to fix: a few points is the pick, tens of points over a long baseline is the sheet's
1739
+ `pt_per_ft`. See *"What the two controls are FOR"* above for the whole table. Say it to the user
1740
+ rather than swallowing it; a note here is the only warning you get before the next read refuses.
1692
1741
  - **On an already-migrated `steel.model/v2` project the post does NOT commit.** A v2 document is
1693
1742
  *staged* for human review: the answer is `202` with `ok: true` — so check the STATUS, not `ok` — the
1694
1743
  request stays queued as `staged`, no version is minted, and nothing is written until the user
package/dist/web/app.css CHANGED
@@ -1813,7 +1813,11 @@
1813
1813
  .req-search { margin-bottom: 10px; flex: 0 0 auto; }
1814
1814
  /* Flexes against .modal.requests' 86vh cap rather than declaring its own 52vh — see the note
1815
1815
  there. min-height:0 is what lets a flex child actually shrink and scroll. */
1816
+ /* scroll-behavior lives here, not in revealRequestRow's scrollIntoView call: an omitted `behavior`
1817
+ defers to the scrolling box's computed value, so the CSS property stays the single source of
1818
+ truth and the reduced-motion override below is the only place that has to know about it. */
1816
1819
  .requests-list { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 4px 0 2px;
1820
+ scroll-behavior: smooth;
1817
1821
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
1818
1822
  .requests-list::-webkit-scrollbar { width: 7px; }
1819
1823
  .requests-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 7px; }
@@ -1821,6 +1825,12 @@
1821
1825
  .req-item {
1822
1826
  display: flex; gap: 10px; align-items: flex-start;
1823
1827
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
1828
+ /* revealRequestRow scrolls with block:'nearest', which otherwise lands the row flush against the
1829
+ scrollport edge — reading as clipped rather than as "here it is". Buys air for a MID-list
1830
+ target; for the last row it is clamped away (the list is already at maxScroll and there is
1831
+ nothing below to scroll past), which is fine — the modal's own padding sits under the
1832
+ scrollport there. */
1833
+ scroll-margin-block: 8px;
1824
1834
  }
1825
1835
  .req-info { flex: 1; min-width: 0; }
1826
1836
  .req-head { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
@@ -1876,6 +1886,34 @@
1876
1886
  }
1877
1887
  .req-copy:hover { color: var(--text); background: var(--surface); }
1878
1888
  .req-del:hover { color: var(--err); border-color: var(--err); }
1889
+ /* Brief highlight for the SPECIFIC row "Open Requests" hands off to — the request the user just
1890
+ queued, which in an oldest-first list is at the bottom and usually below the fold.
1891
+ Reuses the .rtn-fired-flash TECHNIQUE (a background fade back to the row's resting surface-2),
1892
+ recoloured to --accent: this says "this one is yours", where --ok is reserved for success/fired
1893
+ states (.rtn-status.ok, .node-done). Deliberately NOT the .req-pulse shake — that is a
1894
+ PERIPHERAL cue for the chip the user is not looking at; shaking content they are already
1895
+ staring at reads as alarm, not help. The requests chip entry point gets no flash at all,
1896
+ having no particular row in mind. */
1897
+ @keyframes req-target-flash {
1898
+ 0% { background: color-mix(in srgb, var(--accent) 20%, var(--surface-2)); }
1899
+ 100% { background: var(--surface-2); }
1900
+ }
1901
+ .req-item.req-target-flash { animation: req-target-flash 1.2s ease-out; }
1902
+ @media (prefers-reduced-motion: reduce) {
1903
+ .requests-list { scroll-behavior: auto; }
1904
+ /* A steady outline instead of the fade — NOT `animation: none` alone, which would leave these
1905
+ users with no cue at all: taken to a row they cannot pick out, which is the exact problem this
1906
+ feature exists to fix, and the reveal marks the cue delivered either way. What is suppressed
1907
+ here is a background fade, not motion — nothing reduced-motion guidance targets — so keeping a
1908
+ static form costs those users nothing, and revealFlashTimer already strips the class at 1.2s.
1909
+ Same INTENT as .guide-beacon.is-new / .ws-card.is-new (hold a static form where the animation
1910
+ was) but deliberately NOT their technique: both use an outset ring, and an outset ring does not
1911
+ survive here. .requests-list is `overflow-y: auto`, so overflow-x computes to auto too, and
1912
+ .req-item stretches to the full scrollport with 0px of side slack — outset ink is clipped left
1913
+ and right, rendering as two horizontal rules with no sides or corners (measured, then seen).
1914
+ The row's own border is already inside the clip, so recolouring it gives the whole outline. */
1915
+ .req-item.req-target-flash { animation: none; border-color: var(--accent); }
1916
+ }
1879
1917
  /* Stands in for the ✕ on a lifecycle-owned request (knowledge-organize): it clears itself via its
1880
1918
  own finish/fail POST, so no manual clear is offered. Muted text, never a dead-looking button.
1881
1919
  Wraps rather than truncating — a clipped explanation explains nothing. */
package/dist/web/aware.js CHANGED
@@ -59,6 +59,17 @@
59
59
  const exportReceiptsByApp = new Map(); // appId:kind → latest reconciled receipt counts
60
60
  const exportBusyByApp = new Set(); // appId:kind → one in-flight host/export mutation
61
61
 
62
+ // The CLOSED set of reason prefixes a scene bake tags a skipped entry with (contract-to-scene.ts):
63
+ // a connection it could not expand, a trim it could not apply, or a member whose weight the AISC
64
+ // catalogue knows and whose footprint it does not tabulate. Anything else in `skipped` is a bare
65
+ // member id — an RFI with no resolvable size.
66
+ //
67
+ // Matched by PREFIX and not by "contains a colon": a member id is an unconstrained string in the
68
+ // contract schema, so an imported id may legitimately carry one, and a colon test would drop that
69
+ // member out of BOTH counts — an undercount in the one message whose job is to stop members going
70
+ // missing quietly.
71
+ const SKIP_REASON_PREFIX = /^(?:joint|trim|nofootprint):/;
72
+
62
73
  // Local UI-state persistence (per origin; never touches the .flo or lock).
63
74
  // The last-opened app is restored on refresh; per-app input values are saved
64
75
  // explicitly via "Save inputs" (Ctrl+S) and rehydrated when the app opens.
@@ -2624,12 +2635,20 @@
2624
2635
  const res = await api('/api/contract/' + encodeURIComponent(appId) + '/export-3d', { method: 'POST' });
2625
2636
  const html = res.report && res.report.html;
2626
2637
  if (!html) { $reportOverlay.innerHTML = '<div>The 3D render produced no output. Check the Execution tab.</div>'; return; }
2627
- // Partial render: members with no resolvable AISC size were dropped server-side (res.skipped) —
2628
- // surface that, never let an incomplete model read as complete.
2629
- const dropped = Array.isArray(res.skipped) ? res.skipped.length : 0;
2630
- $reportSub.textContent = (dropped ? `${dropped} member(s) not shown (no AISC size — RFI). ` : '')
2638
+ // Partial render: members the bake could not extrude were dropped server-side (res.skipped) —
2639
+ // surface that, never let an incomplete model read as complete. Two reasons, and they are not
2640
+ // the same news: an RFI member has no size and is flagged everywhere else, while a
2641
+ // `nofootprint:` member has an EXACT weight and no tabulated footprint, so it is priced in the
2642
+ // BOM and missing from this view. Calling both "RFI" hid the second entirely (#627).
2643
+ const skips = Array.isArray(res.skipped) ? res.skipped : [];
2644
+ const noFit = skips.filter((s) => String(s).startsWith('nofootprint:')).length;
2645
+ const rfi = skips.filter((s) => !SKIP_REASON_PREFIX.test(String(s))).length;
2646
+ const parts = [];
2647
+ if (rfi) parts.push(`${rfi} with no AISC size (RFI)`);
2648
+ if (noFit) parts.push(`${noFit} priced but not drawn (no tabulated footprint)`);
2649
+ $reportSub.textContent = (parts.length ? `${parts.join(', ')} — not shown. ` : '')
2631
2650
  + 'Live 3D view from the approved model — drag to orbit, scroll to zoom, click an element to inspect.';
2632
- if (dropped) showToast(`3D: ${dropped} member(s) skipped — no resolvable AISC size`, 'info');
2651
+ if (parts.length) showToast(`3D: ${parts.join(' · ')}`, noFit ? 'warn' : 'info');
2633
2652
  paintReport(html, true);
2634
2653
  lastReportByApp.set(currentId, { nodeId: res.report.nodeId, label: '3D', html, interactive: true });
2635
2654
  $reportModal.dataset.html = '1';
@@ -2660,12 +2679,21 @@
2660
2679
  a.href = url; a.download = res.filename || (appId + '.ifc');
2661
2680
  document.body.appendChild(a); a.click(); a.remove();
2662
2681
  setTimeout(() => URL.revokeObjectURL(url), 4000);
2663
- const dropped = Array.isArray(res.skipped) ? res.skipped.length : 0;
2664
- // Skip wording differs by contract: steel `skipped` = RFI members (no AISC size); a vector
2665
- // reconstruction's `skipped` = unplaced entities, plus extruded bodies (extrusionsSkipped)
2666
- // that don't export to IFC yet. Label each honestly.
2682
+ const skips = Array.isArray(res.skipped) ? res.skipped : [];
2683
+ const dropped = skips.length;
2684
+ // Skip wording differs by contract: a vector reconstruction's `skipped` = unplaced entities,
2685
+ // plus extruded bodies (extrusionsSkipped) that don't export to IFC yet. A steel model's splits
2686
+ // in two — an RFI member has no size, while a `nofootprint:` member has an exact weight and no
2687
+ // tabulated footprint, so the BOM prices steel this .ifc does not contain. Label each honestly;
2688
+ // the second used to be reported as an RFI, which is the one thing it is not (#627).
2689
+ const noFit = skips.filter((s) => String(s).startsWith('nofootprint:')).length;
2690
+ const rfi = skips.filter((s) => !SKIP_REASON_PREFIX.test(String(s))).length;
2667
2691
  const notes = [];
2668
- if (dropped) notes.push(isVector ? `${dropped} unplaced` : `${dropped} RFI member${dropped === 1 ? '' : 's'}`);
2692
+ if (isVector) { if (dropped) notes.push(`${dropped} unplaced`); }
2693
+ else {
2694
+ if (rfi) notes.push(`${rfi} RFI member${rfi === 1 ? '' : 's'}`);
2695
+ if (noFit) notes.push(`${noFit} member${noFit === 1 ? '' : 's'} priced but not exported (no tabulated footprint)`);
2696
+ }
2669
2697
  if (res.extrusionsSkipped) notes.push(`${res.extrusionsSkipped} extruded ${res.extrusionsSkipped === 1 ? 'body' : 'bodies'} (view-only)`);
2670
2698
  const summary = exportReceiptText(appId, 'ifc');
2671
2699
  showToast(summary && summary.partial
@@ -7054,6 +7082,12 @@
7054
7082
  let previousRequestCount = 0;
7055
7083
  let previousRequestIds = null;
7056
7084
  let reqPulseTimer = null;
7085
+ let revealFlashTimer = null;
7086
+ let revealArriveCleanup = null;
7087
+ // The row still owed a highlight. Survives the list being closed, because a cue the user never saw
7088
+ // has not been delivered — cleared only once it has actually flashed on a visible list, or once the
7089
+ // request it names is gone.
7090
+ let pendingRevealId = null;
7057
7091
  async function loadRequests() {
7058
7092
  try {
7059
7093
  const { requests } = await api('/api/requests');
@@ -7324,7 +7358,7 @@
7324
7358
  ? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
7325
7359
  : `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="Clear this request">×</button>`;
7326
7360
  return `
7327
- <div class="req-item">
7361
+ <div class="req-item" data-id="${escapeAttr(r.id)}">
7328
7362
  <div class="req-info">
7329
7363
  <div class="req-head"><span class="${badgeCls}">${label}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, requestQuery)}</span>` : ''}${time}</div>
7330
7364
  <div class="req-instruction">${highlightQuery(instructionFor(r), requestQuery) || 'This request has no instruction, so it can’t be handed to your terminal AI. Clear it and queue it again.'}</div>
@@ -7392,7 +7426,7 @@
7392
7426
  }
7393
7427
  // Re-fetch before showing: there is no server `request-added` broadcast, so a request queued in
7394
7428
  // another tab (or by the Knowledge step) would otherwise render from a stale cache.
7395
- async function openRequests() {
7429
+ async function openRequests(targetId) {
7396
7430
  // Open on the scope + a clear search every time. A stuck "All" (or a leftover query) from a
7397
7431
  // previous visit would silently answer a different question than the one just asked.
7398
7432
  requestScopeAll = false;
@@ -7401,8 +7435,140 @@
7401
7435
  if ($search) $search.value = '';
7402
7436
  document.getElementById('requests-modal').classList.add('show');
7403
7437
  renderRequests(); // paint the cache immediately — no empty flash
7438
+ // Scroll off the CACHED paint, before the refetch. Gating the reveal on `/api/requests` means an
7439
+ // arbitrarily slow response leaves the list sitting at the top — precisely the state this feature
7440
+ // exists to prevent — and then jumping a beat later. Measured land-times ran 125ms to 1738ms, and
7441
+ // in one batch three of four opens had not revealed at all after 4s because the fetch had not
7442
+ // resolved. A long queue is both when the fetch is slowest (a thumbnail request per snapshot row
7443
+ // competes with it over HTTP/1.1's six connections) and when being at the top hurts most.
7444
+ // Scroll only: the flash belongs to the authoritative paint below, or the cached one would flash a
7445
+ // row the refresh is about to replace.
7446
+ revealRequestRow(targetId, true /* scrollOnly */);
7404
7447
  await loadRequests();
7448
+ // NOTHING here may touch requestScopeAll. Scoping the window to what you have open is a
7449
+ // deliberate decision (#633), and revealing a row is not a licence to override it: a reveal that
7450
+ // widened would answer a different question than the one asked, and the destructive verb is
7451
+ // downstream — `bulkClearPlan` reads the painted set, and when that set is the whole queue
7452
+ // "Clear all" takes the atomic DELETE /api/requests across every project. If the row we were
7453
+ // asked for is out of scope it simply is not revealed; the user's own scope tab stays the truth.
7405
7454
  renderRequests(); // then reconcile with the truth
7455
+ revealRequestRow(targetId); // …then put the row the user came for in view
7456
+ }
7457
+
7458
+ // The list is oldest-first (a contract two shipped skills document, and the order Copy all
7459
+ // concatenates in), so the request a user just queued is at the BOTTOM — measured off-screen past
7460
+ // about six entries. Both entry points therefore have to scroll, but they want different things:
7461
+ // "Open Requests" comes from the just-queued modal and means THAT row, while the requests chip is a
7462
+ // general "show me my queue" and simply wants the freshest activity in view.
7463
+ //
7464
+ // The chip scrolls too, rather than being left alone as "not the reported bug", because
7465
+ // showRequestQueuedModal has exactly one caller — the drawing-attach flow. Every other way to queue
7466
+ // something (the steel editor's Ask AI, ✎ Tweak, use-template) reports inline and never opens that
7467
+ // modal, so for those the chip is the ONLY route to the row you just created.
7468
+ //
7469
+ // targetId is not the same as "the last row": another tab, a poll, or a knowledge-organize can queue
7470
+ // something between the modal opening and the click, and then the last row is somebody else's.
7471
+ function revealRequestRow(targetId, scrollOnly) {
7472
+ const $list = document.getElementById('requests-list');
7473
+ if (!$list) return;
7474
+ const rows = Array.from($list.querySelectorAll('.req-item'));
7475
+ if (!rows.length) return;
7476
+ // An untargeted open (the chip) adopts a target still owed a highlight: closing the list before it
7477
+ // landed leaves pendingRevealId set, and the reopen — whenever it comes — is where the cue is
7478
+ // finally due. Consumed only once it has actually been SHOWN, so it cannot be spent invisibly.
7479
+ const wanted = targetId || pendingRevealId;
7480
+ const target = wanted ? rows.find((el) => el.dataset.id === wanted) : null;
7481
+ // The cached pass positions the list and touches NO state: it must not consume an owed cue, retire
7482
+ // one, or cancel a pending arrival on the strength of a paint that is about to be replaced.
7483
+ if (!scrollOnly) {
7484
+ // Stop owing a highlight for a request that is no longer in the queue at all — applied or cleared
7485
+ // while the list was closed. Without this the variable outlives its meaning, still reading as
7486
+ // "a row is owed" for a row that can never be shown again.
7487
+ if (pendingRevealId && !pendingRequests.some((r) => r && r.id === pendingRevealId)) pendingRevealId = null;
7488
+ // Supersede a reveal still waiting to land ONLY when this one will flash too, so a general
7489
+ // "show me my queue" never cancels a pending "show me THIS row".
7490
+ if (target && revealArriveCleanup) revealArriveCleanup();
7491
+ if (target) pendingRevealId = wanted;
7492
+ }
7493
+ const row = target || rows[rows.length - 1];
7494
+ // Whether a scroll will actually happen has to be decided BEFORE the call: `scroll-behavior:
7495
+ // smooth` makes the offset animate, so reading scrollTop afterwards still reports the old value.
7496
+ const lb = $list.getBoundingClientRect(), rb = row.getBoundingClientRect();
7497
+ // A row TALLER than the scrollport that already spans it counts as visible to Blink's `nearest`,
7498
+ // so scrollIntoView does not move and scrollend never fires — without this the flash would sit out
7499
+ // the full 2s guard on a row that was already showing. Rare: it needs a row of wrapped snapshot
7500
+ // thumbnails deeper than the whole list, and the list now flexes against the modal's 86vh cap.
7501
+ const coversPort = rb.top <= lb.top && rb.bottom >= lb.bottom;
7502
+ const willScroll = !coversPort && (rb.top < lb.top || rb.bottom > lb.bottom);
7503
+ // `block: 'nearest'` is a no-op when the row is already in the scrollport, and there is nothing to
7504
+ // scroll when the list doesn't overflow — so neither case needs a visibility check of its own.
7505
+ row.scrollIntoView({ block: 'nearest' });
7506
+ // Flash ONLY a row we actually found. If the request was applied or cleared between queuing and
7507
+ // clicking, we still scroll to the newest — but flashing it would be pointing at the wrong row.
7508
+ if (scrollOnly || !target) return;
7509
+
7510
+ // Start the flash when the row ARRIVES, not when the scroll starts. Chromium's smooth-scroll
7511
+ // duration grows with distance and is not capped near our 1.2s budget: measured on ~72px rows,
7512
+ // 60 rows takes 1065ms to land (leaving ~135ms of highlight) and 200 rows takes 1514ms, so the
7513
+ // animation is over before the row is on screen. That fails along exactly the axis this feature
7514
+ // exists for — the longer the queue, the more the user needs to be told which row is theirs.
7515
+ const flash = () => {
7516
+ // Re-resolve by id rather than reusing the captured node. Between the scroll starting and
7517
+ // `scrollend` firing, anything that re-renders the list — reopening it from the chip, an SSE
7518
+ // refresh — replaces innerHTML, and the captured row is then detached: the class would land on
7519
+ // an orphan and the user would see nothing at all. (Found by QA: open via Open Requests, Escape
7520
+ // at ~150ms, reopen from the chip — no highlight, 3/3.)
7521
+ // Never spend the cue on a hidden list. Hiding the modal mid-scroll stops `scrollend` from ever
7522
+ // firing, so the 2s guard is what runs — and without this it would flash an invisible row, mark
7523
+ // it delivered, and leave the user who reopens a moment later with nothing. Measured: reopen at
7524
+ // 2.5s saw no highlight. Returning early keeps pendingRevealId set, so the reopen shows it.
7525
+ const $modal = document.getElementById('requests-modal');
7526
+ if (!$modal || !$modal.classList.contains('show')) return;
7527
+ const row = Array.from($list.querySelectorAll('.req-item')).find((el) => el.dataset.id === wanted);
7528
+ if (!row) {
7529
+ // Absent from the PAINTED rows is not the same as gone. A search typed during the glide, or a
7530
+ // scope the row does not belong to, hides it while the request is alive and still owed a cue —
7531
+ // only stop owing it when it has genuinely left the queue.
7532
+ if (!pendingRequests.some((r) => r && r.id === wanted)) pendingRevealId = null;
7533
+ return;
7534
+ }
7535
+ pendingRevealId = null; // delivered — and only now, with the row on a visible list
7536
+ row.classList.remove('req-target-flash');
7537
+ void row.offsetWidth; // restart the animation if the same row is revealed twice
7538
+ row.classList.add('req-target-flash');
7539
+ // One timer, cleared before it is replaced — the same shape as reqPulseTimer above. Two reveals
7540
+ // inside 1.2s would otherwise leave the first timeout to fire against a row that is mid-flash
7541
+ // and cut the second short. Clears whichever row is flashing, not a captured node, because a
7542
+ // live re-render may have replaced it.
7543
+ if (revealFlashTimer) clearTimeout(revealFlashTimer);
7544
+ revealFlashTimer = setTimeout(() => {
7545
+ const still = document.querySelector('.req-item.req-target-flash');
7546
+ if (still) still.classList.remove('req-target-flash');
7547
+ revealFlashTimer = null;
7548
+ }, 1200);
7549
+ };
7550
+ if (!willScroll) { flash(); return; } // already in view — scrollend would never fire
7551
+ // `once` is not enough: scrollend does not fire if the scroll is interrupted (the user grabs the
7552
+ // wheel) or if the engine lacks it, and a highlight that never appears is the bug above again.
7553
+ let armed = true;
7554
+ const arrive = () => {
7555
+ if (!armed) return;
7556
+ armed = false;
7557
+ revealArriveCleanup = null;
7558
+ $list.removeEventListener('scrollend', arrive);
7559
+ clearTimeout(arriveGuard);
7560
+ flash();
7561
+ };
7562
+ $list.addEventListener('scrollend', arrive);
7563
+ const arriveGuard = setTimeout(arrive, 2000);
7564
+ // So a second reveal can drop the first: otherwise the earlier scrollend still fires and flashes
7565
+ // its row after the user has already moved on to another one.
7566
+ revealArriveCleanup = () => {
7567
+ armed = false;
7568
+ revealArriveCleanup = null; // so the variable actually means "a reveal is pending"
7569
+ $list.removeEventListener('scrollend', arrive);
7570
+ clearTimeout(arriveGuard);
7571
+ };
7406
7572
  }
7407
7573
 
7408
7574
  // ── Agents library: real installed agents + their commands ───────────────────
@@ -8878,8 +9044,11 @@
8878
9044
  const $requestHelpKeep = document.getElementById('request-help-keep');
8879
9045
  const $requestHelpCopy = document.getElementById('request-help-copy');
8880
9046
  if ($requestHelpOpen) $requestHelpOpen.onclick = () => {
9047
+ // Read the id BEFORE closing — this button means "take me to the one I just queued", and only
9048
+ // this entry point knows which that is.
9049
+ const id = requestHelpReq && requestHelpReq.id;
8881
9050
  closeRequestHelp({ restoreFocus: false });
8882
- openRequests();
9051
+ openRequests(id);
8883
9052
  };
8884
9053
  if ($requestHelpKeep) $requestHelpKeep.onclick = () => closeRequestHelp();
8885
9054
  if ($requestHelpCopy) $requestHelpCopy.onclick = async () => {
@@ -662,6 +662,21 @@ export const MODEL_V2_TOL = Object.freeze({
662
662
  RESIDUAL_REFUSE_MM: 6.35, // ...and above this is refused: beyond drafting drift = a different grid
663
663
  ROTATION_REFUSE_DEG: 0.05, // secondary ceiling (the binding gate is induced displacement)
664
664
  SCALE_REFUSE_FRAC: 0.002, // secondary ceiling, 0.2%
665
+
666
+ // How far a HAND-READ registration control may land from the grid intersection it names. These two are
667
+ // in DISPLAY POINTS, and that unit is the whole point (#590): a sheet's display px are PDF points —
668
+ // 1/72" of the PRINTED drawing — so a tolerance stated in them means the same thing at every drawing
669
+ // scale and on every size of building, which a tolerance in mm does not. At 1/4"=1'-0" one point is
670
+ // 33.87 mm on the ground, so judging a pixel pick by the 6.35 mm de-dup distance demanded 0.19 pt of
671
+ // reading accuracy and refused every photographed drawing ever read.
672
+ //
673
+ // They bound the pick, NOT the registration: the transform is fitted from the grid, so a pick within
674
+ // tolerance moves nothing. What they bound is the evidence — the picks are the only measurement that
675
+ // sees the drawing at all, and so the only check on `grid.origin` and `pt_per_ft`. Two picks a
676
+ // baseline apart therefore bound a scale error to ±(REFUSE_PT / baselinePt), which is why the reader
677
+ // skill tells the AI to choose the FURTHEST intersection: a longer baseline is a better measurement.
678
+ CONTROL_CHECK_REPORT_PT: 2, // 1/36" on the printed sheet — past ordinary reading error, worth saying
679
+ CONTROL_CHECK_REFUSE_PT: 9, // 1/8" on the printed sheet — nobody misses a grid bubble by this much
665
680
  });
666
681
 
667
682
  /** The §5.2a elevation union: `{known:mm}` | `{unknown:true, rfiRef?}`. */
@@ -793,6 +808,20 @@ export function registerSheet(input) {
793
808
 
794
809
  // Induced displacement is the BINDING gate: §5.2b's own 0.05 deg over the measured 19.4 m baseline
795
810
  // admits ~16.9 mm, against a 6.35 mm refusal in the same table. Angle and ratio are secondary ceilings.
811
+ //
812
+ // IT IS CHARGED OVER THE WHOLE EXTENT. Charging it only over the reach no sample verifies was written
813
+ // during #590 and reverted before it shipped, because it is wrong twice — recorded here so it is not
814
+ // re-invented. The reasoning was that a sample which AGREES has measured the fit out to its own
815
+ // distance, so the proxy should not be charged for that span as well. But (a) the reach is a scalar
816
+ // radius, and on a grid the second-farthest node is nearly as far as the farthest, so the annulus left
817
+ // to charge collapses and the budget grows with lattice density — measured |scale-1| up to 2e-3 at
818
+ // 10x7, past SCALE_REFUSE_FRAC, i.e. this stops being the binding gate the line above claims it is; and
819
+ // (b) the case it was meant to admit is exactly the case where the error is REAL. A PROPORTIONAL
820
+ // difference between two sheets' grid strings leaves `residualMm` at zero by construction — a
821
+ // similarity absorbs a uniform scale exactly — so induced displacement is the only guard there, and
822
+ // relaxing it let one physical column land 8.3 mm apart when read on two sheets, past DEDUP_MM, and be
823
+ // emitted TWICE with a clean `ok` and no reasons. The migration's per-axis extent collapse also cites
824
+ // this bound by name and would have been silently invalidated with it.
796
825
  const induced = (Math.abs(transform.rotationRad) + Math.abs(transform.scale - 1)) * extentMm;
797
826
  let verdict = 'ok';
798
827
  const report = (why) => { reasons.push(why); if (verdict === 'ok') verdict = 'report'; };
@@ -249,8 +249,29 @@ function init(canvas, theApi) {
249
249
  refMeasureLine = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(), new THREE.Vector3()]),
250
250
  new THREE.LineDashedMaterial({ color: 0x22d3ee, dashSize: 60, gapSize: 40 }));
251
251
  refMeasureLine.material.depthTest = false; refMeasureLine.renderOrder = 997; refMeasureLine.visible = false; scene.add(refMeasureLine);
252
+ /*
253
+ * THE FOUR MODEL-GLUED LABEL HOSTS SIT UNDER THE 3D CHROME, and the numbers below are the whole rule.
254
+ *
255
+ * Each is `position:fixed` on `<body>` and projected per frame, so it is painted in the ROOT stacking
256
+ * context (`#stagewrap` and `<main>` are `position:relative; z-index:auto`, which creates none) — it
257
+ * competes directly with the panels. They shipped at 56/57, above every panel, and a chip landing over
258
+ * the expanded Objects panel drew ON TOP of it: unreadable itself, and hiding a control the user was
259
+ * reading. Reported against the 3D property labels, but it was never theirs — the mark/id, dimension
260
+ * and member-length chips all shared it.
261
+ *
262
+ * A label is a READING OF THE MODEL and belongs with the model, under the chrome that frames it. So the
263
+ * band is BELOW the lowest piece of 3D chrome (`#m3dAxes`, z 5) and above the canvas (z auto):
264
+ * 3 member / property / selected-length labels
265
+ * 4 dimension labels — above the other three, which is the order they shipped with
266
+ * 5+ chrome: the triad, the Objects panel and view cube (6), the collapse chevrons (12) …
267
+ * `#m3dBar` was already at 59 — the toolbar had been lifted over the labels one at a time while the
268
+ * panels were not, which is exactly the inconsistency this replaces with one rule.
269
+ *
270
+ * NOT in this band, deliberately: `hoverChip` (a fixed bottom-centre readout, chrome by position) and
271
+ * `rubber` (a live drag overlay, which must cover everything it is drawn across).
272
+ */
252
273
  dimLabelHost = document.createElement('div');
253
- dimLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:57';
274
+ dimLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:4';
254
275
  document.body.appendChild(dimLabelHost);
255
276
  // …and its label, in the dim host so it is positioned by the same per-frame projection. The cssText is
256
277
  // the member-label chip's verbatim (cyan border = a dimension read); only `display` is ours to drive.
@@ -258,12 +279,12 @@ function init(canvas, theApi) {
258
279
  refMeasureLabel.style.cssText = 'position:absolute;transform:translate(-50%,-50%);pointer-events:none;background:var(--panel,#0f172a);color:#e2e8f0;border:1px solid #22d3ee;border-radius:4px;padding:1px 6px;font:11px system-ui;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,.4);display:none';
259
280
  dimLabelHost.appendChild(refMeasureLabel);
260
281
  memberLabelHost = document.createElement('div'); // member mark/id labels (Slice 4) — below the dim labels
261
- memberLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:56;display:none';
282
+ memberLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:3;display:none';
262
283
  document.body.appendChild(memberLabelHost);
263
284
  propLabelHost = document.createElement('div'); // right-click property labels — own host so they never clobber the mark/id pool
264
- propLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:56;display:none';
285
+ propLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:3;display:none';
265
286
  selLenLabelHost = document.createElement('div'); // ⋯ Display → Show member length: on-select length chips (cyan dimension read)
266
- selLenLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:56;display:none';
287
+ selLenLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:3;display:none';
267
288
  document.body.appendChild(selLenLabelHost);
268
289
  document.body.appendChild(propLabelHost);
269
290
  // persistent hover/selection status chip, bottom-centre of the canvas (mirrors the viewer's readout)
@@ -1878,8 +1899,13 @@ function syncMemberLabels() {
1878
1899
  }
1879
1900
  for (let i = 0; i < memberLabelPool.length; i++) {
1880
1901
  const el = memberLabelPool[i], m = ms[i];
1881
- if (!m || !Array.isArray(m.wp) || m.wp.length < 2) { el.style.display = 'none'; el._mid = null; continue; }
1882
- const g = geoOf(m);
1902
+ // ASK THE READ HALF FOR A WORK LINE, never for `m.wp` — the same repair the reference lines got in
1903
+ // P7d (see buildRefLines), applied to the two label pools that sweep missed. `wp` is a v1 STORAGE
1904
+ // shape; a v2 canonical member has `from`/`to`, so this guard skipped every member of a canonical
1905
+ // model and the toggle drew nothing at all. MEASURED in a real browser on a v2 document: both pools
1906
+ // allocated their divs and left every one `display:none` with empty text (#614).
1907
+ const g = m && geoOf(m);
1908
+ if (!g || !g.line) { el.style.display = 'none'; el._mid = null; continue; }
1883
1909
  el._mid = [(g.line[0][0] + g.line[1][0]) / 2, (g.line[0][1] + g.line[1][1]) / 2, (g.line[0][2] + g.line[1][2]) / 2];
1884
1910
  el.textContent = m.mark || m.id || '';
1885
1911
  el.style.display = 'block';
@@ -1922,8 +1948,10 @@ function syncPropLabels() {
1922
1948
  const byId = new Map(members().map((m) => [m.id, m]));
1923
1949
  for (let i = 0; i < propLabelPool.length; i++) {
1924
1950
  const el = propLabelPool[i], L = labels[i], m = L ? byId.get(L.id) : null;
1925
- if (!m || !Array.isArray(m.wp) || m.wp.length < 2 || !L.lines || !L.lines.length) { el.style.display = 'none'; el._mid = null; el._memberId = null; continue; }
1926
- const g = geoOf(m), a = g.line[0], b = g.line[1];
1951
+ // The work line, not `m.wp` — see syncMemberLabels above for why, and for what it measured.
1952
+ const g = (m && L.lines && L.lines.length) ? geoOf(m) : null;
1953
+ if (!g || !g.line) { el.style.display = 'none'; el._mid = null; el._memberId = null; continue; }
1954
+ const a = g.line[0], b = g.line[1];
1927
1955
  el._mid = place === 'start' ? a : place === 'end' ? b : [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2];
1928
1956
  el._memberId = m.id;
1929
1957
  el.textContent = L.lines.join('\n');