@floless/app 0.138.2 → 0.139.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.
- package/autostart.mjs +6 -2
- package/desktop-access-production-manifest.mjs +7 -0
- package/dist/floless-server.cjs +157202 -70901
- package/dist/schemas/model.continuation.v1.schema.json +19 -0
- package/dist/schemas/model.continuation.v2.schema.json +19 -0
- package/dist/schemas/model.query-response.v1.schema.json +95 -0
- package/dist/schemas/model.query-response.v2.schema.json +80 -0
- package/dist/schemas/model.query.v1.schema.json +87 -0
- package/dist/schemas/model.query.v2.schema.json +87 -0
- package/dist/schemas/model.snap-candidate.v1.schema.json +48 -0
- package/dist/schemas/model.snap-constraint.v1.schema.json +18 -0
- package/dist/schemas/model.snap-query.v1.schema.json +24 -0
- package/dist/schemas/model.snap-result.v1.schema.json +33 -0
- package/dist/schemas/model.snapshot.v1.schema.json +136 -0
- package/dist/schemas/revit.model.v1.schema.json +24 -0
- package/dist/schemas/steel.model.v2.schema.json +45 -6
- package/dist/skills/floless-app-approval/SKILL.md +19 -5
- package/dist/skills/floless-app-bridge/SKILL.md +19 -6
- package/dist/skills/floless-app-knowledge/SKILL.md +22 -1
- package/dist/skills/floless-app-new-workflow/SKILL.md +31 -27
- package/dist/skills/floless-app-new-workflow/references/build-and-verify.md +13 -12
- package/dist/skills/floless-app-onboarding/SKILL.md +3 -3
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +16 -9
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -2
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +95 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +142 -21
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +19 -0
- package/dist/skills/floless-app-tweak-contract/SKILL.md +42 -8
- package/dist/skills/floless-app-vectorize/SKILL.md +19 -6
- package/dist/skills/floless-app-workflows/SKILL.md +30 -3
- package/dist/skills/floless-app-workflows/references/workspace-data.md +77 -4
- package/dist/templates/floless-workspace-model-report.flo +77 -0
- package/dist/templates/revit-model.flo +111 -0
- package/dist/web/app.css +415 -177
- package/dist/web/app.js +302 -51
- package/dist/web/aware.js +1357 -1032
- package/dist/web/chat.css +692 -0
- package/dist/web/chat.js +2651 -0
- package/dist/web/commands-revit.js +42 -0
- package/dist/web/commands-shell.js +531 -70
- package/dist/web/commands-steel.js +344 -146
- package/dist/web/commands.js +1 -1
- package/dist/web/index.html +283 -77
- package/dist/web/instructor.js +217 -36
- package/dist/web/left-pane.js +636 -0
- package/dist/web/model-artifact-loader.js +75 -0
- package/dist/web/model-authoring-gestures.js +141 -0
- package/dist/web/model-cad-tools.js +20 -0
- package/dist/web/model-clip-gesture.js +148 -0
- package/dist/web/model-clip-list.js +156 -0
- package/dist/web/model-clip-session.js +274 -0
- package/dist/web/model-clip-three-overlay.js +295 -0
- package/dist/web/model-clip-three-preview.js +59 -0
- package/dist/web/model-editor-contract.js +519 -0
- package/dist/web/model-editor-revit-adapter.js +139 -0
- package/dist/web/model-editor-shell.js +271 -0
- package/dist/web/model-editor-state-recovery.js +44 -0
- package/dist/web/model-editor-steel-adapter.js +410 -0
- package/dist/web/model-editor.css +268 -0
- package/dist/web/model-frame.js +192 -0
- package/dist/web/model-inspector.js +128 -0
- package/dist/web/model-measure.js +390 -0
- package/dist/web/model-navigation-controls.js +246 -0
- package/dist/web/model-orientation-overlay.js +217 -0
- package/dist/web/model-panel-bridge.js +230 -0
- package/dist/web/model-pointer-dock.js +164 -0
- package/dist/web/model-revit-module.js +83 -0
- package/dist/web/model-selection-coordinator.js +151 -0
- package/dist/web/model-selection-tools.js +290 -0
- package/dist/web/model-snap-contract.js +267 -0
- package/dist/web/model-snapping.js +497 -0
- package/dist/web/model-spatial-panel.js +294 -0
- package/dist/web/model-spatial-tools.js +249 -0
- package/dist/web/model-tree.js +47 -0
- package/dist/web/model-viewport-lighting.js +166 -0
- package/dist/web/model-viewport-revit-adapter.js +1224 -0
- package/dist/web/model-viewport-state.js +505 -0
- package/dist/web/model-viewport-steel-adapter.js +150 -0
- package/dist/web/model-viewport-toolbar.js +516 -0
- package/dist/web/model-viewport.js +717 -0
- package/dist/web/panels.js +8 -15
- package/dist/web/renderers.js +3 -0
- package/dist/web/revit-editor.css +35 -0
- package/dist/web/revit-editor.html +74 -0
- package/dist/web/revit-editor.js +845 -0
- package/dist/web/steel-3d-core.js +16 -44
- package/dist/web/steel-3d-view.js +1384 -633
- package/dist/web/steel-canvas-guidance.js +3 -1
- package/dist/web/steel-editor.html +2121 -1253
- package/dist/web/steel-filter.html +5 -1
- package/dist/web/steel-model-v2-commands.js +72 -1
- package/dist/web/steel-split-view.js +5 -39
- package/dist/web/steel-view-generation.js +107 -17
- package/dist/web/vector-3d.html +12 -0
- package/dist/web/workspaces.js +2154 -283
- package/distribution-profile-active.mjs +2 -0
- package/distribution-profile-production.mjs +47 -0
- package/distribution-profile-shared.mjs +8 -0
- package/distribution-profile.mjs +18 -0
- package/distribution-resource-inventory.mjs +81 -0
- package/launch.mjs +18 -10
- package/log.mjs +2 -1
- package/managed-runtime-policy.mjs +104 -0
- package/model-reader-policy-active.mjs +7 -0
- package/network-policy-active.mjs +6 -0
- package/package.json +17 -2
- package/post-update-marker.mjs +3 -1
- package/rvt-production-uat-authority.mjs +60 -0
- package/teardown.mjs +4 -3
package/dist/web/app.js
CHANGED
|
@@ -267,16 +267,9 @@ function computePorts(p) {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
function renderChat() {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
$messages.appendChild(msgEl('user', '$ you', p.userText));
|
|
274
|
-
p.narration.forEach((line, i) => {
|
|
275
|
-
setTimeout(() => {
|
|
276
|
-
$messages.appendChild(msgEl('aware', 'claude', mdInline(line)));
|
|
277
|
-
$messages.scrollTop = $messages.scrollHeight;
|
|
278
|
-
}, 180 * (i + 1));
|
|
279
|
-
});
|
|
270
|
+
// The production AI Chat shell owns #messages. Keep this long-standing render seam because
|
|
271
|
+
// workflow selection still calls it, but never replace the durable conversation DOM.
|
|
272
|
+
window.flolessChat?.refreshScope?.();
|
|
280
273
|
}
|
|
281
274
|
// Local timestamp, stamped when a chat block is created: YYYY-MM-DD HH:MM:SS.
|
|
282
275
|
function nowStamp(d = new Date()) {
|
|
@@ -897,8 +890,8 @@ function applyCollapse(focusSide = null) {
|
|
|
897
890
|
document.querySelectorAll('.panel-toggle').forEach(btn => {
|
|
898
891
|
const side = btn.dataset.side;
|
|
899
892
|
const collapsed = state.collapse[side];
|
|
900
|
-
const panelName = side === 'left' ? '
|
|
901
|
-
const label = collapsed ? `Expand ${panelName}
|
|
893
|
+
const panelName = side === 'left' ? 'AI Chat' : 'Inspect panel';
|
|
894
|
+
const label = collapsed ? `Expand ${panelName}` : `Collapse ${panelName}`;
|
|
902
895
|
// The chevron is an SVG that CSS rotates (see .panel-toggle svg), not a text glyph swapped here.
|
|
903
896
|
// Writing textContent would delete that SVG on the first toggle — and the glyph it replaced it
|
|
904
897
|
// with rendered at a different weight from the identical control in the steel editor, which is
|
|
@@ -908,10 +901,11 @@ function applyCollapse(focusSide = null) {
|
|
|
908
901
|
btn.dataset.tip = label;
|
|
909
902
|
});
|
|
910
903
|
if (focusSide) {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
904
|
+
requestAnimationFrame(() => {
|
|
905
|
+
const collapsed = state.collapse[focusSide];
|
|
906
|
+
const host = collapsed ? '.collapsed-stub' : (focusSide === 'left' ? '.left-pane-switches' : '.panel-label');
|
|
907
|
+
document.querySelector(`${host} .panel-toggle[data-side="${focusSide}"]`)?.focus();
|
|
908
|
+
});
|
|
915
909
|
}
|
|
916
910
|
// redraw DAG wires after layout changes
|
|
917
911
|
if (isDag()) {
|
|
@@ -968,7 +962,7 @@ function setupResize() {
|
|
|
968
962
|
const cfg = config(side);
|
|
969
963
|
const inlineWidth = parseFloat($app.style.getPropertyValue(cfg.cssVar));
|
|
970
964
|
if (Number.isFinite(inlineWidth)) return inlineWidth;
|
|
971
|
-
// The collapsed shell forces the grid track to
|
|
965
|
+
// The collapsed shell forces the grid track to 36px with !important. That stub is not a user
|
|
972
966
|
// width and must never become the separator's announced or restored expanded width.
|
|
973
967
|
if (state.collapse[side]) return cfg.defaultWidth;
|
|
974
968
|
const cssWidth = parseFloat(getComputedStyle($app).getPropertyValue(cfg.cssVar));
|
|
@@ -1283,6 +1277,53 @@ function escapeHtml(s) {
|
|
|
1283
1277
|
}
|
|
1284
1278
|
function escapeAttr(s) { return escapeHtml(s).replace(/"/g, '"'); }
|
|
1285
1279
|
|
|
1280
|
+
/**
|
|
1281
|
+
* How long ago a PAST instant was, in the spaced long form the project grid and the history
|
|
1282
|
+
* list both show: '' · 'just now' · '7 min ago' · '3 h ago' · '2 d ago'.
|
|
1283
|
+
*
|
|
1284
|
+
* DEFINED HERE (app.js loads first) and reused by panels.js and workspaces.js, which each
|
|
1285
|
+
* carried a byte-identical copy — the same drift the `escapeHtml`/`onBackdropDismiss` pair
|
|
1286
|
+
* above exists to avoid. A blank string for an unparseable or future instant is part of the
|
|
1287
|
+
* contract: every caller interpolates the result straight into a meta line, so a caller that
|
|
1288
|
+
* got 'NaN min ago' or '-3 h ago' would print it.
|
|
1289
|
+
*
|
|
1290
|
+
* NOT the compact spellings. `aware.js`'s `agoTime` ('7m ago', '3h ago') and `workspaces.js`'s
|
|
1291
|
+
* `kbAgo` ('7m ago', taking ms rather than an ISO string) are a different, denser typography
|
|
1292
|
+
* for table rows; folding them in here would mean a style flag, so they stay where they are.
|
|
1293
|
+
*/
|
|
1294
|
+
function relAgo(iso) {
|
|
1295
|
+
const ms = Date.now() - new Date(iso).getTime();
|
|
1296
|
+
if (isNaN(ms) || ms < 0) return '';
|
|
1297
|
+
const min = Math.round(ms / 60000);
|
|
1298
|
+
if (min < 1) return 'just now';
|
|
1299
|
+
if (min < 60) return `${min} min ago`;
|
|
1300
|
+
const h = Math.round(min / 60);
|
|
1301
|
+
if (h < 48) return `${h} h ago`;
|
|
1302
|
+
return `${Math.round(h / 24)} d ago`;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* One line of an export receipt's detail list — `'Warning: …'`, `'Unsupported: …'`.
|
|
1307
|
+
*
|
|
1308
|
+
* DEFINED HERE for the same reason as `relAgo`: aware.js (the Workflows receipt popover) and
|
|
1309
|
+
* workspaces.js (the Workspaces export card) rendered the same receipt rows through two
|
|
1310
|
+
* byte-identical copies, so a fix to one reached exactly one of the two surfaces a user can
|
|
1311
|
+
* read the SAME receipt on.
|
|
1312
|
+
*
|
|
1313
|
+
* A receipt row is server-authored but arbitrarily shaped, so every branch ends in a string:
|
|
1314
|
+
* a bare string passes through, a structured row is named by its `id · code · message`, and
|
|
1315
|
+
* anything else is JSON — with 'detail unavailable' as the last resort, because a row that
|
|
1316
|
+
* cannot be rendered must still be COUNTED rather than silently dropped from the list.
|
|
1317
|
+
*/
|
|
1318
|
+
function receiptItemText(prefix, value) {
|
|
1319
|
+
if (typeof value === 'string') return `${prefix}: ${value}`;
|
|
1320
|
+
if (!value || typeof value !== 'object') return `${prefix}: ${String(value)}`;
|
|
1321
|
+
const parts = [value.id, value.code, value.message].filter((part) => typeof part === 'string' && part.trim());
|
|
1322
|
+
if (parts.length) return `${prefix}: ${parts.join(' · ')}`;
|
|
1323
|
+
try { return `${prefix}: ${JSON.stringify(value)}`; }
|
|
1324
|
+
catch { return `${prefix}: detail unavailable`; }
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1286
1327
|
// Backdrop-dismiss that ignores text-selection drags. A modal closes only when BOTH
|
|
1287
1328
|
// the mousedown AND the click land on the backdrop element itself — so selecting text
|
|
1288
1329
|
// inside a modal input and releasing the cursor outside the modal no longer dismisses
|
|
@@ -1342,6 +1383,7 @@ function handleMenuAction(action) {
|
|
|
1342
1383
|
case 'save-as': doSaveAs(); break;
|
|
1343
1384
|
case 'find': openFind(); break;
|
|
1344
1385
|
case 'integrations': openIntegrations(); break;
|
|
1386
|
+
case 'workspace-folder': openWorkspaceRoot(); break;
|
|
1345
1387
|
case 'agents': openLibrary(); break;
|
|
1346
1388
|
case 'routines': openRoutines(); break;
|
|
1347
1389
|
case 'report-issue': openReportIssue(); break;
|
|
@@ -1495,7 +1537,7 @@ if ($startupToggle) {
|
|
|
1495
1537
|
// UX review 2026-05-31: a preference write doesn't rise to a toast.
|
|
1496
1538
|
} catch (e) {
|
|
1497
1539
|
$startupToggle.checked = !want; // revert the optimistic flip
|
|
1498
|
-
showToast('
|
|
1540
|
+
showToast('We couldn’t save that startup setting. Try again. If it keeps happening, reopen FloLess.', 'err');
|
|
1499
1541
|
} finally {
|
|
1500
1542
|
$startupToggle.disabled = false;
|
|
1501
1543
|
}
|
|
@@ -1602,13 +1644,24 @@ if (!fullscreenSupported()) {
|
|
|
1602
1644
|
|
|
1603
1645
|
/* ============= TOAST ============= */
|
|
1604
1646
|
|
|
1647
|
+
// A server, browser, or command error describes the software's internals, not what a person needs
|
|
1648
|
+
// to do. Keep it in the console for diagnosis and give the person a clear recovery path instead.
|
|
1649
|
+
function userSafeToastMessage(msg, type) {
|
|
1650
|
+
const text = String(msg ?? '').trim();
|
|
1651
|
+
if ((type === 'warn' || type === 'err')
|
|
1652
|
+
&& /\b(?:http\s*\d+|error:|exception|stack trace|server log|status code|undefined|null|subscription required|unauthori[sz]ed|forbidden)\b/i.test(text)) {
|
|
1653
|
+
return 'We couldn’t finish that because FloLess lost contact with part of the app. Your work is still here. Try again. If it keeps happening, reopen FloLess.';
|
|
1654
|
+
}
|
|
1655
|
+
return text || 'We couldn’t finish that. Your work is still here. Try again.';
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1605
1658
|
function showToast(msg, type) {
|
|
1606
1659
|
const c = document.getElementById('toast-container');
|
|
1607
1660
|
const t = document.createElement('div');
|
|
1608
1661
|
t.className = `toast ${type || 'info'}`;
|
|
1609
1662
|
const span = document.createElement('span');
|
|
1610
1663
|
span.className = 'toast-msg';
|
|
1611
|
-
span.textContent = msg; // textContent — never innerHTML
|
|
1664
|
+
span.textContent = userSafeToastMessage(msg, type); // textContent — never innerHTML
|
|
1612
1665
|
t.appendChild(span);
|
|
1613
1666
|
let dismissed = false;
|
|
1614
1667
|
const dismiss = (options) => {
|
|
@@ -1642,38 +1695,6 @@ function showToast(msg, type) {
|
|
|
1642
1695
|
return dismiss;
|
|
1643
1696
|
}
|
|
1644
1697
|
|
|
1645
|
-
// A toast carrying a real, focusable Undo action. Distinct from showToast because that surface has no
|
|
1646
|
-
// action slot. The undo window is the caller's to own (it holds the commit timer) and it should pass
|
|
1647
|
-
// that same duration as `ms` so the visible toast can't outlive the window it advertises — the `6000`
|
|
1648
|
-
// default is a floor, not the source of truth. Reuses #toast-container (already role=status aria-live=polite).
|
|
1649
|
-
function showUndoToast(msg, onUndo, ms = 6000) {
|
|
1650
|
-
const c = document.getElementById('toast-container');
|
|
1651
|
-
if (!c) return () => {};
|
|
1652
|
-
const t = document.createElement('div');
|
|
1653
|
-
t.className = 'toast info toast-undo';
|
|
1654
|
-
const span = document.createElement('span');
|
|
1655
|
-
span.className = 'toast-msg';
|
|
1656
|
-
span.textContent = msg; // textContent — never innerHTML
|
|
1657
|
-
const action = document.createElement('button');
|
|
1658
|
-
action.type = 'button';
|
|
1659
|
-
action.className = 'toast-action';
|
|
1660
|
-
action.textContent = 'Undo';
|
|
1661
|
-
let done = false;
|
|
1662
|
-
const dismiss = () => {
|
|
1663
|
-
if (done) return;
|
|
1664
|
-
done = true;
|
|
1665
|
-
t.style.transition = 'opacity 0.3s, transform 0.3s';
|
|
1666
|
-
t.style.opacity = '0';
|
|
1667
|
-
t.style.transform = 'translateY(8px)';
|
|
1668
|
-
setTimeout(() => t.remove(), 300);
|
|
1669
|
-
};
|
|
1670
|
-
action.onclick = () => { dismiss(); if (typeof onUndo === 'function') onUndo(); };
|
|
1671
|
-
t.append(span, action);
|
|
1672
|
-
c.appendChild(t);
|
|
1673
|
-
if (ms > 0) setTimeout(dismiss, ms);
|
|
1674
|
-
return dismiss;
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
1698
|
/* ============= ZOOM + PAN ============= */
|
|
1678
1699
|
|
|
1679
1700
|
const ZOOM_LEVELS = [0.5, 0.6, 0.75, 0.85, 1.0, 1.15, 1.3, 1.5, 1.75, 2.0];
|
|
@@ -1884,6 +1905,235 @@ const $integrationsList = document.getElementById('integrations-list');
|
|
|
1884
1905
|
document.getElementById('integrations-close').onclick = () => $integrationsModal.classList.remove('show');
|
|
1885
1906
|
onBackdropDismiss($integrationsModal, () => $integrationsModal.classList.remove('show'));
|
|
1886
1907
|
|
|
1908
|
+
/* ============= WORKSPACE FOLDER ============= */
|
|
1909
|
+
// App-wide because the selected folder scopes BOTH Workspaces and Workflows. The native chooser and
|
|
1910
|
+
// protected root commit stay server-owned; the browser receives one short-lived choice id, never the
|
|
1911
|
+
// authority to submit an arbitrary filesystem path.
|
|
1912
|
+
const $workspaceRootModal = document.getElementById('workspace-root-modal');
|
|
1913
|
+
const $workspaceRootDialog = $workspaceRootModal.querySelector('.workspace-root-modal');
|
|
1914
|
+
const $workspaceRootCurrent = document.getElementById('workspace-root-current');
|
|
1915
|
+
const $workspaceRootStatus = document.getElementById('workspace-root-status');
|
|
1916
|
+
const $workspaceRootConfirm = document.getElementById('workspace-root-confirm');
|
|
1917
|
+
const $workspaceRootCandidate = document.getElementById('workspace-root-candidate');
|
|
1918
|
+
const $workspaceRootError = document.getElementById('workspace-root-error');
|
|
1919
|
+
const $workspaceRootCancel = document.getElementById('workspace-root-cancel');
|
|
1920
|
+
const $workspaceRootChange = document.getElementById('workspace-root-change');
|
|
1921
|
+
const $workspaceRootUse = document.getElementById('workspace-root-use');
|
|
1922
|
+
let workspaceRootState = null;
|
|
1923
|
+
let workspaceRootChoice = null;
|
|
1924
|
+
let workspaceRootBusy = false;
|
|
1925
|
+
|
|
1926
|
+
async function workspaceRootApi(path, opts) {
|
|
1927
|
+
const response = await fetch(path, { headers: { 'content-type': 'application/json' }, ...opts });
|
|
1928
|
+
const body = await response.json().catch(() => ({ ok: false, error: `Unreadable response (HTTP ${response.status})` }));
|
|
1929
|
+
if (!response.ok || body.ok === false) {
|
|
1930
|
+
const error = new Error(body.error || `HTTP ${response.status}`);
|
|
1931
|
+
error.body = body;
|
|
1932
|
+
throw error;
|
|
1933
|
+
}
|
|
1934
|
+
return body;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
function workspaceRootName(path) {
|
|
1938
|
+
const parts = String(path || '').replace(/[\\/]+$/, '').split(/[\\/]/);
|
|
1939
|
+
return parts[parts.length - 1] || path || 'Workspace directory';
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
function announceWorkspaceRootState() {
|
|
1943
|
+
try { window.dispatchEvent(new CustomEvent('floless:workspace-root-state', { detail: workspaceRootState })); }
|
|
1944
|
+
catch { /* a listener failure must not break root selection */ }
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
function setWorkspaceRootError(message) {
|
|
1948
|
+
$workspaceRootError.hidden = !message;
|
|
1949
|
+
$workspaceRootError.textContent = message || '';
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
function workspaceRootErrorMessage(error) {
|
|
1953
|
+
const raw = String(error && error.message || error || 'Could not use that folder.');
|
|
1954
|
+
if (/folders? may not contain one another/i.test(raw)) {
|
|
1955
|
+
return 'Choose a different folder. A Workspace directory cannot be inside another FloLess Workspace directory.';
|
|
1956
|
+
}
|
|
1957
|
+
if (/may not be a reserved FloLess directory/i.test(raw)) {
|
|
1958
|
+
return 'Choose a different folder. That folder is reserved for FloLess files.';
|
|
1959
|
+
}
|
|
1960
|
+
if (/may not be a FloLess project directory/i.test(raw)) {
|
|
1961
|
+
return 'Choose a different folder. Select the parent Workspace directory for the project instead.';
|
|
1962
|
+
}
|
|
1963
|
+
if (/filesystem link|reparse point|safe directory|escapes the selected root/i.test(raw)) {
|
|
1964
|
+
return 'Windows treats this folder, or an item inside it, as a link or redirected folder. Choose a regular folder FloLess can read directly.';
|
|
1965
|
+
}
|
|
1966
|
+
if (/\b(?:EBUSY)\b|resource busy|locked/i.test(raw)) {
|
|
1967
|
+
return 'Windows is using or locking this folder right now. Close the app using it, then try again, or choose another folder.';
|
|
1968
|
+
}
|
|
1969
|
+
if (/\b(?:ENOTDIR)\b|not a directory/i.test(raw)) {
|
|
1970
|
+
return 'Part of this path is not a folder. Choose a valid folder and try again.';
|
|
1971
|
+
}
|
|
1972
|
+
if (/\b(?:EPERM|EACCES)\b|operation not permitted|permission denied|watch ['"]/i.test(raw)) {
|
|
1973
|
+
return 'Windows denied FloLess access to this folder or an item inside it. Choose a folder you can open and edit, then try again.';
|
|
1974
|
+
}
|
|
1975
|
+
if (/\b(?:ENOENT)\b|no such file|cannot find/i.test(raw)) {
|
|
1976
|
+
return 'FloLess cannot find this folder or one of its project files. Reconnect the drive or restore the folder, then choose it again.';
|
|
1977
|
+
}
|
|
1978
|
+
if (/offline|unavailable|cannot be inspected|cannot be resolved/i.test(raw)) {
|
|
1979
|
+
return 'FloLess cannot find or open this folder right now. Check the drive or network connection, then choose it again.';
|
|
1980
|
+
}
|
|
1981
|
+
if (/duplicated across workspace roots|project identity .*duplicated/i.test(raw)) {
|
|
1982
|
+
return 'This folder contains a project already registered in another Workspace directory. Open that Workspace directory or choose a folder without that project.';
|
|
1983
|
+
}
|
|
1984
|
+
if (/registered workspace root marker is unavailable|marker is unavailable/i.test(raw)) {
|
|
1985
|
+
return 'This folder no longer matches the Workspace directory FloLess saved earlier. Restore the original folder or choose another one.';
|
|
1986
|
+
}
|
|
1987
|
+
if (/registered with a different identity|identity is already registered/i.test(raw)) {
|
|
1988
|
+
return 'This folder no longer matches the Workspace directory FloLess saved earlier. Restore the original folder or choose another one.';
|
|
1989
|
+
}
|
|
1990
|
+
if (/workspace project collection/i.test(raw)) {
|
|
1991
|
+
return 'FloLess found a project folder it cannot safely read here. Choose a Workspace directory with project folders you can open.';
|
|
1992
|
+
}
|
|
1993
|
+
if (/workspace root|registry|marker|identity|filesystem root|cannot verify project/i.test(raw)) {
|
|
1994
|
+
return 'FloLess could not verify this folder as a Workspace directory for projects and workflows. Choose a regular folder you can access directly, then try again.';
|
|
1995
|
+
}
|
|
1996
|
+
return 'FloLess could not use this folder for projects and workflows. Choose a regular folder you can access directly, then try again.';
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
function setWorkspaceRootBusy(busy, label) {
|
|
2000
|
+
workspaceRootBusy = !!busy;
|
|
2001
|
+
$workspaceRootDialog.setAttribute('aria-busy', String(workspaceRootBusy));
|
|
2002
|
+
const switching = workspaceRootBusy && label === 'Switching folder…';
|
|
2003
|
+
document.body.classList.toggle('workspace-root-switching', switching);
|
|
2004
|
+
for (const selector of ['#mode-switch', '#wf-combo', '#ws-spine', '#ws-landing']) {
|
|
2005
|
+
const surface = document.querySelector(selector);
|
|
2006
|
+
if (surface) surface.inert = switching;
|
|
2007
|
+
}
|
|
2008
|
+
const modeSwitch = document.getElementById('mode-switch');
|
|
2009
|
+
if (switching) modeSwitch.setAttribute('aria-disabled', 'true');
|
|
2010
|
+
else modeSwitch.removeAttribute('aria-disabled');
|
|
2011
|
+
$workspaceRootCancel.disabled = workspaceRootBusy;
|
|
2012
|
+
$workspaceRootChange.disabled = workspaceRootBusy;
|
|
2013
|
+
$workspaceRootUse.disabled = workspaceRootBusy;
|
|
2014
|
+
if (label) $workspaceRootChange.textContent = label;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
function renderWorkspaceRootModal() {
|
|
2018
|
+
const current = workspaceRootState && workspaceRootState.root;
|
|
2019
|
+
$workspaceRootCurrent.textContent = current && current.path || 'Unavailable';
|
|
2020
|
+
if (current && current.path) $workspaceRootCurrent.setAttribute('data-tip', current.path);
|
|
2021
|
+
else $workspaceRootCurrent.removeAttribute('data-tip');
|
|
2022
|
+
$workspaceRootStatus.classList.toggle('is-unavailable', !!workspaceRootState && workspaceRootState.available === false);
|
|
2023
|
+
$workspaceRootStatus.textContent = !workspaceRootState
|
|
2024
|
+
? 'Checking the folder FloLess currently uses…'
|
|
2025
|
+
: workspaceRootState.available
|
|
2026
|
+
? 'FloLess shows projects and workflows from this folder.'
|
|
2027
|
+
: workspaceRootErrorMessage({ message: workspaceRootState.reason || 'Choose another folder to continue.' });
|
|
2028
|
+
$workspaceRootConfirm.hidden = !workspaceRootChoice;
|
|
2029
|
+
$workspaceRootCandidate.textContent = workspaceRootChoice && workspaceRootChoice.path || '';
|
|
2030
|
+
if (workspaceRootChoice) $workspaceRootCandidate.setAttribute('data-tip', workspaceRootChoice.path);
|
|
2031
|
+
else $workspaceRootCandidate.removeAttribute('data-tip');
|
|
2032
|
+
$workspaceRootCancel.textContent = workspaceRootChoice ? 'Cancel' : 'Close';
|
|
2033
|
+
$workspaceRootChange.textContent = 'Choose another Workspace directory…';
|
|
2034
|
+
$workspaceRootUse.hidden = !workspaceRootChoice;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
async function refreshWorkspaceRoot() {
|
|
2038
|
+
try {
|
|
2039
|
+
workspaceRootState = await workspaceRootApi('/api/workspace-root');
|
|
2040
|
+
setWorkspaceRootError('');
|
|
2041
|
+
announceWorkspaceRootState();
|
|
2042
|
+
} catch (error) {
|
|
2043
|
+
setWorkspaceRootError(workspaceRootErrorMessage(error));
|
|
2044
|
+
}
|
|
2045
|
+
renderWorkspaceRootModal();
|
|
2046
|
+
return workspaceRootState;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
function closeWorkspaceRoot() {
|
|
2050
|
+
if (workspaceRootBusy) return;
|
|
2051
|
+
workspaceRootChoice = null;
|
|
2052
|
+
setWorkspaceRootError('');
|
|
2053
|
+
$workspaceRootModal.classList.remove('show');
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
async function openWorkspaceRoot() {
|
|
2057
|
+
workspaceRootChoice = null;
|
|
2058
|
+
setWorkspaceRootError('');
|
|
2059
|
+
renderWorkspaceRootModal();
|
|
2060
|
+
$workspaceRootModal.classList.add('show');
|
|
2061
|
+
await refreshWorkspaceRoot();
|
|
2062
|
+
setTimeout(() => $workspaceRootChange.focus(), 0);
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
async function chooseWorkspaceRoot() {
|
|
2066
|
+
setWorkspaceRootError('');
|
|
2067
|
+
setWorkspaceRootBusy(true, 'Choosing…');
|
|
2068
|
+
try {
|
|
2069
|
+
const choice = await workspaceRootApi('/api/workspace-root/choose', { method: 'POST', body: '{}' });
|
|
2070
|
+
if (choice.cancelled) return;
|
|
2071
|
+
if (choice.unchanged) {
|
|
2072
|
+
setWorkspaceRootBusy(false);
|
|
2073
|
+
closeWorkspaceRoot();
|
|
2074
|
+
showToast('FloLess is already using that folder.', 'ok');
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
2077
|
+
workspaceRootChoice = { selectionId: choice.selectionId, path: choice.path };
|
|
2078
|
+
} catch (error) {
|
|
2079
|
+
setWorkspaceRootError(workspaceRootErrorMessage(error));
|
|
2080
|
+
} finally {
|
|
2081
|
+
setWorkspaceRootBusy(false);
|
|
2082
|
+
renderWorkspaceRootModal();
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
async function confirmWorkspaceRoot() {
|
|
2087
|
+
if (!workspaceRootChoice) return chooseWorkspaceRoot();
|
|
2088
|
+
setWorkspaceRootError('');
|
|
2089
|
+
setWorkspaceRootBusy(true, 'Switching folder…');
|
|
2090
|
+
try {
|
|
2091
|
+
const result = await workspaceRootApi('/api/workspace-root/select', {
|
|
2092
|
+
method: 'POST', body: JSON.stringify({ selectionId: workspaceRootChoice.selectionId }),
|
|
2093
|
+
});
|
|
2094
|
+
workspaceRootState = result;
|
|
2095
|
+
workspaceRootChoice = null;
|
|
2096
|
+
announceWorkspaceRootState();
|
|
2097
|
+
// The server also broadcasts these. Dispatching locally closes the old project immediately even
|
|
2098
|
+
// when this tab's EventSource is reconnecting; every listener re-reads rather than trusting data.
|
|
2099
|
+
window.dispatchEvent(new CustomEvent('floless:projects-changed', { detail: {
|
|
2100
|
+
rootId: result.root.rootId, generation: result.root.generation,
|
|
2101
|
+
} }));
|
|
2102
|
+
if (window.flolessBridge && window.flolessBridge.loadRequests) window.flolessBridge.loadRequests();
|
|
2103
|
+
$workspaceRootModal.classList.remove('show');
|
|
2104
|
+
showToast(`Workspace directory changed to “${workspaceRootName(result.root.path)}”.`, 'ok');
|
|
2105
|
+
} catch (error) {
|
|
2106
|
+
const busy = error && error.body && error.body.code === 'workspace-root-busy';
|
|
2107
|
+
const activities = busy && Array.isArray(error.body.blockers)
|
|
2108
|
+
? [...new Set(error.body.blockers.map((blocker) => blocker && blocker.label).filter(Boolean))]
|
|
2109
|
+
: [];
|
|
2110
|
+
setWorkspaceRootError(busy
|
|
2111
|
+
? `FloLess cannot change this Workspace directory while work is still running${activities.length ? ` (${activities.join(', ')})` : ''}. Stop or let that work finish, then choose the folder again.`
|
|
2112
|
+
: workspaceRootErrorMessage(error));
|
|
2113
|
+
} finally {
|
|
2114
|
+
setWorkspaceRootBusy(false);
|
|
2115
|
+
renderWorkspaceRootModal();
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
$workspaceRootCancel.onclick = () => {
|
|
2120
|
+
if (workspaceRootChoice) {
|
|
2121
|
+
workspaceRootChoice = null;
|
|
2122
|
+
setWorkspaceRootError('');
|
|
2123
|
+
renderWorkspaceRootModal();
|
|
2124
|
+
} else closeWorkspaceRoot();
|
|
2125
|
+
};
|
|
2126
|
+
$workspaceRootChange.onclick = () => { chooseWorkspaceRoot(); };
|
|
2127
|
+
$workspaceRootUse.onclick = () => { confirmWorkspaceRoot(); };
|
|
2128
|
+
onBackdropDismiss($workspaceRootModal, closeWorkspaceRoot, () => !workspaceRootBusy);
|
|
2129
|
+
window.flolessWorkspaceRoot = {
|
|
2130
|
+
open: openWorkspaceRoot,
|
|
2131
|
+
refresh: refreshWorkspaceRoot,
|
|
2132
|
+
current: () => workspaceRootState,
|
|
2133
|
+
name: () => workspaceRootName(workspaceRootState && workspaceRootState.root && workspaceRootState.root.path),
|
|
2134
|
+
};
|
|
2135
|
+
refreshWorkspaceRoot();
|
|
2136
|
+
|
|
1887
2137
|
/* ============= KEYBOARD SHORTCUTS ============= */
|
|
1888
2138
|
|
|
1889
2139
|
document.addEventListener('keydown', (e) => {
|
|
@@ -1914,6 +2164,7 @@ document.addEventListener('keydown', (e) => {
|
|
|
1914
2164
|
if (e.key === 'Escape') {
|
|
1915
2165
|
if ($findOverlay.classList.contains('show')) closeFind();
|
|
1916
2166
|
if ($integrationsModal.classList.contains('show')) $integrationsModal.classList.remove('show');
|
|
2167
|
+
if ($workspaceRootModal.classList.contains('show')) closeWorkspaceRoot();
|
|
1917
2168
|
if ($menu.classList.contains('show')) toggleMenu(false);
|
|
1918
2169
|
}
|
|
1919
2170
|
});
|