@floless/app 0.148.0 → 0.149.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 (44) hide show
  1. package/bin/floless.mjs +1 -1
  2. package/dist/floless-server.cjs +29419 -19062
  3. package/dist/schemas/drawing-check.profile.v1.schema.json +156 -0
  4. package/dist/schemas/steel.model.v2.schema.json +43 -1
  5. package/dist/schemas/tekla.model.v2.schema.json +6 -2
  6. package/dist/skills/floless-app-steel-model/SKILL.md +54 -11
  7. package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +9 -5
  8. package/dist/skills/floless-app-steel-takeoff/SKILL.md +128 -15
  9. package/dist/skills/floless-app-vectorize/SKILL.md +7 -4
  10. package/dist/templates/check-drawings.flo +46 -0
  11. package/dist/templates/drawing-check.flo +55 -0
  12. package/dist/templates/tekla-parser.flo +6 -2
  13. package/dist/web/app.css +143 -8
  14. package/dist/web/aware.js +512 -42
  15. package/dist/web/chat.css +171 -9
  16. package/dist/web/chat.js +2005 -759
  17. package/dist/web/commands-drawing-check.js +53 -0
  18. package/dist/web/commands-shell.js +275 -3
  19. package/dist/web/commands-steel.js +1 -0
  20. package/dist/web/commands-tekla-parser.js +3 -0
  21. package/dist/web/commands.js +1 -1
  22. package/dist/web/connections.js +382 -0
  23. package/dist/web/display-units.js +15 -1
  24. package/dist/web/drawing-check-editor.html +289 -0
  25. package/dist/web/drawing-check-editor.js +1242 -0
  26. package/dist/web/drawing-check-overlay.js +36 -0
  27. package/dist/web/filter-ai-proposal.js +32 -13
  28. package/dist/web/index.html +25 -3
  29. package/dist/web/instructor.js +2 -2
  30. package/dist/web/local-discovery.js +144 -2
  31. package/dist/web/model-display-units.js +23 -9
  32. package/dist/web/model-viewport-revit-adapter.js +12 -2
  33. package/dist/web/revit-editor.css +5 -0
  34. package/dist/web/revit-editor.js +141 -21
  35. package/dist/web/steel-editor.html +166 -27
  36. package/dist/web/steel-filter.html +60 -166
  37. package/dist/web/steel-model-v2-commands.js +13 -3
  38. package/dist/web/steel-model-v2-projection.js +20 -0
  39. package/dist/web/steel-units.js +3 -1
  40. package/dist/web/workspaces.js +323 -26
  41. package/distribution-resource-inventory.mjs +8 -1
  42. package/launch.mjs +5 -5
  43. package/package.json +3 -1
  44. package/dist/web/filter-ai-context.js +0 -92
@@ -46,7 +46,6 @@ function syncHostTheme() {
46
46
  syncHostTheme();
47
47
  window.addEventListener('storage', (event) => { if (event.key === hostThemeKey) syncHostTheme(); });
48
48
  const modelProduct = isTeklaParser ? 'Tekla Parser' : 'Revit Parser';
49
- const sourceProduct = isTeklaParser ? 'Tekla' : 'Revit';
50
49
  const commandPrefix = isTeklaParser ? 'tekla-parser' : 'revit';
51
50
  // AI Chat names this viewer's objects as this model's (#1653): the pill, the card and the chat model's links.
52
51
  const subjectSource = isTeklaParser ? 'tekla-parser' : 'revit';
@@ -269,15 +268,42 @@ const TEKLA_AUDIT_COPY = Object.freeze({
269
268
  'weld-recipes-unevaluated': Object.freeze({ group: 'shape-not-evaluated', title: 'Shape detail not evaluated', detail: 'Some weld-shape instructions were preserved as database facts but were not evaluated into display geometry.' }),
270
269
  'grid-mapping-unevaluated': Object.freeze({ group: 'shape-not-evaluated', title: 'Grid not shown in 3D', detail: 'This grid is present in the Tekla database, but its display extents could not be mapped safely.' }),
271
270
  'unsupported-native-type': Object.freeze({ group: 'shape-not-evaluated', title: 'Shape detail not evaluated', detail: 'This native Tekla object type is recorded but is not yet interpreted by the parser.' }),
271
+ // #1836: the model was read without a Tekla catalogue file the person chose to continue without.
272
+ 'profile-catalogue-missing': Object.freeze({ group: 'shape-not-evaluated', title: 'Shown as a stand-in bar', detail: 'This part’s profile shape isn’t known because profdb.bin was missing, so it is drawn as a thin stand-in bar where it can be placed. Read the model again with that file for the real shape.' }),
273
+ 'bolt-catalogue-missing': Object.freeze({ group: 'not-shown', title: 'Bolt not drawn', detail: 'This bolt needs a catalogue file that was missing (screwdb.db or assdb.db), so it is not drawn. Read the model again with the file to see it.' }),
272
274
  });
273
275
 
276
+ // #1836: what a missing catalogue file affects, for the Audit tab's Missing source files group.
277
+ const TEKLA_MISSING_SOURCE_COPY = Object.freeze({
278
+ 'profdb.bin': Object.freeze({ affects: 'Beam and column shapes', objects: (count) => count
279
+ ? `${count.toLocaleString()} ${count === 1 ? 'part is' : 'parts are'} shown as stand-in bars or not shown.`
280
+ : 'Every part’s shape could be worked out from its profile name.' }),
281
+ 'matdb.bin': Object.freeze({ affects: 'Material grades', objects: () => 'Material grades are read from the model itself, so nothing is drawn differently.' }),
282
+ 'screwdb.db': Object.freeze({ affects: 'Bolt sizes', objects: (count, missing) => boltsNotDrawn(count, missing.has('assdb.db') ? 'assdb.db' : null) }),
283
+ 'assdb.db': Object.freeze({ affects: 'Bolt nuts and washers', objects: (count, missing) => boltsNotDrawn(count, missing.has('screwdb.db') ? 'screwdb.db' : null) }),
284
+ });
285
+ // A bolt that needs both bolt files is counted once, under screwdb.db. A row with no bolt of its
286
+ // own says where its bolts are counted, never "0 bolts are not drawn".
287
+ function boltsNotDrawn(count, otherMissing) {
288
+ if (count) return `${count.toLocaleString()} ${count === 1 ? 'bolt is' : 'bolts are'} not drawn.`;
289
+ return otherMissing ? `The bolts it affects are counted under ${otherMissing}.` : 'No bolt in this model needed it.';
290
+ }
291
+ const TEKLA_CATALOGUE_ROLES = Object.freeze({ 'profdb.bin': 'profdb', 'matdb.bin': 'matdb', 'screwdb.db': 'screwdb', 'assdb.db': 'assdb' });
292
+ const TEKLA_CATALOGUE_ORIGINS = Object.freeze(['model-local', 'user-supplied-package', 'user-added', 'registry-proven', 'user-selected-setup', 'installed-environment']);
293
+
294
+ // #1836: a part profdb.bin's absence left with no axis is not drawn at all, so it is never called a stand-in bar.
295
+ const TEKLA_UNPLACED_PROFILE_COPY = Object.freeze({ group: 'not-shown', title: 'Part not drawn', detail: 'This part’s profile shape isn’t known because profdb.bin was missing, and it has no usable start and end point, so it is not drawn. Read the model again with that file to see it.' });
296
+ function auditCopyFor(finding) {
297
+ return finding.code === 'profile-catalogue-missing' && finding.hasGeometry === false ? TEKLA_UNPLACED_PROFILE_COPY : TEKLA_AUDIT_COPY[finding.code];
298
+ }
299
+
274
300
  function auditFindingsFor(entityId) { return teklaAudit?.findings?.filter((finding) => finding.entityId === entityId) ?? []; }
275
301
 
276
302
  function auditInspectorSection(findings) {
277
303
  return { id: 'import-audit', heading: 'Import audit', editable: false, render(host) {
278
304
  if (!findings.length) { const ok = document.createElement('div'); ok.className = 'tekla-audit-inspector-ok'; ok.textContent = 'No open import findings for this object.'; host.append(ok); return; }
279
305
  for (const finding of findings) {
280
- const copy = TEKLA_AUDIT_COPY[finding.code];
306
+ const copy = auditCopyFor(finding);
281
307
  const item = document.createElement('article'); item.className = 'tekla-audit-inspector-item';
282
308
  const heading = document.createElement('strong'); heading.textContent = copy?.title ?? 'Import finding';
283
309
  const detail = document.createElement('p'); detail.textContent = copy?.detail ?? 'The import audit recorded an unsupported finding code.';
@@ -486,7 +512,11 @@ function renderTeklaTypes(host, values, ownProperties, memberships = teklaAssemb
486
512
  }
487
513
  }, { expanded: !!normalized, populated: !!normalized || grouped.some((entity) => entity.id === followedId) });
488
514
  }
489
- if (!browsable.length) { const empty = document.createElement('div'); empty.className = 'explorer-empty'; empty.textContent = normalized ? 'No objects match this search.' : 'No verified model objects are available.'; host.append(empty); }
515
+ if (!browsable.length) { const empty = document.createElement('div'); empty.className = 'explorer-empty'; empty.textContent = normalized && allBrowsable.length ? 'No objects match this search.'
516
+ // #1849: objects were read, but none has a shape to browse; say so instead of "none available" or
517
+ // "no match" (the search only ever looks through drawn objects).
518
+ : values.length ? 'None of this model’s objects could be drawn, so there is nothing to browse here. The Audit tab lists the missing files and the objects they affect.'
519
+ : 'No verified model objects are available.'; host.append(empty); }
490
520
  return { shown: browsable.length, total: allBrowsable.length };
491
521
  }
492
522
 
@@ -524,22 +554,46 @@ function validateTeklaAuditDocument(value, manifest, auditReceipt, snapshotEntit
524
554
  && Object.keys(candidate).sort().join('\0') === [...expected].sort().join('\0');
525
555
  const snapshotEntityIds = new Set(snapshotEntities.map((entity) => entity.id));
526
556
  const omissions = value?.summary?.decoderOmissions;
557
+ // v2 (#1836) adds the catalogue files the read went without, and where FloLess took the others.
558
+ const v2 = value?.schemaVersion === 'floless.tekla-import-audit/v2';
559
+ const sources = v2 ? value.sources : [];
527
560
  if (!value || typeof value !== 'object' || Array.isArray(value)
528
- || !exactKeys(value, ['schemaVersion', 'summary', 'sourcePropertyDigests', 'findings'])
529
- || value.schemaVersion !== 'floless.tekla-import-audit/v1'
530
- || !exactKeys(value.summary, ['findings', 'affectedObjects', 'open', 'legacyCounts', 'unsupportedNativeTypes', ...(omissions === undefined ? [] : ['decoderOmissions'])])
561
+ || !exactKeys(value, ['schemaVersion', 'summary', 'sourcePropertyDigests', 'findings', ...(v2 ? ['sources', 'provenance', 'provenanceDigest'] : [])])
562
+ || (value.schemaVersion !== 'floless.tekla-import-audit/v1' && !v2)
563
+ || !exactKeys(value.summary, ['findings', 'affectedObjects', 'open', 'legacyCounts', 'unsupportedNativeTypes', ...(v2 ? ['openSources'] : []), ...(omissions === undefined ? [] : ['decoderOmissions'])])
531
564
  || !Array.isArray(value.sourcePropertyDigests) || value.sourcePropertyDigests.some((digest) => !/^[0-9a-f]{64}$/.test(digest))
532
565
  || !Array.isArray(value.summary.legacyCounts) || value.summary.legacyCounts.length !== 6
533
566
  || value.summary.legacyCounts.some((count) => !Number.isSafeInteger(count) || count < 0)
534
567
  || !Number.isSafeInteger(value.summary.unsupportedNativeTypes) || value.summary.unsupportedNativeTypes < 0
535
568
  || !Array.isArray(value.findings)
536
- || value.findings.length !== auditReceipt.items || value.findings.length !== manifest.audit?.findings
537
- || value.summary.findings !== value.findings.length || value.summary.open !== value.findings.length
569
+ || !Array.isArray(sources) || (v2 && value.summary.openSources !== sources.length)
570
+ || value.findings.length + sources.length !== auditReceipt.items || value.findings.length + sources.length !== manifest.audit?.findings
571
+ || value.summary.findings !== value.findings.length + sources.length || value.summary.open !== value.findings.length + sources.length
538
572
  || !Number.isSafeInteger(value.summary.affectedObjects) || value.summary.affectedObjects < 0
539
573
  || value.summary.affectedObjects !== manifest.audit?.affectedObjects || value.summary.open !== manifest.audit?.open) failAudit();
540
574
  if (omissions !== undefined && (!exactKeys(omissions, ['staleOrphanUdaAssignments', 'staleOrphanAssemblyDefinitions', 'description'])
541
575
  || ![omissions.staleOrphanUdaAssignments, omissions.staleOrphanAssemblyDefinitions].every((count) => Number.isSafeInteger(count) && count >= 0 && count <= 0xffffffff)
542
576
  || omissions.description !== 'Ignored stale database records not attached to model objects')) failAudit();
577
+ if (v2) {
578
+ const files = Object.keys(TEKLA_CATALOGUE_ROLES);
579
+ if (!Array.isArray(value.provenance) || value.provenance.length !== files.length
580
+ || typeof value.provenanceDigest !== 'string' || !/^[0-9a-f]{64}$/.test(value.provenanceDigest)) failAudit();
581
+ value.provenance.forEach((entry, index) => {
582
+ const file = files[index];
583
+ if (entry?.file !== file || entry.role !== TEKLA_CATALOGUE_ROLES[file]) failAudit();
584
+ if (exactKeys(entry, ['role', 'file', 'absent'])) { if (entry.absent !== true) failAudit(); return; }
585
+ if (!exactKeys(entry, ['role', 'file', 'origin', 'sha256', 'bytes']) || !TEKLA_CATALOGUE_ORIGINS.includes(entry.origin)
586
+ || !/^[0-9a-f]{64}$/.test(entry.sha256) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0) failAudit();
587
+ });
588
+ const absent = value.provenance.filter((entry) => entry.absent).map((entry) => entry.file);
589
+ if (sources.length !== absent.length) failAudit();
590
+ sources.forEach((source, index) => {
591
+ if (!exactKeys(source, ['role', 'file', 'state', 'affects', 'affectedObjects']) || source.file !== absent[index]
592
+ || source.role !== TEKLA_CATALOGUE_ROLES[source.file] || source.state !== 'absent'
593
+ || !Array.isArray(source.affects) || !source.affects.length || source.affects.some((domain) => typeof domain !== 'string')
594
+ || !Number.isSafeInteger(source.affectedObjects) || source.affectedObjects < 0) failAudit();
595
+ });
596
+ }
543
597
  const ids = new Set(); const affected = new Set();
544
598
  for (const finding of value.findings) {
545
599
  if (!exactKeys(finding, ['issueId', 'entityId', 'objectGuid', 'objectKind', 'check', 'code', 'group', 'hasGeometry', 'evidence'])
@@ -548,7 +602,7 @@ function validateTeklaAuditDocument(value, manifest, auditReceipt, snapshotEntit
548
602
  || typeof finding.objectGuid !== 'string' || !/^[0-9a-f-]{36}$/.test(finding.objectGuid)
549
603
  || typeof finding.objectKind !== 'string' || typeof finding.check !== 'string'
550
604
  || typeof finding.code !== 'string' || !Object.hasOwn(TEKLA_AUDIT_COPY, finding.code)
551
- || TEKLA_AUDIT_COPY[finding.code].group !== finding.group || typeof finding.hasGeometry !== 'boolean'
605
+ || typeof finding.hasGeometry !== 'boolean' || auditCopyFor(finding).group !== finding.group
552
606
  || !finding.evidence || typeof finding.evidence !== 'object' || Array.isArray(finding.evidence)
553
607
  || JSON.stringify(finding.evidence).length > 4096) failAudit();
554
608
  ids.add(finding.issueId); affected.add(finding.entityId);
@@ -571,7 +625,9 @@ function selectAuditFinding(finding) {
571
625
  }
572
626
 
573
627
  function renderTeklaAudit() {
574
- const host = $('teklaAuditHost'); if (!host || !isTeklaParser) return;
628
+ // Held, not looked up: once the Audit tab is shown in the main window's panel frame, $() cannot find
629
+ // it, and a lookup here silently stopped every repaint after the first (a selected row never lit up).
630
+ const host = teklaAuditHost; if (!host || !isTeklaParser) return;
575
631
  host.replaceChildren();
576
632
  if (!teklaAudit) { const empty = document.createElement('div'); empty.className = 'tekla-audit-state'; empty.textContent = 'Import audit is not loaded.'; host.append(empty); return; }
577
633
  if (teklaAudit.legacy) {
@@ -590,6 +646,32 @@ function renderTeklaAudit() {
590
646
  note.textContent = `${omissions.description}: ${omissions.staleOrphanUdaAssignments} UDA assignments and ${omissions.staleOrphanAssemblyDefinitions} assembly definitions. These records are not selectable model objects.`;
591
647
  summary.append(note);
592
648
  }
649
+ const missingSources = teklaAudit.sources ?? [];
650
+ let sourcesSection = null;
651
+ if (missingSources.length) {
652
+ // #1836: the files this read went without come first; every object they affect is listed below.
653
+ sourcesSection = document.createElement('section'); sourcesSection.className = 'tekla-audit-summary tekla-audit-sources';
654
+ sourcesSection.setAttribute('aria-label', 'Missing source files');
655
+ const state = document.createElement('div'); state.className = 'tekla-audit-state';
656
+ const heading = document.createElement('strong'); heading.textContent = 'Missing source files';
657
+ const intro = document.createElement('span'); intro.textContent = 'These files were not in the copied model. Read the model again with them to clear these findings and the ones they cause below.';
658
+ state.append(heading, intro); sourcesSection.append(state);
659
+ const missingFiles = new Set(missingSources.map((source) => source.file));
660
+ for (const source of missingSources) {
661
+ const copy = TEKLA_MISSING_SOURCE_COPY[source.file];
662
+ const item = document.createElement('article'); item.className = 'tekla-audit-inspector-item';
663
+ const name = document.createElement('strong'); name.textContent = source.file;
664
+ const effect = document.createElement('p'); effect.textContent = `Affects: ${copy?.affects ?? 'model detail'}. ${copy?.objects(source.affectedObjects, missingFiles) ?? ''}`.trim();
665
+ item.append(name, effect); sourcesSection.append(item);
666
+ }
667
+ }
668
+ // #1836: catalogue files the installed-environment fallback took from this computer, not from the model.
669
+ const borrowed = (teklaAudit.provenance ?? []).filter((entry) => entry.origin === 'installed-environment').map((entry) => entry.file);
670
+ if (borrowed.length) {
671
+ const note = document.createElement('p'); note.className = 'tekla-audit-omissions';
672
+ note.textContent = `${borrowed.join(', ')} ${borrowed.length === 1 ? 'was' : 'were'} not in the model, so FloLess used ${borrowed.length === 1 ? 'the copy' : 'the copies'} in the model’s Tekla environment on this computer.`;
673
+ summary.append(note);
674
+ }
593
675
  const filters = document.createElement('div'); filters.className = 'tekla-audit-filters'; filters.setAttribute('role', 'group'); filters.setAttribute('aria-label', 'Filter import findings');
594
676
  const filterSpecs = [
595
677
  ['all', 'All'], ['not-shown', 'Not shown'], ['fit-not-confirmed', 'Fit not confirmed'], ['shape-not-evaluated', 'Shape detail not evaluated'],
@@ -601,13 +683,13 @@ function renderTeklaAudit() {
601
683
  const visible = teklaAudit.findings.filter((finding) => active === 'all' || finding.group === active);
602
684
  if (!visible.length) { const empty = document.createElement('div'); empty.className = 'tekla-audit-empty'; empty.textContent = 'No findings in this group.'; list.append(empty); return; }
603
685
  for (const finding of visible) {
604
- const copy = TEKLA_AUDIT_COPY[finding.code]; const entity = entityById.get(finding.entityId);
686
+ const copy = auditCopyFor(finding); const entity = entityById.get(finding.entityId);
605
687
  const button = document.createElement('button'); button.type = 'button'; button.className = 'tekla-audit-row'; button.setAttribute('role', 'option');
606
688
  button.setAttribute('aria-selected', String(selectedId === finding.entityId)); button.dataset.issueId = finding.issueId;
607
- const heading = document.createElement('strong'); heading.textContent = copy.title;
689
+ const heading = document.createElement('strong'); heading.textContent = copy?.title ?? 'Import finding';
608
690
  const name = document.createElement('span'); name.textContent = entity?.name || entity?.typeName || finding.entityId;
609
691
  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';
610
- button.dataset.commandId = 'tekla-parser.audit-finding'; button.dataset.commandInstanceLabel = `${copy.title}: ${name.textContent}`;
692
+ button.dataset.commandId = 'tekla-parser.audit-finding'; button.dataset.commandInstanceLabel = `${copy?.title ?? 'Import finding'}: ${name.textContent}`;
611
693
  button.append(heading, name, location); button.addEventListener('click', () => { try { selectAuditFinding(finding); window.__instructor?.notifyChanged(); } catch (error) { toast(error.message); } }); list.append(button);
612
694
  }
613
695
  };
@@ -624,7 +706,7 @@ function renderTeklaAudit() {
624
706
  else if (event.key === 'Home') next = rows[0]; else if (event.key === 'End') next = rows.at(-1);
625
707
  if (next) { event.preventDefault(); next.focus(); }
626
708
  });
627
- paintRows(); host.append(summary, filters, list);
709
+ paintRows(); host.append(...(sourcesSection ? [sourcesSection] : []), summary, filters, list);
628
710
  }
629
711
 
630
712
  function updateSelectionActions() {
@@ -1032,11 +1114,36 @@ function wireToolbar() {
1032
1114
  return { destroy() { clipButton?.removeEventListener('click', cancelArmedClip, true); release?.(); lightingChrome.destroy(); chrome.destroy(); } };
1033
1115
  }
1034
1116
 
1117
+ /**
1118
+ * #1849: a degraded Tekla read can have nothing drawable. The model still opens: the explorer, the
1119
+ * Properties panel and the Audit list every object. The viewport says so instead of looking broken,
1120
+ * without a scrim, and lets clicks through to the grid and view tools underneath.
1121
+ */
1122
+ // The status overlay as shipped (spinner + "Opening verified model"), so a later load can put it back.
1123
+ let loadedNothingDrawn = null;
1124
+ const loadingStateTemplate = document.getElementById('loadingState')?.cloneNode(true) ?? null;
1125
+ function restoreLoadingState(host) {
1126
+ if (!loadingStateTemplate || !host.classList.contains('viewport-state-notice')) return;
1127
+ host.replaceChildren(...[...loadingStateTemplate.cloneNode(true).childNodes]);
1128
+ host.className = loadingStateTemplate.className; host.removeAttribute('role'); delete host.dataset.state;
1129
+ }
1130
+
1131
+ function renderTeklaNothingDrawnState(host, objectCount, gridDrawn) {
1132
+ const count = Number(objectCount) || 0;
1133
+ renderRevitNoModelState(host, {
1134
+ // A structural grid is drawn from its own record, so it can still show when no object can (#1849).
1135
+ kind: 'nothing-drawn', title: gridDrawn ? 'Only the grid could be drawn' : 'Nothing in this model could be drawn',
1136
+ body: `Tekla Parser read ${count.toLocaleString()} ${count === 1 ? 'object' : 'objects'}, but ${gridDrawn ? 'apart from the grid, none' : 'none'} of them could be drawn in 3D. This copy was read with some files missing, so it cannot be approved. Open the Audit tab in the left panel to see the missing files and the objects they affect.`,
1137
+ });
1138
+ host.classList.add('viewport-state-notice');
1139
+ }
1140
+
1035
1141
  async function loadRevision(state, authority, spatialCandidate) {
1036
1142
  revisionLoadController?.abort();
1037
1143
  const controller = new AbortController(); revisionLoadController = controller;
1038
1144
  const token = ++revisionLoadToken;
1039
1145
  const handle = state[authority]; if (!handle) throw new Error(`No ${authority} model revision is available.`);
1146
+ restoreLoadingState($('loadingState'));
1040
1147
  $('loadingState').style.display = 'flex';
1041
1148
  try {
1042
1149
  const base = `/api/editor/model/${encodeURIComponent(state.projectUuid)}/${encodeURIComponent(handle.revisionId)}`;
@@ -1050,13 +1157,17 @@ async function loadRevision(state, authority, spatialCandidate) {
1050
1157
  const propertyReceipt = receipt(manifest, 'properties-000000', 'aware-package:properties-000000');
1051
1158
  const relationshipReceipt = receipt(manifest, 'relationships-000000', 'aware-package:relationships-000000');
1052
1159
  const auditReceipt = manifest.schema === 'floless.model-cas-manifest/v3' ? receipt(manifest, 'tekla-audit-000000', 'floless.tekla-import-audit/v1') : null;
1053
- const tileId = manifest.tiles.ids[0];
1054
- const tileReceipt = manifest.receipts.find((item) => item.kind === 'tile' && item.digest === tileId);
1055
- if (!entityReceipt || !propertyReceipt || !relationshipReceipt || !tileId || !tileReceipt
1160
+ // A degraded Tekla read with nothing drawable is signed with NO geometry tile (#1849). Only that one
1161
+ // package shape may have none; a Revit model and every other Tekla snapshot still need their tile.
1162
+ const nothingDrawn = isTeklaParser && manifest.schema === 'floless.model-cas-manifest/v3' && manifest.tiles.ids.length === 0
1163
+ && !manifest.receipts.some((item) => item.kind === 'tile');
1164
+ const tileId = nothingDrawn ? null : manifest.tiles.ids[0];
1165
+ const tileReceipt = nothingDrawn ? null : manifest.receipts.find((item) => item.kind === 'tile' && item.digest === tileId);
1166
+ if (!entityReceipt || !propertyReceipt || !relationshipReceipt || (!nothingDrawn && (!tileId || !tileReceipt))
1056
1167
  || (isTeklaParser && manifest.schema === 'floless.model-cas-manifest/v3' && (!auditReceipt || auditReceipt.digest !== manifest.audit?.digest))) throw new Error('The verified snapshot package is incomplete.');
1057
1168
  preflightModelJsonReceipt(entityReceipt); preflightModelJsonReceipt(propertyReceipt); preflightModelJsonReceipt(relationshipReceipt);
1058
1169
  if (auditReceipt) preflightModelJsonReceipt(auditReceipt);
1059
- const aggregateBytes = entityReceipt.bytes + propertyReceipt.bytes + relationshipReceipt.bytes + tileReceipt.bytes + (auditReceipt?.bytes ?? 0);
1170
+ const aggregateBytes = entityReceipt.bytes + propertyReceipt.bytes + relationshipReceipt.bytes + (tileReceipt?.bytes ?? 0) + (auditReceipt?.bytes ?? 0);
1060
1171
  if (!Number.isSafeInteger(aggregateBytes) || aggregateBytes > MODEL_VIEWER_MAX_AGGREGATE_BYTES) throw new Error('This model exceeds the bounded viewer package limit.');
1061
1172
  // Read large artifacts sequentially so their authenticated byte buffers are released before the
1062
1173
  // next download starts. The parsed rows remain, but four simultaneous 100+ MiB buffers do not.
@@ -1064,11 +1175,12 @@ async function loadRevision(state, authority, spatialCandidate) {
1064
1175
  const propertyArtifact = await readModelJsonArtifact({ url: `${base}/entities/${propertyReceipt.digest}`, receipt: propertyReceipt, rowKey: 'properties', signal: controller.signal });
1065
1176
  const relationshipArtifact = await readModelJsonArtifact({ url: `${base}/entities/${relationshipReceipt.digest}`, receipt: relationshipReceipt, rowKey: 'relationships', signal: controller.signal });
1066
1177
  const auditArtifact = auditReceipt ? await readModelJsonDocument({ url: `${base}/entities/${auditReceipt.digest}`, receipt: auditReceipt, signal: controller.signal }) : null;
1067
- const tile = await readModelBinaryArtifact({ url: `${base}/tiles/${tileId}`, receipt: tileReceipt, maxBytes: MODEL_VIEWER_MAX_TILE_BYTES, signal: controller.signal });
1178
+ const tile = nothingDrawn ? null : await readModelBinaryArtifact({ url: `${base}/tiles/${tileId}`, receipt: tileReceipt, maxBytes: MODEL_VIEWER_MAX_TILE_BYTES, signal: controller.signal });
1068
1179
  if (token !== revisionLoadToken) return false;
1069
1180
  const nextEntities = entityArtifact.rows; const nextProperties = propertyArtifact.rows; const nextRelationships = relationshipArtifact.rows;
1070
1181
  const nextAudit = auditArtifact ? validateTeklaAuditDocument(auditArtifact.document, manifest, auditReceipt, nextEntities) : (isTeklaParser ? { legacy: true } : null);
1071
1182
  assertModelViewerRowBudget(nextEntities, nextProperties, nextRelationships);
1183
+ if (nothingDrawn && nextEntities.some((entity) => (entity.geometry || []).length)) throw new Error('The verified snapshot package is incomplete.');
1072
1184
  const nextEntityById = new Map(nextEntities.map((entity) => [entity.id, entity]));
1073
1185
  const nextPropertyByEntity = new Map();
1074
1186
  for (const item of nextProperties) { const values = nextPropertyByEntity.get(item.entityId) || []; values.push(item); nextPropertyByEntity.set(item.entityId, values); }
@@ -1088,6 +1200,9 @@ async function loadRevision(state, authority, spatialCandidate) {
1088
1200
  if (token !== revisionLoadToken) return false;
1089
1201
  commitSpatialForRevision(spatialCandidate);
1090
1202
  teklaAudit = null; selectedId = null; selectedIds = []; geometrySelectionIds = [];
1203
+ // The viewport shows this revision from here, so its notice is this revision's even if a later step
1204
+ // of the switch fails.
1205
+ loadedNothingDrawn = nothingDrawn ? { count: nextEntities.length, gridDrawn: !!nextStructuralGrid } : null;
1091
1206
  loadedRevisionId = handle.revisionId; loadedSourceDigest = handle.sourceSha256;
1092
1207
  entities = nextEntities; properties = nextProperties; relationships = nextRelationships; entityById = nextEntityById; propertyByEntity = nextPropertyByEntity; teklaAudit = nextAudit;
1093
1208
  teklaAssemblyMembers = isTeklaParser ? teklaAssemblyMembership(nextRelationships) : new Map();
@@ -1103,11 +1218,16 @@ async function loadRevision(state, authority, spatialCandidate) {
1103
1218
  inspect(null, true, false, 'tree');
1104
1219
  renderTeklaAudit();
1105
1220
  modelPanelBridge?.ready(handle.revisionId);
1106
- $('loadingState').style.display = 'none';
1221
+ if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn.count, loadedNothingDrawn.gridDrawn);
1222
+ else $('loadingState').style.display = 'none';
1107
1223
  return true;
1108
1224
  } catch (error) {
1109
1225
  if (token !== revisionLoadToken) return false;
1110
- if (viewport?.isReady?.()) $('loadingState').style.display = 'none';
1226
+ // A failed switch keeps the last good revision on screen, and with it that revision's own notice.
1227
+ if (viewport?.isReady?.()) {
1228
+ if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn.count, loadedNothingDrawn.gridDrawn);
1229
+ else $('loadingState').style.display = 'none';
1230
+ }
1111
1231
  throw error;
1112
1232
  }
1113
1233
  }