@floless/app 0.128.1 → 0.129.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.
@@ -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.20.0
10
+ version: 0.20.1
11
11
  ---
12
12
 
13
13
  # Steel Takeoff — read drawings into `steel.model/v2`
@@ -112,6 +112,47 @@ non-coincident registration controls:
112
112
  - `control2_at`: the display-space location of a second grid intersection;
113
113
  - `control2_ref`: the second intersection's `{axis_x, axis_y}` labels.
114
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
+
115
156
  **Narrow headless revision exception.** When floless.app's server-owned headless preamble explicitly
116
157
  says this is a phase-one-only `revision-read`, exposes only the immutable leased PDF sources plus the
117
158
  request-scoped contract/prepass calls, and requires the exact Steel Filter Save question, do not
@@ -119,6 +160,13 @@ create an earlier plan-confirmation checkpoint. Match framing pages only to the
119
160
  already present in that project's current contract; if the match is absent or ambiguous, stop with
120
161
  `needs-you` instead of inventing a plan name. This exception never applies to an initial read, an
121
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.
122
170
 
123
171
  ⚠️ **This ONE plan-scope confirm covers both the filter pass AND the member read — they run on the
124
172
  same sheet set. Getting the OK does NOT mean "go read members"; the very next thing you do is the
package/dist/web/app.css CHANGED
@@ -2060,7 +2060,6 @@
2060
2060
  terminal. It is a button rather than an input so it cannot resemble somewhere to answer the
2061
2061
  parked question; long commands wrap instead of truncating the one thing the user must recover. */
2062
2062
  .req-run-resume { display: flex; flex-direction: column; gap: 4px; }
2063
- .req-run-resume-label { color: var(--text-muted); font-size: 10.5px; font-weight: 600; }
2064
2063
  .req-run-resume-command { appearance: none; width: 100%; min-height: 30px; padding: 6px 8px;
2065
2064
  text-align: left; cursor: pointer; color: var(--accent-bright); background: var(--surface-2);
2066
2065
  border: 1px solid var(--border-strong); border-radius: 4px; font-family: var(--mono); font-size: 10.5px;
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(' ', ' ');
@@ -5532,17 +5536,91 @@
5532
5536
  let awareUpgradeInventory = [];
5533
5537
  let awareUpgradeReturnFocus = null;
5534
5538
  const awareBusy = (status) => status === 'starting' || status === 'running' || status === 'retrying';
5535
- const awareHostLabel = (host) => ({ tekla: 'Tekla', revit: 'Revit', sketchup: 'SketchUp', rhino: 'Rhino' }[host] || host);
5539
+ // The map carries the casing only a human knows ("SketchUp", not "Sketchup"). A host AWARE gains
5540
+ // before this map does must still read as a NAME rather than an id, in the sentence and in the
5541
+ // results rows alike — so the fallback title-cases it instead of surfacing raw `archicad`.
5542
+ // It returns '' only when there is no id to show at all; each caller decides what that means
5543
+ // (the sentence counts the row instead, awareHostRows labels it "Unknown bridge").
5544
+ // Splitting on separators rather than capitalising at /\b[a-z]/ is deliberate: that word boundary
5545
+ // is ASCII-only, so it capitalised the letter AFTER an accent (`éco` → `éCo`), and a stray leading
5546
+ // or trailing hyphen survived as a space that then showed up mid-sentence.
5547
+ // Own-property lookup, not `MAP[host]`: a plain object inherits `constructor`, `toString` and
5548
+ // friends, so a host id colliding with one would render "function Object() { [native code] }"
5549
+ // into the sentence. Unreachable while the server validates against its own tuple — but this
5550
+ // fallback's whole job is to survive host ids nobody has thought of yet.
5551
+ const AWARE_HOST_NAMES = { tekla: 'Tekla', revit: 'Revit', sketchup: 'SketchUp', rhino: 'Rhino' };
5552
+ const awareHostLabel = (host) => {
5553
+ if (Object.hasOwn(AWARE_HOST_NAMES, host)) return AWARE_HOST_NAMES[host];
5554
+ // Only a string can be a host id. Stringifying anything else produces "[object Object]" in a
5555
+ // sentence a non-coder reads; the caller counts the row either way, so nothing goes missing.
5556
+ const raw = typeof host === 'string' ? host.trim() : '';
5557
+ const titled = raw.split(/[-_\s]+/).filter(Boolean)
5558
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
5559
+ .join(' ');
5560
+ // An id that is nothing but separators title-cases to '', and the caller drops empty names — so
5561
+ // the bridge would be refreshed without ever being named, the one thing this fallback exists to
5562
+ // prevent. Keep the raw form: ugly beats absent. Only a genuinely empty host yields ''.
5563
+ return titled || raw;
5564
+ };
5565
+ // "Tekla" / "Tekla and Revit" / "Tekla, Revit, and SketchUp" — inventory order, never alphabetised,
5566
+ // so it reads the same way the results panel below it lists them.
5567
+ const awareHostList = (names) => (names.length < 3
5568
+ ? names.join(' and ')
5569
+ : `${names.slice(0, -1).join(', ')}, and ${names[names.length - 1]}`);
5570
+ /** The bridge inventory an /api/aware/update answer carries, or none when it carries no list. */
5571
+ const awareInventoryOf = (check) => (Array.isArray(check && check.bridges) ? check.bridges : []);
5572
+ /** Above this many, the sentence states the count instead of naming every host. */
5573
+ const AWARE_MAX_NAMED_BRIDGES = 4;
5574
+ /**
5575
+ * Name the bridges THIS computer actually has, instead of reciting a fixed host list.
5576
+ *
5577
+ * The installed set differs per user (it may be none, one, or several) and grows as AWARE
5578
+ * supports more hosts, so the hardcoded four-host list this replaces was both irrelevant to
5579
+ * most readers and destined to rot. An empty inventory is genuinely ambiguous —
5580
+ * the user has none, OR the inspection could not run (`checkAwareUpdate` returns no bridges when
5581
+ * the directory cannot be walked safely) — so that case falls back to a phrase which claims
5582
+ * neither, rather than asserting "no bridges are installed" we cannot verify.
5583
+ *
5584
+ * These are the names the last CHECK saw. The job re-snapshots the directory when it starts
5585
+ * (aware-update-jobs.ts), so a bridge installed or removed between the two is refreshed without
5586
+ * being named here (or named without being refreshed). The offer describes intent before a job
5587
+ * exists, so it cannot be that snapshot; the results panel below reports what the job actually
5588
+ * did. Keeping the inventory in step with every poll (see refreshAwareUpdate) is what shrinks
5589
+ * that window to the gap between the last check and the click.
5590
+ *
5591
+ * Naming them only reads as a sentence while there are FEW. The host list is not fixed — it is
5592
+ * whatever AWARE supports at the time — so past a handful this reciting becomes the same wall of
5593
+ * names the fixed list was, just a personalised one, wrapping the modal and pushing its buttons
5594
+ * down. Beyond the limit it states the count instead; the results panel still lists every host
5595
+ * individually as it updates, so nothing becomes unknowable.
5596
+ */
5597
+ const awareBridgeClause = (inventory) => {
5598
+ const rows = inventory || [];
5599
+ if (!rows.length) return 'refreshes any bridges installed on this computer';
5600
+ const names = rows.map((row) => awareHostLabel(row.host)).filter(Boolean);
5601
+ // The count is over ROWS, never over names: a row this UI cannot name is still a bridge the job
5602
+ // refreshes, so counting names would quietly under-report it out of existence. One unnameable
5603
+ // row therefore drops the whole sentence to the count rather than listing the rest as if they
5604
+ // were all of them. "your N", not "all N" — N comes from the same check-time inventory as the
5605
+ // names, so it must not make the stronger, execution-time claim that N is everything the job
5606
+ // will touch.
5607
+ if (rows.length > AWARE_MAX_NAMED_BRIDGES || names.length !== rows.length) {
5608
+ return `refreshes your ${rows.length} installed bridge${rows.length === 1 ? '' : 's'}`;
5609
+ }
5610
+ return `refreshes your installed ${awareHostList(names)} bridge${names.length === 1 ? '' : 's'}`;
5611
+ };
5612
+ // A registry hiccup leaves `target` empty; "v" + nothing used to render "vthe current release".
5613
+ const awareVersionLabel = (target) => (target ? `v${target}` : 'the current release');
5536
5614
  const awareUpgradeCopyText = (target, operation, inventory) => {
5537
5615
  if (operation === 'bridge-repair') {
5538
5616
  const stale = (inventory || []).filter((row) => row.status === 'stale' || row.status === 'unverifiable');
5539
5617
  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.`;
5618
+ 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
5619
  }
5542
5620
  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.`;
5621
+ return `Updates AWARE to ${awareVersionLabel(target)} and ${awareBridgeClause(inventory)}. No new bridges are installed.`;
5544
5622
  }
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.`;
5623
+ return `Upgrades AWARE to ${awareVersionLabel(target)} and ${awareBridgeClause(inventory)}. No new bridges are installed. FloLess stays open; this may take a few minutes.`;
5546
5624
  };
5547
5625
 
5548
5626
  function closeAwareUpgradeModal() {
@@ -5570,7 +5648,11 @@
5570
5648
  return `<section class="aware-update-section"><div class="aware-update-section-head">${escapeHtml(title)}</div>`
5571
5649
  + `<div class="aware-update-hosts">${rows.map((row) => {
5572
5650
  const host = failed ? row.host : row;
5573
- return `<div class="aware-update-host"><div class="aware-update-host-name">${escapeHtml(awareHostLabel(host))}</div>`
5651
+ // A row here is a bridge the job really touched, so it must be visible even when the host
5652
+ // cannot be named. The sentence above can fall back to a count; a row cannot — an empty
5653
+ // name would render as a blank cell above a message with nothing to attach it to.
5654
+ const name = awareHostLabel(host) || 'Unknown bridge';
5655
+ return `<div class="aware-update-host"><div class="aware-update-host-name">${escapeHtml(name)}</div>`
5574
5656
  + (failed
5575
5657
  ? `<div class="aware-update-host-message">${escapeHtml(row.message)}</div><div class="aware-update-host-code">${escapeHtml(row.code)}</div>`
5576
5658
  : '<div class="aware-update-host-message">Up to date</div>')
@@ -5677,7 +5759,7 @@
5677
5759
  }
5678
5760
  const check = awareUpdateCheck || {};
5679
5761
  awareUpgradeOperation = check.operation || ($awareUpdate && $awareUpdate.dataset.operation) || 'runtime-update';
5680
- awareUpgradeInventory = Array.isArray(check.bridges) ? check.bridges : [];
5762
+ awareUpgradeInventory = awareInventoryOf(check);
5681
5763
  awareUpgradeTarget = target;
5682
5764
  awareUpgradeReturnFocus = returnFocusTo || document.activeElement;
5683
5765
  // `runtime-failed` belongs here alongside `partial`. Without it, clicking the attention pill
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Mirror the app's light/dark theme into a standalone workspace page.
3
+ *
4
+ * THE BUG THIS FIXES (#602). The shell keeps the active theme as `data-theme` on its own
5
+ * <html> (web/app.js → setTheme). The DRAWINGS and MODEL steps render inside iframes, and an
6
+ * attribute does not cross an iframe boundary — so the Drawing Filter and the Steel editor kept
7
+ * their dark default while the app around them went light.
8
+ *
9
+ * WHAT IS WIRED UP TODAY: steel-filter.html (DRAWINGS) only. The Steel editor (MODEL) and the two
10
+ * vector surfaces have no light palette yet — theirs is a much larger port, because those pages
11
+ * paint chrome and drawing geometry from the same ~250 literals and each one has to be judged
12
+ * against which of the two it is. Loading this script there before that work would set an attribute
13
+ * no rule reads. Tracked separately; until it lands, a light-theme user gets a light DRAWINGS panel
14
+ * and a dark MODEL one.
15
+ *
16
+ * WHY localStorage AND NOT A PARENT→CHILD POKE. The shell already persists the choice under
17
+ * THEME_KEY, and these pages are same-origin with it, so the value is simply readable here. The
18
+ * `storage` event then does the rest: it fires in every OTHER same-origin document the moment the
19
+ * shell writes the key, which is exactly the set of frames that need to react. That buys three
20
+ * things a parent-side `frame.contentDocument.dataset.theme = …` would not:
21
+ * - it survives an iframe reload (workspaces.js re-`src`s these frames on project switch,
22
+ * restore and rename) without a `load` listener to re-apply anything;
23
+ * - it works when one of these pages is opened directly in its own tab, which the editor is;
24
+ * - it needs no change to the shell at all, so the theme cannot half-arrive because a new frame
25
+ * was added and nobody remembered to register it.
26
+ *
27
+ * LOAD IT AS A CLASSIC SCRIPT IN <head> (no `defer`, no `type=module`): both defer execution past
28
+ * parsing, and the attribute must be on <html> before first paint or a light user sees a dark flash.
29
+ */
30
+ (function () {
31
+ // Must match web/app.js's THEME_KEY. Pinned against drift by frame-theme.test.ts, which reads
32
+ // the literal out of both files — the shell writes this key and these pages only ever read it,
33
+ // so a rename on one side would fail silently rather than loudly.
34
+ var KEY = 'floless-demo-theme-v1';
35
+
36
+ /** The stored theme, or 'dark' — the app's own default (app.js initTheme) — for anything else.
37
+ * localStorage access itself can throw (a privacy mode that disables storage), hence the try. */
38
+ function read() {
39
+ try {
40
+ return window.localStorage.getItem(KEY) === 'light' ? 'light' : 'dark';
41
+ } catch (_) {
42
+ return 'dark';
43
+ }
44
+ }
45
+
46
+ function apply(theme) {
47
+ document.documentElement.dataset.theme = theme;
48
+ }
49
+
50
+ apply(read());
51
+
52
+ // `key === null` is a localStorage.clear() — the whole store went, so re-read rather than
53
+ // ignore it (the answer is then the 'dark' default, which is what the shell would show too).
54
+ window.addEventListener('storage', function (e) {
55
+ if (e.key === KEY || e.key === null) apply(read());
56
+ });
57
+
58
+ // Exposed for the E2E probe (and any page that wants to read the active theme in script).
59
+ window.FlolessFrameTheme = { KEY: KEY, read: read, apply: apply };
60
+ })();