@floless/app 0.128.0 → 0.128.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.
@@ -2,7 +2,7 @@
2
2
  name: floless-app-steel-model
3
3
  description: The front-door guide for turning a structural steel drawing set into an editable native steel.model/v2 model in floless.app. It orchestrates project setup, set knowledge, AWARE detailer agents, Drawing Filter review, registered plan views, model reading, connection detailing, clash checks, and exports. Use for asks such as "model this steel job from the drawings", "take off this whole set", "start a steel model project", or "/floless-app-steel-model". It is re-runnable and preserves the Filter → Save → read → review → History process end to end.
4
4
  metadata:
5
- version: 0.8.0
5
+ version: 0.9.0
6
6
  ---
7
7
 
8
8
  # Steel Model — guide a steel drawing set into an editable model
@@ -140,6 +140,15 @@ with an explicit OK at each kind (this is the interactive heart — never one-sh
140
140
  With the project, knowledge, agents, and classification confirmed, drive the actual reads and point
141
141
  the user at the editor:
142
142
 
143
+ **Carry one sticky completion ledger from Filter to publication.** User follow-ups add corrections to
144
+ that ledger; they never replace its earlier obligations. The server-owned steel manifest is the ledger's
145
+ inventory, and every page, Filter layer, candidate line, reference/detail/connection marker, member,
146
+ and new or changed joint stays `open` until it has evidence, an explicit reviewed disposition, or a
147
+ named RFI/refusal. Do not summarize an open row away and do not declare the model complete because it
148
+ looks complete. Completion means the `/revision-read/audit` response is `read-complete` for the exact
149
+ candidate and attestation that are submitted, and the published History row carries the matching receipt.
150
+ A blocked audit is the remaining checklist, not permission to stop enforcing the original skill.
151
+
143
152
  - **Read each framing plan** via **`floless-app-steel-takeoff`** — it runs the filter pre-stage
144
153
  (isolate the steel linework by layer/thickness/colour), the vision read, the AISC/EN/BS lookup
145
154
  via the detailer, authors the model datum plus two labelled registration controls per plan,
@@ -7,7 +7,7 @@ description: >-
7
7
  two-phase Drawing Filter process: first prepare and save the deterministic Filter, then read only the
8
8
  selected evidence into model-global members, registered plan views, observations, and revision history.
9
9
  metadata:
10
- version: 0.19.0
10
+ version: 0.20.1
11
11
  ---
12
12
 
13
13
  # Steel Takeoff — read drawings into `steel.model/v2`
@@ -20,14 +20,17 @@ and own observations, never member geometry.
20
20
 
21
21
  Do not read members before the user saves the Drawing Filter.
22
22
 
23
- 1. Prepare the Filter deterministically from the attached sources.
23
+ 1. POST the request's `/steel-manifest` route. The server rehashes every attached PDF, inventories
24
+ every page, and mints the Filter geometry and element identities. If sheet identity is ambiguous,
25
+ inspect only the pages named by `sheet-identification-required` and retry with explicit bindings.
26
+ Never build, rename, or replace server-owned Filter geometry yourself.
24
27
  2. Stop and ask the user to review the Filter in Steel Filter and click **Save**.
25
28
  3. Only after Save, fetch the request and its saved Filter again, pin its ETag, and read members from
26
29
  elements that the saved selection keeps.
27
30
 
28
- Filter preparation is geometry extraction, not interpretation. Use the deterministic PDF/vector tools
29
- available in the environment; do not ask a model to recreate paths, layers, line weights, colours, or
30
- text positions. Preserve coincident primitives as separate elements.
31
+ Filter preparation is geometry extraction, not interpretation. The server's fixed PyMuPDF extractor is
32
+ the sole authority for paths, layers, line weights, colours, text positions, source/page ids, and element
33
+ ids. Preserve coincident primitives as separate elements.
31
34
 
32
35
  Each Filter sheet must carry:
33
36
 
@@ -41,6 +44,32 @@ Each Filter sheet must carry:
41
44
  Reject duplicate sheet labels across the request. Never invent an id after the Filter is saved and never
42
45
  identify evidence by array position or geometry alone. The saved Filter is the evidence catalogue.
43
46
 
47
+ ## Closed completion ledger
48
+
49
+ Create one request-scoped ledger from the server manifest and keep it through every user correction.
50
+ A later instruction adds or changes work; it does not erase the primary requirements below. Each row is
51
+ `open`, `proven`, `explicitly-disposed`, or `blocked/RFI`. No row may disappear from a summary.
52
+
53
+ The ledger must close all of these inventories:
54
+
55
+ - every attached source and every manifest page was rehashed and visually reviewed over its whole bounds;
56
+ - building massing and coordinate frames were stated before members were interpreted;
57
+ - every Filter layer was classified;
58
+ - every manifest line is either supported by an active observation or has a reviewed `lineDisposition`;
59
+ - every reference marker resolves through the drawing graph to a reviewed page, or names the missing sheet;
60
+ - every detail/connection marker maps to a real joint/connection, an explicit non-model disposition, or RFI;
61
+ - every new or changed joint has a dependency review tied to the exact members, recipe, parameters, and details;
62
+ - every built connection has measured bearing, head/nut contact, grip, bolt length, clash clearance,
63
+ support reach, edge distance, and weld-location facts; opaque custom geometry remains blocked;
64
+ - the final selected candidate is schema-valid, uses the exact saved Filter, stays within work limits,
65
+ resolves member profiles/elevations honestly, and contains no unaccounted source evidence.
66
+
67
+ Encode that ledger as the closed `steel-read/v1` attestation fields: `massing`, `layers`,
68
+ `lineDispositions`, `pageReviews`, `references`, `candidateDispositions`, and `jointReviews`. POST it with
69
+ the candidate to `/revision-read/audit`. Treat every blocked check and sample id as mandatory remaining
70
+ work, then repeat until `status: "read-complete"`. Never edit or fabricate a receipt: the server creates
71
+ it from the exact manifest, saved Filter, candidate, proof, project incarnation, base, and generation.
72
+
44
73
  ## Find the active request
45
74
 
46
75
  Use the local request API described by `floless-app-queue`. Read the request's `project`, `appId`,
@@ -83,6 +112,47 @@ non-coincident registration controls:
83
112
  - `control2_at`: the display-space location of a second grid intersection;
84
113
  - `control2_ref`: the second intersection's `{axis_x, axis_y}` labels.
85
114
 
115
+ On an initial read, before saving the Filter shell, derive each framing-plan sheet's effective `pt_per_ft`
116
+ from the measured display spans of two widely separated, non-parallel labelled grid runs (normally one X
117
+ run and one Y run) and their printed grid dimensions. Never inherit scale from an older contract or infer
118
+ it from a grid whose dimensions were themselves derived using that scale. Fit the one persisted value
119
+ deterministically from both runs: for printed lengths `f[i]` in feet and measured spans `p[i]` in points,
120
+ use `pt_per_ft = round(sum(f[i] * p[i]) / sum(f[i]^2), 6)`. Re-read or refuse when either predicted span
121
+ `f[i] * pt_per_ft` differs from its measured span by more than `2 pt`; one `pt_per_ft` cannot represent
122
+ greater non-uniform distortion. When a scale annotation is already inside the selected plan evidence, use
123
+ it only as a nominal cross-check: `72 × paper inches per foot` means
124
+ `1/4" = 1'-0"` is `18 pt/ft` and `1/2" = 1'-0"` is `36 pt/ft`. Never inspect or rasterize an excluded
125
+ title block merely to obtain scale. PDFs may have been replotted or resized, so when nominal and derived
126
+ values disagree, use the independently printed dimensions as geometric authority and record the effective
127
+ scale. Convert each checked printed run to millimetres and assert that
128
+ the corresponding root-grid intersections have that same world-space separation; the PDF registration
129
+ alone is not proof because its fitted scale can cancel an incorrect world grid. Choose `datum_at` and
130
+ `control2_at` as the endpoints of one checked run. Before freezing the shell, verify that their display
131
+ span differs by at most `2 pt` from `worldSpanMm * pt_per_ft / 304.8`; this prevents the runtime's fitted
132
+ registration scale from silently stretching an otherwise correct grid. Apply that fitted similarity
133
+ transform to both world-grid endpoints of the second, non-parallel checked run: each must land within
134
+ `2 pt` of its measured display endpoint. Negate display Y before comparing handedness (world is Y-up;
135
+ display is Y-down), then require the signed cross-product of the two run directions to keep the same sign
136
+ in world and normalized display space. This catches shear and reflected handedness that equal X/Y lengths
137
+ alone cannot. Internally consistent wrong scale and grid values are not independent evidence. If
138
+ this proof fails only after an initial Filter shell was saved, stop and start a fresh initial
139
+ read/checkpoint; never mutate the frozen shell.
140
+
141
+ When an independently authored, unmodified IFC from the same model and drawing revision is available (for
142
+ example, the original Tekla or design export, not an IFC exported from this or an older FloLess contract),
143
+ respect its declared units and use it to validate the provisional root grid and plan registration before
144
+ the initial Filter shell is saved. If revision identity is unavailable, only use surveyed or grid controls
145
+ proven unchanged between issues; a stale IFC may corroborate but must never override current drawing
146
+ dimensions. Compare at least two corresponding grid or column locations plus two separated corresponding
147
+ dimensions. In plan, compare either three non-collinear corresponding controls or two separated,
148
+ non-parallel baselines; also compare two separated corresponding elevations. A shared zero level alone
149
+ proves no Z scale. Do not rescale the IFC merely to make the native read look right. If provisional native
150
+ XY is wrong by a common factor while the separated elevations prove Z scale is correct, correct the
151
+ provisional plan registration and root grid before Save; uniform XYZ scaling destroys the already-correct
152
+ elevations. After the shell is frozen, the completed-model overlap is a verification only: if it fails,
153
+ abort and restart the initial read with a corrected shell rather than mutating registration or members.
154
+ Show the verified overlap to the user before submitting the full read.
155
+
86
156
  **Narrow headless revision exception.** When floless.app's server-owned headless preamble explicitly
87
157
  says this is a phase-one-only `revision-read`, exposes only the immutable leased PDF sources plus the
88
158
  request-scoped contract/prepass calls, and requires the exact Steel Filter Save question, do not
@@ -90,6 +160,13 @@ create an earlier plan-confirmation checkpoint. Match framing pages only to the
90
160
  already present in that project's current contract; if the match is absent or ambiguous, stop with
91
161
  `needs-you` instead of inventing a plan name. This exception never applies to an initial read, an
92
162
  interactive session, or phase two, and it is not permission to read members before the Filter Save.
163
+ Because this phase-one prepass cannot change plan registration, it also cannot prove or repair an existing
164
+ model's scale. After Filter Save, phase two must perform the source-led scale proof above. If it finds an
165
+ existing scale error, stop the revision and report the measured discrepancy; do not restart the
166
+ scale-blind prepass, partially rescale the evidenced subset, or submit a mixed-scale candidate. A global
167
+ correction cannot travel through this revision route: create a fresh project and run an initial model read
168
+ from the complete source set so every member is supported by selected evidence, then use the ordinary
169
+ review. Preserve the old project only as an inspectable archive.
93
170
 
94
171
  ⚠️ **This ONE plan-scope confirm covers both the filter pass AND the member read — they run on the
95
172
  same sheet set. Getting the OK does NOT mean "go read members"; the very next thing you do is the
@@ -213,18 +290,23 @@ working project contract; approval and bake strip them from published artifacts.
213
290
 
214
291
  ## Submit through revision-read
215
292
 
216
- POST the completed candidate to the project `revision-read` route with:
293
+ First POST `{ requestId, contract, attestation }` to the project's `/revision-read/audit` route. Only
294
+ after it returns `read-complete`, POST the exact same contract and attestation to `revision-read` with:
217
295
 
218
296
  - the queued `requestId` and base ledger head;
219
297
  - the pinned contract and Filter ETags required by the route;
220
298
  - the complete native candidate;
299
+ - the complete closed `steel-read/v1` attestation;
221
300
  - source snapshots for every queued drawing;
222
301
  - a concise read summary and unresolved notes.
223
302
 
224
- On the first read, a valid candidate is journal-published as History version 1 and the request clears.
225
- On a later read, the route stages a diff for user review. Do not claim completion until the user confirms
226
- the staged revision and the route publishes it. A conflict, stale Filter, changed source, or changed
227
- ledger head means refetch and re-read; never force the stale candidate through.
303
+ The transaction independently reloads and re-evaluates the manifest, Filter, candidate, and attestation;
304
+ the preflight response is guidance, never a capability token. On the first read, a valid candidate is
305
+ journal-published as History version 1 with its audit receipt and the request clears. On a later read,
306
+ the route stages a diff for user review. Do not claim completion until the user confirms the staged
307
+ revision and the route re-audits the selected final document and publishes a receipt-backed History row.
308
+ A conflict, stale Filter, changed source, changed base, changed selection, or changed ledger head means
309
+ refetch, re-compose, and re-audit; never force the stale candidate through.
228
310
 
229
311
  ## Guardrails
230
312
 
package/dist/web/aware.js CHANGED
@@ -5492,6 +5492,10 @@
5492
5492
  const d = await r.json();
5493
5493
  if (awareJobOwnsPill()) return; // the job resolved while this request was in flight
5494
5494
  awareUpdateCheck = r.ok ? d : null;
5495
+ // Keep the modal's bridge names tied to the LATEST check, not to whenever the modal was last
5496
+ // opened. paintAwareUpgrade is also driven by the client subscription (a server-started job
5497
+ // never opens the modal), so without this a stale set from an earlier open could be named.
5498
+ awareUpgradeInventory = awareInventoryOf(awareUpdateCheck);
5495
5499
  if (r.ok && d.updateAvailable && d.targetVersion && d.operation === 'bridge-repair') {
5496
5500
  const count = Array.isArray(d.bridges) ? d.bridges.filter((row) => row.status !== 'current').length : 0;
5497
5501
  $awareUpdate.textContent = `Repair ${count || ''} installed bridge${count === 1 ? '' : 's'}`.replace(' ', ' ');
@@ -5533,16 +5537,48 @@
5533
5537
  let awareUpgradeReturnFocus = null;
5534
5538
  const awareBusy = (status) => status === 'starting' || status === 'running' || status === 'retrying';
5535
5539
  const awareHostLabel = (host) => ({ tekla: 'Tekla', revit: 'Revit', sketchup: 'SketchUp', rhino: 'Rhino' }[host] || host);
5540
+ // "Tekla" / "Tekla and Revit" / "Tekla, Revit, and SketchUp" — inventory order, never alphabetised,
5541
+ // so it reads the same way the results panel below it lists them.
5542
+ const awareHostList = (names) => (names.length < 3
5543
+ ? names.join(' and ')
5544
+ : `${names.slice(0, -1).join(', ')}, and ${names[names.length - 1]}`);
5545
+ /** The bridge inventory an /api/aware/update answer carries, or none when it carries no list. */
5546
+ const awareInventoryOf = (check) => (Array.isArray(check && check.bridges) ? check.bridges : []);
5547
+ /**
5548
+ * Name the bridges THIS computer actually has, instead of reciting a fixed host list.
5549
+ *
5550
+ * The installed set differs per user (it may be none, one, or several) and grows as AWARE
5551
+ * supports more hosts, so the hardcoded four-host list this replaces was both irrelevant to
5552
+ * most readers and destined to rot. An empty inventory is genuinely ambiguous —
5553
+ * the user has none, OR the inspection could not run (`checkAwareUpdate` returns no bridges when
5554
+ * the directory cannot be walked safely) — so that case falls back to a phrase which claims
5555
+ * neither, rather than asserting "no bridges are installed" we cannot verify.
5556
+ *
5557
+ * These are the names the last CHECK saw. The job re-snapshots the directory when it starts
5558
+ * (aware-update-jobs.ts), so a bridge installed or removed between the two is refreshed without
5559
+ * being named here (or named without being refreshed). The offer describes intent before a job
5560
+ * exists, so it cannot be that snapshot; the results panel below reports what the job actually
5561
+ * did. Keeping the inventory in step with every poll (see refreshAwareUpdate) is what shrinks
5562
+ * that window to the gap between the last check and the click.
5563
+ */
5564
+ const awareBridgeClause = (inventory) => {
5565
+ const names = (inventory || []).map((row) => awareHostLabel(row.host)).filter(Boolean);
5566
+ return names.length
5567
+ ? `refreshes your installed ${awareHostList(names)} bridge${names.length === 1 ? '' : 's'}`
5568
+ : 'refreshes any bridges installed on this computer';
5569
+ };
5570
+ // A registry hiccup leaves `target` empty; "v" + nothing used to render "vthe current release".
5571
+ const awareVersionLabel = (target) => (target ? `v${target}` : 'the current release');
5536
5572
  const awareUpgradeCopyText = (target, operation, inventory) => {
5537
5573
  if (operation === 'bridge-repair') {
5538
5574
  const stale = (inventory || []).filter((row) => row.status === 'stale' || row.status === 'unverifiable');
5539
5575
  const versions = stale.map((row) => `${awareHostLabel(row.host)}${row.version ? ` v${row.version}` : ''}`).join(', ');
5540
- return `AWARE v${target || 'the current release'} is current. ${versions || 'One or more installed bridges'} ${stale.length === 1 ? 'needs' : 'need'} to match it. Repairs only bridges already installed on this computer; no new bridges are installed.`;
5576
+ return `AWARE ${awareVersionLabel(target)} is current. ${versions || 'One or more installed bridges'} ${stale.length === 1 ? 'needs' : 'need'} to match it. Repairs only bridges already installed on this computer; no new bridges are installed.`;
5541
5577
  }
5542
5578
  if (operation === 'combined') {
5543
- return `Updates AWARE to v${target || 'the current release'} and refreshes any Revit, SketchUp, Rhino, or Tekla bridges already installed on this computer. No new bridges are installed.`;
5579
+ return `Updates AWARE to ${awareVersionLabel(target)} and ${awareBridgeClause(inventory)}. No new bridges are installed.`;
5544
5580
  }
5545
- return `Upgrades AWARE to v${target || 'the current release'} and refreshes any Revit, SketchUp, Rhino, or Tekla bridges already installed on this computer. No new bridges are installed. FloLess stays open; this may take a few minutes.`;
5581
+ return `Upgrades AWARE to ${awareVersionLabel(target)} and ${awareBridgeClause(inventory)}. No new bridges are installed. FloLess stays open; this may take a few minutes.`;
5546
5582
  };
5547
5583
 
5548
5584
  function closeAwareUpgradeModal() {
@@ -5677,7 +5713,7 @@
5677
5713
  }
5678
5714
  const check = awareUpdateCheck || {};
5679
5715
  awareUpgradeOperation = check.operation || ($awareUpdate && $awareUpdate.dataset.operation) || 'runtime-update';
5680
- awareUpgradeInventory = Array.isArray(check.bridges) ? check.bridges : [];
5716
+ awareUpgradeInventory = awareInventoryOf(check);
5681
5717
  awareUpgradeTarget = target;
5682
5718
  awareUpgradeReturnFocus = returnFocusTo || document.activeElement;
5683
5719
  // `runtime-failed` belongs here alongside `partial`. Without it, clicking the attention pill
@@ -18,6 +18,7 @@ import * as THREE from 'three';
18
18
  import { OrbitControls } from 'three/addons/OrbitControls.js';
19
19
  import { RoomEnvironment } from 'three/addons/RoomEnvironment.js';
20
20
  import { surfaceTextures, applyTriplanar, TILE_MM, DIRECTIONAL } from './steel-materials.js';
21
+ import { canvasToolGuidanceState } from './steel-canvas-guidance.js';
21
22
  import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
22
23
  import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint, clipSegmentToPlanes, pointSegmentDistance2d, perspectiveSegmentParameter, gridDepthWins, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf } from './steel-3d-core.js';
23
24
  // `gridGeometry`, `gridCandidates3d` and `mmPerPx` moved behind the host's model read half (unit 5, P7d):
@@ -30,7 +31,7 @@ let shadowGround = null, shadowsEnabled = false; // the `shadowed` mode's grou
30
31
  let pending = null, dragging = null, marker = null, readout = null; // pending = member gesture; readout = drag dimension overlay
31
32
  let boxSel = null, rubber = null; // LEFT-drag-on-empty rubber-band multi-select
32
33
  let selectionTrace = null; // last ordinary pointer-selection route (read-only E2E diagnostic)
33
- let hoverId = null, hoverGlowIds = [], hoverChip = null, hoverRAF = 0, lastHoverXY = null; // hover readout + cursor; hoverGlowIds = every mesh currently wearing the sky glow (the WHOLE connection when hovering one of its parts)
34
+ let hoverId = null, hoverGlowIds = [], hoverChip = null, hoverChipShell = null, hoverChipToggle = null, hoverChipIdleCollapsed = false, hoverRAF = 0, lastHoverXY = null; // hover readout + cursor; hoverGlowIds = every mesh currently wearing the sky glow (the WHOLE connection when hovering one of its parts)
34
35
  let epGroup = null; // yellow/magenta endpoint markers (start/end direction dots)
35
36
  let epGeom = null, epMatStart = null, epMatEnd = null; // shared across all endpoint dots (no per-rebuild churn)
36
37
  let epRing = null, epPreview = null, epMovedLine = null; // white ring on the active end node + member rubber (epPreview) + the "moved" leader (epMovedLine) while dragging an end
@@ -291,10 +292,29 @@ function init(canvas, theApi) {
291
292
  selLenLabelHost.style.cssText = 'position:fixed;left:0;top:0;pointer-events:none;z-index:3;display:none';
292
293
  document.body.appendChild(selLenLabelHost);
293
294
  document.body.appendChild(propLabelHost);
294
- // persistent hover/selection status chip, bottom-centre of the canvas (mirrors the viewer's readout)
295
- hoverChip = document.createElement('div');
296
- hoverChip.style.cssText = 'position:fixed;display:none;pointer-events:none;z-index:55;background:var(--panel,#0f172a);color:var(--mut,#94a3b8);border:1px solid var(--line,#334155);border-radius:6px;padding:5px 12px;font:12px system-ui;white-space:nowrap;max-width:60vw;overflow:hidden;text-overflow:ellipsis;box-shadow:0 2px 8px rgba(0,0,0,.45)';
297
- document.body.appendChild(hoverChip);
295
+ // The steel editor provides a shared bottom dock: the status disclosure owns the left, while the
296
+ // non-shrinking Select/Snap controls own the right. The shared renderer also serves vector-3d.html,
297
+ // which has no dock and intentionally keeps its existing read-only bottom-centre chip.
298
+ const statusDock = document.getElementById('bottomDockLeft');
299
+ hoverChip = document.createElement('span');
300
+ if (statusDock) {
301
+ try { hoverChipIdleCollapsed = localStorage.getItem('steel:canvasStatusCollapsed:v1') === '1'; } catch (_) { hoverChipIdleCollapsed = false; }
302
+ hoverChipShell = document.createElement('div'); hoverChipShell.id = 'canvasStatus';
303
+ hoverChipToggle = document.createElement('button'); hoverChipToggle.type = 'button'; hoverChipToggle.id = 'canvasStatusToggle';
304
+ hoverChipToggle.setAttribute('aria-controls', 'canvasStatusText');
305
+ hoverChipToggle.innerHTML = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg>';
306
+ hoverChip.id = 'canvasStatusText'; hoverChip.setAttribute('role', 'status'); hoverChip.setAttribute('aria-live', 'polite');
307
+ hoverChipToggle.onclick = () => {
308
+ if (hoverChipToggle.getAttribute('aria-disabled') === 'true') return;
309
+ hoverChipIdleCollapsed = !hoverChipIdleCollapsed;
310
+ try { localStorage.setItem('steel:canvasStatusCollapsed:v1', hoverChipIdleCollapsed ? '1' : '0'); } catch (_) {}
311
+ updateStatusChip(); hoverChipToggle.focus();
312
+ };
313
+ hoverChipShell.append(hoverChipToggle, hoverChip); statusDock.appendChild(hoverChipShell);
314
+ } else {
315
+ hoverChip.style.cssText = 'position:fixed;display:none;pointer-events:none;z-index:55;background:var(--panel,#0f172a);color:var(--mut,#94a3b8);border:1px solid var(--line,#334155);border-radius:6px;padding:5px 12px;font:12px system-ui;white-space:nowrap;max-width:60vw;overflow:hidden;text-overflow:ellipsis;box-shadow:0 2px 8px rgba(0,0,0,.45)';
316
+ document.body.appendChild(hoverChip);
317
+ }
298
318
  // rubber-band overlay for LEFT-drag box-select on empty space
299
319
  rubber = document.createElement('div');
300
320
  rubber.style.cssText = 'position:fixed;display:none;pointer-events:none;z-index:58;border:1px solid var(--brand,#3b82f6);background:rgba(59,130,246,.12)';
@@ -1833,6 +1853,7 @@ function setInsertMode(on, pending) {
1833
1853
  if (insertMode) { if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); setClipMode(null); disarmFrame3d(); }
1834
1854
  if (canvasEl) canvasEl.style.cursor = insertMode ? 'crosshair' : 'default';
1835
1855
  if (api && api.onInsertModeChange) api.onInsertModeChange(insertMode);
1856
+ updateStatusChip();
1836
1857
  }
1837
1858
  function insertModeOn() { return insertMode; }
1838
1859
 
@@ -1861,6 +1882,7 @@ function setBasePickMode(colId) {
1861
1882
  if (canvasEl) canvasEl.style.cursor = basePickCol ? 'crosshair' : 'default';
1862
1883
  if (!basePickCol) { if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; }
1863
1884
  if (api && api.onBasePickModeChange) api.onBasePickModeChange(basePickModeOn());
1885
+ updateStatusChip();
1864
1886
  }
1865
1887
  function basePickModeOn() { return !!basePickCol; }
1866
1888
  // A point along the target column's VERTICAL axis at the cursor, elevation snapped to the level datums.
@@ -3065,6 +3087,7 @@ function toggleDimTool() {
3065
3087
  if (!dimMode3d) { dimDraft3d = null; dimCandidates3d = null; dimPreviewLine.visible = false; marker.visible = false; readout.style.display = 'none'; canvasEl.style.cursor = 'default'; setSnapOnly3d(null); } // disarming ends the operation → the snap override reverts to all snaps
3066
3088
  else { if (clipMode) setClipMode(null); if (wpMode) armWorkPlanePick(wpMode); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); drClear3d(); disarmFrame3d(); controls.enabled = true; canvasEl.style.cursor = 'crosshair'; } // arming the dim tool disarms the clip pick, a set-plane pick, Move/Copy, Add-member AND the local frame (all share the left-click + Esc)
3067
3089
  reflectDimBar();
3090
+ updateStatusChip();
3068
3091
  return dimMode3d;
3069
3092
  }
3070
3093
  // Arm/disarm the grid panel's "Add single line" pick for the 3D view. The early-out keeps re-arming a no-op:
@@ -4182,7 +4205,7 @@ function frameInfo() {
4182
4205
  }
4183
4206
  return { mode: 'global' };
4184
4207
  }
4185
- function fireFrameChange() { invalidatePointEntry('drift'); if (!(pending && pending.frameDrag)) { tfCandidates = null; dimCandidates3d = null; } renderWorkPlane(); reflectDimAxisBar(); } // re-draws the gizmo + reference plane + fires the Axes chip; relabels the dim-axis bar (X′/Y′/Elev follows the frame); invalidates the typed HUD (drift) + the snap caches so the UCS-origin snap follows the frame — but NOT during a live origin drag (the drag's own snap cache, which excludes the origin, stays efficient)
4208
+ function fireFrameChange() { invalidatePointEntry('drift'); if (!(pending && pending.frameDrag)) { tfCandidates = null; dimCandidates3d = null; } renderWorkPlane(); reflectDimAxisBar(); updateStatusChip(); } // re-draws the gizmo + reference plane + fires the Axes chip; relabels the dim-axis bar (X′/Y′/Elev follows the frame); invalidates the typed HUD (drift) + the snap caches so the UCS-origin snap follows the frame — but NOT during a live origin drag (the drag's own snap cache, which excludes the origin, stays efficient)
4186
4209
  // Set a HORIZONTAL frame at origin (numeric entry + gizmo materialize). origin defaults its Z to the active level.
4187
4210
  function setFrame3d(originMm, angleDeg) {
4188
4211
  const z = (originMm && originMm.length > 2) ? originMm[2] : frameZ();
@@ -4337,7 +4360,7 @@ function framePicking() { return framePickPts !== null; }
4337
4360
  function framePickStep() { return framePickPts ? framePickPts.length : null; } // 0=origin · 1=X · 2=Y | null when not picking
4338
4361
  function cancelFramePick() { framePickPts = null; disposeFramePreview(); if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; }
4339
4362
  function disposeFramePreview() { if (!framePreview) return; if (overlayScene) overlayScene.remove(framePreview); framePreview.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); framePreview = null; }
4340
- function fireFramePickChange() { if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); } // the panel hint follows the pick step; frame3d is unchanged so the chip/gizmo stay put
4363
+ function fireFramePickChange() { if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); updateStatusChip(); } // the panel hint and canvas guidance follow the pick step; frame3d is unchanged so the chip/gizmo stay put
4341
4364
  function framePickClick(e) {
4342
4365
  const r = dimPointAt(e); if (!r) return; // a valid snapped/plane point
4343
4366
  if (framePickPts.length === 1 && Math.hypot(r.p[0] - framePickPts[0][0], r.p[1] - framePickPts[0][1], r.p[2] - framePickPts[0][2]) < 5) { // X point == origin → there's no X axis; reject HERE with an accurate message (else every later Y pick fails on a≈b)
@@ -4434,15 +4457,15 @@ function renderWorkPlane() {
4434
4457
  function reflectWpBar() { const b = document.getElementById('m3dWp'); if (b) { b.classList.toggle('on', !!wpMode || !!workPlane);
4435
4458
  const kind = workPlane && workPlane.kind ? { face: 'Face', p3: '3pt', xy: 'XY', xz: 'XZ', yz: 'YZ' }[workPlane.kind] || '' : '';
4436
4459
  b.textContent = wpMode ? '◇ Plane ✕' : (kind ? '◇ Plane: ' + kind + ' ▾' : '◇ Plane ▾'); } reflectDimAxisBar(); } // the label reads the active plane without opening the menu (ux review); relabel the dim-axis bar (a set/cleared plane flips X/Y between World and local)
4437
- function armWorkPlanePick(mode) { if (wpMode === mode) { wpMode = null; wpDraft = null; } else { wpMode = mode; wpDraft = null; dropGridLinePick3d(); dropRefMeasure3d(); if (dimMode3d) toggleDimTool(); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); disarmFrame3d(); } marker.visible = false; canvasEl.style.cursor = wpMode ? 'crosshair' : 'default'; reflectWpBar(); } // a set-plane pick shares the left-click — disarm Move/Copy + Add + the local frame (their onDown routes run first)
4460
+ function armWorkPlanePick(mode) { if (wpMode === mode) { wpMode = null; wpDraft = null; } else { wpMode = mode; wpDraft = null; dropGridLinePick3d(); dropRefMeasure3d(); if (dimMode3d) toggleDimTool(); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); disarmFrame3d(); } marker.visible = false; canvasEl.style.cursor = wpMode ? 'crosshair' : 'default'; reflectWpBar(); updateStatusChip(); } // a set-plane pick shares the left-click — disarm Move/Copy + Add + the local frame (their onDown routes run first)
4438
4461
  function setWorkPlanePrincipal(kind, offsetMm) {
4439
4462
  const off = offsetMm || 0;
4440
4463
  const def = { xy: { normal: [0, 0, 1], xAxis: [1, 0, 0] }, xz: { normal: [0, 1, 0], xAxis: [1, 0, 0] }, yz: { normal: [1, 0, 0], xAxis: [0, 1, 0] } }[kind];
4441
4464
  if (!def) return;
4442
4465
  workPlane = { origin: def.normal.map((c) => c * off), normal: def.normal, xAxis: def.xAxis, kind };
4443
- wpMode = null; wpDraft = null; invalidatePointEntry('drift'); renderWorkPlane(); reflectWpBar();
4466
+ wpMode = null; wpDraft = null; invalidatePointEntry('drift'); renderWorkPlane(); reflectWpBar(); updateStatusChip();
4444
4467
  }
4445
- function clearWorkPlane() { workPlane = null; wpMode = null; wpDraft = null; invalidatePointEntry('drift'); renderWorkPlane(); reflectWpBar(); }
4468
+ function clearWorkPlane() { workPlane = null; wpMode = null; wpDraft = null; invalidatePointEntry('drift'); renderWorkPlane(); reflectWpBar(); updateStatusChip(); }
4446
4469
  function toggleWorkPlaneVisible(on) { wpVisible = on === undefined ? !wpVisible : !!on; try { localStorage.setItem('steel:wpVisible:v1', wpVisible ? '1' : '0'); } catch { /* storage can be unavailable; keep the session preference */ } renderWorkPlane(); }
4447
4470
  function workPlaneInfo() { return { set: !!workPlane, mode: wpMode, visible: wpVisible, plane: workPlane ? { origin: [...workPlane.origin], normal: [...workPlane.normal], xAxis: [...workPlane.xAxis] } : null }; }
4448
4471
  // face pick: the clip tool's raycast, minus the camera-side flip — the plane lands ON the face.
@@ -4903,7 +4926,7 @@ function onDown(e) {
4903
4926
  if (readout) { readout.style.display = 'none'; if (readout._coord) readout._coord.style.display = 'none'; } // UCS Stage 2: hide the whole readout chip so a drag never shows a lingering coordinate (or an empty coord-only shell); the drag/next hover re-shows it
4904
4927
  if (e.button === 2) { rightDownXY = [e.clientX, e.clientY]; rightMoved = false; } // arm the click-vs-drag test for the snap menu
4905
4928
  if (e.button !== 0) return; // RIGHT/MIDDLE → OrbitControls (orbit/pan)
4906
- if (wpMode === 'face') { e.stopPropagation(); const r = wpFacePick(e.clientX, e.clientY); if (r) { workPlane = r; wpMode = null; invalidatePointEntry('drift'); canvasEl.style.cursor = 'default'; renderWorkPlane(); reflectWpBar(); if (api && api.toast) api.toast('Working plane set on the face'); } return; } // armed: one face click sets the plane
4929
+ if (wpMode === 'face') { e.stopPropagation(); const r = wpFacePick(e.clientX, e.clientY); if (r) { workPlane = r; wpMode = null; invalidatePointEntry('drift'); canvasEl.style.cursor = 'default'; renderWorkPlane(); reflectWpBar(); updateStatusChip(); if (api && api.toast) api.toast('Working plane set on the face'); } return; } // armed: one face click sets the plane
4907
4930
  if (wpMode === '3pt') { e.stopPropagation();
4908
4931
  const r = dimPointAt(e); if (!r) return;
4909
4932
  wpDraft = wpDraft || []; wpDraft.push(r.p);
@@ -4913,7 +4936,7 @@ function onDown(e) {
4913
4936
  if (wp) { wp.kind = 'p3'; workPlane = wp; invalidatePointEntry('drift'); renderWorkPlane(); if (api && api.toast) api.toast('Working plane set from 3 points'); }
4914
4937
  else if (api && api.toast) api.toast('Points are collinear — plane not set');
4915
4938
  reflectWpBar(); }
4916
- return; }
4939
+ updateStatusChip(); return; }
4917
4940
  if (addActive()) { e.stopPropagation(); controls.enabled = true; drClick(e); return; } // Add-member armed (editor state) → two plane picks draw a member
4918
4941
  if (cmActive()) { if (tfClick(e)) { e.stopPropagation(); controls.enabled = true; return; } } // Move/Copy armed (editor state) → picks land on the working plane; an empty-selection click falls through to select
4919
4942
  if (basePickCol) { e.stopPropagation(); const r = basePickPoint(e.clientX, e.clientY); if (r) { if (api && api.onBasePick) api.onBasePick(r); setBasePickMode(null); } return; } // Mode B: commit + disarm only on a valid on-column pick; an off-column click is ignored (stays armed) — Esc cancels
@@ -4986,7 +5009,7 @@ function onDown(e) {
4986
5009
  if (g.valueMm > 1 && api && api.onAddDim3d) api.onAddDim3d({ id: api.newDim3dId(), a, b, axis, ...(axisDir ? { axisDir } : {}) });
4987
5010
  else if (g.valueMm <= 1 && axis !== 'free') { dimDraft3d = { a }; if (api && api.toast) api.toast('No length along the locked axis — move the second point or switch axis'); } // any AXIS-LOCKED projection (world X/Y/Z/Elev or local X′/Y′) collapsed to ~0 despite a real 2nd pick — e.g. two points at the same level with Z / Alt-vertical → keep the first anchor + explain, don't silently drop the pick. A coincident 'free' double-click stays a silent no-op.
4988
5011
  }
4989
- return;
5012
+ updateStatusChip(); return;
4990
5013
  }
4991
5014
  downXY = [e.clientX, e.clientY];
4992
5015
  let id = null; try { id = pickAt(e.clientX, e.clientY); } catch { id = null; }
@@ -5642,6 +5665,16 @@ function updateStatusChip() {
5642
5665
  if (!hoverChip || !canvasEl) return;
5643
5666
  const rect = canvasEl.getBoundingClientRect();
5644
5667
  let txt = '';
5668
+ // Idle hover/help may be collapsed. Instructions for an armed tool or an in-flight gesture are
5669
+ // operationally critical, so they stay visible until that action ends, then return to the saved idle state.
5670
+ const toolGuidance = canvasToolGuidanceState({
5671
+ teklaDragActive: !!(teklaDrag && teklaDrag.active), workPlaneMode: wpMode,
5672
+ addActive: !!addActive(), transformActive: !!cmActive(), referenceMeasureActive: !!refMeasure3d,
5673
+ gridLinePickActive: !!gridLinePick3d, clipMode, dimensionMode: dimMode3d,
5674
+ dimensionHasStart: !!dimDraft3d, insertMode, insertName: insertPending && insertPending.name,
5675
+ basePickColumn: basePickCol, frameMode, framePickStep: framePickStep(), geometryMode: geoMode(),
5676
+ });
5677
+ const forceOpen = toolGuidance.forceOpen;
5645
5678
  const selectionStatus=objectSelectionStatus(selIds.size,selectedGridIds.size),showId=hoverId||(!selectionStatus&&selIds.size===1?[...selIds][0]:null);
5646
5679
  // The badge follows the cursor and so clips away at the window edge — from there this chip is the
5647
5680
  // only thing still telling the user what releasing will do.
@@ -5669,6 +5702,7 @@ function updateStatusChip() {
5669
5702
  else if (gridLinePick3d) txt = gridLinePick3d.a ? 'Click the second point of the grid line · Esc to cancel' : 'Click the first point of the grid line · Esc to cancel'; // must sit above the showId/default branches, else an armed two-click tool shows the hovered member or the drag-move hint the user can't act on
5670
5703
  else if (clipMode === 'plane') txt = 'Click a face to set a clip plane · Esc to cancel';
5671
5704
  else if (clipMode === 'box') txt = !clipBoxDraft ? 'Click the first floor corner of the clip box · Esc to cancel' : !clipBoxDraft.b ? 'Click the opposite floor corner · Esc to cancel' : 'Move up/down to set the height, then click · Esc to step back';
5705
+ else if (toolGuidance.text) txt = toolGuidance.text;
5672
5706
  else if (showId) { const m = memberById(showId); txt = m ? `${m.id} · ${m.profile || '—'}` : ''; }
5673
5707
  else if (selectionStatus) txt = selectionStatus;
5674
5708
  else if (isIsolated()) txt = `Isolated: ${(isolatedIds ? isolatedIds.size : 0) + (isolatedGridIds ? isolatedGridIds.size : 0)} · Show all to restore`;
@@ -5680,9 +5714,19 @@ function updateStatusChip() {
5680
5714
  else { const canDrag = api && api.dragMoveEnabled && api.dragMoveEnabled();
5681
5715
  txt = (canDrag ? 'Drag to move · Ctrl+drag to copy · ' : 'Click to select · ') + 'ends to stretch · Alt+drag elevation · right-drag orbit · dbl-click to zoom in'; }
5682
5716
  hoverChip.textContent = txt;
5683
- hoverChip.style.left = (rect.left + rect.width / 2) + 'px'; hoverChip.style.transform = 'translateX(-50%)';
5684
- hoverChip.style.top = (rect.bottom - 30) + 'px';
5685
- hoverChip.style.display = canvasEl.style.display === 'none' ? 'none' : 'block';
5717
+ if (hoverChipShell) {
5718
+ const open = forceOpen || !hoverChipIdleCollapsed, shown = canvasEl.style.display !== 'none';
5719
+ hoverChipShell.classList.toggle('collapsed', !open); hoverChipShell.style.display = shown ? 'flex' : 'none';
5720
+ hoverChip.dataset.tip = txt;
5721
+ hoverChipToggle.classList.toggle('open', open); hoverChipToggle.setAttribute('aria-expanded', String(open));
5722
+ hoverChipToggle.setAttribute('aria-disabled', String(forceOpen));
5723
+ const label = forceOpen ? 'Tool guidance stays visible until the current action ends' : open ? 'Collapse canvas guidance' : 'Expand canvas guidance';
5724
+ hoverChipToggle.setAttribute('aria-label', label); hoverChipToggle.dataset.tip = label;
5725
+ } else {
5726
+ hoverChip.style.left = (rect.left + rect.width / 2) + 'px'; hoverChip.style.transform = 'translateX(-50%)';
5727
+ hoverChip.style.top = (rect.bottom - 30) + 'px';
5728
+ hoverChip.style.display = canvasEl.style.display === 'none' ? 'none' : 'block';
5729
+ }
5686
5730
  }
5687
5731
 
5688
5732
  function show() { if (controls) controls.enabled = true; if (canvasEl) { canvasEl.style.display = 'block'; resize(); } if (!rafId) loop(); updateStatusChip(); refreshDims(); refreshOverlayDims(); renderFrameGizmo(); } // resume the render loop (reset orbit in case a gesture was stranded by a mid-drag hide)
@@ -5703,7 +5747,7 @@ function hide() {
5703
5747
  if (propLabelHost) propLabelHost.style.display = 'none'; // property labels ride the same loop — hide synchronously so none strand over the 2D UI
5704
5748
  clearCopyGhost(); // drop a stale Ctrl+drag copy ghost on the way out
5705
5749
  endTeklaDrag(); // and a live drag-out to Tekla — a stranded one would leave its badge on screen and swallow every later pointer move
5706
- if (canvasEl) canvasEl.style.display = 'none'; if (hoverChip) hoverChip.style.display = 'none'; if (rafId) { cancelAnimationFrame(rafId); rafId = null; }
5750
+ if (canvasEl) canvasEl.style.display = 'none'; if (hoverChipShell) hoverChipShell.style.display = 'none'; else if (hoverChip) hoverChip.style.display = 'none'; if (rafId) { cancelAnimationFrame(rafId); rafId = null; }
5707
5751
  }
5708
5752
  function isReady() { return built; }
5709
5753
 
@@ -5726,7 +5770,8 @@ function dispose() {
5726
5770
  window.removeEventListener('keydown', onKey);
5727
5771
  window.removeEventListener('keydown', onModifierChange);
5728
5772
  window.removeEventListener('keyup', onModifierChange);
5729
- for (const ovl of [readout, hoverChip, rubber, dimLabelHost]) if (ovl && ovl.parentNode) ovl.parentNode.removeChild(ovl);
5773
+ for (const ovl of [readout, hoverChipShell || hoverChip, rubber, dimLabelHost]) if (ovl && ovl.parentNode) ovl.parentNode.removeChild(ovl);
5774
+ hoverChip = hoverChipShell = hoverChipToggle = null;
5730
5775
  dimLabelHost = null; dimLabelPool.length = 0;
5731
5776
  if (memberLabelHost && memberLabelHost.parentNode) memberLabelHost.parentNode.removeChild(memberLabelHost);
5732
5777
  memberLabelHost = null; memberLabelPool.length = 0; labelsOnFlag = false; insertMode = false; insertPending = null;
@@ -5898,6 +5943,7 @@ window.Steel3DView = {
5898
5943
  setProjection, projection, setDisplayMode, mode: () => displayMode, frameAll, frameSelection, applyView,
5899
5944
  setRefLine, refLine: () => refLineOn,
5900
5945
  setInsertMode, insertMode: insertModeOn, // arm/query the detail-placement pick (Slice 4)
5946
+ refreshStatus: updateStatusChip, // editor-owned armed modes (Extend/Trim, Split) refresh the disclosure immediately
5901
5947
  setBasePickMode, basePickMode: basePickModeOn, // arm/query the Mode B column-base pick (level-snapped elevation)
5902
5948
  selectWholeConn, clearConnSel, ascendConn, connContext, connEnvelopeOn: () => !!connEnvelope, // Connection Components (Slice A): whole-select / drill / ascend + test probes
5903
5949
  // Reference models (#278) — an editor-only layer. `setReferences` takes the geometry the editor
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Pure state-to-guidance seam for the steel canvas disclosure.
3
+ *
4
+ * Keeping the force-open decision here makes every armed left-click tool testable without a Three.js
5
+ * scene. `text` is supplied only for tools whose guidance is wholly owned by the 3D renderer; the
6
+ * older move/add/clip/reference branches still compose their richer, live text in steel-3d-view.js.
7
+ */
8
+ export function canvasToolGuidanceState(state = {}) {
9
+ const forceOpen = !!(
10
+ state.teklaDragActive || state.workPlaneMode || state.addActive || state.transformActive ||
11
+ state.referenceMeasureActive || state.gridLinePickActive || state.clipMode || state.dimensionMode ||
12
+ state.insertMode || state.basePickColumn || state.frameMode || state.framePickStep != null || state.geometryMode
13
+ );
14
+
15
+ let text = null;
16
+ if (state.dimensionMode) {
17
+ text = state.dimensionHasStart
18
+ ? 'Click the second dimension point · Esc to step back'
19
+ : 'Click the first dimension point · Esc to cancel';
20
+ } else if (state.insertMode) {
21
+ text = `Click to place ${state.insertName || 'the detail'} on a member face or the working plane · Esc to cancel`;
22
+ } else if (state.basePickColumn) {
23
+ text = `Click a framing level to trim ${state.basePickColumn}’s base · Esc to cancel`;
24
+ } else if (state.framePickStep != null) {
25
+ text = [
26
+ 'Click the local-frame origin · Esc to cancel',
27
+ 'Click the local-X direction point · Esc to cancel',
28
+ 'Click a point on the local frame’s Y side · Esc to cancel',
29
+ ][state.framePickStep] || 'Pick the next local-frame point · Esc to cancel';
30
+ } else if (state.frameMode) {
31
+ text = 'Drag the local-frame origin or rotation ring to refine the axes · Esc to finish';
32
+ } else if (state.geometryMode === 'el') {
33
+ text = 'Click a target member, segment, or grid line to extend/trim the selection · Esc to cancel';
34
+ } else if (state.geometryMode === 'split') {
35
+ text = 'Click a point on the selected member to split it · Esc to cancel';
36
+ }
37
+
38
+ return { forceOpen, text };
39
+ }