@floless/app 0.148.0 → 0.148.1

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.
package/dist/web/aware.js CHANGED
@@ -12507,9 +12507,17 @@
12507
12507
  const epoch = (completeReportDiscoveryEpoch.get(id) || 0) + 1;
12508
12508
  completeReportDiscoveryEpoch.set(id, epoch);
12509
12509
  const previous = completeReportDiscovery.get(id);
12510
- completeReportDiscovery.set(id, { checking: true });
12511
- if ($routinesModal.classList.contains('show')) renderRoutinesList();
12510
+ // A row already saying "being prepared" keeps saying it while it asks again (no flicker).
12511
+ if (!previous?.starting) {
12512
+ completeReportDiscovery.set(id, { checking: true });
12513
+ if ($routinesModal.classList.contains('show')) renderRoutinesList();
12514
+ }
12512
12515
  try {
12516
+ const starting = await savedReportsStillStarting();
12517
+ if (starting) {
12518
+ if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
12519
+ return noteReportStillStarting(id, epoch, previous, starting === 'paused');
12520
+ }
12513
12521
  const canHttpBootstrap = await ensureReportDiscoverySession();
12514
12522
  let result;
12515
12523
  try { result = await api(`/api/routines/${encodeURIComponent(id)}/complete-report`); }
@@ -12531,6 +12539,12 @@
12531
12539
  return result;
12532
12540
  } catch (error) {
12533
12541
  if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
12542
+ if (error.body?.code === 'model-report-recovery-pending') {
12543
+ // Reports were paused again after start-up (a later check failed): same neutral, self-retrying
12544
+ // row, and the cached report stays — "not ready yet" is not evidence that it is gone.
12545
+ reportsMaybeStarting = true;
12546
+ return noteReportStillStarting(id, epoch, previous, true);
12547
+ }
12534
12548
  const message = error.status === 401 ? 'Sign in again to view saved reports.'
12535
12549
  : 'Could not check this report. Check your access and try again.';
12536
12550
  completeReportDiscovery.set(id, { error: message });
@@ -12547,6 +12561,51 @@
12547
12561
  return null;
12548
12562
  }
12549
12563
 
12564
+ // Saved model reports are verified AFTER the server starts listening (#1826), so for a while after
12565
+ // FloLess starts, report discovery is not ready yet. That is a normal state, not an access problem:
12566
+ // a routine's row says so in neutral words and asks again on its own.
12567
+ const REPORT_STARTING_NOTE = 'Getting your saved report ready… This updates on its own.';
12568
+ const REPORT_STARTING_STUCK_NOTE = 'Your saved report is still being prepared. FloLess keeps checking; if this does not clear, use Report an issue.';
12569
+ const REPORT_STARTING_STUCK_AFTER_MS = 10 * 60 * 1000;
12570
+ // True until /api/health says saved reports are ready. While it may be false we ask health first, so
12571
+ // a page opened during start-up never sends a discovery request that would only be refused.
12572
+ let reportsMaybeStarting = true;
12573
+
12574
+ /** null when saved reports are ready (or health cannot say); otherwise 'checking' or 'paused'. */
12575
+ async function savedReportsStillStarting() {
12576
+ if (!reportsMaybeStarting) return null;
12577
+ try {
12578
+ const response = await fetch('/api/health', { cache: 'no-store' });
12579
+ if (!response.ok) return null;
12580
+ const state = (await response.json())?.startup?.reports;
12581
+ // An older server has no startup field: it only ever answers once reports are ready.
12582
+ if (state === undefined || state === 'ready') { reportsMaybeStarting = false; return null; }
12583
+ return state === 'paused' ? 'paused' : 'checking';
12584
+ } catch { return null; } // the discovery request below then reports any real problem
12585
+ }
12586
+
12587
+ /** Show the neutral "being prepared" row and ask again later; superseded by any newer refresh. */
12588
+ function noteReportStillStarting(id, epoch, previous, paused) {
12589
+ const attempts = previous?.starting ? previous.attempts + 1 : 0;
12590
+ const startingSince = previous?.starting ? previous.startingSince : Date.now();
12591
+ // "paused" means the server already knows a check failed and is retrying: say so at once.
12592
+ const stuck = paused || Date.now() - startingSince > REPORT_STARTING_STUCK_AFTER_MS;
12593
+ const next = { starting: true, attempts, startingSince, note: stuck ? REPORT_STARTING_STUCK_NOTE : REPORT_STARTING_NOTE };
12594
+ completeReportDiscovery.set(id, next);
12595
+ // Repaint only when what the row says changes, so a screen reader is not told the same thing again
12596
+ // on every retry.
12597
+ if ($routinesModal.classList.contains('show') && previous?.note !== next.note) renderRoutinesList();
12598
+ // Ask again only while the Routines list is open. Closed, nothing shows the row; reopening it, the
12599
+ // server's "reports ready" broadcast, and View report all check again anyway.
12600
+ const delay = Math.min(5000 * 2 ** attempts, 30_000);
12601
+ setTimeout(() => {
12602
+ if (completeReportDiscoveryEpoch.get(id) === epoch && $routinesModal.classList.contains('show')) {
12603
+ void refreshRoutineReportDiscovery(id);
12604
+ }
12605
+ }, delay);
12606
+ return next;
12607
+ }
12608
+
12550
12609
  async function viewScheduledCompleteReport(id) {
12551
12610
  const r = routinesData.find((item) => item.id === id);
12552
12611
  if (!isCompleteReportRoutine(r)) return;
@@ -12554,6 +12613,10 @@
12554
12613
  if (currentId !== r.workflow) return;
12555
12614
  // Recheck at the moment of opening; a cached handle is never an authorization grant.
12556
12615
  const state = await refreshRoutineReportDiscovery(id);
12616
+ if (state?.starting) {
12617
+ showToast('Your saved report is still being prepared. It will be ready in a moment.', 'info');
12618
+ return;
12619
+ }
12557
12620
  if (!state?.report) {
12558
12621
  showToast('This saved report is no longer available. Check your access or run the routine again.', 'warn');
12559
12622
  return;
@@ -12984,7 +13047,9 @@
12984
13047
  const isTrigger = r.kind === 'trigger';
12985
13048
  const isCompleteReport = isCompleteReportRoutine(r);
12986
13049
  const discovery = isCompleteReport ? completeReportDiscovery.get(r.id) : null;
12987
- const reportLine = !isCompleteReport ? '' : discovery?.checking
13050
+ const reportLine = !isCompleteReport ? '' : discovery?.starting
13051
+ ? `<div class="rtn-report-note" role="status">${escapeHtml(discovery.note)}</div>`
13052
+ : discovery?.checking
12988
13053
  ? '<div class="rtn-report-note">Checking saved report access…</div>'
12989
13054
  : discovery?.error
12990
13055
  ? `<div class="rtn-report-note warn" role="status">${escapeHtml(discovery.error)}</div>`
@@ -46,7 +46,6 @@ function syncHostTheme() {
46
46
  syncHostTheme();
47
47
  window.addEventListener('storage', (event) => { if (event.key === hostThemeKey) syncHostTheme(); });
48
48
  const modelProduct = isTeklaParser ? 'Tekla Parser' : 'Revit Parser';
49
- const sourceProduct = isTeklaParser ? 'Tekla' : 'Revit';
50
49
  const commandPrefix = isTeklaParser ? 'tekla-parser' : 'revit';
51
50
  // AI Chat names this viewer's objects as this model's (#1653): the pill, the card and the chat model's links.
52
51
  const subjectSource = isTeklaParser ? 'tekla-parser' : 'revit';
@@ -13171,9 +13171,10 @@
13171
13171
  }
13172
13172
  } catch (err) {
13173
13173
  finishProgress();
13174
- showToast(action === 'duplicate'
13174
+ const inUse = projectFolderInUseMessage(err);
13175
+ showToast(inUse || (action === 'duplicate'
13175
13176
  ? 'Duplicate failed: ' + (err && err.message || err)
13176
- : 'Action failed: ' + (err && err.message || err), 'warn');
13177
+ : 'Action failed: ' + (err && err.message || err)), 'warn', inUse ? { persistent: true } : undefined);
13177
13178
  }
13178
13179
  finally { finishProgress(); projActionBusy = false; }
13179
13180
  loadProjects();
@@ -13340,6 +13341,18 @@
13340
13341
  } finally { finishProgress(); }
13341
13342
  }
13342
13343
 
13344
+ // #1719: when another program has a file open inside the project folder, Windows refuses to move or
13345
+ // remove it. The server answers with a complete plain-English sentence (what happened, why, what to do),
13346
+ // so it is shown as-is instead of under a generic "Action failed:" prefix or a "could not save" guess.
13347
+ // It carries the only next step, so it stays until dismissed rather than fading after 5 s.
13348
+ function projectFolderInUseMessage(err) {
13349
+ return err && err.body && err.body.code === 'project-folder-in-use' && err.message ? err.message : '';
13350
+ }
13351
+ function showFolderActionFailure(err, fallback) {
13352
+ const inUse = projectFolderInUseMessage(err);
13353
+ showToast(inUse || fallback, 'warn', inUse ? { persistent: true } : undefined);
13354
+ }
13355
+
13343
13356
  // Restore an archived project to the live grid (the inverse of Archive). Fully reversible — Archive
13344
13357
  // puts it right back — so no confirm: a toast is consistent with how Rename/Duplicate/Archive confirm.
13345
13358
  async function unarchiveProject(id) {
@@ -13347,7 +13360,7 @@
13347
13360
  try {
13348
13361
  await api(`/api/projects/${encodeURIComponent(id)}/unarchive`, { method: 'POST', body: '{}' });
13349
13362
  showToast(`Restored${p ? ` “${p.name}”` : ''}`, 'ok');
13350
- } catch (err) { showToast('We couldn’t restore that item because FloLess could not save the change. Try again.', 'warn'); }
13363
+ } catch (err) { showFolderActionFailure(err, 'We couldn’t restore that item because FloLess could not save the change. Try again.'); }
13351
13364
  loadProjects();
13352
13365
  }
13353
13366
 
@@ -13368,7 +13381,7 @@
13368
13381
  try {
13369
13382
  await api(`/api/projects/${encodeURIComponent(id)}/archived`, { method: 'DELETE' });
13370
13383
  showToast(`Deleted “${name}”`, 'ok');
13371
- } catch (err) { showToast('We couldn’t delete that item because FloLess could not save the change. Try again.', 'warn'); }
13384
+ } catch (err) { showFolderActionFailure(err, 'We couldn’t delete that item because FloLess could not save the change. Try again.'); }
13372
13385
  loadProjects();
13373
13386
  }
13374
13387
 
@@ -3,7 +3,14 @@ import { DISTRIBUTION_PROFILES } from './distribution-profile.mjs';
3
3
  const normalize = (value) => String(value).replace(/\//g, '\\').replace(/\\+$/g, '').toLowerCase();
4
4
  const resource = (kind, name, claim, details = {}) => Object.freeze({ kind, name, claim, ...details });
5
5
 
6
- /** Closed, version-controlled inventory used by builders and both future oracles. */
6
+ /**
7
+ * Closed, version-controlled projection of one distribution profile. The storage roots and registry
8
+ * keys it claims are per USER (%LOCALAPPDATA%, %USERPROFILE%, HKCU); the loopback port and the named
9
+ * pipe are machine-wide, which is why two profiles cannot hold them at once; the lifecycle mutex is
10
+ * `Local\`-prefixed and so per session. The cloud origins and the child-process environment are
11
+ * shared configuration rather than owned resources — `findDistributionResourceCollisions` exempts
12
+ * both kinds for that reason.
13
+ */
7
14
  export function projectDistributionResources(profile) {
8
15
  const id = profile.identity;
9
16
  const root = profile.storage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.148.0",
3
+ "version": "0.148.1",
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": {