@floless/app 0.155.2 → 0.157.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/cli-actions.mjs +392 -0
- package/dist/floless-server.cjs +182734 -141519
- package/dist/schemas/drawing-check.profile.v1.schema.json +15 -2
- package/dist/schemas/steel.model.v2.schema.json +25 -1
- package/dist/skills/floless-app-actions/SKILL.md +199 -0
- package/dist/skills/floless-app-approval/SKILL.md +8 -5
- package/dist/skills/floless-app-bridge/SKILL.md +12 -9
- package/dist/skills/floless-app-knowledge/SKILL.md +50 -14
- package/dist/skills/floless-app-new-workflow/SKILL.md +26 -10
- package/dist/skills/floless-app-onboarding/SKILL.md +31 -1
- package/dist/skills/floless-app-onboarding/references/aware-runtime.md +4 -4
- package/dist/skills/floless-app-queue/SKILL.md +10 -6
- package/dist/skills/floless-app-report-issue/SKILL.md +15 -12
- package/dist/skills/floless-app-rfi/SKILL.md +98 -73
- package/dist/skills/floless-app-routines/SKILL.md +27 -15
- package/dist/skills/floless-app-routines/references/routines-api.md +8 -2
- package/dist/skills/floless-app-steel-model/SKILL.md +1 -1
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +4 -2
- package/dist/skills/floless-app-tweak-contract/SKILL.md +25 -5
- package/dist/skills/floless-app-workflows/SKILL.md +50 -13
- package/dist/skills/floless-app-workflows/references/agent-steps.md +119 -0
- package/dist/web/agent-steps.js +1750 -0
- package/dist/web/agents.js +33 -8
- package/dist/web/app.css +681 -4
- package/dist/web/app.js +111 -11
- package/dist/web/aware-update-client.js +1 -0
- package/dist/web/aware.js +1257 -202
- package/dist/web/chat-landing-scene.js +372 -0
- package/dist/web/chat.css +254 -1
- package/dist/web/chat.js +2657 -87
- package/dist/web/commands-drawing-check.js +17 -0
- package/dist/web/commands-shell.js +1108 -4
- package/dist/web/commands-steel.js +6 -0
- package/dist/web/connections.js +1 -0
- package/dist/web/drawing-check-editor.html +33 -5
- package/dist/web/drawing-check-editor.js +538 -22
- package/dist/web/drawing-check-overlay.js +13 -0
- package/dist/web/flo-avatar.js +28 -3
- package/dist/web/guide.js +7 -2
- package/dist/web/index.html +171 -7
- package/dist/web/instructor.js +6 -4
- package/dist/web/leave-guard.js +4 -2
- package/dist/web/left-pane.js +8 -3
- package/dist/web/model-revit-module.js +15 -0
- package/dist/web/model-view-query.js +12 -2
- package/dist/web/model-viewport-revit-adapter.js +3 -1
- package/dist/web/pages.js +891 -36
- package/dist/web/panels.js +8 -5
- package/dist/web/parser-setup-recovery.js +12 -4
- package/dist/web/project-access.js +549 -0
- package/dist/web/project-reconciliation.js +357 -0
- package/dist/web/report-files.js +50 -0
- package/dist/web/revit-editor.js +116 -27
- package/dist/web/startup-admission.js +132 -0
- package/dist/web/steel-3d-core.js +9 -0
- package/dist/web/steel-editor.html +642 -22
- package/dist/web/steel-model-v2-commands.js +63 -5
- package/dist/web/step-rename.js +287 -0
- package/dist/web/terminal-requests.js +590 -0
- package/dist/web/tool-updates.js +148 -13
- package/dist/web/workspace-root-management.js +39 -0
- package/dist/web/workspaces.js +1879 -74
- package/launch.mjs +82 -2
- package/package.json +3 -1
package/dist/web/tool-updates.js
CHANGED
|
@@ -39,9 +39,12 @@
|
|
|
39
39
|
var $check = document.getElementById('tool-updates-check');
|
|
40
40
|
var $cancel = document.getElementById('tool-updates-cancel');
|
|
41
41
|
var $approve = document.getElementById('tool-updates-approve');
|
|
42
|
+
var CANCEL_COMMAND = $cancel.getAttribute('data-command-id');
|
|
42
43
|
|
|
43
44
|
var view = null;
|
|
44
45
|
var results = null;
|
|
46
|
+
var compileSelection = null; // immutable review shown before the person's separate confirmation
|
|
47
|
+
var compileExcluded = [];
|
|
45
48
|
|
|
46
49
|
// ── The view never goes back in time (#2013; also closes #1997's stale-answer race) ──────────────────────
|
|
47
50
|
// Every change to the view comes from a request this page sends — the server's `tool-updates-changed` broadcast only
|
|
@@ -270,6 +273,7 @@
|
|
|
270
273
|
function plural(n, one, many) { return n + ' ' + (n === 1 ? one : many); }
|
|
271
274
|
|
|
272
275
|
async function call(path, method, payload, signal) {
|
|
276
|
+
await globalThis.flolessStartupAdmission?.admit(path, { method, signal });
|
|
273
277
|
var res = await fetch(path, { method: method || 'GET', headers: { 'content-type': 'application/json' }, body: payload, signal: signal });
|
|
274
278
|
var body = await res.json().catch(function (error) {
|
|
275
279
|
if (error && error.name === 'AbortError') throw error; // the page gave this request up: not "an unreadable answer"
|
|
@@ -298,8 +302,9 @@
|
|
|
298
302
|
var needCount = view && view.supported && typeof view.needsCount === 'number' ? view.needsCount : needs.length;
|
|
299
303
|
var cleanup = cleanupNeeds();
|
|
300
304
|
var urgent = offers.filter(function (o) { return !!o.advisory; }).length;
|
|
305
|
+
var firstCheck = !!(view && view.supported && view.checking && !view.checkedAt);
|
|
301
306
|
// Only a check this page started: a background pass is not something the person is waiting for.
|
|
302
|
-
if (!offers.length && !needCount && !cleanup.length && !checking) {
|
|
307
|
+
if (!offers.length && !needCount && !cleanup.length && !checking && !firstCheck) {
|
|
303
308
|
// A pill that disappears under the keyboard's focus must not drop focus to the page behind.
|
|
304
309
|
if (document.activeElement === $pill) { var menu = document.getElementById('menu-btn'); if (menu) menu.focus(); }
|
|
305
310
|
$pill.hidden = true;
|
|
@@ -320,10 +325,12 @@
|
|
|
320
325
|
var days = Math.max.apply(null, offers.map(function (o) { return o.waitingDays || 0; }));
|
|
321
326
|
text += ' · waiting ' + plural(days, 'day', 'days');
|
|
322
327
|
}
|
|
328
|
+
if (needCount || cleanup.length) text += ' · ' + (needCount + cleanup.length) + ' also need you';
|
|
323
329
|
} else if (needCount || cleanup.length) {
|
|
324
330
|
state = 'needs';
|
|
325
331
|
var folders = cleanup.filter(function (c) { return c.kind !== 'unreadable'; }).length;
|
|
326
|
-
if (needCount && cleanup.length) text = (needCount
|
|
332
|
+
if (needCount && cleanup.length) text = plural(needCount, 'workflow', 'workflows') + ' · '
|
|
333
|
+
+ plural(cleanup.length, folders === cleanup.length ? 'folder' : 'item', folders === cleanup.length ? 'folders' : 'items') + ' need you';
|
|
327
334
|
else if (needCount) text = plural(needCount, 'workflow needs you', 'workflows need you');
|
|
328
335
|
else if (folders === cleanup.length) text = plural(folders, 'folder needs you', 'folders need you');
|
|
329
336
|
else text = plural(cleanup.length, 'item needs you', 'items need you');
|
|
@@ -332,10 +339,11 @@
|
|
|
332
339
|
text = 'Checking for tool updates…';
|
|
333
340
|
}
|
|
334
341
|
// Something to act on keeps its wording and colour; a running check is added to it, not put in its place.
|
|
335
|
-
if (
|
|
342
|
+
if (firstCheck) text = 'Checking workflow approvals…' + (cleanup.length ? ' · ' + plural(cleanup.length, 'cleanup item needs you', 'cleanup items need you') : '');
|
|
343
|
+
else if (checking && state !== 'checking') text += ' · checking…';
|
|
336
344
|
$pill.textContent = text;
|
|
337
345
|
$pill.setAttribute('data-state', state);
|
|
338
|
-
$pill.setAttribute('data-tip', !checking ? PILL_TIP : state === 'checking'
|
|
346
|
+
$pill.setAttribute('data-tip', firstCheck ? 'The first workflow check is still running. The total is not known yet.' : !checking ? PILL_TIP : state === 'checking'
|
|
339
347
|
? 'Still checking for tool updates. Open to watch it.' : PILL_TIP + '. A check is also running.');
|
|
340
348
|
$pill.hidden = false;
|
|
341
349
|
if (isOpen() && !approving && !results) paint();
|
|
@@ -381,13 +389,19 @@
|
|
|
381
389
|
row.setAttribute('data-kind', item.kind);
|
|
382
390
|
var text = el('div', 'tool-updates-needs-text');
|
|
383
391
|
text.appendChild(el('span', 'tool-updates-needs-name', item.workflowName));
|
|
392
|
+
if (item.sourcePath) text.appendChild(el('span', 'tool-updates-needs-sentence', item.sourcePath));
|
|
384
393
|
if (!grouped) text.appendChild(el('span', 'tool-updates-needs-sentence', item.sentence));
|
|
385
394
|
else if (item.detail) text.appendChild(el('span', 'tool-updates-needs-sentence', item.detail));
|
|
386
395
|
row.appendChild(text);
|
|
387
396
|
if (item.action === 'open-workflow') {
|
|
388
397
|
// Offered only for a workflow the Workflows page lists — one installed from a terminal cannot be opened here. That list
|
|
389
398
|
// 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))
|
|
399
|
+
if (!attachOpenButton(row, item)) {
|
|
400
|
+
row.setAttribute('data-awaiting-open', '');
|
|
401
|
+
text.appendChild(el('span', 'tool-updates-needs-sentence tool-updates-open-help', item.compileReview
|
|
402
|
+
? 'This workflow is outside the picker. Use Review bulk compile above to record its current tool versions.'
|
|
403
|
+
: item.compileNextStep || 'This workflow is outside the picker. Ask AI Chat to locate its source file and help you compile it.'));
|
|
404
|
+
}
|
|
391
405
|
}
|
|
392
406
|
return row;
|
|
393
407
|
}
|
|
@@ -411,6 +425,8 @@
|
|
|
411
425
|
});
|
|
412
426
|
});
|
|
413
427
|
row.appendChild(openButton);
|
|
428
|
+
var help = row.querySelector('.tool-updates-open-help');
|
|
429
|
+
if (help) help.remove();
|
|
414
430
|
row.removeAttribute('data-awaiting-open');
|
|
415
431
|
return true;
|
|
416
432
|
}
|
|
@@ -518,6 +534,24 @@
|
|
|
518
534
|
box.setAttribute('data-group', group.id);
|
|
519
535
|
box.appendChild(groupHead(group, rows.length));
|
|
520
536
|
box.appendChild(el('p', 'tool-updates-group-explain', group.explanation));
|
|
537
|
+
var eligible = rows.filter(function (n) { return !!n.compileReview; });
|
|
538
|
+
if (eligible.length) {
|
|
539
|
+
var review = el('button', 'tool-updates-open', 'Review bulk compile (' + eligible.length + ')');
|
|
540
|
+
review.type = 'button';
|
|
541
|
+
review.setAttribute('data-command-id', 'shell.tool-updates-review-compile');
|
|
542
|
+
review.setAttribute('data-tip', 'Review the workflows and consequences before compiling them together');
|
|
543
|
+
lock(review, approving ? 'Compiling now.' : '');
|
|
544
|
+
review.addEventListener('click', function () {
|
|
545
|
+
if (approving) return;
|
|
546
|
+
compileSelection = eligible.map(function (n) { return Object.assign({}, n, { compileReview: Object.assign({}, n.compileReview) }); });
|
|
547
|
+
compileExcluded = rows.filter(function (n) { return !n.compileReview; }).map(function (n) { return Object.assign({}, n); });
|
|
548
|
+
results = null;
|
|
549
|
+
$live.textContent = '';
|
|
550
|
+
paint();
|
|
551
|
+
$title.focus();
|
|
552
|
+
});
|
|
553
|
+
box.appendChild(review);
|
|
554
|
+
}
|
|
521
555
|
var list = el('details', 'tool-updates-group-rows');
|
|
522
556
|
var open = QUIET_OPEN[group.id];
|
|
523
557
|
list.open = open === undefined ? rows.length <= OPEN_WITHOUT_ASKING : open;
|
|
@@ -570,7 +604,7 @@
|
|
|
570
604
|
quiet.forEach(function (g) { quietSection.appendChild(quietGroup(g, rowsOf(g.id))); });
|
|
571
605
|
$body.appendChild(quietSection);
|
|
572
606
|
}
|
|
573
|
-
return count
|
|
607
|
+
return count;
|
|
574
608
|
}
|
|
575
609
|
|
|
576
610
|
function section(title, count) {
|
|
@@ -583,7 +617,7 @@
|
|
|
583
617
|
var row = el('div', 'tool-updates-result');
|
|
584
618
|
row.setAttribute('data-outcome', result.outcome);
|
|
585
619
|
row.setAttribute('data-app', result.app);
|
|
586
|
-
row.appendChild(el('span', 'tool-updates-result-mark', result.outcome === 'moved' ? '✓' : '!')).setAttribute('aria-hidden', 'true');
|
|
620
|
+
row.appendChild(el('span', 'tool-updates-result-mark', result.outcome === 'moved' || result.outcome === 'compiled' ? '✓' : '!')).setAttribute('aria-hidden', 'true');
|
|
587
621
|
var text = el('div', 'tool-updates-result-text');
|
|
588
622
|
text.appendChild(el('span', 'tool-updates-result-name', result.workflowName));
|
|
589
623
|
text.appendChild(el('span', 'tool-updates-result-sentence', result.sentence));
|
|
@@ -671,6 +705,43 @@
|
|
|
671
705
|
function paintNow() {
|
|
672
706
|
$body.textContent = '';
|
|
673
707
|
$foot.textContent = '';
|
|
708
|
+
$cancel.setAttribute('data-command-id', compileSelection ? 'shell.tool-updates-back' : CANCEL_COMMAND);
|
|
709
|
+
$title.textContent = compileSelection ? 'Compile and approve workflows' : 'Approve updated workflows';
|
|
710
|
+
if (compileSelection) {
|
|
711
|
+
var warning = el('div', 'tool-updates-summary');
|
|
712
|
+
warning.appendChild(el('p', null, 'This compiles and records a fresh approval for ' + plural(compileSelection.length, 'workflow', 'workflows') + ' using their current files and the tools installed when each one compiles. Future runs may produce different results.'));
|
|
713
|
+
warning.appendChild(el('p', null, 'It does not request a manual run. Automation enabled while this batch is compiling may run using the new approvals. Edited workflows and workflows with automation already enabled are left for individual review.'));
|
|
714
|
+
$body.appendChild(warning);
|
|
715
|
+
var selected = section('Workflows to compile', compileSelection.length);
|
|
716
|
+
compileSelection.forEach(function (n) {
|
|
717
|
+
var row = el('div', 'tool-updates-needs');
|
|
718
|
+
var text = el('div', 'tool-updates-needs-text');
|
|
719
|
+
text.appendChild(el('span', 'tool-updates-needs-name', n.workflowName));
|
|
720
|
+
text.appendChild(el('span', 'tool-updates-needs-sentence', n.sourcePath || n.app));
|
|
721
|
+
row.appendChild(text); selected.appendChild(row);
|
|
722
|
+
});
|
|
723
|
+
$body.appendChild(selected);
|
|
724
|
+
if (compileExcluded.length) {
|
|
725
|
+
var excluded = section('Review individually', compileExcluded.length);
|
|
726
|
+
compileExcluded.forEach(function (n) {
|
|
727
|
+
var row = el('div', 'tool-updates-needs');
|
|
728
|
+
var text = el('div', 'tool-updates-needs-text');
|
|
729
|
+
text.appendChild(el('span', 'tool-updates-needs-name', n.workflowName));
|
|
730
|
+
text.appendChild(el('span', 'tool-updates-needs-sentence', n.compileNextStep || n.sentence));
|
|
731
|
+
row.appendChild(text); excluded.appendChild(row);
|
|
732
|
+
});
|
|
733
|
+
$body.appendChild(excluded);
|
|
734
|
+
}
|
|
735
|
+
var confirm = el('button', 'primary', 'Compile and approve ' + plural(compileSelection.length, 'workflow', 'workflows'));
|
|
736
|
+
confirm.type = 'button';
|
|
737
|
+
confirm.setAttribute('data-command-id', 'shell.tool-updates-confirm-compile');
|
|
738
|
+
lock(confirm, approving ? 'Compiling now.' : '');
|
|
739
|
+
confirm.addEventListener('click', function () { void compileReviewed(); });
|
|
740
|
+
$body.appendChild(confirm);
|
|
741
|
+
$approve.hidden = true; $check.hidden = true;
|
|
742
|
+
$cancel.textContent = approving ? 'Compiling…' : 'Back';
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
674
745
|
var offers = (view && view.offers) || [];
|
|
675
746
|
var needs = (view && view.needsYou) || [];
|
|
676
747
|
if (view && !view.supported) {
|
|
@@ -701,12 +772,16 @@
|
|
|
701
772
|
}
|
|
702
773
|
}
|
|
703
774
|
var cleanup = cleanupNeeds();
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
|
|
775
|
+
var needsYou = paintNeeds(needs, cleanup);
|
|
776
|
+
// Nothing to approve and nothing the person can act on: say so first, above any quiet "Nothing to do" rows, and do
|
|
777
|
+
// not title the dialog as if something were waiting for approval.
|
|
778
|
+
var allClear = !results && !offers.length && !needsYou && view && view.supported && !view.sentence;
|
|
779
|
+
if (allClear) {
|
|
780
|
+
$body.insertBefore(el('div', 'tool-updates-summary', view.checking
|
|
707
781
|
? 'Checking which workflows a tool update affects…'
|
|
708
|
-
: 'All your workflows are on the tool versions you approved.'));
|
|
782
|
+
: 'Nothing to do. All your workflows are on the tool versions you approved.'), $body.firstChild);
|
|
709
783
|
}
|
|
784
|
+
if (!offers.length && !results) $title.textContent = 'Tool updates';
|
|
710
785
|
var dl = downloadsLine();
|
|
711
786
|
if (dl) $foot.appendChild(el('div', 'tool-updates-downloads' + (view.downloads && view.downloads.error ? ' tool-updates-downloads-problem' : ''), dl));
|
|
712
787
|
// Tools AWARE left as they are because they are the person's own copy: said apart from a failure.
|
|
@@ -739,7 +814,9 @@
|
|
|
739
814
|
|
|
740
815
|
function syncControls() {
|
|
741
816
|
// Only an approval is busy for the screen reader: a busy dialog can make it hold back the step announcements inside.
|
|
742
|
-
$modal.setAttribute('aria-busy', approving ? 'true' : 'false');
|
|
817
|
+
$modal.setAttribute('aria-busy', approving && !compileSelection ? 'true' : 'false');
|
|
818
|
+
// Bulk item progress lives beside the body: do not mute that live region while the list is busy.
|
|
819
|
+
$body.setAttribute('aria-busy', approving && compileSelection ? 'true' : 'false');
|
|
743
820
|
lock($check, heldReason('A check is already running.'));
|
|
744
821
|
lock($approve, heldReason('Wait for the check to finish, then approve.'));
|
|
745
822
|
lock($cancel, approving ? 'Approving now.' : '');
|
|
@@ -762,9 +839,64 @@
|
|
|
762
839
|
syncProgress();
|
|
763
840
|
}
|
|
764
841
|
|
|
842
|
+
async function compileReviewed() {
|
|
843
|
+
if (!compileSelection || approving) return;
|
|
844
|
+
var selected = compileSelection;
|
|
845
|
+
var out = [];
|
|
846
|
+
approving = true;
|
|
847
|
+
paint(); syncControls(); $title.focus();
|
|
848
|
+
try {
|
|
849
|
+
for (var i = 0; i < selected.length; i++) {
|
|
850
|
+
var item = selected[i];
|
|
851
|
+
$live.textContent = 'Compiling ' + item.workflowName + ' (' + (i + 1) + ' of ' + selected.length + ')…';
|
|
852
|
+
var result = { app: item.app, workflowName: item.workflowName, outcome: 'not-moved', sentence: '' };
|
|
853
|
+
try {
|
|
854
|
+
var answer = await call('/api/compile', 'POST', JSON.stringify({ id: item.app, bulkReview: item.compileReview }));
|
|
855
|
+
if (!answer || answer.ok !== true) throw new Error('Compile did not answer.');
|
|
856
|
+
result.outcome = 'compiled';
|
|
857
|
+
result.sentence = 'Fresh approval recorded with the installed tools. Review its compile notices before running.';
|
|
858
|
+
} catch (error) {
|
|
859
|
+
if (error.body && error.body.code === 'bulk-compile-review-again') {
|
|
860
|
+
result.sentence = error.body.error;
|
|
861
|
+
} else {
|
|
862
|
+
// A lost reply can follow a successful compile. Check the actual lock; never replay approval.
|
|
863
|
+
try {
|
|
864
|
+
var reread = await call('/api/app/' + encodeURIComponent(item.app));
|
|
865
|
+
var current = reread && reread.ok === true && reread.app;
|
|
866
|
+
if (current && current.source && current.lock && current.source.hash === item.compileReview.sourceHash
|
|
867
|
+
&& current.runnable && current.lock.sha256 !== item.compileReview.lockDigest) {
|
|
868
|
+
result.outcome = 'approval-present';
|
|
869
|
+
result.sentence = 'A fresh approval is present, but FloLess could not confirm whether this batch recorded it. Open the workflow and review its notices before running.';
|
|
870
|
+
} else {
|
|
871
|
+
result.sentence = 'FloLess could not confirm a fresh approval. Open the workflow, check its source and tools, then compile it individually.';
|
|
872
|
+
}
|
|
873
|
+
} catch (readError) {
|
|
874
|
+
result.sentence = 'FloLess could not check whether compilation finished. Open the workflow and check its approval before deciding to compile again.';
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
out.push(result);
|
|
879
|
+
await refresh();
|
|
880
|
+
}
|
|
881
|
+
} finally {
|
|
882
|
+
approving = false; compileSelection = null; results = out;
|
|
883
|
+
var compiled = out.filter(function (r) { return r.outcome === 'compiled'; }).length;
|
|
884
|
+
var unconfirmed = out.filter(function (r) { return r.outcome === 'approval-present'; }).length;
|
|
885
|
+
$live.textContent = compiled + ' compiled; ' + (unconfirmed ? plural(unconfirmed, 'approval needs confirmation', 'approvals need confirmation') + '; ' : '') + (out.length - compiled - unconfirmed) + ' need individual review.';
|
|
886
|
+
paint(); syncControls(); paintPill();
|
|
887
|
+
var head = document.getElementById('tool-updates-results-head');
|
|
888
|
+
if (head) head.focus(); else $title.focus();
|
|
889
|
+
if (window.flolessBridge && typeof window.flolessBridge.reloadCompiledWorkflows === 'function') {
|
|
890
|
+
try { await window.flolessBridge.reloadCompiledWorkflows(out.filter(function (r) { return r.outcome === 'compiled' || r.outcome === 'approval-present'; }).map(function (r) { return r.app; })); }
|
|
891
|
+
catch (reloadError) { $live.textContent += ' Reopen the workflow to refresh its compile notices.'; }
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
765
896
|
function open(fromEl) {
|
|
766
897
|
returnFocus = fromEl || (document.activeElement instanceof HTMLElement ? document.activeElement : null);
|
|
767
898
|
results = null;
|
|
899
|
+
compileSelection = null;
|
|
768
900
|
$live.textContent = '';
|
|
769
901
|
paint();
|
|
770
902
|
$modal.classList.add('show');
|
|
@@ -786,7 +918,10 @@
|
|
|
786
918
|
}
|
|
787
919
|
|
|
788
920
|
$pill.addEventListener('click', function () { open($pill); });
|
|
789
|
-
$cancel.addEventListener('click',
|
|
921
|
+
$cancel.addEventListener('click', function () {
|
|
922
|
+
if (compileSelection && !approving) { compileSelection = null; paint(); $title.focus(); }
|
|
923
|
+
else close();
|
|
924
|
+
});
|
|
790
925
|
$modal.addEventListener('mousedown', function (e) { if (e.target === $modal) close(); });
|
|
791
926
|
$modal.addEventListener('keydown', function (e) {
|
|
792
927
|
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); close(); return; }
|
|
@@ -193,5 +193,44 @@
|
|
|
193
193
|
})
|
|
194
194
|
.observe(modal, { attributes: true, attributeFilter: ['class'] });
|
|
195
195
|
window.addEventListener('floless:workspace-root-state', () => { if (shown && !busy) void refresh(); });
|
|
196
|
+
// #2363: a confirmed chat card opens this review for one saved directory and presses the same buttons the person would,
|
|
197
|
+
// so the preview and the recording run here, with this window's editor session. `record` also presses the confirm
|
|
198
|
+
// button, but only once the review needs nothing more from the person (a directory in use needs a destination first).
|
|
199
|
+
// Resolves '' on success, or one plain sentence: why it could not, or what the person does next.
|
|
200
|
+
async function until(test, ms) { const end = Date.now() + ms; while (Date.now() < end) { if (test()) return true; await new Promise((r) => setTimeout(r, 50)); } return test(); }
|
|
201
|
+
async function reviewRetirementForCard({ rootId, action, record }) {
|
|
202
|
+
if (busy) return 'A directory choice is already being recorded. Let it finish, then ask again.';
|
|
203
|
+
if (typeof window.flolessWorkspaceRoot?.open !== 'function') return 'FloLess could not open the saved directories from here. Use the Workspace directory button on the Workspaces screen.';
|
|
204
|
+
// A review the person already has open is theirs: another directory's is never thrown away for a card.
|
|
205
|
+
if (modal.classList.contains('show') && step) {
|
|
206
|
+
if (step.row.rootId !== rootId) return 'A review of another saved directory is open. Finish or close it, then ask again.';
|
|
207
|
+
back();
|
|
208
|
+
}
|
|
209
|
+
if (!modal.classList.contains('show')) { data = null; step = null; message = ''; problem = ''; }
|
|
210
|
+
await window.flolessWorkspaceRoot.open();
|
|
211
|
+
// Opening a dialog that is already open does not reload it, so read the list here whichever way it was opened.
|
|
212
|
+
if (!data) await refresh();
|
|
213
|
+
if (!await until(() => data || problem, 8000) || !data) return problem || 'FloLess could not read its saved directories. Close the dialog and open it again.';
|
|
214
|
+
const row = data.roots.find((r) => r.rootId === rootId);
|
|
215
|
+
if (!row) return 'That saved directory is no longer in the list, so nothing was done. Check the list in the dialog.';
|
|
216
|
+
const control = [...content.querySelectorAll('[data-registration-action]')].find((c) => c.dataset.registrationAction === action && c.dataset.rootId === rootId);
|
|
217
|
+
if (!control) {
|
|
218
|
+
return action === 'restore'
|
|
219
|
+
? 'That directory can be restored only once it has been stopped and its original folder is back. The dialog lists each one’s state.'
|
|
220
|
+
: 'FloLess stops using a saved directory only when it cannot reach it right now, and not one already stopped. The dialog lists each one’s state.';
|
|
221
|
+
}
|
|
222
|
+
control.click();
|
|
223
|
+
if (!record) return '';
|
|
224
|
+
// The review this card started: if the person moves to another one while FloLess waits, theirs is left for them to decide.
|
|
225
|
+
const mine = step;
|
|
226
|
+
const needsDestination = () => step.action === 'retire' && step.row.rootId === data.activeRootId;
|
|
227
|
+
if (!await until(() => step && !step.checking && (step.previewId || step.failed || needsDestination()), 15000)) return 'FloLess is still checking this directory. The review is open; confirm it there when it is ready.';
|
|
228
|
+
if (!step?.previewId) return problem || 'The review is open. Choose where to switch, then press the confirm button there.';
|
|
229
|
+
if (step !== mine || mine.row.rootId !== rootId || mine.action !== action) return 'The review on screen changed while FloLess waited, so it recorded nothing. The review that is open is yours to confirm.';
|
|
230
|
+
content.querySelector('[data-registration-action="confirm"]')?.click();
|
|
231
|
+
await until(() => !busy && (!step || problem), 20000);
|
|
232
|
+
return problem || (step ? 'The review is open. Confirm it there to record it.' : '');
|
|
233
|
+
}
|
|
234
|
+
window.flolessWorkspaceRootReview = reviewRetirementForCard;
|
|
196
235
|
render();
|
|
197
236
|
})();
|