@floless/app 0.143.0 → 0.144.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 (48) hide show
  1. package/dist/floless-server.cjs +177152 -160760
  2. package/dist/schemas/steel.model.v2.schema.json +50 -2
  3. package/dist/schemas/tekla.model.v1.schema.json +66 -0
  4. package/dist/schemas/tekla.model.v2.schema.json +69 -0
  5. package/dist/schemas/tekla.source-package.v1.schema.json +37 -0
  6. package/dist/skills/floless-app-steel-takeoff/SKILL.md +24 -1
  7. package/dist/skills/floless-app-workflows/SKILL.md +8 -2
  8. package/dist/skills/floless-app-workflows/references/workspace-data.md +25 -4
  9. package/dist/templates/floless-workspace-model-report.flo +27 -23
  10. package/dist/templates/revit-model.flo +6 -2
  11. package/dist/templates/tekla-model-report.flo +60 -0
  12. package/dist/templates/tekla-parser.flo +61 -0
  13. package/dist/web/app.css +89 -2
  14. package/dist/web/aware.js +423 -46
  15. package/dist/web/commands-revit.js +4 -0
  16. package/dist/web/commands-shell.js +136 -3
  17. package/dist/web/commands-steel.js +6 -0
  18. package/dist/web/commands-tekla-parser.js +48 -0
  19. package/dist/web/commands.js +1 -1
  20. package/dist/web/grid-core.js +15 -0
  21. package/dist/web/index.html +40 -2
  22. package/dist/web/instructor.js +13 -3
  23. package/dist/web/left-pane.js +160 -10
  24. package/dist/web/model-artifact-loader.js +15 -0
  25. package/dist/web/model-display-units.js +89 -0
  26. package/dist/web/model-editor-revit-adapter.js +21 -4
  27. package/dist/web/model-editor.css +4 -2
  28. package/dist/web/model-measure.js +10 -6
  29. package/dist/web/model-panel-bridge.js +46 -3
  30. package/dist/web/model-pointer-dock.js +21 -1
  31. package/dist/web/model-property-display.js +91 -0
  32. package/dist/web/model-revit-module.js +9 -0
  33. package/dist/web/model-selection-tools.js +11 -0
  34. package/dist/web/model-spatial-panel.js +52 -21
  35. package/dist/web/model-structural-grid-view.js +334 -0
  36. package/dist/web/model-tekla-selection.js +32 -0
  37. package/dist/web/model-viewport-revit-adapter.js +119 -32
  38. package/dist/web/revit-editor.css +11 -1
  39. package/dist/web/revit-editor.html +4 -3
  40. package/dist/web/revit-editor.js +589 -111
  41. package/dist/web/steel-3d-view.js +58 -372
  42. package/dist/web/steel-editor.html +231 -8
  43. package/dist/web/tekla-editor.html +71 -0
  44. package/dist/web/tekla-structural-grid-adapter.js +56 -0
  45. package/dist/web/workspaces.js +872 -97
  46. package/distribution-profile-production.mjs +4 -0
  47. package/distribution-resource-inventory.mjs +4 -2
  48. package/package.json +5 -2
package/dist/web/aware.js CHANGED
@@ -31,6 +31,16 @@
31
31
  const $reportRevealFile = document.getElementById('report-reveal-file');
32
32
  const $reportClose = document.getElementById('report-close');
33
33
  const $reportStop = document.getElementById('report-stop');
34
+ const $reportDownload = document.getElementById('report-download');
35
+ const $reportNav = document.getElementById('report-nav');
36
+ const $reportFirst = document.getElementById('report-first-section');
37
+ const $reportPrevious = document.getElementById('report-previous-section');
38
+ const $reportNext = document.getElementById('report-next-section');
39
+ const $reportLast = document.getElementById('report-last-section');
40
+ const $reportSectionStatus = document.getElementById('report-section-status');
41
+ const $reportObjectNumber = document.getElementById('report-object-number');
42
+ const $reportGoObject = document.getElementById('report-go-object');
43
+ const $reportObjectError = document.getElementById('report-object-error');
34
44
  const $stopRunBtn = document.getElementById('stop-run-btn');
35
45
  const $restoreBtn = document.getElementById('restore-btn');
36
46
  const $customizeBtn = document.getElementById('customize-btn');
@@ -137,7 +147,7 @@
137
147
  }
138
148
 
139
149
  function agentDisplayName(id) {
140
- return ({ 'html-report': 'HTML Report', 'viewer-3d': '3D Viewer', file: 'File' })[id] || id;
150
+ return ({ 'html-report': 'HTML Report', 'html-report-stream': 'HTML Report', 'viewer-3d': '3D Viewer', file: 'File' })[id] || id;
141
151
  }
142
152
 
143
153
  function runFailureMessage(message) {
@@ -1389,6 +1399,9 @@
1389
1399
  await commitPublicationAvailability(id, read, contractState);
1390
1400
  currentId = id;
1391
1401
  workflowSelectionGeneration += 1;
1402
+ if (id === 'tekla-model-report' || id === 'floless-workspace-model-report') {
1403
+ void refreshSelectedCompleteReportDiscovery(id);
1404
+ }
1392
1405
  notifyChatScope();
1393
1406
  // The Templates strip also carries app-scoped quick actions. Templates may have
1394
1407
  // loaded before this app did, so repaint it once the ownership boundary is known.
@@ -2159,15 +2172,13 @@
2159
2172
  function reportNodeId() {
2160
2173
  const app = currentId && apps.get(currentId);
2161
2174
  if (!app || !app.nodes.length) return null;
2162
- // An html-report (static) or viewer-3d (interactive 3D) agent node renders HTML — its
2163
- // `render` command returns an `html` field, exactly what extractReportHtml keys on. So
2164
- // it's a report producer regardless of exec code; prefer it directly as the viewer node.
2175
+ // A report agent is the viewer node whether it returns inline HTML or a verified
2176
+ // streamed-report handle. Prefer it directly over any upstream authoring surface.
2165
2177
  // A pre-stage authoring node (config.surface, e.g. the steel `filter` node) renders a summary
2166
2178
  // but is NOT the workflow's report viewer — its affordance is its own surface button. Skip it,
2167
2179
  // or prepending it would steal "View report ▸" from the real first report node (e.g. `read`).
2168
- const htmlReportNode = app.nodes.find(
2169
- (n) => (n.agent === 'html-report' || n.agent === 'viewer-3d') && !(n.config && n.config.surface),
2170
- );
2180
+ const htmlReportNode = app.nodes.find((n) => n.agent === 'html-report-stream' && !(n.config && n.config.surface))
2181
+ || app.nodes.find((n) => (n.agent === 'html-report' || n.agent === 'viewer-3d') && !(n.config && n.config.surface));
2171
2182
  if (htmlReportNode) return htmlReportNode.id;
2172
2183
  // Otherwise, qualify the app only if some node actually PRODUCES report HTML — its exec
2173
2184
  // code returns an `html` field (the `data.result.html` extractReportHtml keys
@@ -2900,25 +2911,28 @@
2900
2911
  } catch { return { ok: false, error: 'transient' }; }
2901
2912
  }
2902
2913
 
2903
- // Exact approved Revit model revisions for `widget: workspace-model-revision`. The picker
2914
+ // Exact approved model revisions for `widget: workspace-model-revision`. The picker
2904
2915
  // endpoint owns approval/account filtering and a signed, revision-bound cursor. A single retry
2905
2916
  // state survives every full-list restart, so alternating session loss and picker changes cannot
2906
2917
  // reset each other's bounds and mix more than one replacement snapshot into the result.
2907
- async function fetchApprovedModelRevisions(retries = Object.freeze({ auth: 0, changed: 0 })) {
2918
+ async function fetchApprovedModelRevisions(module = 'revit', retries = Object.freeze({ auth: 0, changed: 0 })) {
2908
2919
  try {
2909
2920
  const projects = new Map();
2910
2921
  let continuation = null;
2911
2922
  for (let page = 0; page < 20; page += 1) {
2912
- const url = '/api/workspace-projects/model-revisions' + (continuation ? `?continuation=${encodeURIComponent(continuation)}` : '');
2923
+ const params = new URLSearchParams();
2924
+ if (module === 'tekla') params.set('module', 'tekla');
2925
+ if (continuation) params.set('continuation', continuation);
2926
+ const url = '/api/workspace-projects/model-revisions' + (params.size ? `?${params}` : '');
2913
2927
  const r = await fetch(url, { credentials: 'same-origin', cache: 'no-store' });
2914
2928
  const j = await r.json().catch(() => null);
2915
2929
  if (r.status === 401 && retries.auth < 1) {
2916
2930
  const bootstrap = await bootstrapEditorSession();
2917
2931
  if (!bootstrap.ok) return unavailableModelRevisionResult(bootstrap.error);
2918
- return fetchApprovedModelRevisions(Object.freeze({ ...retries, auth: retries.auth + 1 }));
2932
+ return fetchApprovedModelRevisions(module, Object.freeze({ ...retries, auth: retries.auth + 1 }));
2919
2933
  }
2920
2934
  if (r.status === 409 && j && j.code === 'picker-changed' && retries.changed < 1) {
2921
- return fetchApprovedModelRevisions(Object.freeze({ ...retries, changed: retries.changed + 1 }));
2935
+ return fetchApprovedModelRevisions(module, Object.freeze({ ...retries, changed: retries.changed + 1 }));
2922
2936
  }
2923
2937
  if (!r.ok || !j || !j.ok || !Array.isArray(j.projects)) return unavailableModelRevisionResult();
2924
2938
  for (const project of j.projects) {
@@ -2979,12 +2993,14 @@
2979
2993
  const knowledgeProjects = app.inputs.some(isKnowledgeProject) ? await fetchKnowledgeProjects() : [];
2980
2994
  if (!isCurrent()) return;
2981
2995
  const hasModelRevision = app.inputs.some(isModelRevision);
2982
- if (hasModelRevision) showToast('Loading approved Revit models…');
2996
+ const modelModule = app.inputs.find(isModelRevision)?.workspaceModule === 'tekla' ? 'tekla' : 'revit';
2997
+ const modelName = modelModule === 'tekla' ? 'Tekla Parser' : 'Revit';
2998
+ if (hasModelRevision) showToast(`Loading approved ${modelName} models…`);
2983
2999
  let modelRevisions = { projects: [], error: null };
2984
3000
  if (hasModelRevision) {
2985
3001
  const bootstrap = await bootstrapEditorSession();
2986
3002
  if (!isCurrent()) return;
2987
- modelRevisions = bootstrap.ok ? await fetchApprovedModelRevisions() : unavailableModelRevisionResult(bootstrap.error);
3003
+ modelRevisions = bootstrap.ok ? await fetchApprovedModelRevisions(modelModule) : unavailableModelRevisionResult(bootstrap.error);
2988
3004
  if (!isCurrent()) return;
2989
3005
  }
2990
3006
  const fields = app.inputs.map((inp) => {
@@ -3039,6 +3055,7 @@
3039
3055
  };
3040
3056
  }
3041
3057
  if (isModelRevision(inp)) {
3058
+ const selectedModelName = inp.workspaceModule === 'tekla' ? 'Tekla Parser' : 'Revit';
3042
3059
  const options = modelRevisions.projects
3043
3060
  .slice().sort((a, b) => String(a.name).localeCompare(String(b.name)))
3044
3061
  .flatMap((project) => {
@@ -3048,19 +3065,19 @@
3048
3065
  const short = String(version.approvedRevisionId).slice(0, 10);
3049
3066
  return {
3050
3067
  value: selection({ approvedRevisionId: version.approvedRevisionId, approvalVersion: version.approvalVersion }),
3051
- group: project.name, groupMeta: 'Revit model', label: `Approved v${version.approvalVersion}`,
3068
+ group: project.name, groupMeta: `${selectedModelName} model`, label: `Approved v${version.approvalVersion}`,
3052
3069
  triggerLabel: `${project.name} · approved v${version.approvalVersion} · ${short}`,
3053
3070
  meta: `${date} · ${short}`,
3054
- ariaLabel: `${project.name}, Revit model, approved version ${version.approvalVersion}, ${date}, revision ${version.approvedRevisionId}`,
3055
- search: `${project.name} Revit approved version ${version.approvalVersion} ${date} ${version.approvedRevisionId}`,
3071
+ ariaLabel: `${project.name}, ${selectedModelName} model, approved version ${version.approvalVersion}, ${date}, revision ${version.approvedRevisionId}`,
3072
+ search: `${project.name} ${selectedModelName} approved version ${version.approvalVersion} ${date} ${version.approvedRevisionId}`,
3056
3073
  };
3057
3074
  });
3058
3075
  return [...exact, {
3059
- value: selection({ latestApproved: true }), group: project.name, groupMeta: 'Revit model', volatile: true,
3076
+ value: selection({ latestApproved: true }), group: project.name, groupMeta: `${selectedModelName} model`, volatile: true,
3060
3077
  label: 'Latest approved', triggerLabel: `${project.name} · latest approved (volatile)`,
3061
3078
  meta: 'changes when approvals change',
3062
- ariaLabel: `${project.name}, Revit model, latest approved, changes when approvals change`,
3063
- search: `${project.name} Revit latest approved changes approvals volatile`,
3079
+ ariaLabel: `${project.name}, ${selectedModelName} model, latest approved, changes when approvals change`,
3080
+ search: `${project.name} ${selectedModelName} latest approved changes approvals volatile`,
3064
3081
  }];
3065
3082
  });
3066
3083
  const requestedValue = cur[inp.name] != null ? String(cur[inp.name]) : '';
@@ -3073,12 +3090,12 @@
3073
3090
  commandId: 'workflow.select-model-revision',
3074
3091
  placeholder: 'Select an approved model version…',
3075
3092
  disabledLabel: modelRevisions.error === 'unavailable' ? 'Secure model access unavailable'
3076
- : modelRevisions.error ? 'Approved models unavailable' : 'Approve a Revit model first',
3093
+ : modelRevisions.error ? 'Approved models unavailable' : `Approve a ${selectedModelName} model first`,
3077
3094
  emptyNote: modelRevisions.error === 'unavailable'
3078
- ? 'Secure Revit model access is unavailable in this environment.'
3095
+ ? `Secure ${selectedModelName} model access is unavailable in this environment.`
3079
3096
  : modelRevisions.error
3080
- ? 'Couldn’t load approved Revit models. Reload approved models to try again.'
3081
- : 'No approved Revit model is available — open <strong>Workspaces</strong>, import a Revit project, and Approve it first.',
3097
+ ? `Couldn’t load approved ${selectedModelName} models. Reload approved models to try again.`
3098
+ : `No approved ${selectedModelName} model is available — open <strong>Workspaces</strong>, import a ${selectedModelName} project, and Approve it first.`,
3082
3099
  emptyActionLabel: modelRevisions.error === 'transient' ? 'Reload approved models' : '',
3083
3100
  onEmptyAction: modelRevisions.error === 'transient' ? () => openInputsDialog() : null,
3084
3101
  note: !modelRevisions.error && requestedValue && !value
@@ -3123,6 +3140,7 @@
3123
3140
  }
3124
3141
  if (!isCurrent()) return;
3125
3142
  appInputValues.set(appId, store);
3143
+ paintRunState(app); // The Instructor's set/total count follows Set inputs, not the next Run.
3126
3144
  markSpecialNodes();
3127
3145
  refreshDirtyIndicator(); // values changed → reflect unsaved state in the header/menu
3128
3146
  const badge = Object.entries(store).map(([k, v]) => `${k}=${visualNames.has(k) ? String(v).split(/[\\/]/).pop() : v}`).join(' · ');
@@ -3225,6 +3243,87 @@
3225
3243
  // The last HTML painted (static or 3D) — so ↗ Open works for both surfaces.
3226
3244
  let lastPaintedHtml = '';
3227
3245
  let lastPaintedInteractive = false;
3246
+ let currentCompleteReport = null;
3247
+ let currentReportSection = 0;
3248
+ let reportSectionRequest = 0;
3249
+ function updateReportSectionNavigation(ordinal, index) {
3250
+ const first = ordinal === 0;
3251
+ const last = ordinal + 1 >= index.chunkCount;
3252
+ const controls = [
3253
+ [$reportFirst, first, 'Already at the first report section.'],
3254
+ [$reportPrevious, index.previous == null, 'Already at the first report section.'],
3255
+ [$reportNext, index.next == null, 'Already at the final report section.'],
3256
+ [$reportLast, last, 'Already at the final report section.'],
3257
+ ];
3258
+ const focused = document.activeElement;
3259
+ for (const [control, blocked, reason] of controls) {
3260
+ control.disabled = blocked;
3261
+ if (blocked) control.setAttribute('data-blocked-reason', reason);
3262
+ else control.removeAttribute('data-blocked-reason');
3263
+ }
3264
+ if (controls.some(([control]) => control === focused)) window.Instructor?.refreshCarrier(focused);
3265
+ }
3266
+ function clearCompleteReportView() {
3267
+ reportSectionRequest += 1;
3268
+ currentCompleteReport = null;
3269
+ currentReportSection = 0;
3270
+ $reportNav.hidden = true;
3271
+ $reportDownload.hidden = true;
3272
+ $reportObjectError.hidden = true;
3273
+ $reportObjectError.textContent = '';
3274
+ $reportFrame.removeAttribute('src');
3275
+ }
3276
+ async function paintCompleteReport(report, ordinal = 0) {
3277
+ const request = ++reportSectionRequest;
3278
+ const handle = encodeURIComponent(report.handle);
3279
+ $reportOverlay.hidden = false;
3280
+ $reportOverlay.replaceChildren(mkEl('div', 'spinner'), mkEl('div', null, 'Loading report section…'));
3281
+ try {
3282
+ const index = await api(`/api/model-reports/${handle}/index?at=${ordinal}`);
3283
+ if (request !== reportSectionRequest) return;
3284
+ const response = await fetch(`/api/model-reports/${handle}/chunk/${ordinal}`, { credentials: 'same-origin', cache: 'no-store' });
3285
+ if (!response.ok) {
3286
+ const body = await response.json().catch(() => null);
3287
+ throw new Error(body?.error || 'This report is no longer available. Run it again.');
3288
+ }
3289
+ const length = Number(response.headers.get('content-length'));
3290
+ if (Number.isFinite(length) && length > 1200 * 1024) throw new Error('This report section is too large to display safely.');
3291
+ await response.body?.cancel();
3292
+ if (request !== reportSectionRequest) return;
3293
+ $reportFrame.removeAttribute('srcdoc');
3294
+ // Navigate to the real session-gated route. Its restrictive CSP must belong to the
3295
+ // rendered document itself; a blob: copy would silently lose that response header.
3296
+ $reportFrame.src = `/api/model-reports/${handle}/chunk/${ordinal}`;
3297
+ $reportFrame.hidden = false;
3298
+ $reportFrame3d.hidden = true; $reportFrame3d.removeAttribute('src');
3299
+ currentCompleteReport = report;
3300
+ currentReportSection = ordinal;
3301
+ const count = Number(index.objectCount) || 0;
3302
+ const properties = Number(index.propertyCount) || 0;
3303
+ const current = index.current || {};
3304
+ const objectRange = count === 0 ? 'No objects' : current.firstObject == null
3305
+ ? `Model information · 0 of ${count} objects` : `Objects ${Number(current.firstObject) + 1}–${Number(current.lastObject) + 1} of ${count}`;
3306
+ const propertyRange = properties === 0 ? '0 properties'
3307
+ : current.firstProperty == null ? `0 of ${properties} properties in this section`
3308
+ : `Properties ${Number(current.firstProperty) + 1}–${Number(current.lastProperty) + 1} of ${properties}`;
3309
+ $reportSectionStatus.textContent = `${objectRange} · ${propertyRange} · section ${ordinal + 1} of ${index.chunkCount}`;
3310
+ updateReportSectionNavigation(ordinal, index);
3311
+ $reportNav.hidden = false;
3312
+ $reportDownload.hidden = false;
3313
+ $reportOpen.hidden = true;
3314
+ $reportShare.hidden = true;
3315
+ showSavedPathActions('');
3316
+ $reportOverlay.hidden = true; $reportOverlay.replaceChildren();
3317
+ $reportSub.textContent = report.scheduledCaption
3318
+ || `Complete read-only report · ${count} objects · ${properties} properties · approved revision ${String(index.revisionId).slice(0, 12)} · source unchanged.`;
3319
+ } catch (error) {
3320
+ if (request !== reportSectionRequest) return;
3321
+ clearCompleteReportView();
3322
+ $reportFrame.srcdoc = '';
3323
+ $reportOverlay.hidden = false;
3324
+ $reportOverlay.replaceChildren(mkEl('div', null, error?.message || 'This report could not be displayed. Run it again.'));
3325
+ }
3326
+ }
3228
3327
  // The share route's user-facing cap (server/index.ts sets a 6 MB body limit; the JSON envelope
3229
3328
  // rides on top of the HTML, so the document itself is held to 5 MB).
3230
3329
  const SHARE_MAX_BYTES = 5 * 1024 * 1024;
@@ -3246,6 +3345,8 @@
3246
3345
  // origin, cannot touch the app page) and keeps a "Loading 3D view…" overlay until the doc
3247
3346
  // posts `viewer-ready`. Exactly one frame is shown at a time.
3248
3347
  function paintReport(html, interactive) {
3348
+ clearCompleteReportView();
3349
+ $reportOpen.hidden = false;
3249
3350
  lastPaintedHtml = html || '';
3250
3351
  lastPaintedInteractive = !!interactive; // drives the share copy: a 3D model is not a "frozen report"
3251
3352
  showSavedPathActions(''); // default off; the caller re-shows if this report saved a file
@@ -3272,6 +3373,8 @@
3272
3373
  // interactive 3D doc can't linger (its WebGL loop running) behind an overlay, and ↗ Open
3273
3374
  // can't reopen a previous app's report. Used by every empty / transition state.
3274
3375
  function clearReportFrames() {
3376
+ clearCompleteReportView();
3377
+ $reportOpen.hidden = false;
3275
3378
  $reportFrame.srcdoc = ''; $reportFrame.hidden = false;
3276
3379
  $reportFrame3d.hidden = true; $reportFrame3d.removeAttribute('src');
3277
3380
  lastPaintedHtml = '';
@@ -3283,12 +3386,16 @@
3283
3386
  function showReport(nodeId) {
3284
3387
  const app = currentId && apps.get(currentId);
3285
3388
  if (!app) return;
3389
+ viewingScheduledReportRoutine = null;
3286
3390
  $reportModal.dataset.nodeId = nodeId;
3287
3391
  $reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
3288
3392
  showModal($reportModal);
3289
3393
  if (reportRunning) return; // a run is in flight — its overlay already shows progress
3290
3394
  const cached = lastReportByApp.get(currentId);
3291
- if (cached && cached.html) {
3395
+ if (cached && cached.handle) {
3396
+ $reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
3397
+ void paintCompleteReport(cached, 0);
3398
+ } else if (cached && cached.html) {
3292
3399
  const sfx = cached.label ? ' · ' + cached.label : '';
3293
3400
  if (cached.interactive) {
3294
3401
  $reportTitle.textContent = `3D Viewer · ${app.displayName}`;
@@ -3986,6 +4093,7 @@
3986
4093
 
3987
4094
  const inputs = currentInputs();
3988
4095
  const inputBadge = Object.entries(inputs).map(([k, v]) => `${k}=${v}`).join(' · ');
4096
+ const approvedModelReport = app.templateId === 'floless-workspace-model-report' || app.templateId === 'tekla-model-report';
3989
4097
  $reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
3990
4098
  $reportSub.textContent = 'Running the workflow to create your report.';
3991
4099
  clearReportFrames(); // clear any previous report (static or 3D) before this run paints a fresh one
@@ -3993,7 +4101,7 @@
3993
4101
  $reportOverlay.hidden = false;
3994
4102
  $reportOverlay.innerHTML = opts.debug
3995
4103
  ? `<div class="spinner"></div><div>Launching the .NET debugger for <code>${escapeHtml(nodeId)}</code> — a Windows picker will pop; choose your <strong>Visual Studio</strong> to attach to <code>aware-tekla.exe</code>, then step through. The report renders when you let it finish.</div>`
3996
- : `<div class="spinner"></div><div>Running <code>${escapeHtml(currentId)}</code> against the live model…</div><button type="button" class="overlay-stop">■ Stop run</button>`;
4104
+ : `<div class="spinner"></div><div>${approvedModelReport ? 'Reading the selected approved model to make a complete, read-only report…' : `Running <code>${escapeHtml(currentId)}</code> against the live model…`}</div><button type="button" class="overlay-stop">■ Stop run</button>`;
3997
4105
  showModal($reportModal);
3998
4106
  $reportModal.dataset.nodeId = nodeId;
3999
4107
 
@@ -4008,6 +4116,16 @@
4008
4116
  // A run can "succeed" yet carry a rejected token (the report would be an error
4009
4117
  // body, not real data) — prompt reconnect instead of rendering the noise.
4010
4118
  if (res.credentialIssue) { surfaceCredentialIssue(res.credentialIssue); return; }
4119
+ if (res.report && res.report.kind === 'complete-model-properties' && typeof res.report.handle === 'string') {
4120
+ $reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
4121
+ await paintCompleteReport(res.report, 0);
4122
+ if (!currentCompleteReport) return;
4123
+ markFirstRunDone(app.id);
4124
+ lastReportByApp.set(app.id, { nodeId, label: inputBadge, ...res.report });
4125
+ $reportModal.dataset.html = '1';
4126
+ appendNarration(`Rendered the complete read-only property report from <strong>${escapeHtml(nodeId)}</strong>.`);
4127
+ return;
4128
+ }
4011
4129
  const html = res.report && res.report.html;
4012
4130
  const interactive = !!(res.report && res.report.interactive);
4013
4131
  if (!html) {
@@ -5048,12 +5166,35 @@
5048
5166
  else if (id === inputNodeId()) openInputsDialog();
5049
5167
  });
5050
5168
 
5051
- $reportClose.onclick = () => hideModal($reportModal);
5169
+ async function closeReportViewer() {
5170
+ hideModal($reportModal);
5171
+ const routineId = viewingScheduledReportRoutine;
5172
+ viewingScheduledReportRoutine = null;
5173
+ if (!routineId) return;
5174
+ const routine = routinesData.find((item) => item.id === routineId);
5175
+ if (!routine || currentId !== routine.workflow) return;
5176
+ showModal($routinesModal);
5177
+ await loadRoutinesData();
5178
+ await refreshRoutineReportDiscovery(routineId);
5179
+ const origin = [...$routinesModal.querySelectorAll('[data-rtn-report]')]
5180
+ .find((button) => button.dataset.rtnReport === routineId);
5181
+ (origin || document.getElementById('routines-close')).focus();
5182
+ }
5183
+ $reportClose.onclick = () => { void closeReportViewer(); };
5052
5184
  // The in-modal Stop for a live foreground session: the always-on header Stop sits
5053
5185
  // BEHIND the report modal's backdrop, so a session shown in the Viewer needs its
5054
5186
  // own reachable Stop. Visibility is driven by syncRunControls (foregroundTrigger).
5055
5187
  if ($reportStop) $reportStop.onclick = () => stopRun();
5056
- onBackdropDismiss($reportModal, () => hideModal($reportModal));
5188
+ onBackdropDismiss($reportModal, () => { void closeReportViewer(); });
5189
+ document.addEventListener('keydown', (event) => {
5190
+ if (event.key === 'Escape' && viewingScheduledReportRoutine && $reportModal.classList.contains('show')) {
5191
+ event.preventDefault();
5192
+ // A later Routines Escape handler must not close the modal we are restoring
5193
+ // from this same key press.
5194
+ event.stopImmediatePropagation();
5195
+ void closeReportViewer();
5196
+ }
5197
+ });
5057
5198
  // The Stop button is rebuilt into the overlay each run — delegate so one
5058
5199
  // listener survives every innerHTML swap.
5059
5200
  $reportOverlay.addEventListener('click', (e) => { if (e.target.closest('.overlay-stop')) stopRun(); });
@@ -5087,6 +5228,56 @@
5087
5228
  $reportOpenFile.onclick = () => savedFileAction('/api/open-file', 'Couldn’t open the file');
5088
5229
  $reportRevealFile.onclick = () => savedFileAction('/api/reveal', 'Couldn’t reveal the file');
5089
5230
 
5231
+ $reportFirst.onclick = () => { if (currentCompleteReport) void paintCompleteReport(currentCompleteReport, 0); };
5232
+ $reportPrevious.onclick = () => { if (currentCompleteReport && currentReportSection > 0) void paintCompleteReport(currentCompleteReport, currentReportSection - 1); };
5233
+ $reportNext.onclick = () => { if (currentCompleteReport) void paintCompleteReport(currentCompleteReport, currentReportSection + 1); };
5234
+ $reportLast.onclick = () => { if (currentCompleteReport) void paintCompleteReport(currentCompleteReport, currentCompleteReport.chunkCount - 1); };
5235
+ $reportGoObject.onclick = async () => {
5236
+ if (!currentCompleteReport) return;
5237
+ const raw = $reportObjectNumber.value.trim();
5238
+ const number = Number(raw);
5239
+ if (!/^[1-9][0-9]*$/.test(raw) || !Number.isSafeInteger(number) || number > currentCompleteReport.objectCount) {
5240
+ $reportObjectError.textContent = `Enter an object number from 1 to ${currentCompleteReport.objectCount}.`;
5241
+ $reportObjectError.hidden = false;
5242
+ $reportObjectNumber.focus();
5243
+ return;
5244
+ }
5245
+ $reportObjectError.hidden = true;
5246
+ try {
5247
+ const located = await api(`/api/model-reports/${encodeURIComponent(currentCompleteReport.handle)}/object/${number - 1}`);
5248
+ await paintCompleteReport(currentCompleteReport, located.chunkOrdinal);
5249
+ } catch (error) {
5250
+ $reportObjectError.textContent = error?.message || 'Could not find that object. Try again.';
5251
+ $reportObjectError.hidden = false;
5252
+ }
5253
+ };
5254
+ $reportObjectNumber.addEventListener('keydown', (event) => {
5255
+ if (event.key === 'Enter') { event.preventDefault(); $reportGoObject.click(); }
5256
+ });
5257
+ $reportFrame.addEventListener('load', () => {
5258
+ if (!currentCompleteReport || !$reportFrame.getAttribute('src')?.startsWith('/api/model-reports/')) return;
5259
+ try {
5260
+ if ($reportFrame.contentDocument?.contentType === 'text/html') return;
5261
+ } catch { /* an inaccessible document is not an authenticated report */ }
5262
+ clearCompleteReportView();
5263
+ $reportFrame.removeAttribute('src');
5264
+ $reportOverlay.hidden = false;
5265
+ $reportOverlay.replaceChildren(mkEl('div', null, 'Report access changed while loading. Run the report again.'));
5266
+ });
5267
+ $reportDownload.onclick = async () => {
5268
+ if (!currentCompleteReport) return;
5269
+ const handle = encodeURIComponent(currentCompleteReport.handle);
5270
+ try {
5271
+ await api(`/api/model-reports/${handle}/index?at=${currentReportSection}`);
5272
+ const link = document.createElement('a');
5273
+ link.href = `/api/model-reports/${handle}/download`;
5274
+ link.download = 'complete-model-properties.html';
5275
+ document.body.append(link); link.click(); link.remove();
5276
+ } catch (error) {
5277
+ showToast(error?.message || 'Report access could not be confirmed. Try again.', 'warn');
5278
+ }
5279
+ };
5280
+
5090
5281
  $reportOpen.onclick = () => {
5091
5282
  const html = lastPaintedHtml || $reportFrame.srcdoc;
5092
5283
  if (!html) return;
@@ -7764,7 +7955,7 @@
7764
7955
  // have is the exact bug this reason exists to prevent.
7765
7956
  return "Couldn't check whether Node.js is installed — the check didn't finish, which usually means the machine was busy. Nothing is necessarily missing; try again.";
7766
7957
  case 'aware-version-required':
7767
- return 'This FloLess release needs AWARE 0.139.0 or newer. Update AWARE, then try again.';
7958
+ return 'This FloLess release needs AWARE 0.143.0 or newer. Update AWARE, then try again.';
7768
7959
  case 'offline':
7769
7960
  return 'No network connection was detected. Connect to the internet, then try again.';
7770
7961
  case 'smoke-failed':
@@ -8172,13 +8363,13 @@
8172
8363
  return true;
8173
8364
  }
8174
8365
 
8175
- async function recheckLicenseAndGate({ forRevitAccountSelection = false } = {}) {
8366
+ async function recheckLicenseAndGate({ forRevitAccountSelection = false, moduleLabel = 'Revit model' } = {}) {
8176
8367
  let s; try { s = await api('/api/license/status'); } catch { return; }
8177
8368
  if (!routeLicenseStatus(s)) return;
8178
8369
  // Account choice controls only the optional xeoRVT module. Ask only after an
8179
8370
  // explicit Revit action; ordinary license polling must never interrupt FloLess.
8180
8371
  if (forRevitAccountSelection && s.desktopAccess?.state === 'account-selection-required') {
8181
- renderAccountGate(s.desktopAccess.accounts, { moduleOnly: true });
8372
+ renderAccountGate(s.desktopAccess.accounts, { moduleOnly: true, moduleLabel });
8182
8373
  }
8183
8374
  }
8184
8375
 
@@ -8211,6 +8402,9 @@
8211
8402
  // would fix one stale surface and leave its sibling. (Found by review round 2.)
8212
8403
  if (currentId) refreshCurrentWorkflowAvailability().catch(reportErr);
8213
8404
  }
8405
+ // Scheduled reports may finish with every browser closed; refresh their authorized
8406
+ // pointers on both first connection and reconnect, never from SSE payload data.
8407
+ void refreshSelectedCompleteReportDiscovery(currentId);
8214
8408
  everOpened = true;
8215
8409
  };
8216
8410
  es.onmessage = (e) => {
@@ -8415,6 +8609,8 @@
8415
8609
  applyTriggerReport(m);
8416
8610
  } else if (m.type === 'routine-report') {
8417
8611
  applyRoutineReport(m);
8612
+ } else if (m.type === 'routine-report-changed') {
8613
+ if (typeof m.id === 'string') void refreshRoutineReportDiscovery(m.id);
8418
8614
  } else if (m.type === 'connect-result') {
8419
8615
  // A run's credential-reconnect card may be waiting on this integration —
8420
8616
  // drive its success/fail state from the same SSE result.
@@ -11582,6 +11778,16 @@
11582
11778
  openIntegrations('xeorvt');
11583
11779
  });
11584
11780
 
11781
+ window.addEventListener('floless:open-tekla-access', async (event) => {
11782
+ const state = event.detail?.state;
11783
+ if (state === 'account-selection-required') {
11784
+ await recheckLicenseAndGate({ forRevitAccountSelection: true, moduleLabel: 'Tekla Parser' });
11785
+ } else if (state === 'check-unavailable') {
11786
+ await recheckLicenseAndGate();
11787
+ }
11788
+ window.dispatchEvent(new CustomEvent('floless:revit-capability-changed'));
11789
+ });
11790
+
11585
11791
  function runtimeSectionSummary(runtimes, active, folder) {
11586
11792
  // What FloLess would LAUNCH (#1622): its own copy where it runs one, else the user's install.
11587
11793
  const installed = runtimes.filter(runtimeCopyInstalled);
@@ -12007,7 +12213,7 @@
12007
12213
  ? 'Choose the FloLess account you want to use before opening Revit projects.'
12008
12214
  : checkUnavailable
12009
12215
  ? 'FloLess couldn’t check Revit access. Check your connection and try again.'
12010
- : 'Revit model access is not included for this account. Ask the account owner to add it.';
12216
+ : 'Revit Parser is not included for this account. Ask the account owner to enable it.';
12011
12217
  const checkLabel = needsAttention ? 'Try setup again' : needsAccount ? 'Choose account'
12012
12218
  : ready ? 'Check status' : 'Check access again';
12013
12219
  // The Revit detail is always a sentence the person must finish reading (#1524), so it
@@ -12178,11 +12384,139 @@
12178
12384
  const $routineEditModal = document.getElementById('routine-edit-modal');
12179
12385
  let routinesData = [];
12180
12386
  let routinesMax = 15;
12387
+ const completeReportDiscovery = new Map();
12388
+ const completeReportDiscoveryEpoch = new Map();
12389
+ let reportDiscoveryBootstrapMode = null;
12390
+ let reportDiscoverySessionFlight = null;
12391
+ let reportDiscoverySessionUntil = 0;
12392
+ let viewingScheduledReportRoutine = null;
12181
12393
  let editingRoutineId = null;
12182
12394
  let editWorkflows = []; // app list for the workflow <select>, cached per edit-open
12183
12395
  let editTriggerSource = null; // picked workflow's triggerSource (null = not trigger-eligible)
12184
12396
  let editRoutineMode = 'schedule'; // 'schedule' | 'trigger' — chosen kind in the edit form
12185
12397
  const runningRoutines = new Set(); // ids executing now (SSE start → ended)
12398
+
12399
+ function isCompleteReportRoutine(r) {
12400
+ return r && r.kind !== 'trigger' && (r.workflow === 'tekla-model-report'
12401
+ || r.workflow === 'floless-workspace-model-report');
12402
+ }
12403
+
12404
+ function completeReportViewerShape(discovered, scheduledCaption = '') {
12405
+ const summary = discovered?.summary;
12406
+ if (typeof discovered?.handle !== 'string' || !discovered.handle
12407
+ || !summary || !Number.isSafeInteger(summary.chunkCount) || summary.chunkCount < 1
12408
+ || !Number.isSafeInteger(summary.objectCount) || summary.objectCount < 0
12409
+ || !Number.isSafeInteger(summary.propertyCount) || summary.propertyCount < 0) {
12410
+ throw new Error('The saved report details could not be verified. Run the report again.');
12411
+ }
12412
+ // The viewer navigates by flat chunkCount, objectCount and propertyCount.
12413
+ // Discovery deliberately nests its verified summary beside the dated handle.
12414
+ return { ...summary, handle: discovered.handle, scheduledCaption };
12415
+ }
12416
+
12417
+ function scheduledReportCaption(discovery) {
12418
+ const report = discovery.report;
12419
+ const prefix = discovery.earlierReport ? 'Earlier scheduled report' : 'Latest scheduled report';
12420
+ const outcome = discovery.latestAttempt?.status === 'failed' || discovery.latestAttempt?.status === 'recovery'
12421
+ ? ` ${discovery.latestAttempt.status === 'recovery' ? 'Recovery needed' : 'Latest attempt failed'}: ${discovery.latestAttempt.reason}` : '';
12422
+ return `${prefix} · ${new Date(report.at).toLocaleString()} · ${report.summary.objectCount} objects · ${report.summary.propertyCount} properties.${outcome}`;
12423
+ }
12424
+
12425
+ async function refreshSelectedCompleteReportDiscovery(workflow) {
12426
+ if (workflow !== 'tekla-model-report' && workflow !== 'floless-workspace-model-report') return;
12427
+ await loadRoutinesData();
12428
+ }
12429
+
12430
+ async function ensureReportDiscoverySession(force = false) {
12431
+ if (!reportDiscoveryBootstrapMode) {
12432
+ reportDiscoveryBootstrapMode = fetch('/api/health', { cache: 'no-store' }).then(async (response) => {
12433
+ if (!response.ok) throw new Error('report discovery health check unavailable');
12434
+ const health = await response.json();
12435
+ if (typeof health?.capabilities?.editorSessionHttpBootstrap !== 'boolean') {
12436
+ throw new Error('report discovery session mode unavailable');
12437
+ }
12438
+ return health.capabilities.editorSessionHttpBootstrap;
12439
+ }).catch((error) => { reportDiscoveryBootstrapMode = null; throw error; });
12440
+ }
12441
+ // A build without HTTP bootstrap must use its own editor-session channel.
12442
+ // A forbidden HTTP POST would create a spurious 403 console error.
12443
+ if (!await reportDiscoveryBootstrapMode) return false;
12444
+ if (force) reportDiscoverySessionUntil = 0;
12445
+ if (Date.now() < reportDiscoverySessionUntil) return true;
12446
+ if (!reportDiscoverySessionFlight) {
12447
+ reportDiscoverySessionFlight = bootstrapEditorSession().then((result) => {
12448
+ if (!result.ok) throw new Error('report discovery session unavailable');
12449
+ reportDiscoverySessionUntil = Date.now() + 11 * 60 * 60 * 1000;
12450
+ }).finally(() => { reportDiscoverySessionFlight = null; });
12451
+ }
12452
+ await reportDiscoverySessionFlight;
12453
+ return true;
12454
+ }
12455
+
12456
+ async function refreshRoutineReportDiscovery(id) {
12457
+ const r = routinesData.find((item) => item.id === id);
12458
+ if (!isCompleteReportRoutine(r)) return;
12459
+ const epoch = (completeReportDiscoveryEpoch.get(id) || 0) + 1;
12460
+ completeReportDiscoveryEpoch.set(id, epoch);
12461
+ const previous = completeReportDiscovery.get(id);
12462
+ completeReportDiscovery.set(id, { checking: true });
12463
+ if ($routinesModal.classList.contains('show')) renderRoutinesList();
12464
+ try {
12465
+ const canHttpBootstrap = await ensureReportDiscoverySession();
12466
+ let result;
12467
+ try { result = await api(`/api/routines/${encodeURIComponent(id)}/complete-report`); }
12468
+ catch (error) {
12469
+ if (error.status !== 401 || !canHttpBootstrap) throw error;
12470
+ await ensureReportDiscoverySession(true);
12471
+ result = await api(`/api/routines/${encodeURIComponent(id)}/complete-report`);
12472
+ }
12473
+ // A workflow switch can start another discovery request while the clicked View
12474
+ // action is awaiting this one. The verified answer still belongs to that click;
12475
+ // only the shared row cache must obey the latest-render epoch.
12476
+ if (completeReportDiscoveryEpoch.get(id) !== epoch) return result;
12477
+ completeReportDiscovery.set(id, { ...result, checking: false });
12478
+ if (viewingScheduledReportRoutine === id && $reportModal.classList.contains('show')
12479
+ && currentId === r.workflow && result.report && !reportRunning) {
12480
+ await paintCompleteReport(completeReportViewerShape(result.report, scheduledReportCaption(result)), 0);
12481
+ }
12482
+ if ($routinesModal.classList.contains('show')) renderRoutinesList();
12483
+ return result;
12484
+ } catch (error) {
12485
+ if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
12486
+ const message = error.status === 401 ? 'Sign in again to view saved reports.'
12487
+ : 'Could not check this report. Check your access and try again.';
12488
+ completeReportDiscovery.set(id, { error: message });
12489
+ if (viewingScheduledReportRoutine === id && currentId === r.workflow) {
12490
+ clearReportFrames();
12491
+ $reportShare.hidden = true;
12492
+ $reportOverlay.hidden = false;
12493
+ $reportOverlay.replaceChildren(mkEl('div', null, message));
12494
+ $reportSub.textContent = 'Report access needs to be checked again.';
12495
+ }
12496
+ if (previous?.report?.handle === lastReportByApp.get(r.workflow)?.handle) lastReportByApp.delete(r.workflow);
12497
+ }
12498
+ if ($routinesModal.classList.contains('show')) renderRoutinesList();
12499
+ return null;
12500
+ }
12501
+
12502
+ async function viewScheduledCompleteReport(id) {
12503
+ const r = routinesData.find((item) => item.id === id);
12504
+ if (!isCompleteReportRoutine(r)) return;
12505
+ if (currentId !== r.workflow) await loadApp(r.workflow);
12506
+ if (currentId !== r.workflow) return;
12507
+ // Recheck at the moment of opening; a cached handle is never an authorization grant.
12508
+ const state = await refreshRoutineReportDiscovery(id);
12509
+ if (!state?.report) {
12510
+ showToast('This saved report is no longer available. Check your access or run the routine again.', 'warn');
12511
+ return;
12512
+ }
12513
+ viewingScheduledReportRoutine = id;
12514
+ hideModal($routinesModal);
12515
+ $reportTitle.textContent = `HTML Viewer · ${apps.get(r.workflow)?.displayName || r.workflow}`;
12516
+ showModal($reportModal);
12517
+ $reportClose.focus();
12518
+ await paintCompleteReport(completeReportViewerShape(state.report, scheduledReportCaption(state)), 0);
12519
+ }
12186
12520
  // Why a second start is refused, in the user's words. Said identically by the greyed ▶ (tip + `?`)
12187
12521
  // and by the toast when a click races ahead of the repaint. "or waiting its turn" is not padding:
12188
12522
  // the queue refuses a routine that is QUEUED behind another as well as one that is mid-run, and
@@ -12313,6 +12647,12 @@
12313
12647
  // active) so a missed SSE end-event can't leave a spinner wedged on.
12314
12648
  runningRoutines.clear();
12315
12649
  for (const r of routinesData) if (r.running) runningRoutines.add(r.id);
12650
+ const live = new Set(routinesData.filter(isCompleteReportRoutine).map((r) => r.id));
12651
+ for (const id of completeReportDiscovery.keys()) if (!live.has(id)) {
12652
+ completeReportDiscovery.delete(id);
12653
+ completeReportDiscoveryEpoch.set(id, (completeReportDiscoveryEpoch.get(id) || 0) + 1);
12654
+ }
12655
+ for (const id of live) void refreshRoutineReportDiscovery(id);
12316
12656
  if ($routinesModal.classList.contains('show')) renderRoutinesList();
12317
12657
  } catch { /* non-fatal */ }
12318
12658
  }
@@ -12594,6 +12934,19 @@
12594
12934
  }
12595
12935
  $list.innerHTML = routinesData.map((r) => {
12596
12936
  const isTrigger = r.kind === 'trigger';
12937
+ const isCompleteReport = isCompleteReportRoutine(r);
12938
+ const discovery = isCompleteReport ? completeReportDiscovery.get(r.id) : null;
12939
+ const reportLine = !isCompleteReport ? '' : discovery?.checking
12940
+ ? '<div class="rtn-report-note">Checking saved report access…</div>'
12941
+ : discovery?.error
12942
+ ? `<div class="rtn-report-note warn" role="status">${escapeHtml(discovery.error)}</div>`
12943
+ : discovery?.report
12944
+ ? `<div class="rtn-report-note">${discovery.earlierReport ? 'Earlier report' : 'Latest report'} · ${escapeHtml(new Date(discovery.report.at).toLocaleString())} · ${Number(discovery.report.summary.objectCount)} objects</div>`
12945
+ + (discovery.latestAttempt?.status === 'failed' || discovery.latestAttempt?.status === 'recovery'
12946
+ ? `<div class="rtn-report-note warn" role="status">${discovery.latestAttempt.status === 'recovery' ? 'Recovery needed' : 'Latest attempt failed'} · ${escapeHtml(discovery.latestAttempt.reason || 'Run it again.')}</div>` : '')
12947
+ : `<div class="rtn-report-note">${discovery?.latestAttempt?.status === 'failed' || discovery?.latestAttempt?.status === 'recovery'
12948
+ ? `${discovery.latestAttempt.status === 'recovery' ? 'Recovery needed' : 'Latest attempt failed'} · ${escapeHtml(discovery.latestAttempt.reason || 'Run it again.')}`
12949
+ : 'No saved report yet.'}</div>`;
12597
12950
  const running = runningRoutines.has(r.id);
12598
12951
  const broken = r.broken ? `<span class="rtn-dot">·</span><span style="color:var(--err)">${escapeHtml(r.broken.reason)}</span>` : '';
12599
12952
  let statusEl, nextTip, nextLabel;
@@ -12629,6 +12982,7 @@
12629
12982
  <div class="rtn-main">
12630
12983
  <div class="rtn-name">${escapeHtml(r.name)}</div>
12631
12984
  <div class="rtn-sub"><span class="rtn-wf">${escapeHtml(r.workflow)}</span><span class="rtn-dot">·</span><span>${escapeHtml(whenText)}</span>${broken}</div>
12985
+ ${reportLine}
12632
12986
  </div>
12633
12987
  <div class="rtn-meta"${isTrigger ? ' aria-live="polite" aria-atomic="true"' : ''}>
12634
12988
  <span class="rtn-next" data-tip="${escapeAttr(nextTip)}">${escapeHtml(nextLabel)}</span>
@@ -12640,6 +12994,7 @@
12640
12994
  <span class="rtn-toggle-track"></span>
12641
12995
  </label>
12642
12996
  ${isTrigger ? '' : `<button class="rtn-act" data-rtn-run="${escapeAttr(r.id)}" data-command-id="shell.routine-run#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(r.name)}" aria-label="Run ${escapeAttr(r.name)} now" data-tip="${escapeAttr(runTip)}"${running ? ` disabled data-blocked-reason="${escapeAttr(RTN_ALREADY_RUNNING)}"` : ''}>▶</button>`}
12997
+ ${isCompleteReport && discovery?.report && !discovery.checking ? `<button class="rtn-act rtn-report-view" data-rtn-report="${escapeAttr(r.id)}" data-command-id="shell.routine-view-report#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(r.name)}" aria-label="View saved report for ${escapeAttr(r.name)}" data-tip="View the verified, read-only report">View report</button>` : ''}
12643
12998
  <button class="rtn-act" data-rtn-edit="${escapeAttr(r.id)}" data-tip="Edit">✎</button>
12644
12999
  <button class="rtn-act rtn-del-act" data-rtn-del="${escapeAttr(r.id)}" data-tip="Delete">×</button>
12645
13000
  </div>
@@ -12647,6 +13002,7 @@
12647
13002
  }).join('');
12648
13003
  $list.querySelectorAll('[data-rtn-toggle]').forEach((el) => { el.onchange = () => toggleRoutine(el.dataset.rtnToggle, el.checked); });
12649
13004
  $list.querySelectorAll('[data-rtn-run]').forEach((b) => { b.onclick = () => runRoutineNow(b.dataset.rtnRun); });
13005
+ $list.querySelectorAll('[data-rtn-report]').forEach((b) => { b.onclick = () => { void viewScheduledCompleteReport(b.dataset.rtnReport); }; });
12650
13006
  $list.querySelectorAll('[data-rtn-edit]').forEach((b) => { b.onclick = () => openRoutineEdit(b.dataset.rtnEdit); });
12651
13007
  $list.querySelectorAll('[data-rtn-del]').forEach((b) => { b.onclick = () => deleteRoutineUi(b.dataset.rtnDel); });
12652
13008
  }
@@ -12790,8 +13146,9 @@
12790
13146
  if (!inps.length) return;
12791
13147
  let routineModelRevisions = { projects: [], error: null };
12792
13148
  if (inps.some((inp) => inp.widget === 'workspace-model-revision')) {
13149
+ const routineModelModule = inps.find((inp) => inp.widget === 'workspace-model-revision')?.workspaceModule === 'tekla' ? 'tekla' : 'revit';
12793
13150
  const bootstrap = await bootstrapEditorSession();
12794
- routineModelRevisions = bootstrap.ok ? await fetchApprovedModelRevisions() : unavailableModelRevisionResult(bootstrap.error);
13151
+ routineModelRevisions = bootstrap.ok ? await fetchApprovedModelRevisions(routineModelModule) : unavailableModelRevisionResult(bootstrap.error);
12795
13152
  if (document.getElementById('rtn-workflow').value !== workflowId) return;
12796
13153
  }
12797
13154
  $field.hidden = false;
@@ -12802,19 +13159,20 @@
12802
13159
  const id = `rtn-in-${i}`;
12803
13160
  const val = prefill && inp.name in prefill ? prefill[inp.name] : (inp.default != null ? inp.default : '');
12804
13161
  if (inp.widget === 'workspace-model-revision') {
13162
+ const name = inp.workspaceModule === 'tekla' ? 'Tekla Parser' : 'Revit';
12805
13163
  const choices = routineModelRevisions.projects.slice().sort((a, b) => String(a.name).localeCompare(String(b.name))).flatMap((project) => {
12806
13164
  const selection = (extra) => JSON.stringify({ schemaVersion: 'floless.workspace-model-selection/v1', projectUuid: project.projectUuid, ...extra });
12807
13165
  const exact = project.versions.slice().sort((a, b) => Number(b.approvalVersion) - Number(a.approvalVersion)).map((version) => ({
12808
13166
  value: selection({ approvedRevisionId: version.approvedRevisionId, approvalVersion: version.approvalVersion }),
12809
- group: project.name, groupMeta: 'Revit model', label: `Approved v${version.approvalVersion}`,
13167
+ group: project.name, groupMeta: `${name} model`, label: `Approved v${version.approvalVersion}`,
12810
13168
  meta: version.approvedAt ? new Date(version.approvedAt).toLocaleDateString() : 'Date unavailable',
12811
13169
  }));
12812
- return [...exact, { value: selection({ latestApproved: true }), group: project.name, groupMeta: 'Revit model', label: 'Latest approved', meta: 'updates when approvals change' }];
13170
+ return [...exact, { value: selection({ latestApproved: true }), group: project.name, groupMeta: `${name} model`, label: 'Latest approved', meta: 'updates when approvals change' }];
12813
13171
  });
12814
13172
  const selected = choices.find((choice) => String(choice.value) === String(val));
12815
- return `<div class="modal-field"><label>Revit model</label><div class="field-help">Choose the Workspace project and approved revision this scheduled run will read.</div>`
13173
+ return `<div class="modal-field"><label>${name} model</label><div class="field-help">Choose the Workspace project and approved revision this scheduled run will read.</div>`
12816
13174
  + `<input type="hidden" data-rtn-in="${escapeAttr(inp.name)}" value="${escapeAttr(String(val))}">`
12817
- + `<button type="button" class="fm-combo-trigger" data-rtn-model-picker="${escapeAttr(inp.name)}">${escapeHtml(selected ? `${selected.group} · ${selected.label}` : 'Choose a Revit model…')}</button></div>`;
13175
+ + `<button type="button" class="fm-combo-trigger" data-rtn-model-picker="${escapeAttr(inp.name)}">${escapeHtml(selected ? `${selected.group} · ${selected.label}` : `Choose a ${name} model…`)}</button></div>`;
12818
13176
  }
12819
13177
  const type = inp.type === 'integer' || inp.type === 'number' ? 'number' : 'text';
12820
13178
  return `<div class="modal-field"><label for="${id}">${escapeHtml(inp.name)}${inp.description ? ' — ' + escapeHtml(inp.description) : ''}</label>`
@@ -12823,23 +13181,24 @@
12823
13181
  $inputs.querySelectorAll('[data-rtn-model-picker]').forEach((button) => {
12824
13182
  button.onclick = async () => {
12825
13183
  const name = button.dataset.rtnModelPicker;
13184
+ const modelName = inps.find((inp) => inp.name === name)?.workspaceModule === 'tekla' ? 'Tekla Parser' : 'Revit';
12826
13185
  const input = $inputs.querySelector(`[data-rtn-in="${CSS.escape(name)}"]`);
12827
13186
  const choices = routineModelRevisions.projects.slice().sort((a, b) => String(a.name).localeCompare(String(b.name))).flatMap((project) => {
12828
13187
  const selection = (extra) => JSON.stringify({ schemaVersion: 'floless.workspace-model-selection/v1', projectUuid: project.projectUuid, ...extra });
12829
13188
  return [...project.versions.slice().sort((a, b) => Number(b.approvalVersion) - Number(a.approvalVersion)).map((version) => ({
12830
13189
  value: selection({ approvedRevisionId: version.approvedRevisionId, approvalVersion: version.approvalVersion }), group: project.name,
12831
- groupMeta: 'Revit model', label: `Approved v${version.approvalVersion}`, meta: version.approvedAt ? new Date(version.approvedAt).toLocaleDateString() : 'Date unavailable',
12832
- })), { value: selection({ latestApproved: true }), group: project.name, groupMeta: 'Revit model', label: 'Latest approved', meta: 'updates when approvals change' }];
13190
+ groupMeta: `${modelName} model`, label: `Approved v${version.approvalVersion}`, meta: version.approvedAt ? new Date(version.approvedAt).toLocaleDateString() : 'Date unavailable',
13191
+ })), { value: selection({ latestApproved: true }), group: project.name, groupMeta: `${modelName} model`, label: 'Latest approved', meta: 'updates when approvals change' }];
12833
13192
  });
12834
- const picked = await formModal({ title: 'Choose Revit model', sub: 'Select a Workspace project and the approved revision this routine will read.', fields: [{
12835
- name: 'selection', label: 'Revit model', type: 'select', options: choices, value: input.value, required: true,
12836
- placeholder: 'Select an approved model version…', disabledLabel: 'Approve a Revit model first',
12837
- emptyNote: 'No approved Revit model is available — open <strong>Workspaces</strong>, import a Revit project, and Approve it first.',
13193
+ const picked = await formModal({ title: `Choose ${modelName} model`, sub: 'Select a Workspace project and the approved revision this routine will read.', fields: [{
13194
+ name: 'selection', label: `${modelName} model`, type: 'select', options: choices, value: input.value, required: true,
13195
+ placeholder: 'Select an approved model version…', disabledLabel: `Approve a ${modelName} model first`,
13196
+ emptyNote: `No approved ${modelName} model is available — open <strong>Workspaces</strong>, import a ${modelName} project, and Approve it first.`,
12838
13197
  }], okLabel: 'Use this model' });
12839
13198
  if (!picked) return;
12840
13199
  input.value = picked.selection;
12841
13200
  const choice = choices.find((row) => row.value === picked.selection);
12842
- button.textContent = choice ? `${choice.group} · ${choice.label}` : 'Choose a Revit model…';
13201
+ button.textContent = choice ? `${choice.group} · ${choice.label}` : `Choose a ${modelName} model…`;
12843
13202
  };
12844
13203
  });
12845
13204
  }
@@ -13067,6 +13426,24 @@
13067
13426
  setTimeout(() => $riTitle.focus(), 0);
13068
13427
  };
13069
13428
 
13429
+ window.addEventListener('floless:report-tekla-setup-issue', (event) => {
13430
+ openReportIssue();
13431
+ const card = event.detail?.returnFocus;
13432
+ if (card instanceof HTMLElement) riReturnFocus = card;
13433
+ $riTitle.value = 'Tekla Parser setup could not be verified';
13434
+ $riDesc.value = 'FloLess stopped the read because it could not verify this Tekla Parser setup. No model files were changed.';
13435
+ riSyncSend();
13436
+ });
13437
+
13438
+ window.addEventListener('floless:report-revit-setup-issue', (event) => {
13439
+ openReportIssue();
13440
+ const card = event.detail?.returnFocus;
13441
+ if (card instanceof HTMLElement) riReturnFocus = card;
13442
+ $riTitle.value = 'Revit Parser setup: required reader unavailable';
13443
+ $riDesc.value = 'FloLess could not finish Revit Parser setup because the required verified reader version is unavailable.';
13444
+ riSyncSend();
13445
+ });
13446
+
13070
13447
  function riRenderSuccess(ref) {
13071
13448
  const wrap = document.createElement('div');
13072
13449
  wrap.className = 'graft-success';
@@ -13488,7 +13865,7 @@
13488
13865
  // A signed-in person can belong to more than one FloLess account. Desktop module authority is
13489
13866
  // account-bound, so never guess. This chooser is scoped to xeoRVT: core FloLess stays usable
13490
13867
  // while someone decides which of their accounts should supply Revit model authority.
13491
- function renderAccountGate(accounts, { moduleOnly = false } = {}) {
13868
+ function renderAccountGate(accounts, { moduleOnly = false, moduleLabel = 'Revit model' } = {}) {
13492
13869
  if (document.getElementById('account-gate')) return;
13493
13870
  const rows = Array.isArray(accounts) ? accounts : [];
13494
13871
  const returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
@@ -13542,7 +13919,7 @@
13542
13919
  }).join('');
13543
13920
  wrap.innerHTML = `<section class="ag-card" role="dialog"${moduleOnly ? '' : ' aria-modal="true"'} aria-labelledby="ag-title" aria-describedby="ag-copy">
13544
13921
  <h1 id="ag-title">Choose an account</h1>
13545
- <p class="ag-copy" id="ag-copy">Your sign-in belongs to more than one FloLess account. Choose which account to use for Revit model access.</p>
13922
+ <p class="ag-copy" id="ag-copy">Your sign-in belongs to more than one FloLess account. Choose which account to use for ${escapeHtml(moduleLabel)} access.</p>
13546
13923
  ${rows.length ? `<div class="ag-list" id="ag-list" role="listbox" aria-label="FloLess accounts">${options}</div>`
13547
13924
  : '<p class="ag-copy" role="alert">No account is available for this sign-in. Ask your FloLess account owner to add you, or sign in with a different account.</p>'}
13548
13925
  <div class="ag-actions">${moduleOnly ? '<button type="button" id="ag-not-now">Not now</button>' : '<button type="button" id="ag-signout">Sign out</button>'}