@floless/app 0.152.1 → 0.154.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 +5913 -3408
- package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -1
- package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +4 -2
- package/dist/schemas/revit.model.v1.schema.json +5 -0
- package/dist/schemas/steel.model.v2.schema.json +1 -1
- package/dist/skills/floless-app-new-workflow/SKILL.md +8 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +8 -5
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -3
- package/dist/skills/floless-app-queue/SKILL.md +23 -4
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +18 -2
- package/dist/web/agents.js +8 -1
- package/dist/web/app.css +107 -5
- package/dist/web/app.js +106 -12
- package/dist/web/aware.js +424 -57
- package/dist/web/chat.css +60 -13
- package/dist/web/chat.js +814 -148
- package/dist/web/commands-shell.js +200 -21
- package/dist/web/commands-steel.js +78 -3
- package/dist/web/guide.js +213 -13
- package/dist/web/index.html +16 -9
- package/dist/web/instructor.js +2 -1
- package/dist/web/leave-guard.js +51 -7
- package/dist/web/left-pane.js +251 -46
- package/dist/web/model-editor-steel-adapter.js +3 -0
- package/dist/web/model-viewport.js +14 -6
- package/dist/web/revit-editor.js +1 -0
- package/dist/web/steel-3d-view.js +15 -7
- package/dist/web/steel-editor.html +367 -54
- package/dist/web/tekla-structural-grid-adapter.js +7 -1
- package/dist/web/tool-updates.js +141 -33
- package/dist/web/workspaces.js +125 -21
- package/package.json +1 -1
|
@@ -15,7 +15,13 @@ const finiteNonnegative = (value, name) => {
|
|
|
15
15
|
export function teklaStructuralGridContract(entity) {
|
|
16
16
|
const payload = entity?.structuralGrid;
|
|
17
17
|
if (!payload) return null;
|
|
18
|
-
if (payload.schemaVersion !== SCHEMA || payload.entityId !== entity.id
|
|
18
|
+
if (payload.schemaVersion !== SCHEMA || payload.entityId !== entity.id) {
|
|
19
|
+
throw new TypeError('The authenticated Tekla structural grid facade is inconsistent.');
|
|
20
|
+
}
|
|
21
|
+
// A Grid whose extents or origin could not be mapped is signed, but not drawn: its Audit row is the
|
|
22
|
+
// open `grid-mapping-unevaluated` finding ("Grid not shown in 3D"). It must not stop the model opening.
|
|
23
|
+
if (payload.mapping?.kind === 'unevaluated') return null;
|
|
24
|
+
if (payload.mapping?.kind !== 'symmetric') {
|
|
19
25
|
throw new TypeError('The authenticated Tekla structural grid facade is inconsistent.');
|
|
20
26
|
}
|
|
21
27
|
const extents = payload.mapping.extentsMm;
|
package/dist/web/tool-updates.js
CHANGED
|
@@ -292,11 +292,14 @@
|
|
|
292
292
|
// ── The footer pill ────────────────────────────────────────────────────────
|
|
293
293
|
function paintPill() {
|
|
294
294
|
var offers = view && view.supported ? view.offers || [] : [];
|
|
295
|
+
// Only the rows the person can act on count: FloLess's own, archived and in-progress workflows (the quiet groups) never
|
|
296
|
+
// do. The server says how many; a server without groups counts every row, as before.
|
|
295
297
|
var needs = view && view.supported ? view.needsYou || [] : [];
|
|
298
|
+
var needCount = view && view.supported && typeof view.needsCount === 'number' ? view.needsCount : needs.length;
|
|
296
299
|
var cleanup = cleanupNeeds();
|
|
297
300
|
var urgent = offers.filter(function (o) { return !!o.advisory; }).length;
|
|
298
301
|
// Only a check this page started: a background pass is not something the person is waiting for.
|
|
299
|
-
if (!offers.length && !
|
|
302
|
+
if (!offers.length && !needCount && !cleanup.length && !checking) {
|
|
300
303
|
// A pill that disappears under the keyboard's focus must not drop focus to the page behind.
|
|
301
304
|
if (document.activeElement === $pill) { var menu = document.getElementById('menu-btn'); if (menu) menu.focus(); }
|
|
302
305
|
$pill.hidden = true;
|
|
@@ -317,11 +320,11 @@
|
|
|
317
320
|
var days = Math.max.apply(null, offers.map(function (o) { return o.waitingDays || 0; }));
|
|
318
321
|
text += ' · waiting ' + plural(days, 'day', 'days');
|
|
319
322
|
}
|
|
320
|
-
} else if (
|
|
323
|
+
} else if (needCount || cleanup.length) {
|
|
321
324
|
state = 'needs';
|
|
322
325
|
var folders = cleanup.filter(function (c) { return c.kind !== 'unreadable'; }).length;
|
|
323
|
-
if (
|
|
324
|
-
else if (
|
|
326
|
+
if (needCount && cleanup.length) text = (needCount + cleanup.length) + ' things need you';
|
|
327
|
+
else if (needCount) text = plural(needCount, 'workflow needs you', 'workflows need you');
|
|
325
328
|
else if (folders === cleanup.length) text = plural(folders, 'folder needs you', 'folders need you');
|
|
326
329
|
else text = plural(cleanup.length, 'item needs you', 'items need you');
|
|
327
330
|
} else {
|
|
@@ -371,36 +374,47 @@
|
|
|
371
374
|
return card;
|
|
372
375
|
}
|
|
373
376
|
|
|
374
|
-
|
|
377
|
+
/** A row under a group's explanation says only which workflow (and what is specific to it); a row with no group (an older server) carries its own sentence. */
|
|
378
|
+
function needsRow(item, grouped) {
|
|
375
379
|
var row = el('div', 'tool-updates-needs');
|
|
376
380
|
row.setAttribute('data-app', item.app);
|
|
377
381
|
row.setAttribute('data-kind', item.kind);
|
|
378
382
|
var text = el('div', 'tool-updates-needs-text');
|
|
379
383
|
text.appendChild(el('span', 'tool-updates-needs-name', item.workflowName));
|
|
380
|
-
text.appendChild(el('span', 'tool-updates-needs-sentence', item.sentence));
|
|
384
|
+
if (!grouped) text.appendChild(el('span', 'tool-updates-needs-sentence', item.sentence));
|
|
385
|
+
else if (item.detail) text.appendChild(el('span', 'tool-updates-needs-sentence', item.detail));
|
|
381
386
|
row.appendChild(text);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
var openButton = el('button', 'tool-updates-open', 'Open workflow');
|
|
387
|
-
openButton.type = 'button';
|
|
388
|
-
openButton.setAttribute('data-command-id', 'shell.tool-updates-open-workflow');
|
|
389
|
-
openButton.setAttribute('data-tip', 'Open ' + item.workflowName + ' to do this');
|
|
390
|
-
openButton.addEventListener('click', function () {
|
|
391
|
-
close();
|
|
392
|
-
Promise.resolve(bridge.openApp(item.app)).catch(function (error) {
|
|
393
|
-
console.warn('could not open the workflow', error);
|
|
394
|
-
// Back to the dialog, with the reason in its live line (open() clears that line, so it is set after).
|
|
395
|
-
open($pill.hidden ? null : $pill);
|
|
396
|
-
$live.textContent = error.message;
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
row.appendChild(openButton);
|
|
387
|
+
if (item.action === 'open-workflow') {
|
|
388
|
+
// Offered only for a workflow the Workflows page lists — one installed from a terminal cannot be opened here. That list
|
|
389
|
+
// loads on its own schedule, so a row it does not list yet is marked and given its button the moment it does.
|
|
390
|
+
if (!attachOpenButton(row, item)) row.setAttribute('data-awaiting-open', '');
|
|
400
391
|
}
|
|
401
392
|
return row;
|
|
402
393
|
}
|
|
403
394
|
|
|
395
|
+
/** The Open workflow button, once the Workflows page lists this workflow. False while it does not. */
|
|
396
|
+
function attachOpenButton(row, item) {
|
|
397
|
+
var bridge = window.flolessBridge;
|
|
398
|
+
if (!(bridge && typeof bridge.openApp === 'function' && typeof bridge.canOpenApp === 'function' && bridge.canOpenApp(item.app))) return false;
|
|
399
|
+
var openButton = el('button', 'tool-updates-open', 'Open workflow');
|
|
400
|
+
openButton.type = 'button';
|
|
401
|
+
openButton.setAttribute('data-command-id', 'shell.tool-updates-open-workflow');
|
|
402
|
+
openButton.setAttribute('data-tip', 'Open ' + item.workflowName + ' to do this');
|
|
403
|
+
openButton.setAttribute('aria-label', 'Open workflow ' + item.workflowName);
|
|
404
|
+
openButton.addEventListener('click', function () {
|
|
405
|
+
close();
|
|
406
|
+
Promise.resolve(bridge.openApp(item.app)).catch(function (error) {
|
|
407
|
+
console.warn('could not open the workflow', error);
|
|
408
|
+
// Back to the dialog, with the reason in its live line (open() clears that line, so it is set after).
|
|
409
|
+
open($pill.hidden ? null : $pill);
|
|
410
|
+
$live.textContent = error.message;
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
row.appendChild(openButton);
|
|
414
|
+
row.removeAttribute('data-awaiting-open');
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
|
|
404
418
|
var forgetting = null; // the path being removed from the list, while its request is in flight
|
|
405
419
|
|
|
406
420
|
function cleanupRow(item) {
|
|
@@ -479,6 +493,86 @@
|
|
|
479
493
|
return lines;
|
|
480
494
|
}
|
|
481
495
|
|
|
496
|
+
// ── The Needs-you rows, under the server's explanations (#2180) ──────────────────────────────────────────────
|
|
497
|
+
// The server says what each group of rows is (title, one explanation, whether the person can act on it); this only lays
|
|
498
|
+
// them out. A group the person can act on shows its explanation and its rows; the quiet ones (FloLess's own workflows,
|
|
499
|
+
// archived ones, runs in progress) sit collapsed under "Nothing to do" and never count toward the pill.
|
|
500
|
+
var QUIET_OPEN = {}; // group id → the person opened (true) or closed (false) its list; kept across repaints
|
|
501
|
+
var OPEN_WITHOUT_ASKING = 3; // a group this short shows its rows straight away
|
|
502
|
+
|
|
503
|
+
function groupHead(group, count) {
|
|
504
|
+
var head = el('div', 'tool-updates-group-head');
|
|
505
|
+
head.appendChild(el('span', 'tool-updates-group-title', group.title));
|
|
506
|
+
head.appendChild(el('span', 'tool-updates-group-count', String(count)));
|
|
507
|
+
return head;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Only the person's own click or key press on the summary is remembered: a list's default state is set again at every repaint. */
|
|
511
|
+
function rememberOpen(details, id) {
|
|
512
|
+
var summary = details.querySelector('summary');
|
|
513
|
+
if (summary) summary.addEventListener('click', function () { setTimeout(function () { QUIET_OPEN[id] = details.open; }, 0); });
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function actionGroup(group, rows) {
|
|
517
|
+
var box = el('div', 'tool-updates-group');
|
|
518
|
+
box.setAttribute('data-group', group.id);
|
|
519
|
+
box.appendChild(groupHead(group, rows.length));
|
|
520
|
+
box.appendChild(el('p', 'tool-updates-group-explain', group.explanation));
|
|
521
|
+
var list = el('details', 'tool-updates-group-rows');
|
|
522
|
+
var open = QUIET_OPEN[group.id];
|
|
523
|
+
list.open = open === undefined ? rows.length <= OPEN_WITHOUT_ASKING : open;
|
|
524
|
+
var what = rows.length === 1 ? 'the workflow' : 'the ' + rows.length + ' workflows';
|
|
525
|
+
var toggle = el('summary', null, (list.open ? 'Hide ' : 'Show ') + what);
|
|
526
|
+
toggle.setAttribute('data-command-id', 'shell.tool-updates-show-workflows');
|
|
527
|
+
list.appendChild(toggle);
|
|
528
|
+
rememberOpen(list, group.id);
|
|
529
|
+
// The click runs before the browser flips `open`, so the label says what the click is about to do; `toggle` (which comes later, and also for a change made by other means) settles it.
|
|
530
|
+
toggle.addEventListener('click', function () { toggle.textContent = (list.open ? 'Show ' : 'Hide ') + what; });
|
|
531
|
+
list.addEventListener('toggle', function () { toggle.textContent = (list.open ? 'Hide ' : 'Show ') + what; });
|
|
532
|
+
rows.forEach(function (n) { list.appendChild(needsRow(n, true)); });
|
|
533
|
+
box.appendChild(list);
|
|
534
|
+
return box;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function quietGroup(group, rows) {
|
|
538
|
+
var box = el('details', 'tool-updates-group tool-updates-group-quiet');
|
|
539
|
+
box.setAttribute('data-group', group.id);
|
|
540
|
+
box.open = QUIET_OPEN[group.id] === true;
|
|
541
|
+
var summary = el('summary', null);
|
|
542
|
+
summary.setAttribute('data-command-id', 'shell.tool-updates-show-workflows');
|
|
543
|
+
summary.appendChild(el('span', 'tool-updates-group-title', group.title));
|
|
544
|
+
summary.appendChild(el('span', 'tool-updates-group-count', String(rows.length)));
|
|
545
|
+
box.appendChild(summary);
|
|
546
|
+
rememberOpen(box, group.id);
|
|
547
|
+
box.appendChild(el('p', 'tool-updates-group-explain', group.explanation));
|
|
548
|
+
rows.forEach(function (n) { box.appendChild(needsRow(n, true)); });
|
|
549
|
+
return box;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** The workflows' rows, laid out by group. An older server's view has no groups: its flat rows are listed as they come. */
|
|
553
|
+
function paintNeeds(needs, cleanup) {
|
|
554
|
+
var groups = view && Array.isArray(view.needsGroups) ? view.needsGroups : null;
|
|
555
|
+
var rowsOf = function (id) { return needs.filter(function (n) { return n.group === id; }); };
|
|
556
|
+
var loose = groups ? needs.filter(function (n) { return !groups.some(function (g) { return g.id === n.group; }); }) : needs;
|
|
557
|
+
var acting = groups ? groups.filter(function (g) { return g.tone === 'action' && rowsOf(g.id).length; }) : [];
|
|
558
|
+
var quiet = groups ? groups.filter(function (g) { return g.tone !== 'action' && rowsOf(g.id).length; }) : [];
|
|
559
|
+
var count = (groups ? acting.reduce(function (n, g) { return n + rowsOf(g.id).length; }, 0) + loose.length : needs.length) + cleanup.length;
|
|
560
|
+
if (count) {
|
|
561
|
+
var needsSection = section('Needs you', count);
|
|
562
|
+
acting.forEach(function (g) { needsSection.appendChild(actionGroup(g, rowsOf(g.id))); });
|
|
563
|
+
loose.forEach(function (n) { needsSection.appendChild(needsRow(n, false)); });
|
|
564
|
+
cleanup.forEach(function (n) { needsSection.appendChild(cleanupRow(n)); });
|
|
565
|
+
$body.appendChild(needsSection);
|
|
566
|
+
}
|
|
567
|
+
if (quiet.length) {
|
|
568
|
+
var total = quiet.reduce(function (n, g) { return n + rowsOf(g.id).length; }, 0);
|
|
569
|
+
var quietSection = section('Nothing to do', total);
|
|
570
|
+
quiet.forEach(function (g) { quietSection.appendChild(quietGroup(g, rowsOf(g.id))); });
|
|
571
|
+
$body.appendChild(quietSection);
|
|
572
|
+
}
|
|
573
|
+
return count + (quiet.length ? 1 : 0);
|
|
574
|
+
}
|
|
575
|
+
|
|
482
576
|
function section(title, count) {
|
|
483
577
|
var wrap = el('div', 'tool-updates-section');
|
|
484
578
|
wrap.appendChild(el('div', 'tool-updates-section-head', title + ' (' + count + ')'));
|
|
@@ -530,6 +624,7 @@
|
|
|
530
624
|
command: active.getAttribute('data-command-id'),
|
|
531
625
|
path: row && row.getAttribute('data-path'),
|
|
532
626
|
app: row && row.getAttribute('data-app'),
|
|
627
|
+
group: !row && active.closest ? (active.closest('[data-group]') || { getAttribute: function () { return null; } }).getAttribute('data-group') : null,
|
|
533
628
|
head: active.classList.contains('tool-updates-section-head'),
|
|
534
629
|
};
|
|
535
630
|
}
|
|
@@ -541,7 +636,8 @@
|
|
|
541
636
|
else if (key.command) {
|
|
542
637
|
target = Array.prototype.find.call($body.querySelectorAll('[data-command-id="' + key.command + '"]'), function (b) {
|
|
543
638
|
var row = b.closest('.tool-updates-needs');
|
|
544
|
-
|
|
639
|
+
if (!row) return (b.closest('[data-group]') ? b.closest('[data-group]').getAttribute('data-group') : null) === key.group;
|
|
640
|
+
return row.getAttribute('data-path') === key.path && row.getAttribute('data-app') === key.app;
|
|
545
641
|
}) || null;
|
|
546
642
|
}
|
|
547
643
|
if (target && target.offsetParent !== null) {
|
|
@@ -552,6 +648,20 @@
|
|
|
552
648
|
}
|
|
553
649
|
}
|
|
554
650
|
|
|
651
|
+
// A dialog painted before the Workflows page has listed its workflows had no Open workflow buttons and never got them. The page
|
|
652
|
+
// says when its list arrives (floless:workflows-listed); rows marked data-awaiting-open are then given their button in place.
|
|
653
|
+
// Nothing is rebuilt, so a click, a tooltip or the screen reader's place is never lost.
|
|
654
|
+
function giveAwaitingOpenButtons() {
|
|
655
|
+
var rows = $body.querySelectorAll('.tool-updates-needs[data-awaiting-open]');
|
|
656
|
+
if (!rows.length) return;
|
|
657
|
+
var byApp = {};
|
|
658
|
+
((view && view.needsYou) || []).forEach(function (n) { byApp[n.app] = n; });
|
|
659
|
+
Array.prototype.forEach.call(rows, function (row) {
|
|
660
|
+
var item = byApp[row.getAttribute('data-app')];
|
|
661
|
+
if (item) attachOpenButton(row, item);
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
|
|
555
665
|
function paint() {
|
|
556
666
|
var keepFocus = focusKey();
|
|
557
667
|
try { paintNow(); } finally { restoreFocus(keepFocus); }
|
|
@@ -591,19 +701,16 @@
|
|
|
591
701
|
}
|
|
592
702
|
}
|
|
593
703
|
var cleanup = cleanupNeeds();
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
needs.forEach(function (n) { needsSection.appendChild(needsRow(n)); });
|
|
597
|
-
cleanup.forEach(function (n) { needsSection.appendChild(cleanupRow(n)); });
|
|
598
|
-
$body.appendChild(needsSection);
|
|
599
|
-
}
|
|
600
|
-
if (!results && !offers.length && !needs.length && !cleanup.length && view && view.supported && !view.sentence) {
|
|
704
|
+
var shownRows = paintNeeds(needs, cleanup);
|
|
705
|
+
if (!results && !offers.length && !shownRows && view && view.supported && !view.sentence) {
|
|
601
706
|
$body.appendChild(el('div', 'tool-updates-summary', view.checking
|
|
602
707
|
? 'Checking which workflows a tool update affects…'
|
|
603
708
|
: 'All your workflows are on the tool versions you approved.'));
|
|
604
709
|
}
|
|
605
710
|
var dl = downloadsLine();
|
|
606
|
-
if (dl) $foot.appendChild(el('div', 'tool-updates-downloads', dl));
|
|
711
|
+
if (dl) $foot.appendChild(el('div', 'tool-updates-downloads' + (view.downloads && view.downloads.error ? ' tool-updates-downloads-problem' : ''), dl));
|
|
712
|
+
// Tools AWARE left as they are because they are the person's own copy: said apart from a failure.
|
|
713
|
+
if (view && view.downloads && view.downloads.note) $foot.appendChild(el('div', 'tool-updates-downloads', view.downloads.note));
|
|
607
714
|
cleanupLines().forEach(function (line) { $foot.appendChild(el('div', 'tool-updates-downloads', line)); });
|
|
608
715
|
var checked = lastChecked();
|
|
609
716
|
if (checked) $foot.appendChild(el('div', 'tool-updates-downloads', checked));
|
|
@@ -822,6 +929,7 @@
|
|
|
822
929
|
|
|
823
930
|
window.addEventListener('floless:tool-updates-changed', function () { void refresh(); });
|
|
824
931
|
window.addEventListener('floless:apps-changed', function () { void refresh(); });
|
|
932
|
+
window.addEventListener('floless:workflows-listed', giveAwaitingOpenButtons);
|
|
825
933
|
window.flolessToolUpdates = { refresh: refresh, open: open };
|
|
826
934
|
void refresh();
|
|
827
935
|
})();
|
package/dist/web/workspaces.js
CHANGED
|
@@ -350,6 +350,12 @@
|
|
|
350
350
|
const $revisionCard = document.getElementById('ws-revision-card');
|
|
351
351
|
const $revisionFile = document.getElementById('ws-revision-file');
|
|
352
352
|
const $sourcePlaceholder = document.getElementById('ws-source-placeholder'); // shown for a filter-less Source step
|
|
353
|
+
// While a Revit or Tekla read is in flight the Source pane shows Flo working, hat on, as over a running workflow
|
|
354
|
+
// (#2079). It sits in the hidden .ws-source-spin slot that data-importing reveals, and only moves while on screen.
|
|
355
|
+
{
|
|
356
|
+
const slot = $sourcePlaceholder?.querySelector('.ws-source-spin');
|
|
357
|
+
if (slot && typeof floAvatar === 'function') { slot.classList.add('ws-source-flo'); floAvatar(slot, { size: 40, mood: 'working', hat: true }); }
|
|
358
|
+
}
|
|
353
359
|
const $revitSourceActions = document.getElementById('ws-source-actions');
|
|
354
360
|
const $revitOpenModel = document.getElementById('ws-revit-open-model');
|
|
355
361
|
const $revitReplace = document.getElementById('ws-revit-replace');
|
|
@@ -366,6 +372,10 @@
|
|
|
366
372
|
const $revitReassure = document.getElementById('ws-source-reassure');
|
|
367
373
|
let revitSourceState = null;
|
|
368
374
|
let revitActiveOperation = null;
|
|
375
|
+
// The Source card an import leaves ("…It is not approved yet.") stays true only until that model is approved.
|
|
376
|
+
let revitSourceAwaitsApproval = false;
|
|
377
|
+
// Every paint of the Source pane counts, so a late answer can tell that something newer was painted.
|
|
378
|
+
let revitSourcePaints = 0;
|
|
369
379
|
const activeImportPolls = new Set();
|
|
370
380
|
let teklaUploadAbort = null;
|
|
371
381
|
let teklaUploadProjectId = null;
|
|
@@ -1293,6 +1303,7 @@
|
|
|
1293
1303
|
const headVersion = approvalHeadVersion(review);
|
|
1294
1304
|
approvalState = { status: 'ready', review, pendingCount: groups.length, headVersion, error: '' };
|
|
1295
1305
|
renderApprovalHeader();
|
|
1306
|
+
settleImportedSourceCard(projectId);
|
|
1296
1307
|
syncWorkspaceGuide();
|
|
1297
1308
|
if (!$wsExports.hidden) paintExports(current.approvedAt);
|
|
1298
1309
|
return review;
|
|
@@ -1533,7 +1544,7 @@
|
|
|
1533
1544
|
// project open" for the whole pending window and close the project the user asked to stay in —
|
|
1534
1545
|
// and the read would then drop them in Workflows anyway.
|
|
1535
1546
|
const pending = $switch.getAttribute('aria-busy') === 'true';
|
|
1536
|
-
if (!pending && b.dataset.mode === 'workspaces' && mode === 'workspaces' && current) {
|
|
1547
|
+
if (!pending && b.dataset.mode === 'workspaces' && mode === 'workspaces' && current) { void leaveProjectToList(b); return; }
|
|
1537
1548
|
// #1890: the active Workflows tab goes home to the Workflows landing, the same way.
|
|
1538
1549
|
if (!pending && b.dataset.mode === 'workflows' && mode === 'workflows' && bridge.showWorkflowsLanding) { bridge.showWorkflowsLanding(); return; }
|
|
1539
1550
|
// #2007: and the active Agents tab goes home to the list of agents.
|
|
@@ -2041,7 +2052,7 @@
|
|
|
2041
2052
|
// UNPROMPTED. Tracked separately rather than smuggled in here.
|
|
2042
2053
|
const target = mine.id;
|
|
2043
2054
|
try {
|
|
2044
|
-
await openProject(target, currentStep);
|
|
2055
|
+
await openProject(target, currentStep, { skipLeaveGuard: true });
|
|
2045
2056
|
} catch (err) {
|
|
2046
2057
|
// THE REJECTING TWIN of the branch below, and it needs the same sentence: `openProject`
|
|
2047
2058
|
// reassigns `current` and repaints the header BEFORE it re-srcs the frames, so a throw in
|
|
@@ -3111,7 +3122,11 @@
|
|
|
3111
3122
|
if (current?.id !== project.id) return;
|
|
3112
3123
|
if (!state?.canReplace) throw new Error('Tekla Parser replacement access is unavailable.');
|
|
3113
3124
|
const operation = await uploadTeklaForProject(project, source, state.generation);
|
|
3114
|
-
if (current?.id === project.id)
|
|
3125
|
+
if (current?.id === project.id) {
|
|
3126
|
+
// As a new project's read does: the copy check is over, so its "cannot be cancelled" no longer stands.
|
|
3127
|
+
paintRevitSourceState('Waiting for AWARE', 'Your copied Tekla source is waiting for the entitled read-only parser.');
|
|
3128
|
+
pollRevitImport(operation.operationId, project.id);
|
|
3129
|
+
}
|
|
3115
3130
|
} catch (error) {
|
|
3116
3131
|
if (current?.id !== project.id) return;
|
|
3117
3132
|
if (error?.name === 'AbortError') {
|
|
@@ -4132,6 +4147,8 @@
|
|
|
4132
4147
|
$teklaContinueWithout?.addEventListener('click', () => teklaAsk?.onContinue());
|
|
4133
4148
|
|
|
4134
4149
|
function paintRevitSourceState(title, detail) {
|
|
4150
|
+
revitSourcePaints++;
|
|
4151
|
+
revitSourceAwaitsApproval = false;
|
|
4135
4152
|
if (!$sourcePlaceholder) return;
|
|
4136
4153
|
const titleNode = $sourcePlaceholder.querySelector('.ws-source-title');
|
|
4137
4154
|
const detailNode = $sourcePlaceholder.querySelector('.ws-source-sub');
|
|
@@ -4255,6 +4272,18 @@
|
|
|
4255
4272
|
$sourcePlaceholder?.setAttribute('aria-atomic', 'true');
|
|
4256
4273
|
}
|
|
4257
4274
|
|
|
4275
|
+
/**
|
|
4276
|
+
* Once the model an import left on the Source card is approved with nothing pending, the card rests as it
|
|
4277
|
+
* does when the project is reopened ("Source RVT · <file> · <size>"). The header is the one place approval
|
|
4278
|
+
* is shown, so the card never repeats it, and a later import re-arms it.
|
|
4279
|
+
*/
|
|
4280
|
+
function settleImportedSourceCard(projectId) {
|
|
4281
|
+
if (!revitSourceAwaitsApproval || approvalState.status !== 'ready'
|
|
4282
|
+
|| !approvalState.headVersion || approvalState.pendingCount > 0) return;
|
|
4283
|
+
revitSourceAwaitsApproval = false;
|
|
4284
|
+
void refreshRevitSourceState(projectId, revitSourcePaints);
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4258
4287
|
// Replacement admission needs a fresh generation, but it must not share the painter's
|
|
4259
4288
|
// stale-response guard. A simultaneous project-open refresh can legitimately change the
|
|
4260
4289
|
// displayed operation while this request is in flight; that must not silently discard the
|
|
@@ -4285,13 +4314,16 @@
|
|
|
4285
4314
|
return current?.id === project.id ? response.state : null;
|
|
4286
4315
|
}
|
|
4287
4316
|
|
|
4288
|
-
async function refreshRevitSourceState(projectId = current?.id) {
|
|
4317
|
+
async function refreshRevitSourceState(projectId = current?.id, paintsAtRequest = null) {
|
|
4289
4318
|
if (!projectId || !current || current.id !== projectId || !isModelSourceProject(current)) return null;
|
|
4290
4319
|
const operationAtRequest = revitActiveOperation;
|
|
4320
|
+
// A caller that only tidies the pane passes the paint count it saw: anything painted since (an upload that
|
|
4321
|
+
// has no operation yet, a round trip to another project) is newer than this answer.
|
|
4322
|
+
const paintedSince = () => paintsAtRequest !== null && revitSourcePaints !== paintsAtRequest;
|
|
4291
4323
|
try {
|
|
4292
4324
|
const tekla = isTeklaParserProject(current);
|
|
4293
4325
|
const response = await api(`/api/${tekla ? 'tekla' : 'revit'}-projects/${encodeURIComponent(projectId)}/source-state`);
|
|
4294
|
-
if (!current || current.id !== projectId) return null;
|
|
4326
|
+
if (!current || current.id !== projectId || paintedSince()) return null;
|
|
4295
4327
|
// A project-open status request may finish after a new upload has been admitted.
|
|
4296
4328
|
// Never replace the newer operation with the older source-state response.
|
|
4297
4329
|
if (revitActiveOperation !== operationAtRequest) return null;
|
|
@@ -4325,7 +4357,7 @@
|
|
|
4325
4357
|
}
|
|
4326
4358
|
return response.state;
|
|
4327
4359
|
} catch (error) {
|
|
4328
|
-
if (!current || current.id !== projectId || revitActiveOperation !== operationAtRequest) return null;
|
|
4360
|
+
if (!current || current.id !== projectId || revitActiveOperation !== operationAtRequest || paintedSince()) return null;
|
|
4329
4361
|
paintRevitSourceState(isTeklaParserProject() ? 'Tekla source unavailable' : 'Revit source unavailable', error && error.message || 'Could not read source status.');
|
|
4330
4362
|
paintRevitSourceActions('ready', false);
|
|
4331
4363
|
return null;
|
|
@@ -4559,6 +4591,14 @@
|
|
|
4559
4591
|
if (activeImportPolls.has(pollKey)) return;
|
|
4560
4592
|
activeImportPolls.add(pollKey);
|
|
4561
4593
|
const isCurrentImport = () => current?.id === projectId && revitActiveOperation?.operationId === operationId;
|
|
4594
|
+
// Every live state of the read shows it in flight, with its Cancel, from the moment it is admitted. A project
|
|
4595
|
+
// opened just as its upload was admitted can drop its own in-flight paint (refreshRevitSourceState yields to the
|
|
4596
|
+
// newer operation), leaving the idle glyph under "Reading model"; a Tekla read still carries the copy check's
|
|
4597
|
+
// 'uploading' paint, which has no Cancel although the admitted operation has a cancel route.
|
|
4598
|
+
const showReadInFlight = () => {
|
|
4599
|
+
if ($revitCancel?.hidden || $sourcePlaceholder?.getAttribute('data-importing') !== 'true') paintRevitSourceActions('active', true);
|
|
4600
|
+
};
|
|
4601
|
+
if (isCurrentImport()) showReadInFlight();
|
|
4562
4602
|
try {
|
|
4563
4603
|
for (;;) {
|
|
4564
4604
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
@@ -4594,10 +4634,11 @@
|
|
|
4594
4634
|
validating: ['Checking model integrity', 'Verifying the signed source and display packages…'],
|
|
4595
4635
|
publishing: ['Publishing draft', 'Saving the verified read-only model snapshot…'],
|
|
4596
4636
|
}[operation.state];
|
|
4597
|
-
if (copy) { paintRevitSourceState(copy[0], copy[1]); continue; }
|
|
4637
|
+
if (copy) { paintRevitSourceState(copy[0], copy[1]); showReadInFlight(); continue; }
|
|
4598
4638
|
if (operation.state === 'ready') {
|
|
4599
4639
|
revitActiveOperation = null;
|
|
4600
4640
|
paintRevitSourceState(tekla ? 'Read-only snapshot ready to review' : 'Model ready to review', 'The model is available on the Model tab. It is not approved yet.');
|
|
4641
|
+
revitSourceAwaitsApproval = true;
|
|
4601
4642
|
paintRevitSourceActions('imported', true);
|
|
4602
4643
|
// A Model tab opened during conversion has already loaded its temporary "unavailable" state.
|
|
4603
4644
|
// Invalidate that frame now: reload immediately when visible, or on the next tab activation.
|
|
@@ -4711,9 +4752,18 @@
|
|
|
4711
4752
|
}
|
|
4712
4753
|
|
|
4713
4754
|
// ── open project ────────────────────────────────────────────────────────────
|
|
4714
|
-
|
|
4755
|
+
// `opts.skipLeaveGuard` is for the rename re-open only (the project is the same one under a new id and
|
|
4756
|
+
// its old id is already gone, so there is nothing to save to). Every other open of a DIFFERENT project
|
|
4757
|
+
// while one is open asks about unsaved work first — the card click, the switcher, Show in chat, Open
|
|
4758
|
+
// knowledge, create/import — so no path replaces the editors behind the user's back.
|
|
4759
|
+
let openNavSeq = 0;
|
|
4760
|
+
async function openProject(id, initialStep = 'model', opts) {
|
|
4761
|
+
const nav = opts || {};
|
|
4762
|
+
// Latest navigation wins from the first line: an older open still waiting on a lookup must not replace a newer one.
|
|
4763
|
+
const navToken = ++openNavSeq;
|
|
4715
4764
|
let p = projects.find((x) => x.id === id);
|
|
4716
4765
|
if (!p) { try { p = (await api('/api/projects')).projects.find((x) => x.id === id); } catch { /* fall through */ } }
|
|
4766
|
+
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4717
4767
|
if (!p) { showToast('Project not found — it may have been archived.', 'warn'); return loadProjects(); }
|
|
4718
4768
|
// Never a broken open (spec §3.2): a project whose app has no client descriptor can't be rendered
|
|
4719
4769
|
// — toast and bail BEFORE mutating any view state, matching the create-card skip. wsApp() would
|
|
@@ -4727,6 +4777,8 @@
|
|
|
4727
4777
|
showToast('Workspaces has no view for this project’s app yet — ask the AI to add one.', 'warn');
|
|
4728
4778
|
return;
|
|
4729
4779
|
}
|
|
4780
|
+
if (!nav.skipLeaveGuard && current && current.id !== p.id && !(await leaveOpenProject(nav.returnFocus))) return STAYED_IN_PROJECT;
|
|
4781
|
+
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4730
4782
|
current = p;
|
|
4731
4783
|
// #1890: a new workspace conversation suggests this project's units (the one opened last).
|
|
4732
4784
|
try { localStorage.setItem('floless:last-project', p.id); } catch { /* private mode: no suggestion */ }
|
|
@@ -4907,6 +4959,46 @@
|
|
|
4907
4959
|
$revisionCard.className = 'ws-revision-card';
|
|
4908
4960
|
return true;
|
|
4909
4961
|
}
|
|
4962
|
+
/**
|
|
4963
|
+
* Leaving the open project for another one, or for the project list, replaces its editors, so
|
|
4964
|
+
* anything the Drawing Filter or the model editor has not saved would be lost with them. Ask first
|
|
4965
|
+
* — but only when something is actually unsaved. A drawing read running in AI Chat is not part of
|
|
4966
|
+
* the question: it keeps running on the server and its conversation, cards and approvals are there
|
|
4967
|
+
* again when this project is reopened. (Switching tab to Workflows or Agents only hides the editors,
|
|
4968
|
+
* so it needs no question.)
|
|
4969
|
+
*/
|
|
4970
|
+
async function confirmLeaveProject(returnFocus) {
|
|
4971
|
+
const guard = window.flolessLeaveGuard;
|
|
4972
|
+
if (!guard || typeof guard.confirmIfUnsaved !== 'function' || !current) return true;
|
|
4973
|
+
// No `only`: action 'project' filters to this project's editor frames inside the guard itself.
|
|
4974
|
+
return guard.confirmIfUnsaved({ action: 'project', returnFocus });
|
|
4975
|
+
}
|
|
4976
|
+
/**
|
|
4977
|
+
* The ONE gate for replacing the open project's editors (another project, or the list). Latest
|
|
4978
|
+
* navigation wins: each call takes a token, and a call whose token has been superseded by the time
|
|
4979
|
+
* its question is answered resolves false, so two quick choices can never open the earlier one last.
|
|
4980
|
+
* The source project is held by id; if it is no longer the open one when the answer arrives (closed
|
|
4981
|
+
* or replaced meanwhile) the question is asked afresh for whatever is open now. Resolves true only
|
|
4982
|
+
* when nothing in the open project is unsaved at that moment, or the user chose to go on.
|
|
4983
|
+
*/
|
|
4984
|
+
let leaveNavSeq = 0;
|
|
4985
|
+
async function leaveOpenProject(returnFocus) {
|
|
4986
|
+
const token = ++leaveNavSeq;
|
|
4987
|
+
for (let round = 0; round < 3; round++) {
|
|
4988
|
+
const sourceId = current ? current.id : null;
|
|
4989
|
+
if (!sourceId) return true;
|
|
4990
|
+
if (!(await confirmLeaveProject(returnFocus))) return false;
|
|
4991
|
+
if (token !== leaveNavSeq) return false;
|
|
4992
|
+
if ((current ? current.id : null) === sourceId) return true;
|
|
4993
|
+
}
|
|
4994
|
+
return false;
|
|
4995
|
+
}
|
|
4996
|
+
/** What openProject returns when the user chose to stay: callers that open on someone's behalf say so. */
|
|
4997
|
+
const STAYED_IN_PROJECT = Object.freeze({ stayed: true });
|
|
4998
|
+
async function leaveProjectToList(returnFocus) {
|
|
4999
|
+
if (!(await leaveOpenProject(returnFocus))) return;
|
|
5000
|
+
closeProject();
|
|
5001
|
+
}
|
|
4910
5002
|
function closeProject() {
|
|
4911
5003
|
current = null;
|
|
4912
5004
|
approvalStateGen++;
|
|
@@ -4937,7 +5029,7 @@
|
|
|
4937
5029
|
pendingPresenceToast = null;
|
|
4938
5030
|
closeProjMenu(); applyMode(); syncWorkspaceGuide(); // revision state cleared by resetRevisionState() above
|
|
4939
5031
|
}
|
|
4940
|
-
document.getElementById('ws-back').addEventListener('click',
|
|
5032
|
+
document.getElementById('ws-back').addEventListener('click', (e) => { void leaveProjectToList(e.currentTarget); });
|
|
4941
5033
|
|
|
4942
5034
|
// Paint the step-tab LABELS from the current app's descriptor (Source/Traced for vectorize,
|
|
4943
5035
|
// Drawings/Model for steel). The data-step KEYS stay stable (drawings/model/exports/history) so
|
|
@@ -5050,6 +5142,10 @@
|
|
|
5050
5142
|
.map((item) => progressText(item.note))
|
|
5051
5143
|
.filter(Boolean);
|
|
5052
5144
|
const caution = cautions.length ? cautions.join(' · ') : null;
|
|
5145
|
+
// The read runs in AI Chat when the request is chat-owned; only a terminal-run read has a terminal session to return to (#2164).
|
|
5146
|
+
const inChat = req?.chatConversation?.executionOwner === 'chat';
|
|
5147
|
+
const backTo = inChat ? 'AI Chat' : 'the same terminal AI';
|
|
5148
|
+
const backToSession = inChat ? 'AI Chat' : 'the same terminal AI session that prepared it';
|
|
5053
5149
|
let state = progress.status;
|
|
5054
5150
|
let heading = 'Creating the first steel model';
|
|
5055
5151
|
let nowLabel = 'Now';
|
|
@@ -5063,7 +5159,7 @@
|
|
|
5063
5159
|
heading = 'Model creation is blocked';
|
|
5064
5160
|
nowLabel = 'Blocked';
|
|
5065
5161
|
now = progressText(progress.items.find((item) => item.state === 'blocked')?.note)
|
|
5066
|
-
||
|
|
5162
|
+
|| `Return to ${backTo} for the blocking details.`;
|
|
5067
5163
|
} else if (progress.status === 'complete') {
|
|
5068
5164
|
// A finished checklist is NOT a verified model: this request is still pending, nothing has
|
|
5069
5165
|
// been submitted, and no audit has run. Only a signed post-audit surface may say the model
|
|
@@ -5071,11 +5167,11 @@
|
|
|
5071
5167
|
heading = 'Drawing read finished';
|
|
5072
5168
|
nowLabel = 'Done';
|
|
5073
5169
|
now = null;
|
|
5074
|
-
next =
|
|
5170
|
+
next = `Return to ${backToSession} and let it submit the read.`;
|
|
5075
5171
|
} else if (progress.status === 'cancelled') {
|
|
5076
5172
|
heading = 'Model creation stopped';
|
|
5077
5173
|
nowLabel = 'Stopped';
|
|
5078
|
-
now =
|
|
5174
|
+
now = `Return to ${backTo} for next steps.`;
|
|
5079
5175
|
next = null;
|
|
5080
5176
|
}
|
|
5081
5177
|
// A heartbeat nobody can refresh is not a heartbeat. Both arms below replace the forward-looking
|
|
@@ -5091,12 +5187,12 @@
|
|
|
5091
5187
|
state = 'waiting';
|
|
5092
5188
|
heading = 'No progress update in the last 8 minutes';
|
|
5093
5189
|
nowLabel = 'Last reported';
|
|
5094
|
-
next = 'Return to the same terminal AI session that prepared this read and ask it to continue.';
|
|
5190
|
+
next = inChat ? 'Ask the read in AI Chat to continue.' : 'Return to the same terminal AI session that prepared this read and ask it to continue.';
|
|
5095
5191
|
} else if (stale && progress.status === 'complete') {
|
|
5096
5192
|
state = 'waiting';
|
|
5097
5193
|
heading = 'The drawing read finished but has not been submitted';
|
|
5098
5194
|
nowLabel = 'Done';
|
|
5099
|
-
next =
|
|
5195
|
+
next = `Return to ${backToSession} and tell it to submit the read.`;
|
|
5100
5196
|
}
|
|
5101
5197
|
return {
|
|
5102
5198
|
state,
|
|
@@ -5924,7 +6020,9 @@
|
|
|
5924
6020
|
const conflicts = review.moveForward && Array.isArray(review.moveForward.conflicts) ? review.moveForward.conflicts : [];
|
|
5925
6021
|
const conflictDecisions = approvalDialogState.conflicts || {};
|
|
5926
6022
|
$approvalSub.textContent = review.moveForward
|
|
5927
|
-
?
|
|
6023
|
+
? review.moveForward.replacesLatest
|
|
6024
|
+
? `This model will replace v${review.moveForward.toVersion} as the approved version`
|
|
6025
|
+
: `Your changes from v${review.moveForward.fromVersion} will be applied on top of approved v${review.moveForward.toVersion}`
|
|
5928
6026
|
: review.base ? `Compared with approved v${review.base.version}` : 'First approval · full-model baseline';
|
|
5929
6027
|
$approvalImpact.textContent = [review.summary, ...(Array.isArray(review.cautions) ? review.cautions : [])].filter(Boolean).join(' ');
|
|
5930
6028
|
const groupHtml = groups.map((group) => {
|
|
@@ -6239,6 +6337,7 @@
|
|
|
6239
6337
|
approvalState = { status: 'ready', review, pendingCount: Array.isArray(review.groups) ? review.groups.length : 0,
|
|
6240
6338
|
headVersion: approvalHeadVersion(review), error: '' };
|
|
6241
6339
|
renderApprovalHeader();
|
|
6340
|
+
settleImportedSourceCard(project.id);
|
|
6242
6341
|
renderApprovalReview();
|
|
6243
6342
|
if (canRestore) {
|
|
6244
6343
|
approvalDialogState.retryAction = 'approve';
|
|
@@ -14326,7 +14425,7 @@
|
|
|
14326
14425
|
frontProject(project, id);
|
|
14327
14426
|
// If the renamed project was the OPEN one, its editor iframes still carry ?project=<old id> —
|
|
14328
14427
|
// re-open so they re-src to the new id (a stale id 404s the next contract read/write/autosave).
|
|
14329
|
-
if (wasCurrent) await openProject(project.id);
|
|
14428
|
+
if (wasCurrent) await openProject(project.id, 'model', { skipLeaveGuard: true });
|
|
14330
14429
|
showToast(`Renamed to "${project.name}"`, 'ok');
|
|
14331
14430
|
} else if (action === 'duplicate') {
|
|
14332
14431
|
dismissProgress = showToast(`Duplicating “${proj ? proj.name : 'project'}”…`, 'progress');
|
|
@@ -14713,10 +14812,10 @@
|
|
|
14713
14812
|
projComboClearHighlight();
|
|
14714
14813
|
if (focusTrigger && $projTrigger) $projTrigger.focus();
|
|
14715
14814
|
}
|
|
14716
|
-
function selectProjById(id) {
|
|
14815
|
+
async function selectProjById(id) {
|
|
14717
14816
|
closeProjCombo(true);
|
|
14718
14817
|
if (current && current.id === id) return; // already open — no-op, matches selectComboById
|
|
14719
|
-
openProject(id);
|
|
14818
|
+
openProject(id, 'model', { returnFocus: $projTrigger }); // openProject asks about unsaved work itself
|
|
14720
14819
|
}
|
|
14721
14820
|
if ($projTrigger) {
|
|
14722
14821
|
$projTrigger.addEventListener('click', (e) => {
|
|
@@ -14782,7 +14881,8 @@
|
|
|
14782
14881
|
async function openKnowledgeStep(projectId) {
|
|
14783
14882
|
if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
|
|
14784
14883
|
await setMode('workspaces');
|
|
14785
|
-
await openProject(projectId, 'knowledge');
|
|
14884
|
+
const opened = await openProject(projectId, 'knowledge');
|
|
14885
|
+
if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
|
|
14786
14886
|
if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
|
|
14787
14887
|
}
|
|
14788
14888
|
|
|
@@ -14799,9 +14899,13 @@
|
|
|
14799
14899
|
}
|
|
14800
14900
|
await setMode('workspaces');
|
|
14801
14901
|
if (owner.kind === 'project') {
|
|
14802
|
-
await openProject(owner.projectId);
|
|
14902
|
+
const opened = await openProject(owner.projectId);
|
|
14903
|
+
if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
|
|
14803
14904
|
if (current?.id !== owner.projectId) throw new Error('That project could not be opened. Try Show in chat again after opening its project in Workspaces.');
|
|
14804
|
-
} else
|
|
14905
|
+
} else {
|
|
14906
|
+
await leaveProjectToList(null);
|
|
14907
|
+
if (current) throw new Error('You stayed in this project, so the conversation was not opened.');
|
|
14908
|
+
}
|
|
14805
14909
|
}
|
|
14806
14910
|
|
|
14807
14911
|
window.flolessWorkspaces = {
|