@floless/app 0.169.0 → 0.170.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.
Files changed (59) hide show
  1. package/dist/floless-server.cjs +71580 -59849
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  3. package/dist/schemas/steel.model.v2.schema.json +2 -1
  4. package/dist/skills/floless-app-knowledge/SKILL.md +43 -13
  5. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  6. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  7. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  8. package/dist/skills/floless-app-steel-model/SKILL.md +8 -5
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  10. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  11. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  12. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  13. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  14. package/dist/web/agent-steps.js +89 -18
  15. package/dist/web/agents.js +32 -22
  16. package/dist/web/app.css +223 -1
  17. package/dist/web/app.js +24 -3
  18. package/dist/web/aware.js +877 -189
  19. package/dist/web/chat.js +184 -95
  20. package/dist/web/checkpoint-standard.js +5 -3
  21. package/dist/web/commands-drawing-check.js +1 -0
  22. package/dist/web/commands-shell.js +440 -11
  23. package/dist/web/commands-steel.js +60 -1
  24. package/dist/web/drawing-check-editor.js +352 -88
  25. package/dist/web/failure-copy.js +32 -2
  26. package/dist/web/filter-ai-proposal.js +11 -8
  27. package/dist/web/flo-3d.js +1 -1
  28. package/dist/web/guide.js +33 -26
  29. package/dist/web/index.html +69 -1
  30. package/dist/web/instructor.js +99 -15
  31. package/dist/web/left-pane.js +4 -1
  32. package/dist/web/local-discovery.js +8 -7
  33. package/dist/web/missed-routines.js +239 -0
  34. package/dist/web/model-measure.js +6 -0
  35. package/dist/web/model-spatial-panel.js +19 -4
  36. package/dist/web/model-spatial-tools.js +3 -3
  37. package/dist/web/model-viewport-revit-adapter.js +3 -3
  38. package/dist/web/origin-rule.js +155 -0
  39. package/dist/web/project-access.js +1 -1
  40. package/dist/web/project-modules.js +2 -2
  41. package/dist/web/project-rfis.js +6 -1
  42. package/dist/web/project-workflows.js +2 -2
  43. package/dist/web/revit-editor.js +22 -8
  44. package/dist/web/run-history.js +12 -1
  45. package/dist/web/steel-3d-core.js +39 -9
  46. package/dist/web/steel-3d-flo.js +26 -4
  47. package/dist/web/steel-3d-view.js +8 -3
  48. package/dist/web/steel-ai-marks.js +3 -1
  49. package/dist/web/steel-editor.html +455 -122
  50. package/dist/web/steel-environments.js +297 -0
  51. package/dist/web/steel-filter.html +3 -2
  52. package/dist/web/steel-model-v2-client-validation.js +8 -1
  53. package/dist/web/steel-model-v2-commands.js +23 -9
  54. package/dist/web/steel-model-v2-projection.js +1 -1
  55. package/dist/web/step-rename.js +3 -2
  56. package/dist/web/terminal-requests.js +1 -1
  57. package/dist/web/tool-updates.js +7 -6
  58. package/dist/web/workspaces.js +1714 -119
  59. package/package.json +4 -1
@@ -212,6 +212,17 @@ function fail(failure = null) {
212
212
  if (failure) { $('editorRoot').dataset.modelState = 'empty'; renderRevitNoModelState(state, failure); return; }
213
213
  state.replaceChildren(); const strong = document.createElement('strong'); strong.textContent = 'Model unavailable'; const copy = document.createElement('span'); copy.textContent = modelUnavailableCopy(); state.append(strong, copy);
214
214
  }
215
+ /**
216
+ * #3097 3b: what a model route wrote for the person. These routes answer in two shapes: the Revit and editor-state
217
+ * routes send `{ error: <code>, message: <developer text>, userMessage? }` ("editorState.clips must be an object",
218
+ * "Revit import requires an active desktop session"), and the Tekla route sends `{ code, error: <sentence>, userMessage? }`.
219
+ * So `message` is never said, and an `error` is said only when it is a sentence (personText), never a bare code.
220
+ */
221
+ function modelReplyText(value) {
222
+ if (typeof value?.userMessage === 'string' && value.userMessage.trim()) return value.userMessage.trim();
223
+ const said =typeof globalThis.personText === 'function' ? globalThis.personText(value) : '';
224
+ return /\s/.test(said) ? said : '';
225
+ }
215
226
  // Any answer that is not ok rides on the error (`status`, `body`), so a failure can say what the server wrote for a person.
216
227
  // #3097: the message is the server's own sentence when it wrote one, else the shared one (failure-copy.js); never "(<status>)".
217
228
  function sharedFailureText(response, value, ctx, thrown) {
@@ -220,7 +231,7 @@ function sharedFailureText(response, value, ctx, thrown) {
220
231
  if (typeof copy === 'function') return copy(thrown && !thrown.status ? thrown : { status: response.status, body: value }, ctx).text;
221
232
  return `Couldn’t ${ctx?.action || 'finish that'}. Reload this window, then try again.`;
222
233
  }
223
- async function json(url, options) { const response = await fetch(url, { credentials: 'same-origin', ...options }); const value = await response.json().catch(() => ({})); if (!response.ok || value.ok === false) throw Object.assign(new Error(value.message || (typeof globalThis.personText === 'function' ? globalThis.personText(value) : '') || sharedFailureText(response, value, { retrySafe: /^(GET|HEAD)$/.test(String(options?.method || 'GET').toUpperCase()) })), { status: response.status, body: value }); return value; }
234
+ async function json(url, options) { const response = await fetch(url, { credentials: 'same-origin', ...options }); const value = await response.json().catch(() => ({})); if (!response.ok || value.ok === false) throw Object.assign(new Error(modelReplyText(value) || sharedFailureText(response, value, { retrySafe: /^(GET|HEAD)$/.test(String(options?.method || 'GET').toUpperCase()) })), { status: response.status, body: value }); return value; }
224
235
 
225
236
  function propertySection(heading, rows) {
226
237
  return { id: heading.toLowerCase().replace(/\W+/g, '-'), heading, editable: false, render(host) {
@@ -1099,7 +1110,7 @@ function renderTeklaAudit() {
1099
1110
  const name = document.createElement('span'); name.textContent = entity?.name || entity?.typeName || finding.entityId;
1100
1111
  const location = document.createElement('span'); location.className = finding.hasGeometry ? 'tekla-audit-location' : 'tekla-audit-location missing'; location.textContent = finding.hasGeometry ? 'Shown in 3D' : 'No 3D location';
1101
1112
  button.dataset.commandId = 'tekla-parser.audit-finding'; button.dataset.commandInstanceLabel = `${copy?.title ?? 'Import finding'}: ${name.textContent}`;
1102
- button.append(heading, name, location); button.addEventListener('click', () => { try { selectAuditFinding(finding); window.__instructor?.notifyChanged(); } catch (error) { toast(error.message); } }); list.append(button);
1113
+ button.append(heading, name, location); button.addEventListener('click', () => { try { selectAuditFinding(finding); window.__instructor?.notifyChanged(); } catch (error) { toast(errorText(error, { action: 'show that import finding', retrySafe: true })); } }); list.append(button);
1103
1114
  }
1104
1115
  };
1105
1116
  for (const [key, label] of filterSpecs) {
@@ -1361,8 +1372,11 @@ function payloadOnly(state) {
1361
1372
  return payload;
1362
1373
  }
1363
1374
 
1364
- // #3097: the editor-state route answers `{ error: <code>, message }`. The message is shown as written; a code that came
1365
- // without one is said in words, and anything else gets the shared sentence. A bare code or a status is never shown.
1375
+ // #3097: the editor-state route answers `{ error: <code>, message }`. 3b: its `message` is a developer's text for most
1376
+ // codes ("editorState.clips must be an object"), so it is said as written only for the codes whose message the route
1377
+ // writes for the person (EDITOR_STATE_PERSON_MESSAGE, reviewed against server/model-editor-state.ts). Any other code
1378
+ // is said in words, and anything else gets the shared sentence. A bare code, a status or a developer message is never shown.
1379
+ const EDITOR_STATE_PERSON_MESSAGE = new Set(['state-access-unconfirmed']);
1366
1380
  const EDITOR_STATE_CODE_WORDS = {
1367
1381
  'state-access-unconfirmed': 'FloLess couldn’t confirm your access to this model.',
1368
1382
  model_module_unavailable: 'This model is open for viewing only here, so its view settings aren’t saved.',
@@ -1371,8 +1385,8 @@ const EDITOR_STATE_CODE_WORDS = {
1371
1385
  'state-pin-unavailable': 'This version of the model is no longer available.',
1372
1386
  };
1373
1387
  function editorStateFailureText(response, value, action, retrySafe) {
1374
- if (typeof value?.message === 'string' && value.message.trim()) return value.message;
1375
- console.warn('[model] editor state request failed', action, response?.status, value?.error);
1388
+ if (EDITOR_STATE_PERSON_MESSAGE.has(value?.error) && typeof value?.message === 'string' && value.message.trim()) return value.message.trim();
1389
+ console.warn('[model] editor state request failed', action, response?.status, value?.error, value?.message);
1376
1390
  const words = EDITOR_STATE_CODE_WORDS[value?.error];
1377
1391
  if (words) return `Couldn’t ${action}. ${words}`;
1378
1392
  return sharedFailureText(response, value, retrySafe ? { action, retrySafe: true } : { action, unsure: 'Change the view again to save it once more.' });
@@ -1505,7 +1519,7 @@ function commitSpatialForRevision(candidate) {
1505
1519
  spatialTools.subscribe((value) => { $('modelFrameStatus').textContent = spatialTools.activeFrame().label; window.__revitInstructorState = { ...(window.__revitInstructorState || {}), activeFrame: value.activeFrameId }; reflectToolbarState(); });
1506
1520
  spatialPanel = mountModelSpatialPanel({ tools: spatialTools, trigger: $('modelFrameStatus'), onBeforeOpen: () => { closeSpatialDialog(); toolbarChrome?.closeMenus(); selectionFilterChrome?.close(); lightingPanel?.close({ restoreFocus: false }); },
1507
1521
  lengthDisplay: { format: (mm) => formatLength(mm, displayUnitControl.units()), parse: (text) => parseLengthMm(text, displayUnitControl.units()), unitLabel: () => displayUnitControl.units() },
1508
- onError: (error) => toast(error.message || 'That spatial action is unavailable.') });
1522
+ onError: (error) => toast(errorText(error, { action: 'use that spatial tool', retrySafe: true })) });
1509
1523
  if (candidate.recovered) { editorStateDirtyPayload = editorStatePayload(); editorStateDirtyGeneration = 1; retainEditorStateRecovery(); editorStateSaveTimer = setTimeout(() => drainEditorStateSaves().catch((error) => reportEditorStateSaveError(error, 'restore this model view')), 0); }
1510
1524
  }
1511
1525
 
@@ -1660,7 +1674,7 @@ function wireToolbar() {
1660
1674
  reflectToolbarState();
1661
1675
  modelPanelBridge?.publishSnapshot();
1662
1676
  window.__instructor?.notifyChanged();
1663
- } catch (error) { toast(error.message || 'That view action is unavailable.'); }
1677
+ } catch (error) { toast(errorText(error, { action: 'change the view', retrySafe: true })); }
1664
1678
  });
1665
1679
  updateSelectionActions();
1666
1680
  reflectToolbarState();
@@ -48,6 +48,16 @@
48
48
  return `${Math.floor(s / 3600)} h ${Math.floor((s % 3600) / 60)} min`;
49
49
  }
50
50
 
51
+ // #3253: a run that went ahead although its FloLess steps were set to reach another FloLess on this computer (Run anyway),
52
+ // or where FloLess could not check. "Set to reach", never "reached": FloLess knows what the approved workflow names.
53
+ function elsewherePill(e) {
54
+ const port = Number.isInteger(e.port) ? ` (port ${e.port})` : '';
55
+ const tip = e.kind === 'foreign'
56
+ ? `Run anyway: its FloLess steps were set to reach another FloLess on this computer${port}, so its project steps may have read that FloLess’s projects and its AI steps may not have started.`
57
+ : 'FloLess couldn’t check which FloLess this workflow’s steps reach, so it ran as normal.';
58
+ return `<span class="rh-pill" tabindex="0" data-tip="${esc(tip)}">${e.kind === 'foreign' ? 'Another FloLess' : 'Not checked'}</span>`;
59
+ }
60
+
51
61
  function rowHtml(w, r) {
52
62
  const key = r.runId || `${r.routine?.id || 'routine'}@${r.startedAt}`;
53
63
  const label = `${w.name}, ${when(r.startedAt)}`;
@@ -58,6 +68,7 @@
58
68
  r.routine ? `<span class="rh-pill" data-tip="${esc(`Started by the routine “${r.routine.name}”.`)}">Routine: ${esc(r.routine.name)}</span>` : '',
59
69
  r.aiStep ? `<span class="pg-ai-badge rh-ai" tabindex="0" data-tip="${esc(AI_TIP)}">AI step</span>` : '',
60
70
  r.simulated && r.outcome !== 'simulated' ? `<span class="rh-pill" data-tip="${esc(SIM_TIP)}">Simulated</span>` : '',
71
+ r.elsewhere ? elsewherePill(r.elsewhere) : '',
61
72
  ].join('');
62
73
  const report = r.report && r.runId && !w.damaged && !w.missing
63
74
  ? `<button type="button" class="btn-mini rh-btn" data-rh-report="${esc(r.runId)}" data-rh-app="${esc(w.id)}" data-command-id="shell.workflows-history-report#${esc(r.runId)}" data-command-instance-label="${esc(label)}" aria-label="${esc(`View report: ${label}`)}" data-tip="Opens the report this run made">View report</button>` : '';
@@ -183,7 +194,7 @@
183
194
  const report = event.target.closest('[data-rh-report]');
184
195
  if (report) {
185
196
  Promise.resolve(opts.openReport?.(report.dataset.rhApp, report.dataset.rhReport))
186
- .catch((err) => toast(err?.message || 'FloLess couldn’t open that run’s report. Open the workflow to see its latest results.', 'warn'));
197
+ .catch((err) => toast(errorText(err, { action: 'open that run’s report', retrySafe: true }), 'warn'));
187
198
  return;
188
199
  }
189
200
  const act = event.target.closest('[data-rh-act]');
@@ -34,6 +34,10 @@ export { clipSegmentToPlanes } from './model-viewport-state.js';
34
34
  // conversion in disguise — which is why it spells the constant rather than the number, and why this
35
35
  // file leaves the geometry guard's literal ratchet at zero.
36
36
  import { FT_TO_MM, IN_TO_MM, LB_PER_FT_TO_KG_PER_M } from './steel-units.js';
37
+ import {
38
+ COLUMN_BELOW_REACH_MM_IMPERIAL, COLUMN_BELOW_REACH_MM_METRIC as REGISTRY_BELOW_METRIC,
39
+ COLUMN_NEAR_CUT_MM_IMPERIAL, COLUMN_NEAR_CUT_MM_METRIC as REGISTRY_NEAR_CUT_METRIC, traitsFor,
40
+ } from './steel-environments.js';
37
41
  export { FT_TO_MM, IN_TO_MM, LB_PER_FT_TO_KG_PER_M };
38
42
 
39
43
  /** Atomic capability marker: storage, readers, authoring and shipped guidance advance together. */
@@ -186,7 +190,19 @@ export function reexpressMemberPlacement(member, refFrom, refTo, target, extents
186
190
  * EHS carries no entry either: an ellipse has no member of the SectionKind union, so it stays BOX here
187
191
  * and is refused as geometry upstream (`displaySectionForRow` → unsupported-custom), never drawn.
188
192
  *
189
- * @type {ReadonlyArray<readonly [string, SectionKind]>}
193
+ * THE EU FAMILIES (EU epic #3197, EU-2) are the entries carrying a third element, `'token'`: they match the
194
+ * designation's whole leading LETTER RUN, not a prefix. Their names are one to three letters, and a prefix
195
+ * would read `KKB…` or `KU…` (cold-formed channels the EU catalogue does not retain) as `KK`, `NOTCH…` as
196
+ * `N`, `HLB…` as `HL`. `KK200/100/5` has the run `KK`; `KKB100` has `KKB`, which no entry names. Each maps
197
+ * to an EXISTING kind only: the I and H families to 'I', the channels to 'C', `L` to 'L' (the prefix entry
198
+ * above already covers it), the hollow `KK` (cold-formed) and `KW` (hot-finished) to 'TUBE', and the
199
+ * circular `N` also to 'TUBE' — its roundness is the catalogue row's (`section.round`), exactly as a `CHS`
200
+ * or `HSS6.625X0.280` is, never the designation's. The tees `T` and `GT` ride to 'I' for the reason the
201
+ * UK tees do: a resolved tee draws from its displaySection, this is only the fallback.
202
+ * The families the Tekla default environment adds sizes under are whole tokens too: `HD` to 'I', `USP` to 'C', and
203
+ * `CFRHS`/`HFRHS`/`HFSHS`/`CFCHS`/`HFCHS` to 'TUBE' (as prefixes the first two would read as the channel `C`).
204
+ *
205
+ * @type {ReadonlyArray<readonly [string, SectionKind] | readonly [string, SectionKind, 'token']>}
190
206
  */
191
207
  export const SECTION_FAMILIES = [
192
208
  ['W', 'I'], ['M', 'I'], ['S', 'I'], ['HP', 'I'], // US I-family
@@ -198,6 +214,18 @@ export const SECTION_FAMILIES = [
198
214
  ['L', 'L'], ['UKA', 'L'], ['RSA', 'L'], // angles (UK equal/unequal + legacy RSA)
199
215
  ['HSS', 'TUBE'], ['PIPE', 'TUBE'], ['TS', 'TUBE'], ['TUBE', 'TUBE'], ['HSQ', 'TUBE'],
200
216
  ['SHS', 'TUBE'], ['RHS', 'TUBE'], ['CHS', 'TUBE'], // hollow sections
217
+ // EU (EN) families, whole letter-run only. IPE and L are reached by the prefix entries above (an equal-length
218
+ // token entry could never win, so none is listed); HEA/HEB/HEM/HEAA are longer than their `HE` prefix and are listed.
219
+ ['HEA', 'I', 'token'], ['HEB', 'I', 'token'], ['HEM', 'I', 'token'], ['HEAA', 'I', 'token'],
220
+ ['INP', 'I', 'token'], ['HL', 'I', 'token'],
221
+ ['UPE', 'C', 'token'], ['UNP', 'C', 'token'], ['UAP', 'C', 'token'],
222
+ ['KK', 'TUBE', 'token'], ['KW', 'TUBE', 'token'], ['N', 'TUBE', 'token'],
223
+ ['T', 'I', 'token'], ['GT', 'I', 'token'],
224
+ // EU sizes added from the Tekla default environment (#3197): its own family spellings. Whole token for the
225
+ // same reason — as prefixes `CFRHS`/`CFCHS` would read as the channel `C`, `USP` as the I `S`, `HD` as nothing.
226
+ ['HD', 'I', 'token'], ['USP', 'C', 'token'],
227
+ ['CFRHS', 'TUBE', 'token'], ['HFRHS', 'TUBE', 'token'], ['HFSHS', 'TUBE', 'token'],
228
+ ['CFCHS', 'TUBE', 'token'], ['HFCHS', 'TUBE', 'token'],
201
229
  ];
202
230
 
203
231
  /**
@@ -235,10 +263,12 @@ export function sectionKindOf(profile) {
235
263
  /** @type {SectionKind} */
236
264
  let kind = 'BOX';
237
265
  let best = 0;
266
+ // The designation's leading letter run, for the whole-token (EU) entries: `KK200/100/5` -> `KK`.
267
+ const run = /^[A-Z]+/.exec(p)?.[0] ?? '';
238
268
  // No cast on `familyKind`: the table is annotated, so a bad entry is a problem at the table (where
239
269
  // section-kind.test.ts checks for it) rather than something an assertion here quietly waves through.
240
- for (const [prefix, familyKind] of SECTION_FAMILIES) {
241
- if (prefix.length > best && p.startsWith(prefix)) {
270
+ for (const [prefix, familyKind, match] of SECTION_FAMILIES) {
271
+ if (prefix.length > best && (match === 'token' ? run === prefix : p.startsWith(prefix))) {
242
272
  best = prefix.length;
243
273
  kind = familyKind;
244
274
  }
@@ -1148,7 +1178,7 @@ export function sheetIncludesElevation(fromZ, toZ, elevMm, tol = MODEL_V2_TOL.CU
1148
1178
  * the read binds it). Smaller means a missed column that "Add to this view" fixes; larger means dashed
1149
1179
  * clutter that cannot be removed from the sheet.
1150
1180
  */
1151
- export const COLUMN_BELOW_REACH_MM = FT_TO_MM; // 12" = one foot, from the one definition of the foot (steel-units.js), not a second 304.8
1181
+ export const COLUMN_BELOW_REACH_MM = COLUMN_BELOW_REACH_MM_IMPERIAL; // 12" = one foot; the figure lives in the trait registry (steel-environments.js), which takes it from the one definition of the foot
1152
1182
 
1153
1183
  /**
1154
1184
  * The same convention for a project built to a metric standard: a round 300 mm, not the 304.8 a
@@ -1167,11 +1197,11 @@ export const COLUMN_BELOW_REACH_MM = FT_TO_MM; // 12" = one foot, from the one
1167
1197
  * immutable, is a property of the project rather than of the reader, and is exactly the question
1168
1198
  * "which standard is this built to".
1169
1199
  */
1170
- export const COLUMN_BELOW_REACH_MM_METRIC = 300;
1200
+ export const COLUMN_BELOW_REACH_MM_METRIC = REGISTRY_BELOW_METRIC; // 300 — declared once, in the trait registry
1171
1201
 
1172
1202
  /** The default reach for a project built to `environment` — metric standards get the round number. */
1173
1203
  export function defaultColumnBelowReach(environment) {
1174
- return environment === 'UK' ? COLUMN_BELOW_REACH_MM_METRIC : COLUMN_BELOW_REACH_MM;
1204
+ return traitsFor(environment).columnBelowReachMm;
1175
1205
  }
1176
1206
 
1177
1207
  /**
@@ -1251,10 +1281,10 @@ export function columnCutRelation(fromZ, toZ, cutMm, reach = COLUMN_BELOW_REACH_
1251
1281
  * show them anyway. Keyed on the project's environment for the reason `defaultColumnBelowReach` is. Not in
1252
1282
  * the frozen `MODEL_V2_TOL`, which is merge/refusal semantics.
1253
1283
  */
1254
- export const COLUMN_NEAR_CUT_MM_METRIC = 50;
1255
- export const COLUMN_NEAR_CUT_MM = 2 * IN_TO_MM;
1284
+ export const COLUMN_NEAR_CUT_MM_METRIC = REGISTRY_NEAR_CUT_METRIC; // 50 — declared once, in the trait registry
1285
+ export const COLUMN_NEAR_CUT_MM = COLUMN_NEAR_CUT_MM_IMPERIAL;
1256
1286
  export function defaultColumnNearCut(environment) {
1257
- return environment === 'UK' ? COLUMN_NEAR_CUT_MM_METRIC : COLUMN_NEAR_CUT_MM;
1287
+ return traitsFor(environment).columnNearCutMm;
1258
1288
  }
1259
1289
 
1260
1290
  /**
@@ -26,6 +26,7 @@ const REMEMBER_TTL_MS = 120_000;
26
26
  const SETTLE_MS = 250; // a click-through of members moves Flo once, when it stops
27
27
  const ALONG = 0.3; // a beam's perch: this far along it, clear of the label and the ends
28
28
  const LEAVE_S = 0.2; // Minimize: Flo shrinks away this fast (instant under reduced motion)
29
+ const HALF_WIDTH_R = 1.5; // Flo's reach either side of its middle, in r: the hat's brim (1.25 r) widened by a hop's squash
29
30
 
30
31
  export function createSteelFlo({ THREE, scene, meshById, getCamera, getSceneBox, pxToWorldAt, floPose, reducedMotion, enabled: startEnabled = false, onPerch = () => {} }) {
31
32
  const now = () => performance.now() / 1000;
@@ -249,12 +250,33 @@ export function createSteelFlo({ THREE, scene, meshById, getCamera, getSceneBox,
249
250
  return flo.hit(ray);
250
251
  }
251
252
 
252
- // Where the top of Flo's hat is on screen, in the canvas's own pixels (null when Flo is not drawn).
253
+ // Where the top of Flo's hat is on screen, in the canvas's own pixels, and how far Flo reaches either side of that
254
+ // point there (`half`), so a card beside Flo stands clear of it rather than over its brim (null when Flo is not drawn).
253
255
  function hatScreen(camera, width, height) {
254
256
  if (!enabled || !placed || !flo.object.visible) return null;
255
- const p = flo.object.position.clone().add(new THREE.Vector3(0, 0, flo.r * 3.1)).project(camera);
257
+ const top = flo.object.position.clone().add(new THREE.Vector3(0, 0, flo.r * 3.1));
258
+ const p = top.clone().project(camera);
256
259
  if (p.z > 1) return null;
257
- return { x: (p.x + 1) / 2 * width, y: (1 - p.y) / 2 * height };
260
+ const edge = top.add(new THREE.Vector3().setFromMatrixColumn(camera.matrixWorld, 0).multiplyScalar(flo.r * HALF_WIDTH_R)).project(camera);
261
+ return { x: (p.x + 1) / 2 * width, y: (1 - p.y) / 2 * height, half: Math.abs(edge.x - p.x) / 2 * width };
262
+ }
263
+
264
+ // Where Flo's body is drawn on screen, in the canvas's own pixels: the box around every projected vertex, so the outline
265
+ // Flo actually has (null when Flo is not drawn). For the test probe, which measures the card against it; too slow for a frame.
266
+ function screenBox(camera, width, height) {
267
+ if (!enabled || !placed || !flo.object.visible) return null;
268
+ flo.object.updateMatrixWorld(true);
269
+ const v = new THREE.Vector3(), box = { left: Infinity, right: -Infinity, top: Infinity, bottom: -Infinity };
270
+ flo.body.traverse((o) => {
271
+ const pos = o.isMesh && o.visible && o.geometry.attributes.position;
272
+ if (!pos) return;
273
+ for (let i = 0; i < pos.count; i++) {
274
+ v.fromBufferAttribute(pos, i).applyMatrix4(o.matrixWorld).project(camera);
275
+ const x = (v.x + 1) / 2 * width, y = (1 - v.y) / 2 * height;
276
+ box.left = Math.min(box.left, x); box.right = Math.max(box.right, x); box.top = Math.min(box.top, y); box.bottom = Math.max(box.bottom, y);
277
+ }
278
+ });
279
+ return box.left <= box.right ? box : null;
258
280
  }
259
281
 
260
282
  // A press on Flo: true when it was Flo (the caller then leaves the selection alone). Any press in the view stops
@@ -300,7 +322,7 @@ export function createSteelFlo({ THREE, scene, meshById, getCamera, getSceneBox,
300
322
  }
301
323
 
302
324
  return {
303
- tick, modelChanged, selectionChanged, pointerDown, hover, hatScreen, remember, setEnabled, setShellMood, probe,
325
+ tick, modelChanged, selectionChanged, pointerDown, hover, hatScreen, screenBox, remember, setEnabled, setShellMood, probe,
304
326
  setScale(k) { sizeK = Number.isFinite(k) && k > 0 ? k : 1; },
305
327
  setReducedMotion: (on) => { reduced = !!on; flo.setReducedMotion(on); },
306
328
  get enabled() { return enabled; },
@@ -5030,6 +5030,10 @@ function onKey(e) {
5030
5030
  // Don't touch the dim tool while a member gesture (drag / box-select) owns the shared marker/readout —
5031
5031
  // toggling would clear them mid-gesture. The gesture finishes on pointerup; the key is a no-op until then.
5032
5032
  const midGesture = pending || dragging || boxSel;
5033
+ // #3145: D and the X/Y/Z/F locks are toggles, so a held key's auto-repeat would flip them on and off and leave
5034
+ // the tool or lock in whatever state the last repeat landed on. Only the first press counts; repeats are consumed.
5035
+ if (e.repeat && !e.ctrlKey && !e.metaKey && !e.altKey && !midGesture
5036
+ && (k === 'd' || (dimMode3d && (k === 'f' || k === 'x' || k === 'y' || k === 'z')))) { e.preventDefault(); return; }
5033
5037
  if (k === 'd' && !e.ctrlKey && !e.metaKey && !e.altKey && !midGesture) { e.preventDefault(); toggleMeasureTool(); return; } // D routes through the shared CAD lifecycle
5034
5038
  if (dimMode3d && !midGesture) {
5035
5039
  if (k === 'escape') { e.preventDefault(); if (snapOnly3d) setSnapOnly3d(null); else if (measureSession) { measureSession.cancelStep(); dimPreviewLine.visible = false; readout.style.display = 'none'; clearSharedSnapGuides(); } else if (dimDraft3d) { dimDraft3d = null; dimPreviewLine.visible = false; readout.style.display = 'none'; } else disarmMeasureTool(); return; } // Esc steps back through the common restriction → point 2 → point 1 → tool lifecycle
@@ -5413,10 +5417,11 @@ function placeFloCard() {
5413
5417
  if (!floCardWH) measureFloCard();
5414
5418
  const { w, h } = floCardWH;
5415
5419
  const hx = rect.left + at.x, hy = rect.top + at.y;
5420
+ const clear = (at.half || 0) + FLO_CARD_GAP; // from Flo's middle to past its brim, at whatever size Flo is drawn
5416
5421
  const cube = { left: rect.right - 110, bottom: rect.top + 110 }; // the view cube
5417
- let left = hx + FLO_CARD_GAP, side = 'right';
5422
+ let left = hx + clear, side = 'right';
5418
5423
  const top = Math.min(rect.bottom - FLO_CARD_EDGE - h, Math.max(rect.top + FLO_CARD_EDGE, hy - h * 0.35));
5419
- if (left + w > rect.right - FLO_CARD_EDGE || (left + w > cube.left && top < cube.bottom)) { left = hx - FLO_CARD_GAP - w; side = 'left'; }
5424
+ if (left + w > rect.right - FLO_CARD_EDGE || (left + w > cube.left && top < cube.bottom)) { left = hx - clear - w; side = 'left'; }
5420
5425
  left = Math.max(rect.left + FLO_CARD_EDGE, left);
5421
5426
  floCard.style.left = Math.round(left) + 'px';
5422
5427
  floCard.style.top = Math.round(top) + 'px';
@@ -9650,7 +9655,7 @@ window.Steel3DView = {
9650
9655
  // The person changed what Flo's card shows (3D Labels → Flo): read the card again.
9651
9656
  refreshFloCard: () => { if (floPerchId) showFloCard(floPerchId); },
9652
9657
  // Labels → Flo size (a factor, 1 = as designed): Flo and its card together; the card is re-placed on the next frame.
9653
- setFloSize: (k) => applyFloSize(Number.isFinite(k) && k > 0 ? k : 1), floRemember: () => floView?.remember(), floProbe: () => { if (!floView) return null; const r = canvasEl.getBoundingClientRect(), h = floView.hatScreen(camera, r.width, r.height); return { ...floView.probe(), hat: h && { x: r.left + h.x, y: r.top + h.y }, chip: !!floMinChip?.classList.contains('show'), card: floCardId && floCard?.classList.contains('show') && floCard.style.visibility !== 'hidden' ? { id: floCardId, rect: floCard.getBoundingClientRect().toJSON(), side: floCard.dataset.side, text: floCard.innerText } : null }; },
9658
+ setFloSize: (k) => applyFloSize(Number.isFinite(k) && k > 0 ? k : 1), floRemember: () => floView?.remember(), floProbe: () => { if (!floView) return null; const r = canvasEl.getBoundingClientRect(), h = floView.hatScreen(camera, r.width, r.height), b = floView.screenBox(camera, r.width, r.height); return { ...floView.probe(), hat: h && { x: r.left + h.x, y: r.top + h.y, half: h.half }, box: b && { left: r.left + b.left, right: r.left + b.right, top: r.top + b.top, bottom: r.top + b.bottom }, chip: !!floMinChip?.classList.contains('show'), card: floCardId && floCard?.classList.contains('show') && floCard.style.visibility !== 'hidden' ? { id: floCardId, rect: floCard.getBoundingClientRect().toJSON(), side: floCard.dataset.side, text: floCard.innerText } : null }; },
9654
9659
  // Reference models (#278) — an editor-only layer. `setReferences` takes the geometry the editor
9655
9660
  // fetched from the reference route; nothing here ever passes through contractToScene, which is what
9656
9661
  // keeps borrowed geometry out of every export by construction rather than by filtering.
@@ -29,6 +29,7 @@
29
29
  * Pure, and read from the LIVE model the editor holds, so a mark sits on the member on screen.
30
30
  */
31
31
  import { planViewId } from './steel-plan-view-id.js';
32
+ import { bottomLeftOrigin, originRuleNote } from './origin-rule.js';
32
33
  import { createMemberPresenceIndex, memberPresence } from './steel-model-v2-projection.js';
33
34
  import { FT_IN, formatElevation, normalizeDisplayUnits, parseElevationMm } from './display-units.js';
34
35
 
@@ -227,7 +228,8 @@ export function aiDecisionMarksOf(model) {
227
228
  break;
228
229
  }
229
230
  case 'setup': {
230
- if (subject.row === 'origin') { note.push({ decisionId: id, channel: 'setup-origin', reason: 'model' }); break; }
231
+ // #2909: the note says how the AI's origin stands against FloLess's bottom-left default (never a block).
232
+ if (subject.row === 'origin') { note.push({ decisionId: id, channel: 'setup-origin', reason: 'model', rule: originRuleNote(bottomLeftOrigin(model), entry.value) }); break; }
231
233
  const plan = plansByView.get(subject.viewId);
232
234
  if (!plan) { note.push({ decisionId: id, channel: 'setup', reason: 'gone' }); break; }
233
235
  if (!views.has(subject.viewId)) views.set(subject.viewId, []);