@floless/app 0.159.0 → 0.161.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 (43) hide show
  1. package/dist/floless-server.cjs +76823 -65608
  2. package/dist/schemas/steel.model.v2.schema.json +24 -0
  3. package/dist/skills/floless-app-onboarding/SKILL.md +4 -3
  4. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +1 -2
  5. package/dist/skills/floless-app-rfi/SKILL.md +44 -3
  6. package/dist/skills/floless-app-steel-model/SKILL.md +2 -2
  7. package/dist/skills/floless-app-steel-takeoff/SKILL.md +417 -261
  8. package/dist/templates/steel-model.flo +6 -2
  9. package/dist/templates/viewer-3d-demo.flo +8 -2
  10. package/dist/web/app.css +342 -160
  11. package/dist/web/app.js +17 -51
  12. package/dist/web/aware.js +656 -574
  13. package/dist/web/chat-question-card.js +27 -1
  14. package/dist/web/chat.css +185 -30
  15. package/dist/web/chat.js +2099 -255
  16. package/dist/web/commands-drawing-check.js +1 -0
  17. package/dist/web/commands-filter.js +11 -0
  18. package/dist/web/commands-shell.js +1118 -134
  19. package/dist/web/commands-steel.js +41 -38
  20. package/dist/web/drawing-check-editor.js +76 -3
  21. package/dist/web/guide.js +8 -0
  22. package/dist/web/index.html +68 -42
  23. package/dist/web/instructor.js +17 -6
  24. package/dist/web/pages.js +158 -30
  25. package/dist/web/panels.js +19 -1
  26. package/dist/web/project-history.js +349 -0
  27. package/dist/web/project-reconciliation.js +1 -0
  28. package/dist/web/project-rfis.js +954 -0
  29. package/dist/web/project-workflows.js +236 -4
  30. package/dist/web/run-history.js +198 -0
  31. package/dist/web/run-page-view.js +12 -2
  32. package/dist/web/startup-admission.js +53 -7
  33. package/dist/web/steel-3d-core.js +144 -7
  34. package/dist/web/steel-3d-view.js +61 -5
  35. package/dist/web/steel-editor.html +510 -128
  36. package/dist/web/steel-filter.html +139 -0
  37. package/dist/web/steel-model-v2-commands.js +3 -3
  38. package/dist/web/steel-model-v2-projection.js +139 -4
  39. package/dist/web/steel-plan-transform.js +78 -0
  40. package/dist/web/tool-updates.js +5 -0
  41. package/dist/web/workspaces.js +1438 -159
  42. package/launch.mjs +36 -5
  43. package/package.json +7 -4
@@ -130,7 +130,14 @@
130
130
  var tone = 'idle';
131
131
  var chip = wf.statusLabel || 'Ready';
132
132
 
133
- if (wf.runState === 'drift') {
133
+ if (wf.runState === 'locked') {
134
+ // #2644: a Drawing Checker or Steel Model workflow this account's plan does not include. Its sentence (what is
135
+ // missing and how to get it) comes from the server; nothing of the workflow opens.
136
+ tone = 'blocked';
137
+ chip = 'Locked';
138
+ parts.push(wf.name);
139
+ parts.push(wf.reason || 'is part of a module this account’s plan does not include');
140
+ } else if (wf.runState === 'drift') {
134
141
  tone = 'blocked';
135
142
  chip = 'Run blocked';
136
143
  parts.push(wf.name);
@@ -326,8 +333,10 @@
326
333
  if (!el || el === document.body) return null;
327
334
  // A semantic divider is not a control. Only focusable separators (the panel
328
335
  // resize handles) belong in Instructor's interaction stream.
329
- // A registered drag handle that is not a button (the left pane's section headers) is a control too.
330
- var target = el.closest('button, summary, [role="button"], [role="treeitem"], [role="separator"][tabindex], a[href], input, select, textarea, [draggable="true"][data-command-id]');
336
+ // A registered drag handle that is not a button (the left pane's section headers) is a control too, and so is a
337
+ // registered element a keyboard can reach (`tabindex="0"`): a label such as the Quick model pill (#2521 row 5)
338
+ // has nothing to press but is exactly what `?` should explain.
339
+ var target = el.closest('button, summary, [role="button"], [role="treeitem"], [role="separator"][tabindex], a[href], input, select, textarea, [draggable="true"][data-command-id], [tabindex="0"][data-command-id]');
331
340
  /* A switch paints `.rtn-toggle-track` over an input that is `opacity:0; width:0;
332
341
  height:0`, so the pointer NEVER lands on the input — it lands on the track, or
333
342
  on the <label> around it, and neither is in the list above. Hovering "Start on
@@ -856,7 +865,7 @@
856
865
  // #2046: the ways into the Guide on the empty pages, and its first-launch question.
857
866
  'Getting started', 'In the Guide question',
858
867
  'In the Workspace directory dialog', 'In Tekla source selection', 'In the new project dialog', 'In the project workspace', 'In the Revit workspace', 'In the Tekla Parser workspace', 'In the Drawing Checker profile', 'In Company knowledge',
859
- 'In the project History', 'In the revision note', 'In the Pages list', 'In a project’s Workflows step', 'In a project’s Modules step',
868
+ 'In the project History', 'In the revision note', 'In the Pages list', 'In a project’s Workflows step', 'In a project’s RFIs step', 'In a project’s Modules step', 'In a project’s History step',
860
869
  'On the workflow canvas', 'In workflow setup dialogs',
861
870
  // The Informed by row sits at the top of the canvas column, so it is read right after the canvas.
862
871
  // #1998: the approval notices sit above the canvas with the Informed by row.
@@ -865,12 +874,14 @@
865
874
  'At the left edge of the workspace', 'At the edge of the left or Inspect panel', 'In the left panel', 'Between AI Chat and Model', 'In the Model section of the left panel', 'In the Grid object in the Model section',
866
875
  'In AI Chat', 'In AI Chat history', 'In AI Chat settings', 'In the node Inspect panel', 'In the Instructor strip',
867
876
  'In the ≡ menu', 'In the account menu', 'In the footer',
868
- 'In the contract editor', 'In the report viewer', 'In the Page viewer', 'In My shared links', 'In the video player', 'In the Knowledge Base viewer', 'In the guide',
877
+ 'In the contract editor', 'In the report viewer', 'In the Page viewer', 'In My shared links', 'In the video player', 'In the Knowledge Base viewer',
869
878
  'In the Tools library', 'In Discover local tools', 'In the requests list', 'In the revision review', 'In the run request dialog', 'In the Integrations dialog', 'In the Routines dialog', 'In the Automatic tool updates dialog', 'In the terminal requests dialog',
870
879
  'In the Report an issue dialog', 'In the Build a tool dialog', 'In the Bake dialog', 'In the CAD send review',
871
880
  'In the FloLess dialogs', 'On the FloLess has stopped screen',
872
881
  // #2381: the first-run setup card, which covers the whole window until AWARE is ready.
873
882
  'On the setup card',
883
+ // #2786: the full-window sign-in screen, shown whenever the subscription gate locks FloLess.
884
+ 'On the sign-in screen',
874
885
  /* the steel editor — read top-left down, then the menus, then the dialogs.
875
886
  The ⋯ menu is six groups rather than one because it is six accordion
876
887
  sections on screen: a single 'In the ⋯ menu' would have been about thirty
@@ -884,7 +895,7 @@
884
895
  'In the ⋯ menu',
885
896
  'In the ⋯ menu — Snapping', 'In the ⋯ menu — Display', 'In the ⋯ menu — Detailing',
886
897
  'In the ⋯ menu — Model checks', 'In the ⋯ menu — Coordinate system', 'In the ⋯ menu — Session',
887
- 'In the steel editor dialogs', 'In the Generate views dialog', 'In the Details dialog', 'In the RFI dialog', 'In the Raise an RFI dialog',
898
+ 'In the steel editor dialogs', 'In the Generate views dialog', 'In the Details dialog', 'In a steel project’s RFIs step', 'In the steel editor opened on its own', 'In the Raise an RFI dialog',
888
899
  'In the Connections dialog', 'In the Frames dialog', 'In the reference-model dialogs', 'In the connection-import dialog',
889
900
  'In the confidence report', 'In the Ask AI panel', 'In the Ask AI dialog', 'In the Favourites dialog',
890
901
  // the read-only Revit model editor
package/dist/web/pages.js CHANGED
@@ -103,13 +103,29 @@
103
103
  ${canDelete ? `<button type="button" class="ghost pg-row-delete" data-command-id="shell.page-delete-unreadable#${esc(p.id)}" data-home="${esc(home)}" data-page="${esc(p.id)}">Delete</button>` : ''}
104
104
  </div>`;
105
105
  }
106
- const meta = [...(view.lead || [sourceText(p.source)]), versionsText(p.versionCount), p.sequence ? 'Has an order' : '', `Updated ${ago(p.updatedAt)}`].filter(Boolean).join(' · ');
106
+ if (typeof p.locked === 'string' && p.locked) {
107
+ // #2644: made by a Drawing Checker or Steel Model workflow this account's plan does not include. It stays listed
108
+ // by name and says why it does not open, in the module's own words; nothing of it is read.
109
+ // Housekeeping stays: Delete, and Cancel publishing while a link is still going out (the viewer that holds them
110
+ // does not open). The landing's owner and Archived context lead the sentence, as on any other row.
111
+ const lead = (view.lead || []).filter(Boolean).join(' · ');
112
+ const cancel = p.shareState === 'pending-publish'
113
+ ? `<button type="button" class="ghost pg-row-locked-act" data-locked-act="cancel" data-command-id="shell.page-share-cancel-locked#${esc(p.id)}" data-command-instance-label="${esc(p.title)}" data-home="${esc(home)}" data-page="${esc(p.id)}">Cancel publishing</button>` : '';
114
+ return `<div class="pg-row pg-row-locked" role="listitem" aria-disabled="true" data-blocked-reason="${esc(p.locked)}">
115
+ <div class="pg-row-text"><span class="pg-row-line"><span class="pg-row-title">${esc(p.title)}</span><span class="wf-fork-badge wf-lock-badge" data-tip="${esc(p.locked)}">${globalThis.FLOLESS_LOCK_ICON_SVG || ''}Locked</span></span>
116
+ <span class="pg-row-meta">${esc(lead ? `${lead} · ${p.locked}` : p.locked)}</span></div>
117
+ ${cancel}<button type="button" class="ghost pg-row-locked-act" data-locked-act="delete" data-command-id="shell.page-delete-locked#${esc(p.id)}" data-command-instance-label="${esc(p.title)}" data-home="${esc(home)}" data-page="${esc(p.id)}">Delete</button>
118
+ </div>`;
119
+ }
120
+ const meta = [...(view.lead || [sourceText(p.source)]), versionsText(p.versionCount), p.sequence ? 'Has an order' : ''].filter(Boolean).join(' · ');
121
+ // #2702: "Updated N min ago" is its own element so a quiet clock tick (retimeLists) can keep it true without a re-read.
122
+ const updated = `Updated <span class="pg-ago" data-at="${esc(p.updatedAt)}">${esc(ago(p.updatedAt))}</span>`;
107
123
  // Only an order FloLess did not read is flagged on the row; a read one is the plain "Has an order".
108
124
  const seqChip = p.sequence && (p.sequence !== 'read' || p.sequencePartial) ? `<span class="pg-seq-chip is-warn">${esc(seqLabel({ order: p.sequence, partial: p.sequencePartial }))}</span>` : '';
109
125
  return `<div class="pg-row" role="listitem">
110
126
  <button type="button" class="pg-row-open" data-command-id="shell.page-open#${esc(p.id)}" data-command-instance-label="${esc(p.title)}" data-home="${esc(home)}" data-page="${esc(p.id)}">
111
127
  <span class="pg-row-line"><span class="pg-row-title">${esc(p.title)}</span>${p.aiMade ? '<span class="pg-ai-badge">AI-made</span>' : ''}${seqChip}${p.shareState && p.shareState !== 'revoked' ? `<span class="sl-chip" data-state="${esc(p.shareState)}">${esc(LIST_CHIP[p.shareState] || 'Shared')}</span>` : ''}</span>
112
- <span class="pg-row-meta" data-tip="${esc(when(p.updatedAt))}">${esc(meta)}</span>
128
+ <span class="pg-row-meta" data-tip="${esc(when(p.updatedAt))}">${esc(meta)}${meta ? ' · ' : ''}${updated}</span>
113
129
  </button>
114
130
  </div>`;
115
131
  }
@@ -135,7 +151,9 @@
135
151
  for (const e of lists) if (e.container === container) lists.delete(e);
136
152
  lists.add(entry);
137
153
  const token = (container.dataset.pagesToken = String(Math.random()));
138
- if (!opts.hideWhenEmpty) container.innerHTML = `${opts.headHtml || ''}<p class="pg-loading-line">Loading Pages…</p>`;
154
+ // A re-read for a change (opts.quiet) keeps the rows on screen until the new ones arrive, so the list never flashes.
155
+ const keepRows = opts.quiet && container.querySelector('.pg-list, .pg-empty');
156
+ if (!opts.hideWhenEmpty && !keepRows) container.innerHTML = `${opts.headHtml || ''}<p class="pg-loading-line">Loading Pages…</p>`;
139
157
  let body;
140
158
  try {
141
159
  body = await api(`/api/pages?home=${encodeURIComponent(home)}`);
@@ -163,7 +181,7 @@
163
181
  }
164
182
  // Landing rows remain usable during loading: preserve the person's latest row, not the
165
183
  // one focused when the request began. Other surfaces replace rows with Loading immediately.
166
- if (opts.hideWhenEmpty) focusedPageCommand = container.contains(document.activeElement) ? document.activeElement?.getAttribute('data-command-id') : null;
184
+ if (opts.hideWhenEmpty || opts.quiet) focusedPageCommand = container.contains(document.activeElement) ? document.activeElement?.getAttribute('data-command-id') : null;
167
185
  const own = pages.length ? `<div class="pg-list" role="list" aria-label="${esc(opts.label || 'Pages')}">${pages.map((p) => rowHtml(body.home || home, p)).join('')}</div>` : '';
168
186
  const workflows = fromWorkflows.length || workflowsNote ? `<div class="pg-group-label">From workflows</div>
169
187
  ${workflowsNote ? `<p class="pg-empty">${esc(workflowsNote)}</p>` : ''}
@@ -279,19 +297,41 @@
279
297
  window.dispatchEvent(new CustomEvent('floless:page-deleted', { detail: { home, id } }));
280
298
  }
281
299
 
282
- function refreshLists() {
300
+ function refreshLists(quiet = false) {
283
301
  for (const e of [...lists]) {
284
302
  if (!e.container.isConnected) { lists.delete(e); continue; }
285
303
  if (e.kind === 'workflows') renderWorkflowsList(e.container, e.opts);
286
- else renderList(e.container, e.home, e.opts);
304
+ else renderList(e.container, e.home, quiet ? { ...e.opts, quiet: true } : e.opts);
305
+ }
306
+ }
307
+
308
+ // #2702: a Page changed anywhere (chat, workflow run, viewer share/publish/revoke, delete) — the server says so on the
309
+ // event stream it already has open, and every open list re-reads. Bursts (a run adding versions) become one re-read.
310
+ let pagesChangedTimer = null;
311
+ window.addEventListener('floless:pages-changed', () => {
312
+ if (pagesChangedTimer) return;
313
+ pagesChangedTimer = setTimeout(() => { pagesChangedTimer = null; refreshLists(true); }, 250);
314
+ });
315
+
316
+ /** Keep "Updated N min ago" true on an open list with no request: re-word it from the time already on the row. */
317
+ function retimeLists() {
318
+ for (const el of document.querySelectorAll('.pg-ago[data-at]')) {
319
+ const text = ago(el.getAttribute('data-at'));
320
+ if (text && el.textContent !== text) el.textContent = text;
287
321
  }
288
322
  }
323
+ const retimeTick = () => { if (!document.hidden) retimeLists(); const t = setTimeout(retimeTick, 30_000); t?.unref?.(); };
324
+ retimeTick();
325
+ document.addEventListener('visibilitychange', () => { if (!document.hidden) retimeLists(); });
289
326
 
290
327
  document.addEventListener('click', (event) => {
291
328
  const open = event.target.closest?.('.pg-row-open');
292
329
  if (open) { openViewer(open.dataset.home, open.dataset.page, null, open); return; }
293
330
  const del = event.target.closest?.('.pg-row-delete');
294
331
  if (del) { deleteUnreadable(del.dataset.home, del.dataset.page, del); return; }
332
+ // #2644: a locked Page's housekeeping, from its row (its viewer does not open).
333
+ const lockedAct = event.target.closest?.('.pg-row-locked-act');
334
+ if (lockedAct) { void lockedPageAction(lockedAct.dataset.lockedAct, lockedAct.dataset.home, lockedAct.dataset.page, lockedAct); return; }
295
335
  const act = event.target.closest?.('.pg-wf-act');
296
336
  const owner = act && [...lists].find((e) => e.kind === 'workflows' && e.container.contains(act));
297
337
  if (!owner) return;
@@ -316,6 +356,37 @@
316
356
  refreshLists();
317
357
  }
318
358
 
359
+ /** #2644: Delete, or Cancel publishing, a locked Page from its row. Each asks first, as the viewer's buttons do. */
360
+ async function lockedPageAction(act, home, id, button) {
361
+ const page = `/api/pages/${encodeURIComponent(home)}/${encodeURIComponent(id)}`;
362
+ const ok = await bridge.formModal?.(act === 'cancel'
363
+ ? { title: 'Cancel publishing this Page?', sub: 'Its link is not out yet. Cancelling stops it from being published; the Page itself stays.',
364
+ fields: [], okLabel: 'Cancel publishing', danger: false, returnFocusTo: button }
365
+ : { title: 'Delete this Page?', sub: 'Deleting removes its folder and every version in it. This can’t be undone.',
366
+ fields: [], okLabel: 'Delete', danger: true, returnFocusTo: button });
367
+ if (!ok) return;
368
+ try {
369
+ if (act === 'cancel') {
370
+ // Said as the viewer's own Cancel publishing says it: a cancel that found the link already out, or could not reach
371
+ // floless.io, is never reported as cancelled.
372
+ const { outcome } = await api(`${page}/share/cancel`, { method: 'POST' });
373
+ if (outcome === 'cancelled') toast('Publishing cancelled. The link is as it was.', 'ok');
374
+ else if (outcome === 'published') toast('It had already been published, so the link shows it.', 'ok');
375
+ else if (outcome && outcome !== 'nothing-to-do') toast(outcomeSentence(outcome), 'warn');
376
+ } else {
377
+ const body = await api(page, { method: 'DELETE' });
378
+ announceDeleted(home, id);
379
+ // As the viewer's Delete says it: a shared link floless.io could not be told about yet is still online.
380
+ if (body?.revokePending === true) {
381
+ toast('Page deleted. Its link will be revoked as soon as FloLess can reach floless.io; you can see it in My shared links.', 'warn');
382
+ } else toast('Page deleted.', 'ok');
383
+ }
384
+ } catch (err) {
385
+ toast(`FloLess couldn’t ${act === 'cancel' ? 'cancel publishing' : 'delete it'}. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
386
+ }
387
+ refreshLists();
388
+ }
389
+
319
390
  // ── Viewer ───────────────────────────────────────────────────────────────────────────────────────
320
391
 
321
392
  const $modal = document.getElementById('page-viewer');
@@ -342,6 +413,7 @@
342
413
 
343
414
  const view = {
344
415
  home: null, page: null, n: null, returnFocus: null,
416
+ returnList: null, // the Pages list the viewer was opened from, which outlives its rows (#2728)
345
417
  known: [], // the versions loaded so far: a contiguous run of the newest, oldest first (#2291)
346
418
  pagingOlder: false, // a "Show older versions" request is in flight
347
419
  openSeq: 0, // each open counts up, so an earlier open's late answer never replaces a newer one
@@ -387,6 +459,18 @@
387
459
  // whole history is count minus the versions newer than it — never its position in what happens to be loaded.
388
460
  function totalVersions() { return view.page?.history?.count ?? view.known.length; }
389
461
  function position(v) { return totalVersions() - view.known.filter((x) => x.n > v.n).length; }
462
+ // #2730: a version is always called by its stored number — the one the run viewer's link, the chat's Page cards, the
463
+ // share link and the AI actions use. Until a version is dropped that number IS its place in the history, so the header
464
+ // can say "of M"; once older ones are dropped (a workflow's Page keeps its newest twenty), it says what is kept instead.
465
+ // A version a share link shows is kept however old it is, so "the newest N" is said only when the kept ones are a run.
466
+ function droppedNote() {
467
+ const latest = view.known[view.known.length - 1]?.n ?? 0;
468
+ const total = totalVersions();
469
+ if (latest <= total) return '';
470
+ const first = view.page?.history?.first;
471
+ if (Number.isInteger(first) && latest - first + 1 !== total) return 'Some older versions were removed. The newest ones are kept, and so is any version a share link shows.';
472
+ return total === 1 ? 'Only the latest version is kept. Older ones were removed.' : `Only the newest ${total} versions are kept. Older ones were removed.`;
473
+ }
390
474
  function currentVersion() { return view.known.find((v) => v.n === view.n) || null; }
391
475
  const CAPTURE_TEXT = { live: 'Captured during a live session', 'live-failed': 'Captured during a live session that later failed' };
392
476
 
@@ -463,8 +547,8 @@
463
547
  const p = view.page;
464
548
  const v = currentVersion();
465
549
  const latest = view.known[view.known.length - 1].n;
466
- const index = v ? position(v) : totalVersions();
467
550
  const total = totalVersions();
551
+ const dropped = droppedNote();
468
552
  $title.textContent = p.title;
469
553
  $ai.hidden = !v?.aiMade;
470
554
  $ai.setAttribute('data-tip', AI_TIP);
@@ -490,13 +574,13 @@
490
574
  ? 'This version is only a summary. Open the whole report FloLess keeps on this computer, in its report viewer'
491
575
  : 'Open the whole report FloLess keeps on this computer, in its report viewer');
492
576
  }
493
- $version.textContent = `Version ${index} of ${total}${view.n === latest ? ' · latest' : ''}`;
494
- $version.setAttribute('aria-label', `Version ${index} of ${total}. Choose another version`);
577
+ $version.textContent = `Version ${view.n}${dropped ? '' : ` of ${total}`}${view.n === latest ? ' · latest' : ''}`;
578
+ $version.setAttribute('aria-label', dropped ? `Version ${view.n}${view.n === latest ? ', the latest' : ''}. ${dropped} Choose another version` : `Version ${view.n} of ${total}. Choose another version`);
495
579
  const allowed = p.allowedOrigins.length;
496
580
  $allowed.hidden = allowed === 0;
497
581
  $allowed.textContent = allowed === 1 ? '1 site allowed' : `${allowed} sites allowed`;
498
582
  $sites.setAttribute('aria-label', allowed ? `Sites this Page may load (${allowed})` : 'Sites this Page may load');
499
- $frame.setAttribute('title', `Page: ${p.title}, version ${index}`);
583
+ $frame.setAttribute('title', `Page: ${p.title}, version ${view.n}`);
500
584
  }
501
585
 
502
586
  async function loadFrame() {
@@ -522,7 +606,7 @@
522
606
  $loading.hidden = true;
523
607
  });
524
608
 
525
- async function openViewer(home, id, n, returnFocus) {
609
+ async function openViewer(home, id, n, returnFocus, opts = {}) {
526
610
  const seq = ++view.openSeq;
527
611
  let body;
528
612
  try {
@@ -533,6 +617,14 @@
533
617
  if (['page-damaged', 'page-not-found'].includes(err?.body?.code) && typeof window.flolessWorkspaces?.openPagesHome === 'function') {
534
618
  if (await window.flolessWorkspaces.openPagesHome(home, id, closeViewer)) return true;
535
619
  }
620
+ // #2644: a Page a locked Drawing Checker or Steel Model workflow made does not open. Say why, and go to its row in the
621
+ // Pages list, where its Delete (and Cancel publishing) still are: AI Chat's delete hands the person this screen.
622
+ const locked = err?.status === 403 && typeof err.body?.userMessage === 'string' ? err.body.userMessage.trim() : '';
623
+ if (locked) {
624
+ toast(locked, 'warn');
625
+ if (typeof window.flolessWorkspaces?.openPagesHome === 'function' && await window.flolessWorkspaces.openPagesHome(home, id, closeViewer)) return true;
626
+ return false;
627
+ }
536
628
  toast(`FloLess couldn’t open this Page. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
537
629
  return false;
538
630
  }
@@ -558,7 +650,12 @@
558
650
  if (found === 'known') view.n = n;
559
651
  else note = found === 'gone' ? goneNote(n) : failedNote(n, found);
560
652
  }
561
- view.returnFocus = returnFocus instanceof HTMLElement ? returnFocus : document.activeElement;
653
+ // #2706: a caller that has to close something first (the run viewer) does it here, once the Page is known to open, so a
654
+ // Page that cannot be opened leaves that screen as it was. Focus then returns to whatever the caller put back.
655
+ if (typeof opts.beforeShow === 'function') await opts.beforeShow();
656
+ if (seq !== view.openSeq) return false;
657
+ view.returnFocus = !opts.beforeShow && returnFocus instanceof HTMLElement ? returnFocus : document.activeElement;
658
+ view.returnList = [...lists].find((e) => e.container.contains(view.returnFocus))?.container || null;
562
659
  view.linkAsk = null;
563
660
  view.blocked.clear();
564
661
  view.kept.clear();
@@ -575,7 +672,13 @@
575
672
  $modal.classList.add('show');
576
673
  loadFrame();
577
674
  $close.focus();
578
- void loadShare();
675
+ if (opts.share) {
676
+ // #2706: the run viewer's Share lands here with the share menu open for the version that run made, so it is the
677
+ // same menu, link and confirmation as this viewer's own Share. The menu opens once the link's state is known.
678
+ await loadShare();
679
+ // Not over something the person opened meanwhile (the version list, the site list).
680
+ if (seq === view.openSeq && isOpen() && $versionPop.hidden && $sitesPop.hidden) showSharePop();
681
+ } else void loadShare();
579
682
  return true;
580
683
  }
581
684
 
@@ -589,9 +692,28 @@
589
692
  view.linkAsk = null;
590
693
  view.blocked.clear();
591
694
  paintBanner();
592
- const back = view.returnFocus;
695
+ const back = returnTarget(view.returnFocus, view.returnList);
593
696
  view.returnFocus = null;
594
- if (back?.isConnected) back.focus();
697
+ view.returnList = null;
698
+ back?.focus();
699
+ }
700
+
701
+ /** #2728: where focus goes when the viewer closes. A Page change re-reads the open lists quietly, which replaces their
702
+ * rows, so the row the viewer was opened from may be gone: the same Page's row is found again by its command in that
703
+ * list, and when the Page left the list, the list's first Page row takes focus, so a keyboard user keeps their place.
704
+ * An opener that is still in the page is the answer even when hidden (then nothing takes focus): only a replaced one
705
+ * is looked for. Nothing hidden is ever focused. */
706
+ function returnTarget(back, list) {
707
+ const shown = (el) => !!el?.isConnected
708
+ && (typeof el.checkVisibility !== 'function' || el.checkVisibility({ checkVisibilityCSS: true, visibilityProperty: true, checkOpacity: false }));
709
+ if (!back) return null;
710
+ if (back.isConnected) return shown(back) ? back : null;
711
+ const id = back.getAttribute('data-command-id');
712
+ const scope = list?.isConnected ? list : document;
713
+ const again = id ? [...scope.querySelectorAll('[data-command-id]')].find((el) => el.getAttribute('data-command-id') === id && shown(el)) : null;
714
+ if (again) return again;
715
+ const firstRow = list?.isConnected ? list.querySelector('.pg-row-open') : null;
716
+ return shown(firstRow) ? firstRow : null;
595
717
  }
596
718
 
597
719
  /** Re-read the open Page's record (its labels changed on the server). An answer that arrives after the person
@@ -634,8 +756,9 @@
634
756
  const total = totalVersions();
635
757
  const older = total - view.known.length;
636
758
  const next = Math.min(200, older);
759
+ const dropped = droppedNote();
637
760
  const options = versions.map((v) => {
638
- const label = `Version ${position(v)}${v.n === latest ? ' · latest' : ''}`;
761
+ const label = `Version ${v.n}${v.n === latest ? ' · latest' : ''}`;
639
762
  const meta = [when(v.createdAt), v.aiMade ? 'AI-made' : '', v.capture ? CAPTURE_TEXT[v.capture] : '', v.sequence ? seqLabel(v.sequence) : ''].filter(Boolean).join(' · ');
640
763
  return `<button type="button" class="wf-option pv-version-option${v.n === view.n ? ' selected' : ''}" role="option" aria-selected="${v.n === view.n}"
641
764
  aria-posinset="${position(v)}" aria-setsize="${total}" data-command-id="shell.page-version-choose#${esc(label)}" data-n="${v.n}">
@@ -649,7 +772,7 @@
649
772
  <span class="pv-option-main">${older > 200 ? `Show ${next} older versions` : `Show the last ${older} version${older === 1 ? '' : 's'}`}</span>
650
773
  <span class="pv-option-meta">${older} more not shown</span></button></div>`
651
774
  : '';
652
- $versionPop.innerHTML = `<div role="listbox" id="pv-version-list" aria-label="Versions of this Page">${options}</div>${footer}
775
+ $versionPop.innerHTML = `${dropped ? `<p class="pv-pop-note" id="pv-version-kept">${esc(dropped)}</p>` : ''}<div role="listbox" id="pv-version-list" aria-label="Versions of this Page"${dropped ? ' aria-describedby="pv-version-kept"' : ''}>${options}</div>${footer}
653
776
  <span class="pv-version-announce" role="status" aria-live="polite">${esc(view.announce || '')}</span>`;
654
777
  view.announce = '';
655
778
  $versionPop.hidden = false;
@@ -957,10 +1080,7 @@
957
1080
  const $sharePop = $('pv-share-pop');
958
1081
  const PLANS_URL = 'https://floless.io/pricing';
959
1082
 
960
- function verLabel(n) {
961
- const v = view.known.find((x) => x.n === n);
962
- return v ? `version ${position(v)}` : `version ${n}`;
963
- }
1083
+ function verLabel(n) { return `version ${n}`; } // the stored number, as every other surface says it (#2730)
964
1084
  function latestN() { return view.known[view.known.length - 1]?.n ?? null; }
965
1085
 
966
1086
  /** The words for where the link stands: the button label, its tip, and the popover's first line. */
@@ -1001,7 +1121,7 @@
1001
1121
  parts.push(`<div class="pv-share-row">${`<button type="button" class="ghost" data-command-id="shell.page-share-open-link" data-share-act="open">${esc('Open link')}</button>`}</div>`);
1002
1122
  }
1003
1123
  const shown = view.n;
1004
- // floless.io can't draw the order label yet, so a version whose order FloLess did not read carries it in the title.
1124
+ // Row 6b: floless.io draws the order label beside the link's title; this says so for the version being published.
1005
1125
  const shownVersion = view.known.find((x) => x.n === shown);
1006
1126
  const shownSeq = shownVersion?.sequence;
1007
1127
  // #2262 slice 3c: a whole complete report says what leaves the computer before it is shared.
@@ -1010,9 +1130,11 @@
1010
1130
  ? '<p class="pv-pop-note pv-share-whole-report">This version holds the whole model property report — every property in it will be on the link.</p>'
1011
1131
  : '<p class="pv-pop-note pv-share-whole-report">This version is only a summary of the report, so only the summary will be on the link.</p>');
1012
1132
  }
1013
- if (shownSeq && (shownSeq.order !== 'read' || shownSeq.partial)) {
1014
- const suffix = shownSeq.order === 'read' ? 'order partly read' : shownSeq.order === 'assumed' ? 'order assumed' : shownSeq.order === 'unverified' ? 'order not checked' : 'order unreadable';
1015
- parts.push(`<p class="pv-pop-note pv-share-seq">The shared link’s title will end with “ · ${esc(suffix)}”, because floless.io can’t show the order label yet.</p>`);
1133
+ // #2262 6b: floless.io shows every order as a chip (owner ruling 2026-10-23), so the note says so for every labelled
1134
+ // version; only an order not fully read keeps the warning colour.
1135
+ if (shownSeq) {
1136
+ const fullyRead = shownSeq.order === 'read' && !shownSeq.partial;
1137
+ parts.push(`<p class="pv-pop-note pv-share-seq${fullyRead ? ' is-read' : ''}">Publishing this version shows its order label (${esc(seqLabel(shownSeq))}) on the link.</p>`);
1016
1138
  }
1017
1139
  if (!s || s.state === 'revoked') {
1018
1140
  parts.push(`<div class="pv-share-row">${`<button type="button" class="pv-share-primary" data-command-id="shell.page-share-create" data-share-act="create">${esc(s ? `Share ${verLabel(shown)} again` : `Share ${verLabel(shown)}`)}</button>`}</div>`);
@@ -1293,13 +1415,17 @@
1293
1415
  $share.setAttribute('aria-expanded', 'false');
1294
1416
  }
1295
1417
 
1296
- $share.addEventListener('click', () => {
1297
- if (!$sharePop.hidden) { closePopovers(); return; }
1418
+ function showSharePop() {
1298
1419
  closePopovers();
1299
1420
  paintSharePop();
1300
1421
  $sharePop.hidden = false;
1301
1422
  $share.setAttribute('aria-expanded', 'true');
1302
1423
  ($sharePop.querySelector('.pv-share-primary') || $sharePop.querySelector('button'))?.focus();
1424
+ }
1425
+
1426
+ $share.addEventListener('click', () => {
1427
+ if (!$sharePop.hidden) { closePopovers(); return; }
1428
+ showSharePop();
1303
1429
  });
1304
1430
 
1305
1431
  async function onShareAct(act, button) {
@@ -1404,6 +1530,8 @@
1404
1530
 
1405
1531
  function slRowHtml(row) {
1406
1532
  const chip = row.state ? `<span class="sl-chip" data-state="${esc(row.state)}">${esc(CHIP[row.state] || '')}</span>` : '';
1533
+ // The chip describes the link's own version as floless.io holds it, never the local Page's latest (row 6b).
1534
+ const seq = row.sequence ? `<span class="pg-seq-chip${row.sequence.order !== 'read' || row.sequence.partial ? ' is-warn' : ''}" tabindex="0" data-tip="${esc(row.sequence.sentence)}">${esc(seqLabel(row.sequence))}</span>` : '';
1407
1535
  const ai = row.aiMade ? '<span class="pg-ai-badge" tabindex="0" data-tip="Made by AI. FloLess doesn’t check its figures or statements.">AI-made</span>' : '';
1408
1536
  const titleCell = row.page && !row.deleted
1409
1537
  ? `<button type="button" class="sl-title-open" data-command-id="shell.shared-link-page#${esc(row.title)}" data-sl-act="page" data-home="${esc(row.page.home)}" data-page="${esc(row.page.pageId)}">${esc(row.title || 'Untitled Page')}</button>`
@@ -1414,7 +1542,7 @@
1414
1542
  <button type="button" class="ghost" data-command-id="shell.shared-link-open#${esc(row.title)}" data-sl-act="open" data-url="${esc(row.url)}">Open</button>
1415
1543
  <button type="button" class="ghost sl-revoke" data-command-id="shell.shared-link-revoke#${esc(row.title)}" data-sl-act="revoke" data-token="${esc(row.token)}" data-title="${esc(row.title)}">Revoke</button>` : '';
1416
1544
  return `<div class="pg-row sl-row" role="listitem">
1417
- <div class="pg-row-text sl-row-text"><span class="pg-row-line">${titleCell}${ai}${chip}</span>
1545
+ <div class="pg-row-text sl-row-text"><span class="pg-row-line">${titleCell}${ai}${seq}${chip}</span>
1418
1546
  <span class="pg-row-meta" ${row.when ? `data-tip="${esc(when(row.when))}"` : ''}>${esc(row.meta)}</span></div>
1419
1547
  <div class="sl-actions">${actions}</div></div>`;
1420
1548
  }
@@ -1428,7 +1556,7 @@
1428
1556
  byToken.delete(r.token);
1429
1557
  const state = r.revoked ? 'revoked' : (mine?.share?.state === 'pending-revoke' ? 'pending-revoke' : 'live');
1430
1558
  const kind = r.kind === 'page' ? `Page link · link version ${r.remoteVersion}` : 'Report link';
1431
- return { token: r.token, url: r.url, title: mine?.title || r.title, aiMade: r.aiMade, state, page: mine ? { home: mine.home, pageId: mine.pageId } : null,
1559
+ return { token: r.token, url: r.url, title: r.title || mine?.title, aiMade: r.aiMade, sequence: r.sequence || null, state, page: mine ? { home: mine.home, pageId: mine.pageId } : null,
1432
1560
  deleted: !!mine?.deleted, when: r.updatedAt || r.createdAt, meta: `${kind} · updated ${ago(r.updatedAt || r.createdAt)}` };
1433
1561
  });
1434
1562
  return rows;
@@ -1602,7 +1730,7 @@
1602
1730
  renderWorkflowsList,
1603
1731
  repaintWorkflowsList,
1604
1732
  openSharedLinks: (returnFocus) => openSharedLinks(returnFocus),
1605
- open: (home, id, n) => openViewer(home, id, n ?? null, document.activeElement),
1733
+ open: (home, id, n, opts) => openViewer(home, id, n ?? null, document.activeElement, opts || {}),
1606
1734
  refresh: refreshLists,
1607
1735
  /** The server changed this Page's record (a failed live session's labels): an open copy re-reads it. */
1608
1736
  reloadIfOpen: (home, id) => {
@@ -242,9 +242,19 @@
242
242
  // distinct from "no run yet" — don't tell the user to run something that DID run.
243
243
  const traceUnreadable = (payload) =>
244
244
  !!(payload && typeof payload === 'object' && payload.traceUnreadable === true);
245
+ // #2644: a Drawing Checker or Steel Model workflow this account's plan does not include: its run is not shown, and
246
+ // the panel says why in the module's own words (never "run it", which would not help).
247
+ function moduleRefusedHtml(payload) {
248
+ if (!payload || typeof payload !== 'object' || payload.moduleRefused !== true) return null;
249
+ const sentence = typeof payload.userMessage === 'string' && payload.userMessage.trim() ? payload.userMessage.trim()
250
+ : 'this workflow is part of a module this account’s plan does not include.';
251
+ return placeholderHtml(`Locked: ${sentence}`);
252
+ }
245
253
 
246
254
  function tableHtml(b) {
247
255
  const payload = payloadFor(b.source);
256
+ const locked = moduleRefusedHtml(payload);
257
+ if (locked) return locked;
248
258
  if (traceUnreadable(payload)) {
249
259
  return placeholderHtml(`The last run of “${String(b.source ?? '')}” finished, but its trace couldn’t be read — re-run to refresh this table.`);
250
260
  }
@@ -297,6 +307,8 @@
297
307
  function reportHtml(b) {
298
308
  const payload = payloadFor(b.source);
299
309
  const title = typeof b.title === 'string' && b.title ? b.title : String(b.source ?? 'Report');
310
+ const locked = moduleRefusedHtml(payload);
311
+ if (locked) return locked;
300
312
  if (traceUnreadable(payload)) {
301
313
  return placeholderHtml(`The last run of “${String(b.source ?? '')}” finished, but its trace couldn’t be read — re-run to refresh this report.`);
302
314
  }
@@ -321,6 +333,7 @@
321
333
  let disabled = ' disabled';
322
334
  let tip;
323
335
  if (!gate || gate.state === 'loading') tip = 'Checking workflow state…';
336
+ else if (gate.locked) tip = `Locked: ${gate.locked}`;
324
337
  else if (gate.missing) tip = `Blocked: workflow “${appId}” is not installed.`;
325
338
  else if (!gate.runnable) {
326
339
  // The same stale-lock language the header Run button teaches.
@@ -451,7 +464,12 @@
451
464
  appGate.set(id, { state: 'loading' });
452
465
  api(`/api/app/${encodeURIComponent(id)}`)
453
466
  .then(({ app }) => appGate.set(id, { state: 'ready', runnable: !!app.runnable, runState: app.runState, missing: false }))
454
- .catch(() => appGate.set(id, { state: 'ready', runnable: false, runState: 'uncompiled', missing: true }))
467
+ // #2644: a module workflow this account's plan does not include answers 403 with its own sentence; it is
468
+ // locked, not missing, so the panel says that instead of "not installed".
469
+ .catch((e) => {
470
+ const locked = e?.status === 403 && typeof e.body?.userMessage === 'string' ? e.body.userMessage.trim() : '';
471
+ appGate.set(id, { state: 'ready', runnable: false, runState: 'uncompiled', missing: !locked, locked });
472
+ })
455
473
  .then(() => renderActiveSurfaces());
456
474
  }
457
475
  }