@floless/app 0.155.2 → 0.156.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 (38) hide show
  1. package/cli-actions.mjs +376 -0
  2. package/dist/floless-server.cjs +100135 -86559
  3. package/dist/skills/floless-app-actions/SKILL.md +137 -0
  4. package/dist/skills/floless-app-approval/SKILL.md +8 -5
  5. package/dist/skills/floless-app-bridge/SKILL.md +12 -9
  6. package/dist/skills/floless-app-knowledge/SKILL.md +30 -13
  7. package/dist/skills/floless-app-new-workflow/SKILL.md +4 -4
  8. package/dist/skills/floless-app-onboarding/SKILL.md +1 -1
  9. package/dist/skills/floless-app-onboarding/references/aware-runtime.md +4 -4
  10. package/dist/skills/floless-app-queue/SKILL.md +10 -6
  11. package/dist/skills/floless-app-report-issue/SKILL.md +13 -10
  12. package/dist/skills/floless-app-rfi/SKILL.md +59 -68
  13. package/dist/skills/floless-app-routines/SKILL.md +19 -14
  14. package/dist/skills/floless-app-routines/references/routines-api.md +8 -2
  15. package/dist/skills/floless-app-workflows/SKILL.md +5 -4
  16. package/dist/web/agent-steps.js +933 -0
  17. package/dist/web/agents.js +5 -0
  18. package/dist/web/app.css +205 -3
  19. package/dist/web/app.js +1 -0
  20. package/dist/web/aware.js +584 -44
  21. package/dist/web/chat.css +9 -0
  22. package/dist/web/chat.js +195 -13
  23. package/dist/web/commands-shell.js +288 -1
  24. package/dist/web/index.html +52 -1
  25. package/dist/web/instructor.js +4 -2
  26. package/dist/web/leave-guard.js +4 -2
  27. package/dist/web/left-pane.js +8 -3
  28. package/dist/web/model-revit-module.js +15 -0
  29. package/dist/web/model-viewport-revit-adapter.js +3 -1
  30. package/dist/web/pages.js +27 -3
  31. package/dist/web/panels.js +3 -3
  32. package/dist/web/project-reconciliation.js +357 -0
  33. package/dist/web/revit-editor.js +116 -27
  34. package/dist/web/terminal-requests.js +541 -0
  35. package/dist/web/tool-updates.js +147 -13
  36. package/dist/web/workspaces.js +213 -12
  37. package/launch.mjs +80 -2
  38. package/package.json +1 -1
@@ -981,6 +981,15 @@
981
981
  if (saved === 'workspaces' || saved === 'agents') mode = saved;
982
982
  } catch { /* private mode */ }
983
983
  let projects = [];
984
+ const registeredRows = new Map();
985
+ const registeredCards = new Map();
986
+ const registeredPickerRows = new Map();
987
+ const metadataRefreshes = new Map();
988
+ function indexRegisteredRows() {
989
+ registeredRows.clear();
990
+ for (const row of projects) if (row.registrationId) registeredRows.set(row.registrationId, row);
991
+ for (const row of archived) if (row.registrationId) registeredRows.set(row.registrationId, row);
992
+ }
984
993
  let projectsLoadError = null; // last /api/projects failure reason, or null — an empty list means
985
994
  // "none yet" ONLY when this is null (see the empty state in renderLanding)
986
995
  let archived = []; // archived projects (the "Trash") — listed under a collapsed section on the landing
@@ -1604,6 +1613,7 @@
1604
1613
  const res = await api('/api/projects');
1605
1614
  if (stale()) return;
1606
1615
  projects = res.projects;
1616
+ indexRegisteredRows();
1607
1617
  projectsLoadError = null;
1608
1618
  } catch (err) {
1609
1619
  if (stale()) return;
@@ -1634,6 +1644,7 @@
1634
1644
  const res = await api('/api/projects/archived');
1635
1645
  if (stale()) return;
1636
1646
  archived = res.projects;
1647
+ indexRegisteredRows();
1637
1648
  } catch (err) {
1638
1649
  if (stale()) return;
1639
1650
  archived = [];
@@ -1858,6 +1869,10 @@
1858
1869
 
1859
1870
  window.addEventListener('floless:projects-changed', (e) => {
1860
1871
  const m = (e && e.detail) || {};
1872
+ if (m.kind === 'metadata' && typeof m.registrationId === 'string') {
1873
+ refreshRegisteredProject(m);
1874
+ return;
1875
+ }
1861
1876
  if (!current) {
1862
1877
  // THE LANDING IS DERIVED FROM THE SAME LIVE SET, so it goes stale on exactly these events —
1863
1878
  // and not merely cosmetically: its cards carry `data-open`/`data-kebab` ids, so after a rename
@@ -1912,6 +1927,127 @@
1912
1927
  });
1913
1928
  }
1914
1929
 
1930
+ // A save invalidates exactly one registered display row. The event grants no authority:
1931
+ // the keyed route checks the physical target and returns its current registration view.
1932
+ async function refreshRegisteredProject(event) {
1933
+ const root = window.flolessWorkspaceRoot?.current()?.root;
1934
+ if (!root || event.rootId !== root.rootId || event.generation !== root.generation) return;
1935
+ const registrationId = event.registrationId;
1936
+ const cached = registeredRows.get(registrationId);
1937
+ if (!cached) return;
1938
+ const running = metadataRefreshes.get(registrationId);
1939
+ if (running) { running.again = true; return; }
1940
+ const state = { again: false, retries: event._retry ? 0 : 1 };
1941
+ metadataRefreshes.set(registrationId, state);
1942
+ try {
1943
+ do {
1944
+ state.again = false;
1945
+ const navigation = openNavSeq;
1946
+ const seq = projectsLoadSeq;
1947
+ const response = await api(`/api/project-registrations/${encodeURIComponent(registrationId)}/view`);
1948
+ const activeRoot = window.flolessWorkspaceRoot?.current()?.root;
1949
+ if (activeRoot?.rootId !== root.rootId || activeRoot?.generation !== root.generation
1950
+ || response.root?.rootId !== root.rootId || response.root?.generation !== root.generation
1951
+ || seq !== projectsLoadSeq || registeredRows.get(registrationId) !== cached) return;
1952
+ const registration = response.registration;
1953
+ const fresh = response.project;
1954
+ if (registration?.registrationId !== registrationId || !fresh
1955
+ || registration.projectId !== cached.id || String(registration.projectUuid).toLowerCase() !== String(cached.uuid).toLowerCase()
1956
+ || fresh.id !== cached.id || String(fresh.uuid).toLowerCase() !== String(cached.uuid).toLowerCase()
1957
+ || !['available', 'unavailable'].includes(registration.status)) {
1958
+ throw new Error('The project view no longer matches this registration.');
1959
+ }
1960
+ const wasUnits = cached.displayUnits === 'mm' ? 'mm' : 'ft-in';
1961
+ const wasApproved = cached.approvedAt;
1962
+ Object.assign(cached, fresh, {
1963
+ displayUnits: fresh.displayUnits === 'mm' ? 'mm' : 'ft-in',
1964
+ registrationState: registration.status,
1965
+ registrationRevision: registration.entryRevision,
1966
+ registrationReason: registration.reason,
1967
+ registrationPhysicalIdentityGuarantee: registration.physicalIdentityGuarantee,
1968
+ registrationLocationWarning: registration.locationWarning,
1969
+ });
1970
+ if (!Object.hasOwn(fresh, 'approvedAt')) delete cached.approvedAt;
1971
+ patchRegisteredCard(cached);
1972
+ if (navigation !== openNavSeq || current?.registrationId !== registrationId) continue;
1973
+ const units = cached.displayUnits === 'mm' ? 'mm' : 'ft-in';
1974
+ Object.assign(current, cached);
1975
+ if (!Object.hasOwn(cached, 'approvedAt')) delete current.approvedAt;
1976
+ $projName.textContent = cached.name;
1977
+ paintProjectLocationWarning(cached);
1978
+ if (registration.status === 'unavailable') {
1979
+ // Keep the editor and its unsaved draft in place while the person reviews recovery.
1980
+ showToast('This project folder is unavailable. Review its location before continuing.', 'warn');
1981
+ window.flolessProjectReconciliation?.openRegistration(registrationId);
1982
+ return;
1983
+ }
1984
+ if (wasUnits !== units || wasApproved !== cached.approvedAt) {
1985
+ exportUnits = null;
1986
+ if (!$wsExports.hidden) safeRenderExports('after this project changed');
1987
+ }
1988
+ } while (state.again);
1989
+ } catch (error) {
1990
+ if (!workspacePageUnloading) {
1991
+ showToast('Couldn’t refresh this project. Check its folder or reload to try again.', 'warn');
1992
+ if (state.retries) setTimeout(() => refreshRegisteredProject({ ...event, _retry: true }), 2000);
1993
+ }
1994
+ } finally {
1995
+ if (metadataRefreshes.get(registrationId) === state) metadataRefreshes.delete(registrationId);
1996
+ }
1997
+ }
1998
+
1999
+ function patchRegisteredCard(project) {
2000
+ const picker = registeredPickerRows.get(project.registrationId);
2001
+ if (picker?.isConnected) {
2002
+ const pickerName = picker.querySelector('.wf-option-name');
2003
+ if (pickerName) pickerName.textContent = project.name;
2004
+ picker.dataset.search = `${project.name} ${projectAppName(project)} ${project.app}`.toLowerCase();
2005
+ }
2006
+ const card = registeredCards.get(project.registrationId);
2007
+ if (!card?.isConnected) return;
2008
+ const name = card.querySelector('.ws-name, .ws-archived-name');
2009
+ const time = card.querySelector('.t');
2010
+ const status = card.querySelector('.ws-registration-status');
2011
+ const locationWarning = card.querySelector('.ws-registration-location-note');
2012
+ if (name) name.textContent = project.name;
2013
+ if (time) time.textContent = relAgo(project.updatedAt);
2014
+ if (status) {
2015
+ status.hidden = project.registrationState !== 'unavailable';
2016
+ status.textContent = project.registrationReason || 'Project folder unavailable. Locate or restore it.';
2017
+ }
2018
+ if (locationWarning) {
2019
+ locationWarning.hidden = project.registrationState === 'unavailable' || !project.registrationLocationWarning;
2020
+ locationWarning.textContent = project.registrationLocationWarning || '';
2021
+ }
2022
+ const unavailable = project.registrationState === 'unavailable';
2023
+ const menu = card.querySelector('.ws-kebab');
2024
+ if (unavailable) {
2025
+ card.setAttribute('data-command-id', `shell.project-registration-review#${project.registrationId}`);
2026
+ card.setAttribute('data-command-instance-label', project.name);
2027
+ if (menu) {
2028
+ menu.setAttribute('data-command-id', `shell.project-registration-review#${project.registrationId}`);
2029
+ menu.setAttribute('data-command-instance-label', project.name);
2030
+ menu.setAttribute('data-tip', 'Review project folder');
2031
+ menu.setAttribute('aria-label', 'Review project folder');
2032
+ }
2033
+ } else if (card.getAttribute('data-command-id')?.startsWith('shell.project-registration-review#')) {
2034
+ card.removeAttribute('data-command-id');
2035
+ card.removeAttribute('data-command-instance-label');
2036
+ if (menu) {
2037
+ menu.removeAttribute('data-command-id'); menu.removeAttribute('data-command-instance-label');
2038
+ menu.setAttribute('data-tip', project.importedMidSave ? 'Rename · Thumbnail · Mark as checked · Duplicate · Export · Archive' : 'Rename · Thumbnail · Duplicate · Export · Archive');
2039
+ menu.setAttribute('aria-label', 'Project actions');
2040
+ }
2041
+ }
2042
+ }
2043
+
2044
+ function paintProjectLocationWarning(project) {
2045
+ const warning = document.getElementById('ws-project-location-warning');
2046
+ if (!warning) return;
2047
+ warning.hidden = project.registrationState === 'unavailable' || !project.registrationLocationWarning;
2048
+ warning.textContent = project.registrationLocationWarning || '';
2049
+ }
2050
+
1915
2051
  /**
1916
2052
  * Reconcile the OPEN project against the server's live set — the answer to "is what I have still
1917
2053
  * there, and under what id".
@@ -1978,7 +2114,7 @@
1978
2114
  // through the fix's own path. `openProject`'s fallback fetch keeps one entry and discards the
1979
2115
  // array, so this is the only place the whole list lands. (Found by review.)
1980
2116
  if (!current || current.id !== id) continue; // the user moved on mid-read; ask again for the new one
1981
- if (seq === projectsLoadSeq) projects = res.projects;
2117
+ if (seq === projectsLoadSeq) { projects = res.projects; indexRegisteredRows(); }
1982
2118
  // Identity first; the id only as the legacy fallback.
1983
2119
  const mine = uuid
1984
2120
  ? res.projects.find((p) => p.uuid === uuid)
@@ -1987,6 +2123,14 @@
1987
2123
  // read predates it, so recording it would let the loop exit on a claim that was never true —
1988
2124
  // and the trailing pass re-reads anyway. (Found by review round 3.)
1989
2125
  if (mine && mine.id === id) {
2126
+ paintProjectLocationWarning(mine);
2127
+ if (mine.registrationState === 'unavailable' && mine.registrationId) {
2128
+ Object.assign(current, mine);
2129
+ showToast('This project folder is unavailable. Review its location before continuing.', 'warn');
2130
+ window.flolessProjectReconciliation?.openRegistration(mine.registrationId);
2131
+ if (!reconcileAgain) validated = id;
2132
+ continue;
2133
+ }
1990
2134
  /*
1991
2135
  * "UNCHANGED" MEANS THE IDENTITY, NOT THE ROW. `mine` is a freshly read server row, and the
1992
2136
  * reconnect catch-up (`aware.js` `es.onopen`) re-announces `projects-changed` precisely
@@ -2381,7 +2525,7 @@
2381
2525
  function workspaceProjectGroups(list) {
2382
2526
  const groups = new Map();
2383
2527
  for (const project of list) {
2384
- const key = project.templateId || project.app || '';
2528
+ const key = project.templateId || project.app || 'other-projects';
2385
2529
  if (!groups.has(key)) groups.set(key, {
2386
2530
  key, label: projectAppName(project) || 'Other projects', projects: [],
2387
2531
  });
@@ -2451,6 +2595,7 @@
2451
2595
 
2452
2596
  let landingPageFocusCommand = null;
2453
2597
  function renderLanding() {
2598
+ indexRegisteredRows();
2454
2599
  syncProjectGroupSearchRoot();
2455
2600
  const rootState = window.flolessWorkspaceRoot && window.flolessWorkspaceRoot.current();
2456
2601
  const rootPath = rootState && rootState.root && rootState.root.path;
@@ -2465,6 +2610,7 @@
2465
2610
  : '') +
2466
2611
  `<button type="button" class="ws-import-btn ws-folder-btn${rootUnavailable ? ' is-unavailable' : ''}" id="ws-workspace-folder" data-command-id="menu.workspace-folder" data-tip="${escapeAttr(rootPath || 'Choose the Workspace directory FloLess reads for projects and workflows')}">Workspace directory · ${escapeHtml(rootUnavailable ? 'unavailable' : folderName)}</button>` +
2467
2612
  `${rootUnavailable ? '' : '<button type="button" class="ws-import-btn" id="ws-import-project" data-command-id="shell.project-import" data-tip="Restore a project from an exported .zip file or a zipped project folder">↓ Import project…</button>'}</div></div>`;
2613
+ html += '<div class="ws-folder-review-note" id="ws-folder-review-note" hidden></div>';
2468
2614
  if (rootUnavailable) {
2469
2615
  html += `<div class="ws-empty-note ws-root-unavailable" role="status" aria-live="polite"><b>Workspace directory unavailable.</b> ` +
2470
2616
  `Choose another folder to continue. ` +
@@ -2479,6 +2625,9 @@
2479
2625
  }
2480
2626
  html += `</div>`;
2481
2627
  }
2628
+ }
2629
+ // Last-known registered rows remain useful recovery entry points when the drive is offline.
2630
+ // Only creation/import controls above require an available root.
2482
2631
  const projectGroups = projects.length ? workspaceProjectGroups(projects) : [];
2483
2632
  for (const [groupIndex, group] of projectGroups.entries()) {
2484
2633
  const groupGridId = `ws-project-group-grid-${groupIndex}`;
@@ -2505,13 +2654,15 @@
2505
2654
  const wfName = wsRenamed(p)
2506
2655
  ? `<span class="ws-sep"> · </span><span class="ws-meta-wf" data-tip="The workflow this project runs on:\n${escapeAttr(p.app)}">${escapeHtml(p.app)}</span>`
2507
2656
  : '';
2508
- html += `<div class="ws-card" role="button" tabindex="0" data-open="${escapeAttr(p.id)}">` +
2657
+ html += `<div class="ws-card" role="button" tabindex="0" data-open="${escapeAttr(p.id)}"${p.registrationId ? ` data-registration-id="${escapeAttr(p.registrationId)}"` : ''}${p.registrationState === 'unavailable' ? ` data-command-id="shell.project-registration-review#${escapeAttr(p.registrationId)}" data-command-instance-label="${escapeAttr(p.name)}"` : ''}>` +
2509
2658
  thumbBandHtml(p, displayApp) +
2510
2659
  `<span class="ws-body"><span><span class="ws-name">${escapeHtml(p.name)}</span>` +
2511
2660
  (projectCapability ? `<span class="ws-meta">${escapeHtml(projectCapability)}</span>` : '') +
2512
2661
  (p.importedMidSave ? `<span class="ws-meta ws-unverified" data-tip="${escapeAttr(UNVERIFIED_IMPORT_TIP)}">Imported mid-save · not verified. Export again on the source computer.</span>` : '') +
2662
+ `<span class="ws-meta ws-registration-status"${p.registrationState === 'unavailable' ? '' : ' hidden'}>${escapeHtml(p.registrationReason || 'Project folder unavailable. Locate or restore it.')}</span>` +
2663
+ `<span class="ws-meta ws-registration-location-note"${p.registrationState !== 'unavailable' && p.registrationLocationWarning ? '' : ' hidden'}>${escapeHtml(p.registrationLocationWarning || '')}</span>` +
2513
2664
  `<span class="ws-meta ws-meta-app"><span class="ws-meta-kind">${escapeHtml(displayApp)}</span>${wfName}<span class="ws-sep"> · </span><span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span></span>` +
2514
- `<button type="button" class="ws-kebab" data-kebab="${escapeAttr(p.id)}" aria-label="Project actions" data-tip="${p.importedMidSave ? 'Rename · Thumbnail · Mark as checked · Duplicate · Export · Archive' : 'Rename · Thumbnail · Duplicate · Export · Archive'}">⋯</button>` +
2665
+ `<button type="button" class="ws-kebab" data-kebab="${escapeAttr(p.id)}"${p.registrationState === 'unavailable' ? ` data-command-id="shell.project-registration-review#${escapeAttr(p.registrationId)}" data-command-instance-label="${escapeAttr(p.name)}"` : ''} aria-label="${p.registrationState === 'unavailable' ? 'Review project folder' : 'Project actions'}" data-tip="${p.registrationState === 'unavailable' ? 'Review project folder' : p.importedMidSave ? 'Rename · Thumbnail · Mark as checked · Duplicate · Export · Archive' : 'Rename · Thumbnail · Duplicate · Export · Archive'}">⋯</button>` +
2515
2666
  `</span></div>`;
2516
2667
  }
2517
2668
  html += `</div></section>`;
@@ -2523,7 +2674,7 @@
2523
2674
  // empty, and telling someone with 11 projects "No projects yet — start one" is a lie that reads
2524
2675
  // like their work is gone. The toast alone can't carry this: it auto-dismisses, and the false
2525
2676
  // sentence stays on screen. Say what happened and offer the retry instead.
2526
- if (!projects.length) {
2677
+ if (!projects.length && !rootUnavailable) {
2527
2678
  if (projectsLoadError) {
2528
2679
  // role=status/polite, not alert: this can appear on an ordinary repaint (any action that
2529
2680
  // re-runs loadProjects re-renders it), and assertive would interrupt a screen-reader user
@@ -2564,11 +2715,14 @@
2564
2715
  rows += `<div class="ws-archived-row">` +
2565
2716
  `<span class="ws-archived-info">` +
2566
2717
  `<span class="ws-archived-name">${escapeHtml(p.name)}</span>` +
2718
+ (p.registrationState !== 'unavailable' && p.registrationLocationWarning ? `<span class="ws-registration-location-note">${escapeHtml(p.registrationLocationWarning)}</span>` : '') +
2567
2719
  `<span class="ws-archived-meta"${wfTip}>${escapeHtml(displayApp)} · archived <span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span>` +
2568
2720
  `</span>` +
2569
2721
  `<span class="ws-archived-actions">` +
2570
- `<button type="button" class="btn-mini ws-restore" data-restore="${escapeAttr(p.id)}" data-tip="Un-archive — returns to the live grid">↺ Restore</button>` +
2571
- `<button type="button" class="btn-mini ws-del" data-delete-archived="${escapeAttr(p.id)}" data-tip="Permanently erase this project from disk">Delete…</button>` +
2722
+ (p.registrationState === 'unavailable'
2723
+ ? `<button type="button" class="btn-mini" data-project-registration-review="${escapeAttr(p.registrationId)}" data-command-id="shell.project-registration-review#${escapeAttr(p.registrationId)}" data-command-instance-label="${escapeAttr(p.name)}">Review folder…</button>`
2724
+ : `<button type="button" class="btn-mini ws-restore" data-restore="${escapeAttr(p.id)}" data-tip="Un-archive — returns to the live grid">↺ Restore</button>` +
2725
+ `<button type="button" class="btn-mini ws-del" data-delete-archived="${escapeAttr(p.id)}" data-tip="Permanently erase this project from disk">Delete…</button>`) +
2572
2726
  `</span>` +
2573
2727
  `</div>`;
2574
2728
  }
@@ -2577,7 +2731,6 @@
2577
2731
  `<div class="ws-archived-list">${rows}</div>` +
2578
2732
  `</details>`;
2579
2733
  }
2580
- }
2581
2734
  // Carry the user's place across the rebuild below, which replaces the landing wholesale: that
2582
2735
  // drops focus to <body>, collapses the Archived disclosure, and can leave a scrolled grid showing
2583
2736
  // a different slice. Every caller used to be a click or keypress in this tab, so the user's
@@ -2592,6 +2745,9 @@
2592
2745
  const search = document.activeElement?.id === 'ws-landing-search' ? document.activeElement : null;
2593
2746
  const keepCaret = search ? [search.selectionStart, search.selectionEnd] : null;
2594
2747
  $landing.innerHTML = html;
2748
+ registeredCards.clear();
2749
+ for (const card of $landing.querySelectorAll('[data-registration-id]')) registeredCards.set(card.dataset.registrationId, card);
2750
+ window.flolessProjectReconciliation?.paintNotice();
2595
2751
  // Reapply in this order: the disclosure changes the scrollable height, so it must land before the
2596
2752
  // offset; focus lands next, with preventScroll so its scroll-into-view can't undo that offset. The
2597
2753
  // search filter runs after both: it needs the restored focus to put the caret back, and it hides the
@@ -2632,7 +2788,7 @@
2632
2788
  const terms = landingQuery.trim().toLowerCase().split(/\s+/).filter(Boolean);
2633
2789
  let shown = 0;
2634
2790
  for (const card of $landing.querySelectorAll('.ws-grid .ws-card[data-open]')) {
2635
- const hay = Array.from(card.querySelectorAll('.ws-name, .ws-meta:not(.ws-meta-app), .ws-meta-kind, .ws-meta-wf'), (el) => el.textContent).join(' ').toLowerCase();
2791
+ const hay = Array.from(card.querySelectorAll('.ws-name, .ws-meta:not(.ws-meta-app):not(.ws-registration-status):not(.ws-registration-location-note), .ws-meta-kind, .ws-meta-wf'), (el) => el.textContent).join(' ').toLowerCase();
2636
2792
  card.hidden = !terms.every((t) => hay.includes(t));
2637
2793
  if (!card.hidden) shown++;
2638
2794
  }
@@ -2757,6 +2913,8 @@
2757
2913
  }
2758
2914
 
2759
2915
  $landing.addEventListener('click', async (e) => {
2916
+ const registrationReview = e.target.closest('[data-project-registration-review]');
2917
+ if (registrationReview) { window.flolessProjectReconciliation?.openRegistration(registrationReview.dataset.projectRegistrationReview); return; }
2760
2918
  const groupToggle = e.target.closest('[data-project-group-toggle]');
2761
2919
  if (groupToggle) {
2762
2920
  const expanded = groupToggle.getAttribute('aria-expanded') !== 'true';
@@ -4791,6 +4949,15 @@
4791
4949
  if (!p) { try { p = (await api('/api/projects')).projects.find((x) => x.id === id); } catch { /* fall through */ } }
4792
4950
  if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
4793
4951
  if (!p) { showToast('Project not found — it may have been archived.', 'warn'); return loadProjects(); }
4952
+ if (window.flolessWorkspaceRoot?.current()?.available === false) {
4953
+ if (p.registrationId) window.flolessProjectReconciliation?.openRegistration(p.registrationId);
4954
+ else window.flolessWorkspaceRoot.open();
4955
+ return STAYED_IN_PROJECT;
4956
+ }
4957
+ if (p.registrationState === 'unavailable' && p.registrationId) {
4958
+ window.flolessProjectReconciliation?.openRegistration(p.registrationId);
4959
+ return STAYED_IN_PROJECT;
4960
+ }
4794
4961
  // Never a broken open (spec §3.2): a project whose app has no client descriptor can't be rendered
4795
4962
  // — toast and bail BEFORE mutating any view state, matching the create-card skip. wsApp() would
4796
4963
  // return null for it and the frame wiring would fail.
@@ -4832,6 +4999,7 @@
4832
4999
  // file resets state to avoid — and the next path that renders rows would inherit it.
4833
5000
  histDiffSupported = false;
4834
5001
  $projName.textContent = p.name;
5002
+ paintProjectLocationWarning(p);
4835
5003
  // Lazily src the frames once per project; switching steps only toggles hidden so the
4836
5004
  // editor's state survives a Source⇄Traced round-trip. Frame URLs come from the app descriptor:
4837
5005
  // the 'model' frame loads the app's editor; the 'drawings' frame loads its filter (steel) OR is
@@ -14570,6 +14738,17 @@
14570
14738
  return `<button class="menu-item" data-act="${action}" role="menuitem"><span class="menu-label">${escapeHtml(label)}</span></button>`;
14571
14739
  }
14572
14740
  function openProjMenu(id, anchor) {
14741
+ if (window.flolessWorkspaceRoot?.current()?.available === false) {
14742
+ const row = projects.find((project) => project.id === id);
14743
+ if (row?.registrationId) window.flolessProjectReconciliation?.openRegistration(row.registrationId);
14744
+ else window.flolessWorkspaceRoot.open();
14745
+ return;
14746
+ }
14747
+ const unavailable = projects.find((project) => project.id === id && project.registrationState === 'unavailable');
14748
+ if (unavailable?.registrationId) {
14749
+ window.flolessProjectReconciliation?.openRegistration(unavailable.registrationId);
14750
+ return;
14751
+ }
14573
14752
  menuFor = id;
14574
14753
  // An explicit popup wins over the passive fullscreen suggestion. The app-shell listener removes
14575
14754
  // the nudge synchronously without persisting its seen key, before this menu can receive a click.
@@ -15122,11 +15301,13 @@
15122
15301
  // marker (.wf-option.selected in app.css) actually shows — mirrors the workflow picker (aware.js).
15123
15302
  // It matters more now the action icons are gone: without it the open row is visually unmarked.
15124
15303
  const here = current && current.id === p.id;
15125
- return `<div class="wf-option${here ? ' selected' : ''}" role="option" id="ws-proj-opt-${pid}" data-id="${pid}" data-search="${escapeAttr((p.name + ' ' + displayApp + ' ' + p.app).toLowerCase())}" tabindex="-1" aria-selected="${here ? 'true' : 'false'}">`
15304
+ return `<div class="wf-option${here ? ' selected' : ''}" role="option" id="ws-proj-opt-${pid}" data-id="${pid}"${p.registrationId ? ` data-registration-id="${escapeAttr(p.registrationId)}"` : ''} data-search="${escapeAttr((p.name + ' ' + displayApp + ' ' + p.app).toLowerCase())}" tabindex="-1" aria-selected="${here ? 'true' : 'false'}">`
15126
15305
  + `<span class="wf-option-name">${escapeHtml(p.name)}</span><span class="wf-option-meta">${meta}</span></div>`;
15127
15306
  }).join('');
15128
15307
  html += `<div class="wf-empty-search" hidden>No projects match '<span class="wf-empty-term"></span>'</div>`;
15129
15308
  $projList.innerHTML = html;
15309
+ registeredPickerRows.clear();
15310
+ for (const row of $projList.querySelectorAll('[data-registration-id]')) registeredPickerRows.set(row.dataset.registrationId, row);
15130
15311
  }
15131
15312
  function projComboVisible() { return [...$projList.querySelectorAll('.wf-option')].filter((o) => !o.hidden); }
15132
15313
  function projComboClearHighlight() {
@@ -15249,6 +15430,15 @@
15249
15430
  if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
15250
15431
  }
15251
15432
 
15433
+ // The Drawing Filter step of a project, where a drawing read's exclusions are saved and signed off.
15434
+ async function openDrawingsStep(projectId) {
15435
+ if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
15436
+ await setMode('workspaces');
15437
+ const opened = await openProject(projectId, 'drawings');
15438
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
15439
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
15440
+ }
15441
+
15252
15442
  // A cross-project object pin still belongs to its original conversation, wherever its model is shown.
15253
15443
  async function openChatOwner(owner) {
15254
15444
  const validId = (id) => typeof id === 'string' && !!id && id.length <= 200;
@@ -15298,10 +15488,21 @@
15298
15488
  return Boolean(carrier);
15299
15489
  }
15300
15490
 
15491
+ async function folderDecisionCompleted(result, operation) {
15492
+ const project = result.project;
15493
+ if (operation === 'import') {
15494
+ const toast = formatRfiTransferToast(result.rfiTransfer, 'import', project.name, result.appInstalled);
15495
+ const leftOut = importLeftOutNote(result.leftOut, project.name);
15496
+ showToast(toast.message + (leftOut ? ` ${leftOut}` : ''), leftOut ? 'warn' : toast.tone);
15497
+ } else showToast(`Project folder updated for “${project.name}”.`, 'ok');
15498
+ await loadProjects({ quiet: true });
15499
+ flashCard(project.id, { scroll: true });
15500
+ if (current?.id === project.id) reconcileNow();
15501
+ }
15301
15502
  window.flolessWorkspaces = {
15302
15503
  setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
15303
- openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, drawingFilterCheckpointSaved,
15304
- syncWorkspaceReporter, openChatOwner, openPagesHome,
15504
+ openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, drawingFilterCheckpointSaved,
15505
+ syncWorkspaceReporter, openChatOwner, openPagesHome, folderDecisionCompleted,
15305
15506
  };
15306
15507
  applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
15307
15508
  })();
package/launch.mjs CHANGED
@@ -12,13 +12,14 @@ import { spawn, execSync, execFileSync } from 'node:child_process';
12
12
  import { dirname, join, basename } from 'node:path';
13
13
  import { fileURLToPath } from 'node:url';
14
14
  import { distributionProfile } from './distribution-profile-active.mjs';
15
- import { existsSync } from 'node:fs';
15
+ import { existsSync, readFileSync } from 'node:fs';
16
16
  import http from 'node:http';
17
17
  import { createInterface } from 'node:readline';
18
18
  import { rotateLog, openLogFd } from './log.mjs';
19
19
  import { supervisorPidsToKill, teardownDecision, awareIsPresent, RUN_KEY, RUN_VALUE, PROTOCOL_KEY } from './teardown.mjs';
20
20
  import { resolveRealInstallExe } from './install-path.mjs';
21
21
  import { consumePostUpdateMarker } from './post-update-marker.mjs';
22
+ import { ACTIONS_CLI_COMMANDS, runActionsCli } from './cli-actions.mjs';
22
23
 
23
24
  const __dirname = dirname(fileURLToPath(import.meta.url));
24
25
  const PORT = Number(process.env.PORT ?? 4317);
@@ -530,6 +531,12 @@ export function parseAction(arg) {
530
531
  return cmd;
531
532
  }
532
533
 
534
+ // Is this argv[0] one of the actions verbs, typed as a bare word? A floless:// URI is never one: parseAction maps
535
+ // `floless://do` to "do", so this checks the raw word itself, never the parsed action.
536
+ export function isActionsCliCommand(arg) {
537
+ return typeof arg === 'string' && ACTIONS_CLI_COMMANDS.includes(arg);
538
+ }
539
+
533
540
  // `floless update` via the npm bin lands here (bin/floless.mjs → launch.mjs).
534
541
  // The npm install has no Velopack package to self-update — npm owns versions — so
535
542
  // this is a deliberate no-op with the right instruction. The packaged exe never
@@ -633,6 +640,69 @@ export async function cmdUninstall(flags = {}) {
633
640
  log('done. Finally, remove floless.app itself with: npm uninstall -g @floless/app');
634
641
  }
635
642
 
643
+ // One JSON request to the local server for the actions CLI: { status, body } (body parsed, or null). Throws only
644
+ // when the server cannot be reached at all. A generous timeout: a read action runs the UI's own route in full.
645
+ function apiRequest(method, path, body) {
646
+ return new Promise((resolve, reject) => {
647
+ const payload = body === undefined ? undefined : JSON.stringify(body);
648
+ const req = http.request(`http://127.0.0.1:${PORT}${path}`, {
649
+ method, timeout: 120000,
650
+ headers: payload === undefined ? {} : { 'content-type': 'application/json', 'content-length': Buffer.byteLength(payload) },
651
+ }, (res) => {
652
+ let text = '';
653
+ res.setEncoding('utf8');
654
+ res.on('data', (c) => (text += c));
655
+ res.on('end', () => {
656
+ let parsed = null;
657
+ try { parsed = text ? JSON.parse(text) : null; } catch { parsed = null; }
658
+ resolve({ status: res.statusCode ?? 0, body: parsed });
659
+ });
660
+ });
661
+ req.on('error', reject);
662
+ req.on('timeout', () => { req.destroy(new Error('FloLess took too long to answer')); });
663
+ if (payload !== undefined) req.write(payload);
664
+ req.end();
665
+ });
666
+ }
667
+
668
+ // `floless-app actions …` / `floless-app do …` (#2248). The launcher only wires the real world in: the server on
669
+ // PORT (started if it is not running, as `login` does — its progress goes to stderr so --json stays one envelope),
670
+ // the terminal, and Ctrl+C. Everything else is cli-actions.mjs, which is tested without any of it.
671
+ export async function cmdActionsCli(argv) {
672
+ const write = (stream, line) => { try { stream.write(`${line}\n`); } catch { /* no console */ } };
673
+ const say = (line) => write(process.stderr, line);
674
+ // Ctrl+C is taken over only while a `--wait` is listening for it (to stop waiting, or the run it waits on).
675
+ // Everywhere else — a slow read, a server that is starting — it ends the command as it always does.
676
+ const listeners = new Set();
677
+ // A second Ctrl+C always ends the command: the first only asks it to stop waiting, which a hung request could delay.
678
+ let sigints = 0;
679
+ const onSigint = () => { if (++sigints > 1) process.exit(130); for (const fn of listeners) fn(); };
680
+ try {
681
+ return await runActionsCli(argv, {
682
+ request: apiRequest,
683
+ ensureServer: async () => {
684
+ if (await ping()) return true;
685
+ say('Starting FloLess…');
686
+ startServerDetached();
687
+ return waitHealthy();
688
+ },
689
+ out: (text) => write(process.stdout, text),
690
+ err: say,
691
+ readFile: (file) => readFileSync(file, 'utf8'),
692
+ sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
693
+ now: () => Date.now(),
694
+ onInterrupt: (fn) => {
695
+ if (!listeners.size) process.on('SIGINT', onSigint);
696
+ listeners.add(fn);
697
+ return () => { listeners.delete(fn); if (!listeners.size) process.off('SIGINT', onSigint); };
698
+ },
699
+ });
700
+ } finally {
701
+ listeners.clear();
702
+ process.off('SIGINT', onSigint);
703
+ }
704
+ }
705
+
636
706
  const ACTIONS = { open: cmdOpen, start: cmdStart, supervise: cmdSupervise, stop: cmdStop, restart: cmdRestart, login: cmdLogin, update: cmdUpdate, uninstall: cmdUninstall };
637
707
 
638
708
  // Run one launcher action by name/URI. Shared by the npm bin (CLI shim below) and
@@ -642,9 +712,17 @@ const ACTIONS = { open: cmdOpen, start: cmdStart, supervise: cmdSupervise, stop:
642
712
  export async function runAction(arg, flagArgv = [], selfVersion = null, selfChannel = null) {
643
713
  _selfVersion = selfVersion;
644
714
  _selfChannel = selfChannel;
715
+ // The actions verbs take their own arguments and set the exit code. Only ever from a typed command: a
716
+ // floless:// link (which any web page can open) never reaches them, so it cannot make FloLess do anything.
717
+ if (isActionsCliCommand(arg)) { process.exitCode = await cmdActionsCli([arg, ...flagArgv]); return; }
645
718
  const cmd = parseAction(arg);
646
719
  const action = ACTIONS[cmd];
647
- if (!action) { log(`unknown command "${cmd}" — use: open | start | supervise | stop | restart | login | update | uninstall`); process.exit(2); }
720
+ if (!action && ACTIONS_CLI_COMMANDS.includes(cmd)) {
721
+ // A floless:// link (which any web page can open) named an actions verb: refused, and said why.
722
+ log(`a link cannot make FloLess do anything — type "floless-app ${cmd} …" in a terminal instead`);
723
+ process.exit(2);
724
+ }
725
+ if (!action) { log(`unknown command "${cmd}" — use: open | start | supervise | stop | restart | login | update | uninstall | actions | do`); process.exit(2); }
648
726
  await action(parseTeardownFlags(flagArgv));
649
727
  }
650
728
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.155.2",
3
+ "version": "0.156.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": {