@floless/app 0.151.0 → 0.152.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/dist/floless-server.cjs +14420 -8488
- package/dist/skills/floless-app-knowledge/SKILL.md +25 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +18 -1
- package/dist/skills/floless-app-report-issue/SKILL.md +10 -5
- package/dist/skills/floless-app-routines/SKILL.md +1 -1
- package/dist/skills/floless-app-routines/references/routines-api.md +14 -4
- package/dist/templates/revit-model.flo +6 -2
- package/dist/templates/tekla-parser.flo +6 -2
- package/dist/web/agents.js +146 -9
- package/dist/web/app.css +210 -19
- package/dist/web/app.js +53 -8
- package/dist/web/aware.js +852 -53
- package/dist/web/chat.css +98 -4
- package/dist/web/chat.js +550 -35
- package/dist/web/commands-shell.js +289 -20
- package/dist/web/connections.js +24 -6
- package/dist/web/flo-avatar.js +191 -0
- package/dist/web/flo.js +156 -0
- package/dist/web/guide.js +695 -57
- package/dist/web/index.html +58 -7
- package/dist/web/instructor.js +6 -1
- package/dist/web/local-discovery.js +35 -6
- package/dist/web/panels.js +2 -0
- package/dist/web/parser-setup-recovery.js +250 -0
- package/dist/web/tool-updates.js +198 -4
- package/dist/web/workspace-root-management.js +197 -0
- package/dist/web/workspaces.js +235 -15
- package/package.json +1 -1
package/dist/web/workspaces.js
CHANGED
|
@@ -378,17 +378,37 @@
|
|
|
378
378
|
// image/*"> can't carry a custom label — Chromium shows it as generic "Custom Files").
|
|
379
379
|
// Falls back to the hidden <input type=file> on engines without the API. Returns []
|
|
380
380
|
// on cancel; never throws (AbortError from a user cancel is swallowed).
|
|
381
|
+
// Chrome refuses a file chooser while another one is already open — as a NotAllowedError, or as an AbortError
|
|
382
|
+
// that looks like a cancel — and a chooser left open behind another window is easy to miss, so the next click
|
|
383
|
+
// seemed to do nothing. NotAllowedError is never a choice. A person cannot cancel a dialog in under half a
|
|
384
|
+
// second, so an instant AbortError, or one asked for while the page had no focus, is the browser refusing too.
|
|
385
|
+
// A real cancel stays silent; a refusal says what to do. Returns true when the error was one of these.
|
|
386
|
+
const pageHasFocus = () => typeof document.hasFocus !== 'function' || document.hasFocus();
|
|
387
|
+
const CHOOSER_HUMAN_CANCEL_MS = 500;
|
|
388
|
+
let dismissChooserHint = null;
|
|
389
|
+
function chooserEndedWithoutChoice(err, wasFocused, startedAt) {
|
|
390
|
+
if (!err) return false;
|
|
391
|
+
const refused = err.name === 'NotAllowedError'
|
|
392
|
+
|| (err.name === 'AbortError' && (!wasFocused || Date.now() - startedAt < CHOOSER_HUMAN_CANCEL_MS));
|
|
393
|
+
if (refused) {
|
|
394
|
+
// The cause is a window the person cannot see, so the hint stays until dismissed, and a repeat replaces it.
|
|
395
|
+
if (typeof dismissChooserHint === 'function') dismissChooserHint(true);
|
|
396
|
+
dismissChooserHint = showToast('The file chooser did not open. One may already be open behind another window. Close it, then click again.', 'warn', { persistent: true });
|
|
397
|
+
}
|
|
398
|
+
return refused || err.name === 'AbortError';
|
|
399
|
+
}
|
|
381
400
|
const DRAWING_FILE_TYPES = [{
|
|
382
401
|
description: 'PDF or image',
|
|
383
402
|
accept: { 'application/pdf': ['.pdf'], 'image/*': ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp'] },
|
|
384
403
|
}];
|
|
385
404
|
async function pickDrawingFiles(fallbackInput) {
|
|
386
405
|
if (window.showOpenFilePicker) {
|
|
406
|
+
const wasFocused = pageHasFocus(), startedAt = Date.now();
|
|
387
407
|
try {
|
|
388
408
|
const handles = await window.showOpenFilePicker({ multiple: true, types: DRAWING_FILE_TYPES });
|
|
389
409
|
return Promise.all(handles.map((h) => h.getFile()));
|
|
390
410
|
} catch (err) {
|
|
391
|
-
if (err
|
|
411
|
+
if (chooserEndedWithoutChoice(err, wasFocused, startedAt)) return []; // a cancel is silent; a refusal said so
|
|
392
412
|
throw err;
|
|
393
413
|
}
|
|
394
414
|
}
|
|
@@ -415,11 +435,12 @@
|
|
|
415
435
|
const ZIP_FILE_TYPES = [{ description: 'Project archive (.zip)', accept: { 'application/zip': ['.zip'] } }];
|
|
416
436
|
async function pickZipFile(fallbackInput) {
|
|
417
437
|
if (window.showOpenFilePicker) {
|
|
438
|
+
const wasFocused = pageHasFocus(), startedAt = Date.now();
|
|
418
439
|
try {
|
|
419
440
|
const [handle] = await window.showOpenFilePicker({ multiple: false, types: ZIP_FILE_TYPES });
|
|
420
441
|
return handle ? handle.getFile() : null;
|
|
421
442
|
} catch (err) {
|
|
422
|
-
if (err
|
|
443
|
+
if (chooserEndedWithoutChoice(err, wasFocused, startedAt)) return null; // a cancel is silent; a refusal said so
|
|
423
444
|
throw err;
|
|
424
445
|
}
|
|
425
446
|
}
|
|
@@ -439,11 +460,12 @@
|
|
|
439
460
|
const RVT_FILE_TYPES = [{ description: 'Revit model (.rvt)', accept: { 'application/x-rvt': ['.rvt'] } }];
|
|
440
461
|
async function pickRvtFile(fallbackInput) {
|
|
441
462
|
if (window.showOpenFilePicker) {
|
|
463
|
+
const wasFocused = pageHasFocus(), startedAt = Date.now();
|
|
442
464
|
try {
|
|
443
465
|
const [handle] = await window.showOpenFilePicker({ multiple: false, types: RVT_FILE_TYPES });
|
|
444
466
|
return handle ? handle.getFile() : null;
|
|
445
467
|
} catch (err) {
|
|
446
|
-
if (err
|
|
468
|
+
if (chooserEndedWithoutChoice(err, wasFocused, startedAt)) return null;
|
|
447
469
|
throw err;
|
|
448
470
|
}
|
|
449
471
|
}
|
|
@@ -500,8 +522,9 @@
|
|
|
500
522
|
|
|
501
523
|
async function pickTeklaFolder(fallbackInput) {
|
|
502
524
|
if (window.showDirectoryPicker) {
|
|
525
|
+
const wasFocused = pageHasFocus(), startedAt = Date.now();
|
|
503
526
|
try { return await filesFromDirectoryHandle(await window.showDirectoryPicker({ mode: 'read' })); }
|
|
504
|
-
catch (error) { if (error
|
|
527
|
+
catch (error) { if (chooserEndedWithoutChoice(error, wasFocused, startedAt)) return null; throw error; }
|
|
505
528
|
}
|
|
506
529
|
return new Promise((resolve, reject) => {
|
|
507
530
|
const cleanup = () => { fallbackInput.removeEventListener('change', onChange); fallbackInput.removeEventListener('cancel', onCancel); };
|
|
@@ -993,6 +1016,7 @@
|
|
|
993
1016
|
byRoot.get(root).push(a.id);
|
|
994
1017
|
}
|
|
995
1018
|
const capabilityByRoot = new Map();
|
|
1019
|
+
const setupChoiceByRoot = new Set();
|
|
996
1020
|
// The server decides when a "Needs setup" card has a remedy the person can act on (#1965 review);
|
|
997
1021
|
// the card only renders that sentence, and only on the state it was written for.
|
|
998
1022
|
const remedyByRoot = new Map();
|
|
@@ -1002,6 +1026,7 @@
|
|
|
1002
1026
|
|| WORKSPACE_APPS[capability.templateId]?.serverAuthorizedOnly !== true) continue;
|
|
1003
1027
|
const known = ['ready', 'access-required', 'account-selection-required', 'setup-provisioning', 'setup-unavailable', 'setup-integrity-failure', 'setup-repair-required', 'check-unavailable'];
|
|
1004
1028
|
capabilityByRoot.set(capability.templateId, known.includes(capability.status) ? capability.status : 'check-unavailable');
|
|
1029
|
+
if (capability.setupChoice === true && ['tekla-parser', 'revit-model'].includes(capability.templateId)) setupChoiceByRoot.add(capability.templateId);
|
|
1005
1030
|
if (capability.status === 'setup-unavailable' && typeof capability.setupRemedy === 'string' && capability.setupRemedy.trim()) {
|
|
1006
1031
|
remedyByRoot.set(capability.templateId, capability.setupRemedy.trim());
|
|
1007
1032
|
}
|
|
@@ -1033,6 +1058,7 @@
|
|
|
1033
1058
|
templateId: root,
|
|
1034
1059
|
ambiguous: WORKSPACE_APPS[root]?.serverAuthorizedOnly === true ? false : ids.length > 1,
|
|
1035
1060
|
...(capabilityStatus ? { capabilityStatus } : {}),
|
|
1061
|
+
...(setupChoiceByRoot.has(root) ? { setupChoice: true } : {}),
|
|
1036
1062
|
...(setupRemedy ? { setupRemedy } : {}),
|
|
1037
1063
|
...(missingCoreRoots.has(root) ? { missing: true } : {}),
|
|
1038
1064
|
};
|
|
@@ -1846,6 +1872,7 @@
|
|
|
1846
1872
|
// app.js owns the app-wide root selector; repaint only the neutral landing when its remembered
|
|
1847
1873
|
// availability/path changes. An open project is reconciled through projects-changed instead.
|
|
1848
1874
|
window.addEventListener('floless:workspace-root-state', () => {
|
|
1875
|
+
syncProjectGroupSearchRoot();
|
|
1849
1876
|
if (mode === 'workspaces' && !current) renderLanding();
|
|
1850
1877
|
});
|
|
1851
1878
|
|
|
@@ -2186,10 +2213,15 @@
|
|
|
2186
2213
|
},
|
|
2187
2214
|
};
|
|
2188
2215
|
const states = descriptor.accessCopy || revitStates;
|
|
2189
|
-
const state = states[entry.capabilityStatus] || states['check-unavailable'];
|
|
2216
|
+
const state = { ...(states[entry.capabilityStatus] || states['check-unavailable']) };
|
|
2217
|
+
if (entry.setupChoice === true) {
|
|
2218
|
+
state.body = `FloLess couldn’t verify the current ${descriptor.displayName}. Review the choices for keeping its files and setting up a fresh copy.`;
|
|
2219
|
+
state.action = 'Review setup choices';
|
|
2220
|
+
state.aria = `${descriptor.displayName} needs a setup choice — review choices`;
|
|
2221
|
+
}
|
|
2190
2222
|
// A remedy the server wrote for this "Needs setup" replaces "setup didn’t finish"; the button
|
|
2191
2223
|
// still re-runs setup, so the person can check again once they have fixed it.
|
|
2192
|
-
const body = entry.capabilityStatus === 'setup-unavailable' && entry.setupRemedy ? entry.setupRemedy : state.body;
|
|
2224
|
+
const body = entry.setupChoice !== true && entry.capabilityStatus === 'setup-unavailable' && entry.setupRemedy ? entry.setupRemedy : state.body;
|
|
2193
2225
|
const descriptionId = `ws-${entry.templateId}-${entry.capabilityStatus || 'check-unavailable'}`;
|
|
2194
2226
|
const actionable = !!state.action;
|
|
2195
2227
|
const provisioning = entry.capabilityStatus === 'setup-provisioning';
|
|
@@ -2213,7 +2245,9 @@
|
|
|
2213
2245
|
return `<${actionable ? 'button type="button"' : 'div'} class="ws-seed ws-seed-remedy" ` +
|
|
2214
2246
|
`aria-label="${escapeAttr(state.aria)}" aria-describedby="${escapeAttr(descriptionId)}" ` +
|
|
2215
2247
|
(provisioning ? 'aria-busy="true" ' : '') +
|
|
2216
|
-
(actionable ? entry.
|
|
2248
|
+
(actionable ? entry.setupChoice === true
|
|
2249
|
+
? `data-command-id="shell.parser-review-setup#${escapeAttr(entry.templateId)}" data-command-instance-label="${escapeAttr(descriptor.displayName)}" data-parser-setup="${escapeAttr(entry.templateId)}"`
|
|
2250
|
+
: entry.templateId === 'revit-model'
|
|
2217
2251
|
? `${revitCommand} data-revit-remedy="${remedyState}"`
|
|
2218
2252
|
: entry.templateId === 'drawing-check'
|
|
2219
2253
|
? `${drawingCheckCommand} data-module-remedy="drawing-check" data-module-remedy-state="${remedyState}"`
|
|
@@ -2323,7 +2357,81 @@
|
|
|
2323
2357
|
if (hadFocus && card) card.focus({ focusVisible: true, preventScroll: true });
|
|
2324
2358
|
}
|
|
2325
2359
|
|
|
2360
|
+
/** Keep a renamed workflow with its original module; preserve the server's order within each
|
|
2361
|
+
* module. Built-in modules follow the descriptor order, with custom workflows after them. */
|
|
2362
|
+
function workspaceProjectGroups(list) {
|
|
2363
|
+
const groups = new Map();
|
|
2364
|
+
for (const project of list) {
|
|
2365
|
+
const key = project.templateId || project.app || '';
|
|
2366
|
+
if (!groups.has(key)) groups.set(key, {
|
|
2367
|
+
key, label: projectAppName(project) || 'Other projects', projects: [],
|
|
2368
|
+
});
|
|
2369
|
+
groups.get(key).projects.push(project);
|
|
2370
|
+
}
|
|
2371
|
+
const ordered = [];
|
|
2372
|
+
for (const key of Object.keys(WORKSPACE_APPS)) {
|
|
2373
|
+
if (groups.has(key)) { ordered.push(groups.get(key)); groups.delete(key); }
|
|
2374
|
+
}
|
|
2375
|
+
return ordered.concat([...groups.values()]);
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
// Browser display preferences are scoped to the actual registered directory identity.
|
|
2379
|
+
const PROJECT_GROUP_PREF = 'floless:project-groups:v1:';
|
|
2380
|
+
const projectGroupSearchOverrides = new Map();
|
|
2381
|
+
const projectGroupMemory = new Map();
|
|
2382
|
+
let projectGroupSearchRootId = null;
|
|
2383
|
+
function projectGroupRootId() { return window.flolessWorkspaceRoot?.current()?.root?.rootId || ''; }
|
|
2384
|
+
function syncProjectGroupSearchRoot() {
|
|
2385
|
+
const rootId = projectGroupRootId();
|
|
2386
|
+
if (rootId !== projectGroupSearchRootId) {
|
|
2387
|
+
projectGroupSearchOverrides.clear();
|
|
2388
|
+
projectGroupSearchRootId = rootId;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
function projectGroupExpanded(key) {
|
|
2392
|
+
const rootId = projectGroupRootId();
|
|
2393
|
+
const memory = projectGroupMemory.get(rootId);
|
|
2394
|
+
if (memory?.has(key)) return memory.get(key);
|
|
2395
|
+
if (!rootId) return true;
|
|
2396
|
+
try {
|
|
2397
|
+
const saved = JSON.parse(localStorage.getItem(PROJECT_GROUP_PREF + encodeURIComponent(rootId)) || '{}');
|
|
2398
|
+
return !(saved && Object.prototype.hasOwnProperty.call(saved, key) && saved[key] === false);
|
|
2399
|
+
} catch { return true; }
|
|
2400
|
+
}
|
|
2401
|
+
function saveProjectGroupExpanded(key, expanded) {
|
|
2402
|
+
const rootId = projectGroupRootId();
|
|
2403
|
+
if (!projectGroupMemory.has(rootId)) projectGroupMemory.set(rootId, new Map());
|
|
2404
|
+
projectGroupMemory.get(rootId).set(key, expanded);
|
|
2405
|
+
if (!rootId) return;
|
|
2406
|
+
try {
|
|
2407
|
+
let parsed;
|
|
2408
|
+
try { parsed = JSON.parse(localStorage.getItem(PROJECT_GROUP_PREF + encodeURIComponent(rootId)) || '{}'); } catch { parsed = null; }
|
|
2409
|
+
const saved = Object.assign(Object.create(null), parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {});
|
|
2410
|
+
saved[key] = expanded;
|
|
2411
|
+
localStorage.setItem(PROJECT_GROUP_PREF + encodeURIComponent(rootId), JSON.stringify(saved));
|
|
2412
|
+
} catch { /* keep the choice on this page when browser storage is blocked */ }
|
|
2413
|
+
}
|
|
2414
|
+
function showProjectGroup(section, expanded) {
|
|
2415
|
+
const button = section.querySelector('[data-project-group-toggle]');
|
|
2416
|
+
section.querySelector('.ws-grid').hidden = !expanded;
|
|
2417
|
+
button.setAttribute('aria-expanded', String(expanded));
|
|
2418
|
+
button.setAttribute('data-tip', (expanded ? 'Collapse ' : 'Expand ') + button.dataset.commandInstanceLabel);
|
|
2419
|
+
if (document.activeElement === button) window.Instructor?.refreshCarrier(button);
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
// An explicit success must reveal its project; search-only choices remain temporary.
|
|
2423
|
+
function revealProjectGroup(card) {
|
|
2424
|
+
const section = card.closest('.ws-project-section');
|
|
2425
|
+
if (!section?.querySelector('.ws-grid')?.hidden) return;
|
|
2426
|
+
const key = section.dataset.module;
|
|
2427
|
+
if (landingQuery.trim()) projectGroupSearchOverrides.set(key, true);
|
|
2428
|
+
else saveProjectGroupExpanded(key, true);
|
|
2429
|
+
showProjectGroup(section, true);
|
|
2430
|
+
tipTruncatedNames();
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2326
2433
|
function renderLanding() {
|
|
2434
|
+
syncProjectGroupSearchRoot();
|
|
2327
2435
|
const rootState = window.flolessWorkspaceRoot && window.flolessWorkspaceRoot.current();
|
|
2328
2436
|
const rootPath = rootState && rootState.root && rootState.root.path;
|
|
2329
2437
|
const rootUnavailable = !!rootState && rootState.available === false;
|
|
@@ -2351,8 +2459,15 @@
|
|
|
2351
2459
|
}
|
|
2352
2460
|
html += `</div>`;
|
|
2353
2461
|
}
|
|
2354
|
-
|
|
2355
|
-
for (const
|
|
2462
|
+
const projectGroups = projects.length ? workspaceProjectGroups(projects) : [];
|
|
2463
|
+
for (const [groupIndex, group] of projectGroups.entries()) {
|
|
2464
|
+
const groupGridId = `ws-project-group-grid-${groupIndex}`;
|
|
2465
|
+
const expanded = landingQuery.trim() ? (projectGroupSearchOverrides.get(group.key) ?? true) : projectGroupExpanded(group.key);
|
|
2466
|
+
html += `<section class="ws-project-section" data-module="${escapeAttr(group.key)}">` +
|
|
2467
|
+
`<h3 class="ws-project-heading"><button type="button" class="ws-project-group-toggle" data-project-group-toggle="${escapeAttr(group.key)}" data-command-id="shell.project-group-toggle#${escapeAttr(group.key)}" data-command-instance-label="${escapeAttr(group.label)}" aria-controls="${groupGridId}" aria-expanded="${expanded}" data-tip="${escapeAttr((expanded ? 'Collapse ' : 'Expand ') + group.label)}"><span class="ws-project-chevron" aria-hidden="true">›</span><span class="ws-project-group-label">${escapeHtml(group.label)}</span> ` +
|
|
2468
|
+
`<span class="ws-project-count">${group.projects.length} ${group.projects.length === 1 ? 'project' : 'projects'}</span></button></h3>` +
|
|
2469
|
+
`<div class="ws-grid" id="${groupGridId}"${expanded ? '' : ' hidden'}>`;
|
|
2470
|
+
for (const p of group.projects) {
|
|
2356
2471
|
const d = wsDescOf(p);
|
|
2357
2472
|
const displayApp = projectAppName(p);
|
|
2358
2473
|
const projectCapability = d && d.projectCapability ? d.projectCapability : '';
|
|
@@ -2379,7 +2494,8 @@
|
|
|
2379
2494
|
`<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>` +
|
|
2380
2495
|
`</span></div>`;
|
|
2381
2496
|
}
|
|
2382
|
-
html += `</div>`;
|
|
2497
|
+
html += `</div></section>`;
|
|
2498
|
+
}
|
|
2383
2499
|
// The search's no-match message. Always rendered (empty) beside a search box, and filled in by
|
|
2384
2500
|
// applyLandingSearch(): a live region inserted with its text already inside is announced unreliably.
|
|
2385
2501
|
if (projects.length) html += `<div class="ws-empty-note ws-search-empty" id="ws-search-empty" role="status" aria-live="polite"></div>`;
|
|
@@ -2473,6 +2589,7 @@
|
|
|
2473
2589
|
* cards and the Archived list are not results, so they are left alone. `caret` restores the
|
|
2474
2590
|
* selection a rebuild dropped. */
|
|
2475
2591
|
function applyLandingSearch(caret) {
|
|
2592
|
+
syncProjectGroupSearchRoot();
|
|
2476
2593
|
const input = $landing.querySelector('#ws-landing-search');
|
|
2477
2594
|
if (!input) return;
|
|
2478
2595
|
const terms = landingQuery.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
@@ -2482,6 +2599,15 @@
|
|
|
2482
2599
|
card.hidden = !terms.every((t) => hay.includes(t));
|
|
2483
2600
|
if (!card.hidden) shown++;
|
|
2484
2601
|
}
|
|
2602
|
+
// Search counts describe the visible results, and a module with no matches leaves no empty
|
|
2603
|
+
// heading behind. Clearing the query restores the same sections without rebuilding the cards.
|
|
2604
|
+
for (const section of $landing.querySelectorAll('.ws-project-section')) {
|
|
2605
|
+
const count = Array.from(section.querySelectorAll('.ws-card[data-open]')).filter((card) => !card.hidden).length;
|
|
2606
|
+
section.hidden = count === 0;
|
|
2607
|
+
const key = section.dataset.module;
|
|
2608
|
+
showProjectGroup(section, terms.length ? (projectGroupSearchOverrides.get(key) ?? true) : projectGroupExpanded(key));
|
|
2609
|
+
section.querySelector('.ws-project-count').textContent = `${count} ${count === 1 ? 'project' : 'projects'}`;
|
|
2610
|
+
}
|
|
2485
2611
|
const note = $landing.querySelector('#ws-search-empty');
|
|
2486
2612
|
if (note) {
|
|
2487
2613
|
note.textContent = shown ? '' : `No projects match “${landingQuery.trim()}”.${archived.length ? ' Archived projects aren’t searched.' : ''} `;
|
|
@@ -2491,6 +2617,7 @@
|
|
|
2491
2617
|
if (caret) input.setSelectionRange(caret[0], caret[1]);
|
|
2492
2618
|
}
|
|
2493
2619
|
function setLandingQuery(q) {
|
|
2620
|
+
if (q !== landingQuery) projectGroupSearchOverrides.clear();
|
|
2494
2621
|
landingQuery = q;
|
|
2495
2622
|
const input = $landing.querySelector('#ws-landing-search');
|
|
2496
2623
|
if (input) input.value = q;
|
|
@@ -2541,7 +2668,7 @@
|
|
|
2541
2668
|
// element is ACTED on by, never by DOM position: a rebuild reorders the grid (a rename re-fronts its
|
|
2542
2669
|
// card), so an index would hand focus to a different project — worse than losing it. Returns null
|
|
2543
2670
|
// for anything unrecognised or outside the landing, which simply means "don't restore".
|
|
2544
|
-
const FOCUS_KEY_ATTRS = ['data-open', 'data-kebab', 'data-thumb', 'data-restore', 'data-delete-archived', 'data-revit-remedy', 'data-module-remedy'];
|
|
2671
|
+
const FOCUS_KEY_ATTRS = ['data-project-group-toggle', 'data-open', 'data-kebab', 'data-thumb', 'data-restore', 'data-delete-archived', 'data-parser-setup', 'data-revit-remedy', 'data-module-remedy'];
|
|
2545
2672
|
function landingFocusKey(el) {
|
|
2546
2673
|
if (!el || !$landing.contains(el)) return null;
|
|
2547
2674
|
if (el.id) return `#${el.id}`; // #ws-import-project / #ws-retry-projects
|
|
@@ -2593,6 +2720,17 @@
|
|
|
2593
2720
|
}
|
|
2594
2721
|
|
|
2595
2722
|
$landing.addEventListener('click', async (e) => {
|
|
2723
|
+
const groupToggle = e.target.closest('[data-project-group-toggle]');
|
|
2724
|
+
if (groupToggle) {
|
|
2725
|
+
const expanded = groupToggle.getAttribute('aria-expanded') !== 'true';
|
|
2726
|
+
const key = groupToggle.dataset.projectGroupToggle;
|
|
2727
|
+
if (landingQuery.trim()) projectGroupSearchOverrides.set(key, expanded);
|
|
2728
|
+
else saveProjectGroupExpanded(key, expanded);
|
|
2729
|
+
showProjectGroup(groupToggle.closest('.ws-project-section'), expanded);
|
|
2730
|
+
if (expanded) tipTruncatedNames();
|
|
2731
|
+
e.stopPropagation();
|
|
2732
|
+
return;
|
|
2733
|
+
}
|
|
2596
2734
|
const kebab = e.target.closest('[data-kebab]');
|
|
2597
2735
|
if (kebab) { e.stopPropagation(); openProjMenu(kebab.dataset.kebab, kebab); return; }
|
|
2598
2736
|
// Before the card's own [data-open] branch below, exactly like the kebab: the thumbnail is the one
|
|
@@ -2612,6 +2750,11 @@
|
|
|
2612
2750
|
return;
|
|
2613
2751
|
}
|
|
2614
2752
|
if (e.target.closest('#ws-import-project')) { importProject(); return; }
|
|
2753
|
+
const parserSetup = e.target.closest('[data-parser-setup]');
|
|
2754
|
+
if (parserSetup) {
|
|
2755
|
+
window.flolessParserSetupRecovery?.open(parserSetup.dataset.parserSetup, parserSetup);
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2615
2758
|
const revitRemedy = e.target.closest('[data-revit-remedy]');
|
|
2616
2759
|
if (revitRemedy) {
|
|
2617
2760
|
if (revitRemedy.dataset.revitRemedy === 'report-issue') {
|
|
@@ -2840,6 +2983,7 @@
|
|
|
2840
2983
|
});
|
|
2841
2984
|
$landing.addEventListener('input', (e) => {
|
|
2842
2985
|
if (e.target.id !== 'ws-landing-search') return;
|
|
2986
|
+
projectGroupSearchOverrides.clear();
|
|
2843
2987
|
landingQuery = e.target.value;
|
|
2844
2988
|
applyLandingSearch();
|
|
2845
2989
|
});
|
|
@@ -3324,6 +3468,17 @@
|
|
|
3324
3468
|
if (userMessage) return userMessage;
|
|
3325
3469
|
const raw = String(error && error.body?.error || error && error.message || error || '');
|
|
3326
3470
|
const code = String(error && (error.code || error.body?.code) || '');
|
|
3471
|
+
// Account access can expire while this dialog is open, before the folder chooser
|
|
3472
|
+
// or project creation runs. Name that cause without blaming the selected folder.
|
|
3473
|
+
if (error?.status === 402 || error?.body?.error === 'subscription required') {
|
|
3474
|
+
const access = error?.body || error;
|
|
3475
|
+
if (access?.reason === 'session-expired') return 'Your FloLess sign-in has expired. Sign in again, then try again.';
|
|
3476
|
+
if (access?.reason === 'signed-out') return 'You are signed out of FloLess. Sign in again, then try again.';
|
|
3477
|
+
if (access?.reason === 'seat-taken') return 'Your FloLess session has ended. Sign in again, then try again.';
|
|
3478
|
+
if (access?.state === 'expired') return 'Your FloLess subscription has expired. Renew your subscription, then try again.';
|
|
3479
|
+
if (access?.reason === 'no-subscription') return 'This account does not have a FloLess subscription. Sign in with a subscribed account or subscribe, then try again.';
|
|
3480
|
+
return 'Sign in to FloLess to check your account access, then try again.';
|
|
3481
|
+
}
|
|
3327
3482
|
// A setup refusal with no sentence for the person (#1965 review, round 3). The code covers several
|
|
3328
3483
|
// causes — the parser's setup has not finished, or a check refused this project while its card shows
|
|
3329
3484
|
// the ready state — so the sentence names none of them, only the card that shows what is left to do.
|
|
@@ -6106,6 +6261,37 @@
|
|
|
6106
6261
|
}
|
|
6107
6262
|
}
|
|
6108
6263
|
|
|
6264
|
+
// These replies are made before this attempt writes durable approval state. Asking for its
|
|
6265
|
+
// receipt would only find nothing and turn the rejected request into an identical retry.
|
|
6266
|
+
const APPROVAL_PREWRITE_REFUSAL_CODES = ['approval-forward-invalid', 'approval-partition-conflict', 'approval-head-stale', 'nothing-to-approve'];
|
|
6267
|
+
function showApprovalPrewriteRefusal(error, project) {
|
|
6268
|
+
const st = approvalDialogState;
|
|
6269
|
+
const code = error && error.body && error.body.code;
|
|
6270
|
+
if (!st || !APPROVAL_PREWRITE_REFUSAL_CODES.includes(code)) return false;
|
|
6271
|
+
rememberApprovalOperation(project, null);
|
|
6272
|
+
st.operationId = null;
|
|
6273
|
+
st.operationToken = null;
|
|
6274
|
+
st.decisions = {};
|
|
6275
|
+
st.conflicts = {};
|
|
6276
|
+
st.retryAction = null;
|
|
6277
|
+
st.stale = true;
|
|
6278
|
+
const nothingSelected = code === 'nothing-to-approve';
|
|
6279
|
+
const explanation = error.body.error || (nothingSelected
|
|
6280
|
+
? 'Choose at least one change to approve.'
|
|
6281
|
+
: 'FloLess could not apply these selected changes together.');
|
|
6282
|
+
const next = nothingSelected
|
|
6283
|
+
? 'Close this review, then reopen it to choose the changes you want to approve.'
|
|
6284
|
+
: code === 'approval-partition-conflict'
|
|
6285
|
+
? 'Reload current review, then approve related changes together or leave them pending. Your earlier decisions will be cleared.'
|
|
6286
|
+
: 'Reload current review, then choose which changes to approve. Your earlier decisions will be cleared.';
|
|
6287
|
+
$approvalImpact.textContent = explanation;
|
|
6288
|
+
$approvalCounts.textContent = '';
|
|
6289
|
+
$approvalBody.innerHTML = `<div class="approval-notice approval-notice-error"><b>Nothing was approved.</b> ${escapeHtml(next)}</div>`;
|
|
6290
|
+
setApprovalPhase(nothingSelected ? 'recovery-close' : 'stale', `Nothing was approved. ${next}`);
|
|
6291
|
+
(nothingSelected ? $approvalClose : $approvalReload).focus();
|
|
6292
|
+
return true;
|
|
6293
|
+
}
|
|
6294
|
+
|
|
6109
6295
|
async function confirmApprovalReview() {
|
|
6110
6296
|
const st = approvalDialogState;
|
|
6111
6297
|
if (!st || $approvalConfirm.disabled || !current || current.id !== st.projectId) return;
|
|
@@ -6130,6 +6316,7 @@
|
|
|
6130
6316
|
});
|
|
6131
6317
|
await finishApprovalSuccess(res, project);
|
|
6132
6318
|
} catch (error) {
|
|
6319
|
+
if (showApprovalPrewriteRefusal(error, project)) return;
|
|
6133
6320
|
if (approvalDialogState && error && error.body && IMPORT_FINDINGS_REFUSAL_CODES.includes(error.body.code)) {
|
|
6134
6321
|
// Refused BEFORE anything durable was written for this operation (no claim, no recovery), so it
|
|
6135
6322
|
// is never a retry. Forget the operation pair, clear the decision, re-bind the warning to the
|
|
@@ -6157,8 +6344,8 @@
|
|
|
6157
6344
|
st.operationId = null;
|
|
6158
6345
|
st.operationToken = null;
|
|
6159
6346
|
approvalDialogState.stale = true;
|
|
6160
|
-
$approvalImpact.textContent = 'The working copy changed. Your decisions were not applied. Reload the current review; earlier decisions will be cleared.';
|
|
6161
6347
|
renderApprovalReview();
|
|
6348
|
+
$approvalImpact.textContent = 'The working copy changed. Your decisions were not applied. Reload the current review; earlier decisions will be cleared.';
|
|
6162
6349
|
setApprovalPhase('stale', 'The review changed. Reload current review.');
|
|
6163
6350
|
$approvalReload.focus();
|
|
6164
6351
|
} else if (approvalDialogState) {
|
|
@@ -6550,7 +6737,8 @@
|
|
|
6550
6737
|
function kbPending(st) {
|
|
6551
6738
|
if (st.organize) return { started: true, since: Date.parse(st.organize.startedAt) };
|
|
6552
6739
|
const q = st.queued[0];
|
|
6553
|
-
|
|
6740
|
+
// id: which queued request Cancel deletes; wait (#2131): its start met work already changing the project.
|
|
6741
|
+
if (q) return { started: false, since: Date.parse(q.createdAt), id: q.id, wait: q.organizeWait || null };
|
|
6554
6742
|
return null;
|
|
6555
6743
|
}
|
|
6556
6744
|
const kbAgo = (ms) => {
|
|
@@ -6636,6 +6824,21 @@
|
|
|
6636
6824
|
`</div>`;
|
|
6637
6825
|
}
|
|
6638
6826
|
|
|
6827
|
+
/**
|
|
6828
|
+
* #2131: a queued organize whose start met work already changing the project. Only what was recorded is said — when
|
|
6829
|
+
* the AI last tried and who held the project — never that it starts by itself: nothing here can tell whether that AI
|
|
6830
|
+
* is still trying. Past FloLess's 30 minutes the server's own sentence says what happened and what to do.
|
|
6831
|
+
*/
|
|
6832
|
+
function kbWaitLead(wait) {
|
|
6833
|
+
if (wait.endedAt) return escapeHtml(String(wait.message || 'Organizing waited too long for other work in this project and didn’t start. Ask your AI to organize again.'));
|
|
6834
|
+
const full = String(wait.holder?.title || 'other work');
|
|
6835
|
+
const title = full.length > 48 ? `${full.slice(0, 45).trimEnd()}…` : full;
|
|
6836
|
+
const who = wait.holder?.kind === 'chat' ? `“${title}”` : title;
|
|
6837
|
+
const ago = kbAgo(Date.now() - Date.parse(wait.lastTriedAt));
|
|
6838
|
+
return escapeHtml(`Your AI tried to start organizing${ago ? ` ${ago}` : ''}, but ${who} was changing this project. Organizing hasn’t started. `
|
|
6839
|
+
+ 'If your AI is no longer waiting, ask it to organize again once that work is done.');
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6639
6842
|
function kbFoot(st) {
|
|
6640
6843
|
const enabled = st.sources.filter((s) => s.useAsKb).length;
|
|
6641
6844
|
const pending = kbPending(st);
|
|
@@ -6648,11 +6851,12 @@
|
|
|
6648
6851
|
const age = kbAgo(Date.now() - pending.since);
|
|
6649
6852
|
const stale = pending.started && Date.now() - pending.since > KB_LOCK_STALE_MS;
|
|
6650
6853
|
const cls = stale ? 'kb-pending stale' : pending.started ? 'kb-pending' : 'kb-pending queued';
|
|
6651
|
-
const ico = stale ? '<span class="kb-ico" aria-hidden="true">⚠</span>'
|
|
6854
|
+
const ico = stale || pending.wait?.endedAt ? '<span class="kb-ico" aria-hidden="true">⚠</span>'
|
|
6652
6855
|
: pending.started ? '<span class="kb-spin" aria-hidden="true"></span>'
|
|
6653
6856
|
: '<span class="kb-ico" aria-hidden="true">◷</span>';
|
|
6654
6857
|
const lead = pending.started
|
|
6655
6858
|
? `Organizing…${age ? ` started ${escapeHtml(age)}` : ''}`
|
|
6859
|
+
: pending.wait ? kbWaitLead(pending.wait)
|
|
6656
6860
|
: `Queued for your terminal AI — waiting to start…${age ? ` (${escapeHtml(age)})` : ''}`;
|
|
6657
6861
|
// A queued organize (not yet started) can be cancelled — at that point there is no organize lock
|
|
6658
6862
|
// to strand, so this is the immediate, user-initiated escape from a button wedged by an organize
|
|
@@ -7794,6 +7998,8 @@
|
|
|
7794
7998
|
// already-started: the terminal AI won a fair race — not a failure; the repaint shows "Organizing…".
|
|
7795
7999
|
// not-found: already gone (drained/cancelled elsewhere) — silent; the repaint shows it's cleared.
|
|
7796
8000
|
if (code === 'already-started') showToast('Knowledge organization has already started, so it will finish in your AI app.', 'warn');
|
|
8001
|
+
// #2132: the AI is starting it right now (it may still fail to start), or FloLess could not check — say which.
|
|
8002
|
+
else if ((code === 'organize-starting' || code === 'organize-state-unknown') && typeof err.body.error === 'string') showToast(err.body.error, 'warn');
|
|
7797
8003
|
else if (code !== 'not-found') showToast('Couldn’t cancel Knowledge organization. Try again.', 'warn');
|
|
7798
8004
|
} finally {
|
|
7799
8005
|
kbCancelBusy = false;
|
|
@@ -14005,6 +14211,7 @@
|
|
|
14005
14211
|
const el = $landing.querySelector(`.ws-card[data-open="${escapeAttr(id)}"]`);
|
|
14006
14212
|
if (!el) return;
|
|
14007
14213
|
if (el.hidden) setLandingQuery(''); // never confirm on a card the search is hiding (an import, a rename)
|
|
14214
|
+
revealProjectGroup(el);
|
|
14008
14215
|
if (opts && opts.scroll) el.scrollIntoView({ block: 'nearest' });
|
|
14009
14216
|
flashId = id;
|
|
14010
14217
|
armFlash(id, el);
|
|
@@ -14015,6 +14222,8 @@
|
|
|
14015
14222
|
if (!flashId) return;
|
|
14016
14223
|
const el = $landing.querySelector(`.ws-card[data-open="${escapeAttr(flashId)}"]`);
|
|
14017
14224
|
if (!el) { flashId = null; return; } // card is gone (archived/deleted) — drop the pending flash
|
|
14225
|
+
// A later manual collapse or search choice wins over this background confirmation repaint.
|
|
14226
|
+
if (el.hidden || el.closest('.ws-grid')?.hidden) { endFlash(flashId, el); return; }
|
|
14018
14227
|
armFlash(flashId, el);
|
|
14019
14228
|
}
|
|
14020
14229
|
|
|
@@ -14566,6 +14775,17 @@
|
|
|
14566
14775
|
renderKnowledge();
|
|
14567
14776
|
}
|
|
14568
14777
|
|
|
14778
|
+
/**
|
|
14779
|
+
* #2106: open a project on its Knowledge step — where a person sees FloLess organizing its knowledge, the work a busy
|
|
14780
|
+
* card's "Open it" leads to. Throws a plain sentence when the project can't be opened, so the caller can say so.
|
|
14781
|
+
*/
|
|
14782
|
+
async function openKnowledgeStep(projectId) {
|
|
14783
|
+
if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
|
|
14784
|
+
await setMode('workspaces');
|
|
14785
|
+
await openProject(projectId, 'knowledge');
|
|
14786
|
+
if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
|
|
14787
|
+
}
|
|
14788
|
+
|
|
14569
14789
|
// A cross-project object pin still belongs to its original conversation, wherever its model is shown.
|
|
14570
14790
|
async function openChatOwner(owner) {
|
|
14571
14791
|
const validId = (id) => typeof id === 'string' && !!id && id.length <= 200;
|
|
@@ -14586,7 +14806,7 @@
|
|
|
14586
14806
|
|
|
14587
14807
|
window.flolessWorkspaces = {
|
|
14588
14808
|
setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
|
|
14589
|
-
openHistory: wsOpenHistory, openKnowledgePage, drawingFilterCheckpointSaved,
|
|
14809
|
+
openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, drawingFilterCheckpointSaved,
|
|
14590
14810
|
syncWorkspaceReporter, openChatOwner,
|
|
14591
14811
|
};
|
|
14592
14812
|
applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
|