@floless/app 0.139.0 → 0.140.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.
@@ -213,6 +213,8 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
213
213
  than none, and a sentence with no number in it cannot be misread as one. */
214
214
  .signoff-total{margin:0 0 12px;color:var(--mut);font-size:12.5px;line-height:1.5}
215
215
  .signoff-total b{color:var(--text);font-weight:600}
216
+ .signoff-spinner{display:inline-block;width:12px;height:12px;margin-right:7px;vertical-align:-2px;border:2px solid var(--ctrl-border);border-top-color:var(--brand);border-radius:50%;animation:signoff-spin .8s linear infinite}
217
+ @keyframes signoff-spin{to{transform:rotate(360deg)}}
216
218
  /* A scroll container — themed by the global `*` scrollbar rules at the top of this sheet, exactly as
217
219
  .sheet-list is, so no native white bar can appear inside the modal.
218
220
  NO padding here, unlike .sheet-list: `position:sticky` on the group headings computes against the
@@ -259,7 +261,7 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
259
261
  #app{--panel-w:300px}
260
262
  #app:not(.resizing){transition:--panel-w .26s cubic-bezier(.2,.6,.2,1)}
261
263
  #app.panel-shut{--panel-w:0px !important}
262
- @media (prefers-reduced-motion:reduce){#app:not(.resizing),#panel,#panelStub{transition:none}}
264
+ @media (prefers-reduced-motion:reduce){#app:not(.resizing),#panel,#panelStub{transition:none}.signoff-spinner{animation:none}}
263
265
  /* A 14px RIGHT BORDER in the panel's own colour, not a margin. This panel is itself the scroller, so
264
266
  padding cannot move its scrollbar — the thumb sits at the panel's own right edge whatever the
265
267
  padding is. A margin does move it, but it moves the panel's BACKGROUND with it, which opened a
@@ -2065,7 +2067,7 @@ let signoffOutcome = null; // a refusal code, for the notice below
2065
2067
  let signoffBusy = false; // a write is in flight: dismissal is locked
2066
2068
  let signoffPreview = null; // the server's reply: { manifestHash, controlsHash, potentialLines }
2067
2069
  let signoffPreviewState = 'idle'; // 'idle' | 'pending' | 'ok' | 'failed'
2068
- let signoffPreviewSeq = 0; // ONE in-flight preview; a stale reply is ignored, never rendered
2070
+ let signoffPreviewSeq = 0; // ONE visible preview; a reply for a closed/superseded dialog is ignored
2069
2071
  const signoffOverlay = document.getElementById('signoffOverlay');
2070
2072
  const signoffPanel = document.getElementById('signoffPanel');
2071
2073
  const signoffList = document.getElementById('signoffList');
@@ -2077,11 +2079,6 @@ const signoffApprove = document.getElementById('signoffApprove');
2077
2079
  const signoffCloseBtn = document.getElementById('signoffClose');
2078
2080
  const signoffReload = document.getElementById('signoffReload');
2079
2081
  const SIGNOFF_APPROVE_LABEL = 'Approve these exclusions';
2080
- /* Long enough that a slow fold on a 120,000-element set still lands, short enough that a hung request
2081
- does not leave the modal waiting forever — §4.3b requires the modal not to block on one. A timeout
2082
- resolves to the FAILED state, which is a real state with a way out, not a spinner nobody can leave. */
2083
- const SIGNOFF_PREVIEW_TIMEOUT_MS = 30_000;
2084
-
2085
2082
  /** The visible heading for each dimension's group, in MODE_ORDER.
2086
2083
  * "Line weight", not "Thickness": this is a structural-steel product, where "thickness" reads as
2087
2084
  * PLATE thickness. On the one screen where a human authorises dismissing elements, the drawn-line
@@ -2289,9 +2286,12 @@ function renderSignoffTotal(){
2289
2286
  signoffTotal.append(strong, document.createTextNode(' lines may be dismissed as a group.'));
2290
2287
  return;
2291
2288
  }
2292
- signoffTotal.textContent = signoffPreviewState === 'pending'
2293
- ? 'Working out how many lines this may dismiss…'
2294
- : '';
2289
+ signoffTotal.textContent = '';
2290
+ if(signoffPreviewState === 'pending'){
2291
+ const spinner = document.createElement('span');
2292
+ spinner.className = 'signoff-spinner'; spinner.setAttribute('aria-hidden', 'true');
2293
+ signoffTotal.append(spinner, document.createTextNode('Working out how many lines this may dismiss…'));
2294
+ }
2295
2295
  }
2296
2296
 
2297
2297
  /** Approve is inert while the figure it is approving against has not arrived.
@@ -2306,9 +2306,30 @@ function setSignoffApproveGate(){
2306
2306
  if(waiting){
2307
2307
  signoffApprove.setAttribute('aria-disabled', 'true');
2308
2308
  signoffApprove.setAttribute('data-tip', 'Waiting for the count of what this read may dismiss.');
2309
+ signoffApprove.setAttribute('data-blocked-reason', 'Waiting for the count of what this read may dismiss.');
2309
2310
  } else {
2310
2311
  signoffApprove.removeAttribute('aria-disabled');
2311
2312
  signoffApprove.removeAttribute('data-tip');
2313
+ signoffApprove.removeAttribute('data-blocked-reason');
2314
+ }
2315
+ }
2316
+
2317
+ /** Keep the header Save command reachable for an explanation while the modal owns this attempt. */
2318
+ function setSignoffSaveGate(blocked){
2319
+ if(blocked){
2320
+ // The modal owns Save's explanation until it closes. Retire the underlying checkpoint cue first
2321
+ // so the header cannot simultaneously say "Ready" while this same command refuses activation.
2322
+ setRequiredSaveCue(false, false);
2323
+ saveBtn.setAttribute('aria-disabled', 'true');
2324
+ saveBtn.setAttribute('data-tip', 'Finish or close this exclusion review before saving again.');
2325
+ saveBtn.setAttribute('data-blocked-reason', 'Finish or close this exclusion review before saving again.');
2326
+ } else {
2327
+ saveBtn.removeAttribute('aria-disabled');
2328
+ saveBtn.removeAttribute('data-tip');
2329
+ saveBtn.removeAttribute('data-blocked-reason');
2330
+ // Recompute the header's underlying dirty/checkpoint explanation; the modal temporarily replaced
2331
+ // those same carriers, and merely removing its copy would silently discard the prior Save state.
2332
+ syncRequiredSaveCue();
2312
2333
  }
2313
2334
  }
2314
2335
 
@@ -2327,7 +2348,6 @@ function setSignoffApproveGate(){
2327
2348
  */
2328
2349
  async function runSignoffPreview(){
2329
2350
  const seq = ++signoffPreviewSeq;
2330
- let timer;
2331
2351
  try {
2332
2352
  signoffPreview = null;
2333
2353
  signoffPreviewState = 'pending';
@@ -2338,11 +2358,12 @@ async function runSignoffPreview(){
2338
2358
  const d = FACET_DIMS[dim];
2339
2359
  body[d.control] = ((F && F[d.control]) || []).map(row => ({ [d.rowKey]: row[d.rowKey], on: row.on === true }));
2340
2360
  }
2341
- const controller = new AbortController();
2342
- timer = setTimeout(() => controller.abort(), SIGNOFF_PREVIEW_TIMEOUT_MS);
2361
+ // Do not impose a browser deadline here. The server cannot cancel the synchronous whole-manifest
2362
+ // fold, so aborting only hides a result that is still being computed and makes a later click appear
2363
+ // to fix the save when it merely hits the cache warmed by the abandoned request.
2343
2364
  const res = await fetch(`/api/projects/${encodeURIComponent(PROJECT)}/revision-requests/${encodeURIComponent(revisionRequest)}/exclusion-preview`, {
2344
2365
  method: 'POST', headers: { 'content-type': 'application/json' },
2345
- body: JSON.stringify(body), signal: controller.signal,
2366
+ body: JSON.stringify(body),
2346
2367
  });
2347
2368
  if(!res.ok){
2348
2369
  // The server's own CODE, not just its status. Each preview refusal has a different recovery and
@@ -2367,8 +2388,6 @@ async function runSignoffPreview(){
2367
2388
  setSignoffApproveGate();
2368
2389
  } catch(e){
2369
2390
  failSignoffPreview(seq, e);
2370
- } finally {
2371
- clearTimeout(timer);
2372
2391
  }
2373
2392
  }
2374
2393
 
@@ -2433,6 +2452,7 @@ function openSignOff(values){
2433
2452
  signoffList.appendChild(section);
2434
2453
  }
2435
2454
  setSignoffMode(null);
2455
+ setSignoffSaveGate(true);
2436
2456
  coverSignoffBackground();
2437
2457
  signoffOverlay.hidden = false;
2438
2458
  // Cancel takes focus, not Approve: a stray Enter must not fire the consequential action before the
@@ -2452,7 +2472,9 @@ function closeSignOff(){
2452
2472
  signoffPreviewSeq += 1;
2453
2473
  signoffPreviewState = 'idle';
2454
2474
  signoffPreview = null;
2475
+ renderSignoffTotal();
2455
2476
  setSignoffApproveGate();
2477
+ setSignoffSaveGate(false);
2456
2478
  // A refusal is not resolved by dismissing its explanation. Leave the header carrying the state, as
2457
2479
  // a control that brings the explanation back — the same cyan "non-default, click to act" chip the
2458
2480
  // page already uses for a write conflict.
@@ -2506,7 +2528,9 @@ function retireSignOffForCheckpointChange(){
2506
2528
  signoffPreviewState = 'idle';
2507
2529
  signoffPreview = null;
2508
2530
  relayedRefusal = null;
2531
+ renderSignoffTotal();
2509
2532
  setSignoffApproveGate();
2533
+ setSignoffSaveGate(false);
2510
2534
  // A dismissed refusal is hidden but still checkpoint-owned: closeSignOff deliberately preserves
2511
2535
  // signoffOutcome so its status chip can reopen the explanation. A replacement must retire that state
2512
2536
  // too, without moving focus when no dialog is currently on screen.
@@ -2582,6 +2606,9 @@ async function beginSave(){
2582
2606
  // `!sel` (not just `!F`) for the same reason saveNow checks it — an empty state can carry a truthy
2583
2607
  // filter with nothing rendered.
2584
2608
  if(!C || !F || !sel) return;
2609
+ // The modal already owns this Save attempt. Save remains focusable for its blocked explanation, and
2610
+ // this guard closes its keyboard/programmatic activation so one slow count never becomes two requests.
2611
+ if(!signoffOverlay.hidden) return;
2585
2612
  if(conflicted){ showChangedBanner(); return; }
2586
2613
  applySelToFilter(F, sel, mode);
2587
2614
  // Only a revision read records an approval, and only when something is actually being dismissed.
@@ -681,9 +681,15 @@ export function createV2CommandSession(model, options = {}) {
681
681
  plan.memberObservations = clone(row.memberObservations || []);
682
682
  plan.frame = clone(row.frame || null);
683
683
  // Registration controls, restored by PRESENCE: an absent `datum_ref` says "this control point
684
- // is the model origin", so a missing key must delete rather than be skipped (#740).
684
+ // is the model origin", so a missing key must delete rather than be skipped (#740). An
685
+ // `undefined` VALUE is absent too (#1446): `memberEndSnapshot` maps `datum_ref: p.datum_ref`,
686
+ // so a plan with no datum control arrives as `{datum_ref: undefined}` — an own key with no
687
+ // value. Restoring that fabricates `datum_ref: undefined`, which the schema rejects
688
+ // (`expected object`), and the member-end extend that produced it then fails to load. The undo
689
+ // `snapshot()` has the same mapping but survives only because `JSON.stringify` drops the
690
+ // undefined key; treating undefined as absent here makes every producer safe.
685
691
  for (const key of ['datum_ref', 'control2_ref']) {
686
- if (Object.hasOwn(row, key)) plan[key] = clone(row[key]);
692
+ if (Object.hasOwn(row, key) && row[key] !== undefined) plan[key] = clone(row[key]);
687
693
  else delete plan[key];
688
694
  }
689
695
  }
@@ -148,7 +148,7 @@ export function chromeVisibility({ mode, activePane } = {}) {
148
148
  const active = resolveActivePane(m, activePane);
149
149
  const panes = panesShown(m);
150
150
  return {
151
- zoombar: panes.two, // 2D zoom slider — addresses the plan canvas
151
+ viewBar2d: panes.two, // #viewBar2d (Fit all / Zoom to selected) — addresses the plan canvas
152
152
  planCombo: panes.two, // plan switcher — chooses what the plan canvas shows
153
153
  m3dChrome: panes.three, // #m3dBar, #m3dCube, #m3dAxes — painted over the 3D canvas
154
154
  dim2d: active === '2d', // #dimB
@@ -77,6 +77,10 @@
77
77
  #state .spin{width:26px;height:26px;border:3px solid var(--line);border-top-color:var(--brand);border-radius:50%;animation:spin .8s linear infinite}
78
78
  @keyframes spin{to{transform:rotate(360deg)}}
79
79
  aside{width:244px;flex:none;background:var(--panel);border-left:1px solid var(--line);padding:12px;overflow:auto;display:flex;flex-direction:column;gap:14px}
80
+ /* The pane title, flush to the pane edges so it reads as the header and not one more section
81
+ (two levels: h2 pane, h3 sections); the -12px undoes the aside's own 12px padding, previous
82
+ line. Revit's .insp-head in this page's own tokens. */
83
+ aside h2{margin:-12px -12px 0;padding:12px 12px 9px;font-size:14px;font-weight:650;color:var(--text);border-bottom:1px solid var(--line)}
80
84
  aside h3{margin:0;font-size:10px;color:var(--mut);text-transform:uppercase;letter-spacing:.06em}
81
85
  .ck{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:6px;cursor:pointer;color:var(--text)}
82
86
  .ck:hover{background:var(--line)}
@@ -219,7 +223,8 @@
219
223
  </div>
220
224
  <div id="toast" role="status"><span id="toastMsg"></span><button class="ghost" id="undoBtn" data-command-id="vector.undo-delete">Undo</button></div>
221
225
  </div>
222
- <aside>
226
+ <aside aria-labelledby="asideTitle">
227
+ <h2 id="asideTitle">Properties</h2>
223
228
  <div>
224
229
  <h3>Show</h3>
225
230
  <label class="ck" data-command-id="vector.show-kind"><input type="checkbox" id="kLines" checked><span>Lines</span><span class="ct" id="cLines">0</span></label>
@@ -274,6 +274,11 @@
274
274
  const $app = document.getElementById('app');
275
275
  const $switch = document.getElementById('mode-switch');
276
276
  const $workflowTab = $switch.querySelector('button[data-mode="workflows"]');
277
+ const $workspaceTab = $switch.querySelector('button[data-mode="workspaces"]');
278
+ // The Workspaces tab's AUTHORED tooltip, captured from the markup so applyMode() can restore it
279
+ // verbatim whenever the tab is not the way out of an open project — project closed, or Workflows
280
+ // mode — and the markup stays the one place that sentence is written.
281
+ const WORKSPACE_TAB_TIP = $workspaceTab?.getAttribute('data-tip') || '';
277
282
  const $landing = document.getElementById('ws-landing');
278
283
  const $project = document.getElementById('ws-project');
279
284
  const $spine = document.getElementById('ws-spine');
@@ -337,6 +342,7 @@
337
342
  const $revisionFile = document.getElementById('ws-revision-file');
338
343
  const $sourcePlaceholder = document.getElementById('ws-source-placeholder'); // shown for a filter-less Source step
339
344
  const $revitSourceActions = document.getElementById('ws-source-actions');
345
+ const $revitOpenModel = document.getElementById('ws-revit-open-model');
340
346
  const $revitReplace = document.getElementById('ws-revit-replace');
341
347
  const $revitRetry = document.getElementById('ws-revit-retry');
342
348
  const $revitCancel = document.getElementById('ws-revit-cancel');
@@ -739,7 +745,7 @@
739
745
  const wsDefaultAppEntries = () => Object.entries(WORKSPACE_APPS)
740
746
  .filter(([, descriptor]) => descriptor.serverAuthorizedOnly !== true)
741
747
  .map(([id]) => ({ appId: id, templateId: id, ambiguous: false }));
742
- function installedWorkspaceAppEntries(apps, capabilities) {
748
+ function installedWorkspaceAppEntries(apps, capabilities, coreDefaults = 'ready') {
743
749
  // Group every installed app whose lineage root the client can render. A known descriptor plus a
744
750
  // live installed source is sufficient authority for today's first-party create cards; requiring
745
751
  // the lagging source flag as a third vote breaks partial updates (#362). Still call out a FLAGGED
@@ -766,6 +772,18 @@
766
772
  // its presentation entry even when authorization intentionally filtered it out of `apps`.
767
773
  if (!byRoot.has('revit-model')) byRoot.set('revit-model', ['revit-model']);
768
774
  }
775
+ // Keep the two built-in drawing actions visible when only one workflow is installed.
776
+ // /api/apps is authoritative about which canonical workflow is missing, so the card's
777
+ // click handler can explain the setup failure instead of silently removing the action.
778
+ const missingCoreRoots = new Set();
779
+ for (const root of ['steel-model', 'vectorize']) {
780
+ if (!byRoot.has(root)) {
781
+ byRoot.set(root, [root]);
782
+ // During bootstrap, one workflow may appear before its sibling finishes compiling.
783
+ // Keep the first-paint card neutral until provisioning reaches a terminal state.
784
+ if (['ready', 'failed', 'not-applicable'].includes(coreDefaults)) missingCoreRoots.add(root);
785
+ }
786
+ }
769
787
  return Object.keys(WORKSPACE_APPS).filter((root) => byRoot.has(root)).map((root) => {
770
788
  // Sorted, so which app a card targets is stable across loads rather than dependent on the
771
789
  // order `aware app list` happened to return. The canonical install wins when present: it is
@@ -777,10 +795,14 @@
777
795
  templateId: root,
778
796
  ambiguous: root === 'revit-model' ? false : ids.length > 1,
779
797
  ...(capabilityStatus ? { capabilityStatus } : {}),
798
+ ...(missingCoreRoots.has(root) ? { missing: true } : {}),
780
799
  };
781
800
  });
782
801
  }
783
802
  let wsAppEntries = wsDefaultAppEntries();
803
+ // Null means the installed catalogue has not been confirmed. A first-paint card can be clicked
804
+ // while /api/apps is still loading, but a confirmed missing workflow must stop before the picker.
805
+ let knownInstalledWorkspaceIds = null;
784
806
  let current = null; // the open project (null = landing)
785
807
 
786
808
  // One server-derived answer owns every approval-facing surface. Unknown/error states fail closed;
@@ -1080,6 +1102,15 @@
1080
1102
  b.classList.toggle('active', on);
1081
1103
  b.setAttribute('aria-selected', String(on));
1082
1104
  });
1105
+ // The tab's tooltip has to be true in both of its states. The authored one (WORKSPACE_TAB_TIP —
1106
+ // an invitation to open the module) describes it to someone outside it; inside a project the
1107
+ // same tab is the way OUT (see the click handler below), and a tooltip still inviting you in
1108
+ // would be false.
1109
+ if ($workspaceTab) {
1110
+ $workspaceTab.setAttribute('data-tip', ws && current
1111
+ ? 'Back to all projects — leaves this project for the project list.'
1112
+ : WORKSPACE_TAB_TIP);
1113
+ }
1083
1114
  $landing.hidden = !ws || !!current;
1084
1115
  $project.hidden = !ws || !current;
1085
1116
  $spine.hidden = !ws || !current;
@@ -1167,7 +1198,24 @@
1167
1198
  }
1168
1199
  $switch.addEventListener('click', (e) => {
1169
1200
  const b = e.target.closest('button[data-mode]');
1170
- if (b) setMode(b.dataset.mode);
1201
+ if (!b) return;
1202
+ // The ACTIVE tab doubles as "home" for its module: clicking Workspaces from inside a project
1203
+ // leaves it for the project list, the same as the ‹ button next to the project name — a small
1204
+ // control that is easy to miss next to a tab that looks like it should do it. Workflows keeps
1205
+ // the no-op: it has no landing to go home TO yet, and would get the same treatment once it
1206
+ // does. The Ctrl+1/2 shortcuts stay pure mode switches on purpose: a key that silently closes
1207
+ // the project you are in is a surprise, the button is the deliberate affordance.
1208
+ // (`closeProject`, not `setMode`: setMode never clears `current`.)
1209
+ //
1210
+ // One exception: while a Workflows switch is still pending (the "Opening Workflows…" spinner,
1211
+ // `#mode-switch` busy — see setMode above), the still-selected Workspaces tab is the CANCEL and
1212
+ // must keep reaching setMode, whose sequence bump discards the resolving read. `mode` is only
1213
+ // written once that read lands, so without this check the home branch would read "active tab,
1214
+ // project open" for the whole pending window and close the project the user asked to stay in —
1215
+ // and the read would then drop them in Workflows anyway.
1216
+ const pending = $switch.getAttribute('aria-busy') === 'true';
1217
+ if (!pending && b.dataset.mode === 'workspaces' && mode === 'workspaces' && current) { closeProject(); return; }
1218
+ setMode(b.dataset.mode);
1171
1219
  });
1172
1220
  document.addEventListener('keydown', (e) => {
1173
1221
  if (!(e.ctrlKey || e.metaKey) || e.altKey || e.shiftKey) return;
@@ -1200,6 +1248,14 @@
1200
1248
  async function loadProjects(opts) {
1201
1249
  const seq = ++projectsLoadSeq;
1202
1250
  const stale = () => seq !== projectsLoadSeq;
1251
+ const deferIfBusy = () => {
1252
+ if (!opts?.deferWhenBusy || !landingBusy()) return false;
1253
+ // An apps-changed refresh may start while a dialog is still closed, then finish after
1254
+ // it opens. Requeue the event before replacing the opener or adopting unseen cards.
1255
+ clearTimeout(appsChangedTimer);
1256
+ appsChangedTimer = setTimeout(appsChangedRefresh, 250);
1257
+ return true;
1258
+ };
1203
1259
  // Surface a real failure — never present a server/network error as an empty workspace
1204
1260
  // (the empty-state CTA would be a lie: "no projects yet" when the truth is "load failed").
1205
1261
  try {
@@ -1220,6 +1276,7 @@
1220
1276
  // secondary concern (a collapsed Trash disclosure) but it was measured at 0.31-0.83 s normally
1221
1277
  // and 5.6 s under load, and holding the first paint behind it made it the only remaining source
1222
1278
  // of a blank landing. The repaint below adds the Archived section when it arrives.
1279
+ if (deferIfBusy()) return;
1223
1280
  renderLanding();
1224
1281
  // Archived ("Trash") list — never let its failure blank the main workspace, but don't swallow it
1225
1282
  // silently either: warn so a broken archive listing is diagnosable (a bare catch here would hide
@@ -1240,7 +1297,10 @@
1240
1297
  archived = [];
1241
1298
  console.warn('[workspaces] archived list failed to load: ' + (err && err.message || err));
1242
1299
  }
1243
- if (archivedSig(archived) !== archivedBefore) renderLanding();
1300
+ if (archivedSig(archived) !== archivedBefore) {
1301
+ if (deferIfBusy()) return;
1302
+ renderLanding();
1303
+ }
1244
1304
  // Which workspace apps to offer a create card for: installed apps whose LINEAGE ROOT we know how
1245
1305
  // to render (have a WORKSPACE_APPS descriptor). Matching on the root, not the raw id, keeps cards
1246
1306
  // alive across rename/duplicate. Do not narrow on the installed source's `workspace` flag: an
@@ -1249,20 +1309,31 @@
1249
1309
  // Keep descriptor order for a stable card order. A load failure RE-WIDENS the entries to the
1250
1310
  // descriptor keys (the catch assigns them): still usable, and a card for something uninstalled is
1251
1311
  // refused by the server on click.
1252
- const cardsSig = (entries) => entries.map((e) => `${e.appId}>${e.templateId}${e.ambiguous ? '?' : ''}:${e.capabilityStatus || ''}`).join(',');
1312
+ const cardsSig = (entries) => entries.map((e) => `${e.appId}>${e.templateId}${e.ambiguous ? '?' : ''}:${e.capabilityStatus || ''}:${e.missing ? 'missing' : ''}`).join(',');
1253
1313
  const cardsBefore = cardsSig(wsAppEntries);
1314
+ let coreDefaults = null;
1254
1315
  try {
1255
- const { apps, workspaceCapabilities } = await api('/api/apps');
1316
+ const catalogue = await api('/api/apps');
1256
1317
  if (stale()) return;
1257
- wsAppEntries = installedWorkspaceAppEntries(apps, workspaceCapabilities);
1318
+ if (deferIfBusy()) return;
1319
+ const { apps, workspaceCapabilities } = catalogue;
1320
+ coreDefaults = catalogue.coreDefaults;
1321
+ knownInstalledWorkspaceIds = new Set((apps || []).map((app) => app.id));
1322
+ wsAppEntries = installedWorkspaceAppEntries(apps, workspaceCapabilities, coreDefaults);
1323
+ if (coreDefaults === 'idle' || coreDefaults === 'provisioning') knownInstalledWorkspaceIds = null;
1258
1324
  // Hardening: /api/apps loaded but reported NONE of our known installed workspace apps (a
1259
1325
  // transient empty/read blip). Rather than render zero create cards, fall back to the descriptor
1260
1326
  // keys — the same usable default a full /api/apps failure lands on.
1261
- if (wsAppEntries.length === 0 && Object.keys(WORKSPACE_APPS).length > 0) {
1327
+ if ((apps || []).length === 0 && (workspaceCapabilities || []).length === 0 && coreDefaults !== 'failed' && Object.keys(WORKSPACE_APPS).length > 0) {
1328
+ // A transient empty catalogue cannot prove the fallback workflows are absent.
1329
+ // Let the picker continue; the project POST still reports a real missing workflow.
1330
+ knownInstalledWorkspaceIds = null;
1262
1331
  wsAppEntries = wsDefaultAppEntries();
1263
1332
  }
1264
1333
  } catch {
1265
1334
  if (stale()) return;
1335
+ if (deferIfBusy()) return;
1336
+ knownInstalledWorkspaceIds = null;
1266
1337
  // /api/apps failed — fall back to the descriptor keys so the create cards still work.
1267
1338
  wsAppEntries = wsDefaultAppEntries();
1268
1339
  }
@@ -1276,10 +1347,22 @@
1276
1347
  // than the one it acts on. It targets by id so nothing acts on the wrong row, but it reads as
1277
1348
  // if it does. Close it first.
1278
1349
  closeProjMenu();
1350
+ if (deferIfBusy()) return;
1279
1351
  renderLanding();
1280
1352
  }
1281
1353
  }
1282
1354
 
1355
+ function missingWorkspaceWorkflowMessage(templateId) {
1356
+ const action = templateId === 'vectorize' ? 'Trace a drawing'
1357
+ : templateId === 'steel-model' ? 'Steel model from drawings'
1358
+ : templateId === 'revit-model' ? 'Revit model' : 'This project';
1359
+ return `${action} isn’t ready because its workflow is missing. Restart FloLess and try again. If it’s still missing, use Report an issue.`;
1360
+ }
1361
+
1362
+ function workspaceWorkflowKnownMissing(appId) {
1363
+ return knownInstalledWorkspaceIds !== null && !knownInstalledWorkspaceIds.has(appId);
1364
+ }
1365
+
1283
1366
  // A workflow was renamed, duplicated, imported or deleted — here, in another tab, or by the terminal
1284
1367
  // AI. aware.js relays the `apps-changed` SSE as a DOM event (the same seam as floless:render-progress:
1285
1368
  // a relay, not a wider bridge, since this is the only listener). Without it the landing kept showing
@@ -1326,7 +1409,7 @@
1326
1409
  closeProjMenu();
1327
1410
  // `quiet`: the user did not ask for this load, so a surprise failure toast would be noise. A real
1328
1411
  // failure still shows — renderLanding() paints the error banner from projectsLoadError.
1329
- loadProjects({ quiet: true }).catch((err) => {
1412
+ loadProjects({ quiet: true, deferWhenBusy: true }).catch((err) => {
1330
1413
  // loadProjects swallows API failures itself, so reaching here means the RENDER threw. Nothing to
1331
1414
  // restore (no control was put into a pending state), but never swallow it silently.
1332
1415
  console.error('[workspaces] apps-changed refresh failed to render: ' + ((err && err.message) || err));
@@ -1752,6 +1835,21 @@
1752
1835
  }
1753
1836
 
1754
1837
  function workspaceCreateCardHtml(entry, action) {
1838
+ if (entry.missing === true) {
1839
+ const descriptionId = `ws-${entry.templateId}-missing`;
1840
+ const buttonStart = entry.templateId === 'vectorize'
1841
+ ? `<button type="button" class="ws-seed ws-seed-remedy" data-command-id="shell.project-trace-missing-workflow" `
1842
+ : `<button type="button" class="ws-seed ws-seed-remedy" data-command-id="shell.project-steel-missing-workflow" `;
1843
+ return buttonStart +
1844
+ `aria-label="${escapeAttr(`${action.headline} needs setup — why unavailable`)}" aria-describedby="${escapeAttr(descriptionId)}" ` +
1845
+ `data-seed-app="${escapeAttr(entry.appId)}" data-seed-template="${escapeAttr(entry.templateId)}" data-seed-action="${escapeAttr(action.kind)}">` +
1846
+ `<span class="plus" aria-hidden="true">!</span>` +
1847
+ `<span class="ws-seed-headline">${escapeHtml(action.headline)}</span>` +
1848
+ `<span class="ws-seed-capability ws-seed-state">Needs setup</span>` +
1849
+ `<span class="ws-seed-sub" id="${escapeAttr(descriptionId)}">${escapeHtml(missingWorkspaceWorkflowMessage(entry.templateId))}</span>` +
1850
+ `<span class="ws-seed-action">Why unavailable →</span>` +
1851
+ `</button>`;
1852
+ }
1755
1853
  if (entry.templateId === 'revit-model' && entry.capabilityStatus && entry.capabilityStatus !== 'ready') {
1756
1854
  const states = {
1757
1855
  'access-required': {
@@ -1783,7 +1881,7 @@
1783
1881
  const descriptionId = `ws-revit-${entry.capabilityStatus || 'check-unavailable'}`;
1784
1882
  return `<button type="button" class="ws-seed ws-seed-remedy" ` +
1785
1883
  `aria-label="${escapeAttr(state.aria)}" aria-describedby="${escapeAttr(descriptionId)}" ` +
1786
- `data-revit-remedy="${escapeAttr(entry.capabilityStatus || 'check-unavailable')}">` +
1884
+ `data-command-id="shell.revit-view-access" data-revit-remedy="${escapeAttr(entry.capabilityStatus || 'check-unavailable')}">` +
1787
1885
  `<span class="plus" aria-hidden="true">R</span>` +
1788
1886
  `<span class="ws-seed-headline">Revit model</span>` +
1789
1887
  `<span class="ws-seed-capability ws-seed-state">${escapeHtml(state.status)}</span>` +
@@ -1792,6 +1890,10 @@
1792
1890
  `</button>`;
1793
1891
  }
1794
1892
  const acceptsDrop = action.kind === 'drawing' || action.kind === 'rvt';
1893
+ const createCommand = action.kind !== 'drawing' ? ''
1894
+ : entry.templateId === 'steel-model' ? 'data-command-id="shell.project-create-steel-from-drawings" '
1895
+ : entry.templateId === 'vectorize' ? 'data-command-id="shell.project-create-trace-from-drawing" '
1896
+ : '';
1795
1897
  // Name the target workflow ONLY when the root has more than one live app behind it, so the
1796
1898
  // ordinary card stays clean and the extra line means something wherever it does appear. It
1797
1899
  // must also go on the aria-label: the button's own aria-label REPLACES the accessible name
@@ -1799,6 +1901,7 @@
1799
1901
  const target = entry.ambiguous ? entry.appId : '';
1800
1902
  return `<button type="button" class="ws-seed${acceptsDrop ? ' ws-seed-drop' : ''}" ` +
1801
1903
  `aria-label="${escapeAttr((action.label || action.headline) + (target ? ` (on the ${target} workflow)` : ''))}" ` +
1904
+ createCommand +
1802
1905
  (action.tip ? `data-tip="${escapeAttr(action.tip)}" ` : '') +
1803
1906
  `data-seed-app="${escapeAttr(entry.appId)}" data-seed-template="${escapeAttr(entry.templateId)}" data-seed-action="${escapeAttr(action.kind)}"` +
1804
1907
  (acceptsDrop ? ` data-seed-drop="${escapeAttr(entry.appId)}" data-seed-drop-kind="${escapeAttr(action.kind)}"` : '') +
@@ -2119,8 +2222,19 @@
2119
2222
  // check stays a check rather than an assumption: a future kind must declare its own branch,
2120
2223
  // not silently inherit the file picker.
2121
2224
  if (seed.dataset.seedAction === 'drawing') {
2122
- const files = await pickDrawingFiles($seedFile); // drop-a-drawing: open the picker
2123
- if (files.length) createFromDrawing(appId, templateId, files);
2225
+ if (workspaceWorkflowKnownMissing(appId)) {
2226
+ showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
2227
+ return;
2228
+ }
2229
+ let files;
2230
+ try { files = await pickDrawingFiles($seedFile); } // keep native picker in the click activation
2231
+ catch { showToast('Couldn’t open the drawing picker. Try again.', 'warn'); return; }
2232
+ if (!files.length) return;
2233
+ if (workspaceWorkflowKnownMissing(appId)) {
2234
+ showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
2235
+ return;
2236
+ }
2237
+ createFromDrawing(appId, templateId, files);
2124
2238
  } else if (seed.dataset.seedAction === 'rvt') {
2125
2239
  const file = await pickRvtFile($seedRvt);
2126
2240
  if (file) createFromRvt(appId, templateId, file);
@@ -2158,6 +2272,7 @@
2158
2272
  const $seedRvt = document.createElement('input');
2159
2273
  $seedRvt.type = 'file'; $seedRvt.accept = '.rvt,application/x-rvt'; $seedRvt.hidden = true;
2160
2274
  document.body.appendChild($seedRvt);
2275
+ $revitOpenModel?.addEventListener('click', () => setStep('model'));
2161
2276
  $revitReplace?.addEventListener('click', async () => {
2162
2277
  const project = current;
2163
2278
  if (!project) return;
@@ -2236,7 +2351,12 @@
2236
2351
  if (zone.dataset.seedDropKind === 'rvt') {
2237
2352
  if (files.length === 1 && /\.rvt$/i.test(files[0].name)) createFromRvt(zone.dataset.seedDrop, zone.dataset.seedTemplate || zone.dataset.seedDrop, files[0]);
2238
2353
  else showToast('Choose one Revit .rvt file.', 'warn');
2239
- } else if (files.length) createFromDrawing(zone.dataset.seedDrop, zone.dataset.seedTemplate || zone.dataset.seedDrop, files);
2354
+ } else if (files.length) {
2355
+ const appId = zone.dataset.seedDrop;
2356
+ const templateId = zone.dataset.seedTemplate || appId;
2357
+ if (workspaceWorkflowKnownMissing(appId)) showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
2358
+ else createFromDrawing(appId, templateId, files);
2359
+ }
2240
2360
  });
2241
2361
 
2242
2362
  async function promptName(title, label, value) {
@@ -2333,6 +2453,7 @@
2333
2453
  function projectSetupErrorMessage(error) {
2334
2454
  const raw = String(error && error.body?.error || error && error.message || error || '');
2335
2455
  const code = String(error && (error.code || error.body?.code) || '');
2456
+ if (code === 'not-installed') return missingWorkspaceWorkflowMessage(projectSetupState?.templateId);
2336
2457
  if (code === 'chat-provider-unavailable' || /sign in|provider .* unavailable|chat providers are not configured/i.test(raw)) {
2337
2458
  return 'Sign in to Claude or Codex before starting this project in AI Chat. You can still create the project only.';
2338
2459
  }
@@ -2664,14 +2785,21 @@
2664
2785
  if (detailNode) detailNode.textContent = detail;
2665
2786
  }
2666
2787
 
2788
+ // mode: 'active' (import running) | 'imported' (this import just landed — offer to open it) |
2789
+ // 'ready' (steady state / cancelled) | 'failed'.
2667
2790
  function paintRevitSourceActions(mode, canReplace = true, canRetry = true) {
2668
2791
  if (!$revitSourceActions) return;
2669
- $revitSourceActions.hidden = !canReplace && mode !== 'active' && !(mode === 'failed' && canRetry);
2792
+ $revitOpenModel.hidden = mode !== 'imported';
2670
2793
  $revitReplace.hidden = mode === 'active' || !canReplace;
2671
2794
  $revitRetry.hidden = mode !== 'failed' || !canRetry;
2672
2795
  $revitCancel.hidden = mode !== 'active';
2796
+ $revitSourceActions.hidden = [$revitOpenModel, $revitReplace, $revitRetry, $revitCancel].every((b) => b.hidden);
2673
2797
  $revitReassure.hidden = mode !== 'active';
2674
- $sourcePlaceholder?.toggleAttribute('aria-busy', mode === 'active');
2798
+ // The spinner's hook is deliberately NOT aria-busy. This element IS the live region below, and
2799
+ // pollRevitImport narrates the import through it by rewriting the title and detail; marking a
2800
+ // live region busy tells assistive tech to withhold exactly those updates, so the change that
2801
+ // gives sighted users a spinner would have taken the running commentary away from everyone else.
2802
+ $sourcePlaceholder?.setAttribute('data-importing', String(mode === 'active'));
2675
2803
  $sourcePlaceholder?.setAttribute('role', mode === 'failed' ? 'alert' : 'status');
2676
2804
  $sourcePlaceholder?.setAttribute('aria-live', mode === 'failed' ? 'assertive' : 'polite');
2677
2805
  $sourcePlaceholder?.setAttribute('aria-atomic', 'true');
@@ -2761,8 +2889,8 @@
2761
2889
  if (copy) { paintRevitSourceState(copy[0], copy[1]); continue; }
2762
2890
  if (operation.state === 'ready') {
2763
2891
  revitActiveOperation = null;
2764
- paintRevitSourceState('Model ready to review', 'The model is available on the Model tab. It is not approved yet.');
2765
- paintRevitSourceActions('ready', true);
2892
+ paintRevitSourceState('Model ready to review', 'Imported as a draft — not approved yet.');
2893
+ paintRevitSourceActions('imported', true);
2766
2894
  // A Model tab opened during conversion has already loaded its temporary "unavailable" state.
2767
2895
  // Invalidate that frame now: reload immediately when visible, or on the next tab activation.
2768
2896
  reloadModelFromServerTruth();
@@ -2875,6 +3003,12 @@
2875
3003
  paintRevitSourceState('Revit source', 'Checking the current RVT and import state…');
2876
3004
  paintRevitSourceActions('ready', false);
2877
3005
  void refreshRevitSourceState(p.id);
3006
+ } else {
3007
+ // This pane is shared with the apps that have no filter step (vectorize), and only the branch
3008
+ // above ever repaints it. Without this reset, opening one of those straight after a Revit
3009
+ // import leaves Revit's controls sitting on it — a spinner, an Open Model tab and a Cancel
3010
+ // import that would act on the OTHER project's operation.
3011
+ paintRevitSourceActions('ready', false);
2878
3012
  }
2879
3013
  if (d.filter && ['model', 'exports', 'history'].includes(initialStep)) {
2880
3014
  pendingPresenceStep = { projectId: p.id, step: initialStep };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.139.0",
3
+ "version": "0.140.0",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {
@@ -39,6 +39,7 @@
39
39
  "verify:forward-merge": "node build/verify-forward-merge.mjs",
40
40
  "verify:no-title": "node build/verify-no-title.mjs",
41
41
  "verify:runtime-pins": "node build/verify-runtime-pins.mjs",
42
+ "verify:rvt-registry-pins": "node build/verify-rvt-registry-pins.mjs",
42
43
  "verify:native-steel": "node build/verify-native-steel.mjs",
43
44
  "verify:no-native-select": "node build/verify-no-native-select.mjs",
44
45
  "verify:scrollbars": "node build/verify-scrollbars.mjs",