@floless/app 0.160.0 → 0.162.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/aware-version-pin.mjs +43 -0
- package/dist/floless-server.cjs +126990 -120010
- package/dist/schemas/steel.model.v2.schema.json +23 -0
- package/dist/skills/floless-app-knowledge/SKILL.md +6 -5
- package/dist/skills/floless-app-rfi/SKILL.md +18 -5
- package/dist/skills/floless-app-steel-model/SKILL.md +28 -6
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +579 -282
- package/dist/templates/floless-workspace-read.flo +9 -1
- package/dist/templates/steel-model.flo +6 -2
- package/dist/templates/viewer-3d-demo.flo +8 -2
- package/dist/web/app.css +198 -17
- package/dist/web/app.js +23 -0
- package/dist/web/aware.js +303 -54
- package/dist/web/chat-question-card.js +10 -3
- package/dist/web/chat.css +79 -5
- package/dist/web/chat.js +1513 -243
- package/dist/web/commands-drawing-check.js +1 -0
- package/dist/web/commands-filter.js +11 -0
- package/dist/web/commands-shell.js +467 -29
- package/dist/web/commands-steel.js +40 -38
- package/dist/web/drawing-check-editor.js +76 -3
- package/dist/web/index.html +46 -2
- package/dist/web/instructor.js +5 -3
- package/dist/web/leave-guard.js +12 -2
- package/dist/web/pages.js +43 -12
- package/dist/web/project-history.js +349 -0
- package/dist/web/project-reconciliation.js +1 -0
- package/dist/web/project-rfis.js +260 -21
- package/dist/web/startup-admission.js +53 -7
- package/dist/web/steel-3d-core.js +115 -6
- package/dist/web/steel-3d-view.js +61 -5
- package/dist/web/steel-editor.html +439 -118
- package/dist/web/steel-filter.html +139 -0
- package/dist/web/steel-model-v2-commands.js +3 -3
- package/dist/web/steel-model-v2-projection.js +132 -4
- package/dist/web/steel-plan-transform.js +78 -0
- package/dist/web/tool-updates.js +59 -3
- package/dist/web/workspaces.js +1553 -196
- package/launch.mjs +36 -5
- package/package.json +6 -4
package/dist/web/aware.js
CHANGED
|
@@ -2877,21 +2877,36 @@
|
|
|
2877
2877
|
|
|
2878
2878
|
async function restoreWorkflow(id) {
|
|
2879
2879
|
closeCombo(false);
|
|
2880
|
+
let review;
|
|
2881
|
+
let sourceOnly = false;
|
|
2882
|
+
try {
|
|
2883
|
+
const updates = await api('/api/workflows/updates');
|
|
2884
|
+
const repair = (updates.sourceRepairReviews || []).find((t) => t.id === id);
|
|
2885
|
+
sourceOnly = Boolean(repair);
|
|
2886
|
+
review = repair ? { expectedSourceHash: repair.sourceHash, expectedFromVersion: repair.fromVersion,
|
|
2887
|
+
expectedToVersion: repair.toVersion, expectedTemplateHash: repair.templateHash } : {};
|
|
2888
|
+
} catch (e) { reportErr(e); return; }
|
|
2880
2889
|
const ok = await formModal({
|
|
2881
2890
|
title: 'Restore the official version?',
|
|
2882
|
-
sub: 'Re-installs the official workflow and discards any changes made to its logic. Your saved inputs are kept.'
|
|
2891
|
+
sub: 'Re-installs the official workflow and discards any changes made to its logic. Your saved inputs are kept.'
|
|
2892
|
+
+ (sourceOnly ? ' This restores the source only. Review it afterwards, then press Compile yourself before running it.' : ''),
|
|
2883
2893
|
fields: [],
|
|
2884
2894
|
okLabel: 'Restore',
|
|
2885
2895
|
});
|
|
2886
2896
|
if (!ok) return;
|
|
2887
2897
|
showToast('Restoring…', 'ok');
|
|
2888
2898
|
try {
|
|
2889
|
-
await api(`/api/app/${encodeURIComponent(id)}/restore`, { method: 'POST', body: JSON.stringify(
|
|
2899
|
+
const restored = await api(`/api/app/${encodeURIComponent(id)}/restore`, { method: 'POST', body: JSON.stringify(review) });
|
|
2890
2900
|
await loadApps();
|
|
2891
2901
|
if (currentId === id) await loadApp(id);
|
|
2892
2902
|
await refreshWorkflowUpdates(); // back on the channel — re-offer any pending update
|
|
2893
|
-
showToast(
|
|
2903
|
+
showToast(restored.needsCompile ? 'The official workflow source was restored. Review it, then press Compile yourself before running it.'
|
|
2904
|
+
: 'Restored to the official version.', 'ok');
|
|
2894
2905
|
} catch (e) {
|
|
2906
|
+
if (e.body && (e.body.code === 'update-changed' || e.body.code === 'workflow-changed')) {
|
|
2907
|
+
showToast('The workflow or its official version changed after you reviewed it. Your work was kept. Open Restore again to review the current versions.', 'warn');
|
|
2908
|
+
return;
|
|
2909
|
+
}
|
|
2895
2910
|
console.error(e);
|
|
2896
2911
|
showToast('We couldn’t restore that workflow because FloLess could not save it. Try again.', 'warn');
|
|
2897
2912
|
}
|
|
@@ -4011,7 +4026,7 @@
|
|
|
4011
4026
|
if (m.relabelled === 'live-failed' && typeof m.home === 'string' && typeof m.pageId === 'string') {
|
|
4012
4027
|
// A failed live session's versions changed label: an open copy of that Page must not keep the old one.
|
|
4013
4028
|
window.flolessPages?.reloadIfOpen?.(m.home, m.pageId);
|
|
4014
|
-
window.flolessPages?.refresh?.();
|
|
4029
|
+
window.flolessPages?.refresh?.(true); // quiet: the open list keeps its rows until the new ones arrive (#2724)
|
|
4015
4030
|
return;
|
|
4016
4031
|
}
|
|
4017
4032
|
if (typeof m.home !== 'string' || typeof m.pageId !== 'string' || !Number.isInteger(m.version) || m.version < 1) {
|
|
@@ -4022,7 +4037,7 @@
|
|
|
4022
4037
|
workflowPageByRun.set(captureKeyOf(m.runId, m.fireKey) || m.runId, page);
|
|
4023
4038
|
if (workflowPageByRun.size > WORKFLOW_PAGE_RUNS_KEPT) workflowPageByRun.delete(workflowPageByRun.keys().next().value);
|
|
4024
4039
|
noteWorkflowPageLatest(m.app, page);
|
|
4025
|
-
window.flolessPages?.refresh?.();
|
|
4040
|
+
window.flolessPages?.refresh?.(true); // quiet, as every re-read for a change (#2724)
|
|
4026
4041
|
if (currentId === m.app) paintReportPageLinks();
|
|
4027
4042
|
}
|
|
4028
4043
|
|
|
@@ -5372,7 +5387,9 @@
|
|
|
5372
5387
|
// in the viewer overlay + a toast. No console.error — the server returns the
|
|
5373
5388
|
// failure in-band, so a failed run isn't a console-worthy fault.
|
|
5374
5389
|
$reportSub.textContent = 'Execution ended without a report.';
|
|
5375
|
-
|
|
5390
|
+
// #2796: Try again only once the server has answered that this run ended. With no answer the run may still be
|
|
5391
|
+
// going on the host, and a second one could do its work twice.
|
|
5392
|
+
showRunFailure(e.body || {}, runFailureMessage(msg), app, opts.debug || liveOutcome === 'no-answer' ? null : () => runReport(nodeId));
|
|
5376
5393
|
}
|
|
5377
5394
|
}
|
|
5378
5395
|
} finally {
|
|
@@ -5402,9 +5419,9 @@
|
|
|
5402
5419
|
|
|
5403
5420
|
// A run that failed for any reason other than Stop or an expired sign-in (#1912, #1851): the
|
|
5404
5421
|
// plain sentence the server or runFailureMessage produced, the fix when there is one (Compile, for
|
|
5405
|
-
// an approval AWARE refused), and Report this problem every time. Reuses the reconnect card's
|
|
5422
|
+
// an approval AWARE refused, or Try again through `runAgain`), and Report this problem every time. Reuses the reconnect card's
|
|
5406
5423
|
// amber-topped layout; built with textContent only, so nothing the server says becomes markup.
|
|
5407
|
-
function showRunFailure(body, message, app) {
|
|
5424
|
+
function showRunFailure(body, message, app, runAgain = null) {
|
|
5408
5425
|
const code = body && typeof body.code === 'string' ? body.code : '';
|
|
5409
5426
|
const compileFix = (code === 'agent-version-changed' || code === 'needs-compile') && !$compileBtn.hidden;
|
|
5410
5427
|
const reinstall = code === 'agent-files-changed';
|
|
@@ -5445,6 +5462,22 @@
|
|
|
5445
5462
|
compile.onclick = () => { hideModal($reportModal); $compileBtn.click(); };
|
|
5446
5463
|
actions.append(compile);
|
|
5447
5464
|
}
|
|
5465
|
+
// #2796: a run that stopped can be run again from here, with the same inputs and every check Run makes, so a card
|
|
5466
|
+
// whose sentence says "try again" offers it. Not where the server says running again cannot help (`retryable:
|
|
5467
|
+
// false`: the account cannot read the model, or FloLess lost its connection to AWARE and a restart comes first), not
|
|
5468
|
+
// where Compile or a reinstall is the fix, and not for a run that never started.
|
|
5469
|
+
if (runAgain && !notRun && !compileFix && !reinstall && body.retryable !== false) {
|
|
5470
|
+
const retry = mkEl('button', 'primary cred-reconnect run-fail-retry', 'Try again');
|
|
5471
|
+
retry.type = 'button';
|
|
5472
|
+
retry.dataset.commandId = 'shell.run-failure-retry';
|
|
5473
|
+
// One run per click, however fast the clicks. A run that starts replaces this card; one that does not (an inputs
|
|
5474
|
+
// prompt or a confirmation the person cancelled) leaves it, so Try again works again.
|
|
5475
|
+
retry.onclick = async () => {
|
|
5476
|
+
retry.disabled = true;
|
|
5477
|
+
try { await runAgain(); } finally { if (retry.isConnected) retry.disabled = false; }
|
|
5478
|
+
};
|
|
5479
|
+
actions.append(retry);
|
|
5480
|
+
}
|
|
5448
5481
|
const report = mkEl('button', 'cred-open-integrations run-fail-report', 'Report this problem');
|
|
5449
5482
|
report.type = 'button';
|
|
5450
5483
|
report.dataset.commandId = 'shell.run-failure-report';
|
|
@@ -5638,6 +5671,7 @@
|
|
|
5638
5671
|
resolve(result);
|
|
5639
5672
|
};
|
|
5640
5673
|
const onKey = (e) => {
|
|
5674
|
+
if ($confirmModal.inert || document.getElementById('server-offline-overlay')) return;
|
|
5641
5675
|
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); done('cancel'); }
|
|
5642
5676
|
else if (e.key === 'Tab') {
|
|
5643
5677
|
// This confirmation can sit above Requests. Own Tab here so the lower dialog's document-level
|
|
@@ -5879,6 +5913,7 @@
|
|
|
5879
5913
|
else if (f.commandId === 'shell.requests-runtime') commandCarrier = ' data-command-id="shell.requests-runtime"';
|
|
5880
5914
|
else if (f.commandId === 'shell.new-workflow-location') commandCarrier = ' data-command-id="shell.new-workflow-location"';
|
|
5881
5915
|
else if (f.commandId === 'workflow.select-model-revision') commandCarrier = ' data-command-id="workflow.select-model-revision"';
|
|
5916
|
+
else if (f.commandId === 'shell.render-caption-choice') commandCarrier = ' data-command-id="shell.render-caption-choice"';
|
|
5882
5917
|
let optionIndex = 0;
|
|
5883
5918
|
const optionRow = (o) => `<div id="${id}-option-${optionIndex++}" class="wf-option${isOn(o) && !o.unavailable ? ' selected' : ''}${o.volatile ? ' volatile' : ''}${o.unavailable ? ' is-unavailable' : ''}" role="option" data-id="${escapeAttr(String(o.value))}" data-trigger-label="${escapeAttr(o.triggerLabel || '')}"${o.unavailable ? ` aria-disabled="true" data-blocked-reason="${escapeAttr(String(o.unavailable))}" data-tip="${escapeAttr(String(o.unavailable))}"` : ''}${commandCarrier}${commandCarrier ? ` data-command-instance="${escapeAttr(String(o.value))}" data-command-instance-label="${escapeAttr(String(o.label))}"` : ''} data-search="${escapeAttr(String(o.search || o.label).toLowerCase())}" tabindex="-1" aria-label="${escapeAttr(o.ariaLabel || o.label)}" aria-selected="${isOn(o) ? 'true' : 'false'}"><span class="wf-option-name">${escapeHtml(o.label)}</span>${o.meta ? `<span class="wf-option-meta">${escapeHtml(o.meta)}</span>` : ''}</div>`;
|
|
5884
5919
|
const grouped = opts.some((o) => o.group);
|
|
@@ -6863,6 +6898,9 @@
|
|
|
6863
6898
|
$compileBtn.disabled = false;
|
|
6864
6899
|
const ask = globalThis.flolessStepRename ? globalThis.flolessStepRename.askOf(e) : null;
|
|
6865
6900
|
if (ask) { await renameStepThenCompile(id, ask); return; }
|
|
6901
|
+
// #2740: in the Compile slot, so a second refusal replaces the first and a later clean compile clears it.
|
|
6902
|
+
const refused = compileRefusalText(e);
|
|
6903
|
+
if (refused) { standingToast('compile', authoredToastCopy(refused), 'warn'); return; }
|
|
6866
6904
|
reportErr(e);
|
|
6867
6905
|
}
|
|
6868
6906
|
}
|
|
@@ -8021,11 +8059,14 @@
|
|
|
8021
8059
|
let content;
|
|
8022
8060
|
try { content = await file.text(); } catch { showToast('Could not read that file', 'err'); return; }
|
|
8023
8061
|
try {
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8062
|
+
// #2742: the file is kept as a Standalone draft (not installed under its app: id, which no list showed), so it
|
|
8063
|
+
// opens as a draft with Compile, and Compile publishes it into the picker like any workflow built in AI Chat.
|
|
8064
|
+
const { workflow } = await api('/api/import', { method: 'POST', body: JSON.stringify({ filename: file.name, content }) });
|
|
8065
|
+
try { await loadApps({ preserveSelection: true }); } catch { /* the draft is still on the Workflows page after the next refresh */ }
|
|
8066
|
+
const opened = openDraftWorkflow(workflow.workflowId);
|
|
8067
|
+
showToast(opened
|
|
8068
|
+
? `Imported "${workflow.displayName}" as a draft — Compile to add it to your picker`
|
|
8069
|
+
: `Imported "${workflow.displayName}" as a draft — find it under Standalone on the Workflows page, then Compile it to add it to your picker`, 'ok');
|
|
8029
8070
|
} catch (e) {
|
|
8030
8071
|
const body = e && e.body;
|
|
8031
8072
|
const reason = body && typeof body.reason === 'string' ? body.reason.trim() : '';
|
|
@@ -8037,12 +8078,14 @@
|
|
|
8037
8078
|
openImportFailedModal(reason, Array.isArray(body.agentsUnavailable) ? body.agentsUnavailable : [], file);
|
|
8038
8079
|
return;
|
|
8039
8080
|
}
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8081
|
+
// A file FloLess could not read is a 400. The Workspace refusing to keep it (no Workspace folder, a folder it
|
|
8082
|
+
// cannot write) is labelled by the server, whose sentence names why. Anything else is unconfirmed: it may have been kept.
|
|
8083
|
+
showToast(body && body.stage === 'workspace' && typeof body.error === 'string' && body.error
|
|
8084
|
+
? `We couldn’t save that workflow to your Workspace: ${body.error.replace(/[.\s]+$/, '')}. Try again.`
|
|
8085
|
+
// Only a 400 is a verdict on the file; a lost response (no status) may follow a kept draft.
|
|
8086
|
+
: e && e.status === 400
|
|
8087
|
+
? 'We couldn’t import that workflow because FloLess could not read it. Check the file, then try again.'
|
|
8088
|
+
: 'FloLess couldn’t confirm the import just now. Check Standalone on the Workflows page before you try again.', 'err');
|
|
8046
8089
|
}
|
|
8047
8090
|
} finally {
|
|
8048
8091
|
_importing = false; // every path, including an unreadable file and the dialog's early return
|
|
@@ -8567,6 +8610,7 @@
|
|
|
8567
8610
|
const $wfUpdate = document.getElementById('wf-update');
|
|
8568
8611
|
const $wfUpdateModal = document.getElementById('wf-update-modal');
|
|
8569
8612
|
let _wfUpdateApplying = false;
|
|
8613
|
+
let _wfReviewedUpdate = null;
|
|
8570
8614
|
function wfUpdateFor(id) { return _wfUpdates.find((u) => u.id === id) || null; }
|
|
8571
8615
|
function renderWfUpdatePill() {
|
|
8572
8616
|
const el = document.getElementById('wf-update');
|
|
@@ -8574,6 +8618,8 @@
|
|
|
8574
8618
|
const u = currentId ? wfUpdateFor(currentId) : null;
|
|
8575
8619
|
if (u) {
|
|
8576
8620
|
el.textContent = '↑ Update to v' + u.available;
|
|
8621
|
+
el.setAttribute('data-command-id', 'shell.workflow-update#' + u.id);
|
|
8622
|
+
el.setAttribute('data-command-instance-label', apps.get(u.id)?.displayName || u.id);
|
|
8577
8623
|
el.dataset.tip = 'A newer version of this workflow is available — see what changed';
|
|
8578
8624
|
el.hidden = false;
|
|
8579
8625
|
} else {
|
|
@@ -8591,10 +8637,20 @@
|
|
|
8591
8637
|
}
|
|
8592
8638
|
function openWfUpdateModal(u) {
|
|
8593
8639
|
if (!$wfUpdateModal) return;
|
|
8640
|
+
// Confirm exactly the offer displayed here, even if background polling replaces the live list.
|
|
8641
|
+
_wfReviewedUpdate = Object.freeze({ ...u });
|
|
8594
8642
|
const a = apps.get(u.id);
|
|
8595
8643
|
const name = (a && a.displayName) || u.id;
|
|
8596
|
-
document.getElementById('wf-update-title').textContent = `
|
|
8597
|
-
|
|
8644
|
+
document.getElementById('wf-update-title').textContent = u.sourceUpdate?.mode === 'steel-compatibility' ? `Repair “${name}” compatibility`
|
|
8645
|
+
: u.sourceUpdate?.mode === 'steel-review' ? `Review the update for “${name}”` : `Update “${name}” to v${u.available}`;
|
|
8646
|
+
document.getElementById('wf-update-sub').textContent = `${name} ${u.installed} → ${u.available}${u.sourceUpdate?.mode === 'steel-compatibility' ? ' available · compatibility repair only' : '. What’s new:'}`;
|
|
8647
|
+
const note = $wfUpdateModal.querySelector('.wf-update-note');
|
|
8648
|
+
if (note) note.textContent = u.sourceUpdate ? `${u.sourceUpdate.explanation} A backup is saved before any source change. Afterwards return to Review and approve your model.` : u.sourceOnly
|
|
8649
|
+
? 'This updates the unchanged older workflow file and saves a backup. It does not approve it. Review the updated workflow, then press Compile yourself before running it.'
|
|
8650
|
+
: "Your work is safe — this updates the workflow's steps and keeps your data. A backup of the current version is saved first.";
|
|
8651
|
+
const apply = document.getElementById('wf-update-ok');
|
|
8652
|
+
if (apply) apply.textContent = u.sourceUpdate?.mode === 'steel-compatibility' ? 'Back up & repair compatibility'
|
|
8653
|
+
: u.sourceUpdate?.mode === 'steel-review' ? 'Review in AI Chat' : '↑ Back up & update';
|
|
8598
8654
|
const changelog = Array.isArray(u.changelog) ? u.changelog : [];
|
|
8599
8655
|
document.getElementById('wf-update-changelog').innerHTML = changelog.map((e) => {
|
|
8600
8656
|
const changes = Array.isArray(e.changes) && e.changes.length
|
|
@@ -8604,32 +8660,66 @@
|
|
|
8604
8660
|
}).join('') || '<div class="wf-ver-sum">No changelog provided.</div>';
|
|
8605
8661
|
showModal($wfUpdateModal);
|
|
8606
8662
|
}
|
|
8663
|
+
function dismissWfUpdateModal() {
|
|
8664
|
+
_wfReviewedUpdate = null;
|
|
8665
|
+
hideModal($wfUpdateModal);
|
|
8666
|
+
}
|
|
8607
8667
|
async function applyWfUpdate(u) {
|
|
8608
8668
|
if (_wfUpdateApplying) return;
|
|
8669
|
+
if (u.sourceUpdate?.mode === 'steel-review') {
|
|
8670
|
+
if (typeof window.flolessChat?.openDraft !== 'function' || typeof window.flolessBridge?.openApp !== 'function') {
|
|
8671
|
+
showToast('AI Chat is still starting. Keep this review open and try again in a moment.', 'warn'); return;
|
|
8672
|
+
}
|
|
8673
|
+
_wfUpdateApplying = true;
|
|
8674
|
+
const button = document.getElementById('wf-update-ok');
|
|
8675
|
+
if (button) { button.disabled = true; button.setAttribute('data-blocked-reason', 'Opening this workflow’s chat review.'); }
|
|
8676
|
+
try {
|
|
8677
|
+
// Installed workflows use Workspace chat. Opening the exact workflow first leaves a project
|
|
8678
|
+
// conversation safely; openDraft then preserves/appends the destination draft or offers a provider.
|
|
8679
|
+
await window.flolessBridge.openApp(u.id);
|
|
8680
|
+
await window.flolessChat.openDraft(`Review the installed workflow ${u.id} (${u.installed}) against its bundled maintained template ${u.templateId} (${u.available}). Preserve all my customizations, baked content, models and approval history. Explain the changes before editing; do not compile or approve anything for me.`);
|
|
8681
|
+
dismissWfUpdateModal();
|
|
8682
|
+
showToast('The update review is ready in AI Chat. Send it when you are ready; nothing was changed.', 'ok');
|
|
8683
|
+
} catch (error) { showToast('The review could not open in this workflow’s AI Chat. Your drafts were kept. Try again.', 'warn'); }
|
|
8684
|
+
finally { _wfUpdateApplying = false; if (button) { button.disabled = false; button.removeAttribute('data-blocked-reason'); } }
|
|
8685
|
+
return;
|
|
8686
|
+
}
|
|
8609
8687
|
_wfUpdateApplying = true;
|
|
8610
8688
|
const $ok = document.getElementById('wf-update-ok');
|
|
8611
8689
|
const prev = $ok ? $ok.textContent : '';
|
|
8612
|
-
if ($ok) { $ok.disabled = true; $ok.textContent = 'Updating…'; }
|
|
8690
|
+
if ($ok) { $ok.disabled = true; $ok.setAttribute('data-blocked-reason', 'Updating this workflow now.'); $ok.textContent = 'Updating…'; }
|
|
8613
8691
|
try {
|
|
8614
|
-
const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' }
|
|
8692
|
+
const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' },
|
|
8693
|
+
body: JSON.stringify({ expectedFromVersion: u.installed, expectedToVersion: u.available,
|
|
8694
|
+
...(u.sourceOnly ? { expectedSourceHash: u.sourceHash, expectedTemplateHash: u.templateHash } : {}),
|
|
8695
|
+
...(u.sourceUpdate ? { sourceUpdateMode: u.sourceUpdate.mode, expectedSourceHash: u.sourceUpdate.sourceHash, expectedTemplateHash: u.sourceUpdate.templateHash } : {}) }) });
|
|
8615
8696
|
const d = await r.json().catch(() => ({}));
|
|
8616
|
-
if (!r.ok || !d.ok) throw new Error(d.error || 'update failed');
|
|
8617
|
-
|
|
8618
|
-
showToast(`
|
|
8697
|
+
if (!r.ok || !d.ok) throw Object.assign(new Error(d.error || 'update failed'), { code: d.code });
|
|
8698
|
+
dismissWfUpdateModal();
|
|
8699
|
+
showToast(d.compatibilityRepaired ? `3D Viewer compatibility repaired. Workflow v${d.toVersion} and your work were preserved; a backup was saved. Return to Review and approve your model.`
|
|
8700
|
+
: d.needsCompile ? `Updated to v${d.toVersion}. A backup was saved. Review the workflow, then press Compile yourself before running it.`
|
|
8701
|
+
: `Updated to v${d.toVersion} — your data is preserved, a backup was saved.`, 'ok');
|
|
8619
8702
|
await refreshWorkflowUpdates();
|
|
8703
|
+
globalThis.dispatchEvent?.(new CustomEvent('floless:workflow-updates-changed'));
|
|
8620
8704
|
if (currentId === u.id) await loadApp(currentId); // reload to show the new structure
|
|
8621
8705
|
} catch (e) {
|
|
8622
|
-
|
|
8706
|
+
if (e.code === 'update-changed') {
|
|
8707
|
+
dismissWfUpdateModal();
|
|
8708
|
+
await refreshWorkflowUpdates();
|
|
8709
|
+
}
|
|
8710
|
+
showToast(e.code === 'update-changed'
|
|
8711
|
+
? 'The workflow or its update changed after you opened this review. Your work was kept. Open the update again to review the current version.'
|
|
8712
|
+
: 'We couldn’t update this workflow because FloLess could not save the change. Try again.', 'warn');
|
|
8623
8713
|
} finally {
|
|
8624
8714
|
_wfUpdateApplying = false;
|
|
8625
|
-
if ($ok) { $ok.disabled = false; $ok.textContent = prev; }
|
|
8715
|
+
if ($ok) { $ok.disabled = false; $ok.removeAttribute('data-blocked-reason'); $ok.textContent = prev; }
|
|
8626
8716
|
}
|
|
8627
8717
|
}
|
|
8628
8718
|
if ($wfUpdate) {
|
|
8629
8719
|
$wfUpdate.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) openWfUpdateModal(u); };
|
|
8630
|
-
const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick =
|
|
8631
|
-
const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => {
|
|
8632
|
-
if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal,
|
|
8720
|
+
const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = dismissWfUpdateModal;
|
|
8721
|
+
const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => { if (_wfReviewedUpdate) return applyWfUpdate(_wfReviewedUpdate); };
|
|
8722
|
+
if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, dismissWfUpdateModal);
|
|
8633
8723
|
}
|
|
8634
8724
|
|
|
8635
8725
|
// The poll deliberately does NOT start here. Module init runs before the boot sequence, so the
|
|
@@ -9765,6 +9855,8 @@
|
|
|
9765
9855
|
// bug.) The tab then heals itself: the next health tick flips back online and, if
|
|
9766
9856
|
// we never managed to load, pulls the workspace.
|
|
9767
9857
|
let serverOnline = null;
|
|
9858
|
+
// SSE is newer evidence than a health probe already in flight. Fence all effects of that probe.
|
|
9859
|
+
let serverObservationEpoch = 0;
|
|
9768
9860
|
|
|
9769
9861
|
// The overlay leads with AUTO-RECOVERY. The login watchdog (FlolessApp --supervise)
|
|
9770
9862
|
// respawns a dead server within seconds, so a crash heals itself with NO user action
|
|
@@ -9785,10 +9877,24 @@
|
|
|
9785
9877
|
// preventDefault. No "approve the dialog" promise: on managed browsers no dialog
|
|
9786
9878
|
// ever appears, so the escalation line's "reopen FloLess" stays the honest path.
|
|
9787
9879
|
const s = document.getElementById('so-status');
|
|
9788
|
-
if (s) s.textContent = '
|
|
9880
|
+
if (s) s.textContent = 'Your browser was asked to open FloLess. If it does not open, use the Start menu or desktop shortcut.';
|
|
9789
9881
|
}
|
|
9790
9882
|
|
|
9791
9883
|
let offlineOverlayEl = null;
|
|
9884
|
+
function trapOfflineOverlayKeys(event) {
|
|
9885
|
+
if (document.getElementById('leave-guard-modal')?.classList.contains('show')) return;
|
|
9886
|
+
if (!offlineOverlayEl?.contains(event.target)) return;
|
|
9887
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); return; }
|
|
9888
|
+
if (event.key !== 'Tab') return;
|
|
9889
|
+
// Capture before lower dialogs' document-level traps; they are covered, not dismissed.
|
|
9890
|
+
event.preventDefault();
|
|
9891
|
+
event.stopPropagation();
|
|
9892
|
+
const actions = [...offlineOverlayEl.querySelectorAll('.secondary:not([hidden])')];
|
|
9893
|
+
if (!actions.length) return;
|
|
9894
|
+
const at = actions.indexOf(document.activeElement);
|
|
9895
|
+
const next = at < 0 ? (event.shiftKey ? actions.length - 1 : 0) : (at + (event.shiftKey ? actions.length - 1 : 1)) % actions.length;
|
|
9896
|
+
actions[next].focus();
|
|
9897
|
+
}
|
|
9792
9898
|
function showOfflineOverlay() {
|
|
9793
9899
|
if (offlineOverlayEl) return;
|
|
9794
9900
|
lastFocusBeforeOverlay = document.activeElement; // restored on heal (WCAG 2.4.3)
|
|
@@ -9800,33 +9906,54 @@
|
|
|
9800
9906
|
`<div class="so-card" role="status" tabindex="-1">
|
|
9801
9907
|
<div class="so-spinner" aria-hidden="true"></div>
|
|
9802
9908
|
<h1>Reconnecting to FloLess…</h1>
|
|
9803
|
-
<p>
|
|
9909
|
+
<p>FloLess isn’t responding. This tab will keep trying to reconnect.</p>
|
|
9804
9910
|
<p class="so-status" id="so-status"></p>
|
|
9805
|
-
<
|
|
9911
|
+
<div class="so-actions">
|
|
9912
|
+
<button type="button" id="so-refresh" data-command-id="app.reconnect-refresh" class="secondary" hidden>Refresh page</button>
|
|
9913
|
+
<a id="so-start" data-command-id="app.reconnect-start" href="floless://start" class="secondary" hidden>Start FloLess now</a>
|
|
9914
|
+
</div>
|
|
9806
9915
|
</div>`;
|
|
9807
9916
|
document.body.appendChild(wrap);
|
|
9808
9917
|
offlineOverlayEl = wrap;
|
|
9809
9918
|
document.getElementById('so-start').addEventListener('click', onStartClickFeedback);
|
|
9919
|
+
document.getElementById('so-refresh').addEventListener('click', async () => {
|
|
9920
|
+
// The shared question probes every editor and workflow, even while HTTP is unavailable.
|
|
9921
|
+
// Do not use the self-update reload path: that path intentionally bypasses the leave guard.
|
|
9922
|
+
if (!window.flolessLeaveGuard) { location.reload(); return; } // native beforeunload fallback
|
|
9923
|
+
const returnFocus = lastFocusBeforeOverlay;
|
|
9924
|
+
if (await window.flolessLeaveGuard.confirm({ action: 'refresh', returnFocus })) location.reload();
|
|
9925
|
+
else if (offlineOverlayEl) {
|
|
9926
|
+
// A renewed outage may have replaced the button that opened this question.
|
|
9927
|
+
// Cancel returns to the current recovery card; a later recovery returns to the view.
|
|
9928
|
+
lastFocusBeforeOverlay = returnFocus;
|
|
9929
|
+
(offlineOverlayEl.querySelector('#so-refresh:not([hidden])') || offlineOverlayEl.querySelector('.so-card')).focus();
|
|
9930
|
+
}
|
|
9931
|
+
});
|
|
9932
|
+
window.addEventListener('keydown', trapOfflineOverlayKeys, true);
|
|
9810
9933
|
// No action is required, so move focus to the CARD (tabindex=-1), NOT the link —
|
|
9811
9934
|
// keeps keyboard focus inside the overlay without implying the link is the action.
|
|
9812
|
-
wrap.querySelector('.so-card').focus();
|
|
9935
|
+
if (!document.getElementById('leave-guard-modal')?.classList.contains('show')) wrap.querySelector('.so-card').focus();
|
|
9813
9936
|
// Reveal the manual fallback only if recovery is clearly stuck (watchdog down).
|
|
9814
9937
|
if (escalateTimer) clearTimeout(escalateTimer);
|
|
9815
9938
|
escalateTimer = setTimeout(() => {
|
|
9816
9939
|
if (serverOnline === true) return; // healed
|
|
9817
9940
|
const s = document.getElementById('so-status');
|
|
9818
9941
|
const a = document.getElementById('so-start');
|
|
9819
|
-
if (s) s.textContent = '
|
|
9942
|
+
if (s) s.textContent = 'This is taking longer than usual. You can refresh this page, or start FloLess if it is closed.';
|
|
9943
|
+
const refresh = document.getElementById('so-refresh');
|
|
9944
|
+
if (refresh) refresh.hidden = false;
|
|
9820
9945
|
if (a) a.hidden = false;
|
|
9821
9946
|
}, ESCALATE_MS);
|
|
9822
9947
|
}
|
|
9823
9948
|
function hideOfflineOverlay() {
|
|
9824
9949
|
if (escalateTimer) { clearTimeout(escalateTimer); escalateTimer = null; }
|
|
9825
9950
|
if (!offlineOverlayEl) return;
|
|
9951
|
+
const restoreFocus = offlineOverlayEl.contains(document.activeElement);
|
|
9952
|
+
window.removeEventListener('keydown', trapOfflineOverlayKeys, true);
|
|
9826
9953
|
offlineOverlayEl.remove();
|
|
9827
9954
|
offlineOverlayEl = null;
|
|
9828
9955
|
// Return focus to wherever it was before the overlay grabbed it.
|
|
9829
|
-
if (lastFocusBeforeOverlay && document.contains(lastFocusBeforeOverlay)) {
|
|
9956
|
+
if (restoreFocus && lastFocusBeforeOverlay && document.contains(lastFocusBeforeOverlay)) {
|
|
9830
9957
|
try { lastFocusBeforeOverlay.focus(); } catch { /* element gone */ }
|
|
9831
9958
|
}
|
|
9832
9959
|
lastFocusBeforeOverlay = null;
|
|
@@ -10372,6 +10499,23 @@
|
|
|
10372
10499
|
background:transparent;border:1px solid var(--border,#1e293b);color:var(--text-dim,#94a3b8);
|
|
10373
10500
|
padding:7px 16px;border-radius:7px;text-decoration:none;display:inline-block;}
|
|
10374
10501
|
#server-offline-overlay .secondary:hover{border-color:var(--accent,#3b82f6);color:var(--text,#f8fafc);}
|
|
10502
|
+
#server-offline-overlay .secondary:focus-visible{outline:2px solid var(--accent,#3b82f6);outline-offset:3px;}
|
|
10503
|
+
#server-offline-overlay .so-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;}
|
|
10504
|
+
#server-offline-overlay .so-card{box-sizing:border-box;width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;
|
|
10505
|
+
scrollbar-width:thin;scrollbar-color:var(--text-dim,#94a3b8) transparent;}
|
|
10506
|
+
#server-offline-overlay .so-card::-webkit-scrollbar{width:8px;}
|
|
10507
|
+
#server-offline-overlay .so-card::-webkit-scrollbar-thumb{background:var(--text-dim,#94a3b8);border-radius:8px;}
|
|
10508
|
+
#server-offline-overlay .so-card::-webkit-scrollbar-track{background:transparent;}
|
|
10509
|
+
/* The question may outlive reconnection, above a preserved generic confirmation. */
|
|
10510
|
+
#leave-guard-modal{z-index:100002;}
|
|
10511
|
+
body:has(#server-offline-overlay) #command-sheet{z-index:100004;}
|
|
10512
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor{position:fixed;inset:auto 0 0;z-index:100003;}
|
|
10513
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor:not(.collapsed){height:auto;max-height:140px;overflow:auto;white-space:normal;}
|
|
10514
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor .ix-parts{white-space:normal;overflow-wrap:anywhere;}
|
|
10515
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor{scrollbar-width:thin;scrollbar-color:var(--text-dim,#94a3b8) transparent;}
|
|
10516
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor::-webkit-scrollbar{width:8px;}
|
|
10517
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor::-webkit-scrollbar-thumb{background:var(--text-dim,#94a3b8);border-radius:8px;}
|
|
10518
|
+
body:has(#server-offline-overlay) .app.has-instructor #instructor::-webkit-scrollbar-track{background:transparent;}
|
|
10375
10519
|
/* display:inline-block (for padding) would beat the UA [hidden] rule — keep the
|
|
10376
10520
|
link hidden until escalation with an ID+attribute rule that wins on specificity. */
|
|
10377
10521
|
#server-offline-overlay .secondary[hidden]{display:none;}
|
|
@@ -10489,9 +10633,11 @@
|
|
|
10489
10633
|
try { await healthTick(); } finally { healthInFlight = false; }
|
|
10490
10634
|
};
|
|
10491
10635
|
const healthTick = async () => {
|
|
10636
|
+
const observationEpoch = serverObservationEpoch;
|
|
10492
10637
|
let ok = false;
|
|
10493
10638
|
try {
|
|
10494
10639
|
const h = await readHealth();
|
|
10640
|
+
if (observationEpoch !== serverObservationEpoch) return;
|
|
10495
10641
|
ok = true;
|
|
10496
10642
|
if (ok) {
|
|
10497
10643
|
// Stamp the build + AWARE runtime versions into the footer once (so a
|
|
@@ -10564,7 +10710,7 @@
|
|
|
10564
10710
|
}
|
|
10565
10711
|
}
|
|
10566
10712
|
} catch { ok = false; }
|
|
10567
|
-
setServerStatus(ok);
|
|
10713
|
+
if (observationEpoch === serverObservationEpoch) setServerStatus(ok);
|
|
10568
10714
|
};
|
|
10569
10715
|
tick();
|
|
10570
10716
|
setInterval(tick, 5000);
|
|
@@ -10641,6 +10787,7 @@
|
|
|
10641
10787
|
// One unfinished reconnect may resume after an existing dialog refresh or root selection.
|
|
10642
10788
|
window.addEventListener('floless:workspace-root-state', drainPendingCatchup);
|
|
10643
10789
|
es.onopen = () => {
|
|
10790
|
+
serverObservationEpoch++;
|
|
10644
10791
|
const reconnect = everOpened || rootDisconnected;
|
|
10645
10792
|
everOpened = true;
|
|
10646
10793
|
rootDisconnected = false;
|
|
@@ -11007,6 +11154,9 @@
|
|
|
11007
11154
|
}
|
|
11008
11155
|
};
|
|
11009
11156
|
es.onerror = () => {
|
|
11157
|
+
serverObservationEpoch++;
|
|
11158
|
+
// A later health poll must not borrow a pre-disconnect shared startup probe.
|
|
11159
|
+
globalThis.flolessStartupAdmission?.invalidate();
|
|
11010
11160
|
connectionGeneration++;
|
|
11011
11161
|
pendingCatchup = null;
|
|
11012
11162
|
rootDisconnected = true;
|
|
@@ -11059,6 +11209,11 @@
|
|
|
11059
11209
|
return text;
|
|
11060
11210
|
}
|
|
11061
11211
|
|
|
11212
|
+
/** #2740: the sentence the server wrote from AWARE's reason when it refused to compile a workflow, or ''. */
|
|
11213
|
+
function compileRefusalText(e) {
|
|
11214
|
+
return e?.body?.ok === false && e.body.code === 'workflow-compile-refused' && typeof e.body.userMessage === 'string' ? e.body.userMessage.trim() : '';
|
|
11215
|
+
}
|
|
11216
|
+
|
|
11062
11217
|
function reportErr(e) {
|
|
11063
11218
|
if (awarePageUnloading && e instanceof TypeError && e.message === 'Failed to fetch') return;
|
|
11064
11219
|
console.error(e);
|
|
@@ -11073,6 +11228,13 @@
|
|
|
11073
11228
|
showToast(owned, 'warn');
|
|
11074
11229
|
return;
|
|
11075
11230
|
}
|
|
11231
|
+
// #2740: AWARE refused to compile the workflow and said why (a pin mismatch names both versions). Retrying cannot fix
|
|
11232
|
+
// that, so the person reads AWARE's reason and the choices, and it stays until they close it.
|
|
11233
|
+
const refused = compileRefusalText(e);
|
|
11234
|
+
if (refused) {
|
|
11235
|
+
showToast(authoredToastCopy(refused), 'warn', { persistent: true });
|
|
11236
|
+
return;
|
|
11237
|
+
}
|
|
11076
11238
|
showToast('We couldn’t finish that. Your work is still here. Try again. If it keeps happening, reopen FloLess.', 'err');
|
|
11077
11239
|
}
|
|
11078
11240
|
|
|
@@ -17980,17 +18142,76 @@
|
|
|
17980
18142
|
done.focus();
|
|
17981
18143
|
}
|
|
17982
18144
|
|
|
18145
|
+
// #2786: how a browser sign-in ended, in the words the sign-in screen and the report dialog both use.
|
|
18146
|
+
const SIGN_IN_ENDED = {
|
|
18147
|
+
refused: "FloLess didn't receive this sign-in from floless.io, so you're still signed out. Click Try again to start a new sign-in.",
|
|
18148
|
+
expired: "This sign-in expired before it was finished, so you're still signed out. Click Try again to start a new sign-in.",
|
|
18149
|
+
unconfirmed: "FloLess couldn't confirm that the sign-in started. If no sign-in page opened, click Try again.",
|
|
18150
|
+
stopped: "FloLess is no longer waiting for this sign-in, so you're still signed out. Click Try again to start a new sign-in.",
|
|
18151
|
+
};
|
|
18152
|
+
const SIGN_IN_STARTING = 'FloLess is starting the sign-in with floless.io. Wait a moment.';
|
|
18153
|
+
|
|
18154
|
+
// #2786: what a sign-in watcher does with one /api/license/status read (null when it could not be read).
|
|
18155
|
+
// `view.waiting`: the watcher's screen says it is waiting for a sign-in it started. `view.shown`: the sign-in
|
|
18156
|
+
// (by session id) whose ending is already on screen, so each ending shows once and a retry's ending always does.
|
|
18157
|
+
// `view.doneOnly`: only a finished sign-in counts, not a licence that was already valid. Pure, so
|
|
18158
|
+
// desktop-login.test.ts runs it.
|
|
18159
|
+
function signInWatchStep(st, view) {
|
|
18160
|
+
if (!st) return { act: 'again' };
|
|
18161
|
+
if (!view.doneOnly && (st.state === 'valid' || st.state === 'offline-grace')) return { act: 'signed-in' };
|
|
18162
|
+
const latest = st.signIn || null;
|
|
18163
|
+
if (latest && latest.state === 'waiting') return { act: 'again' };
|
|
18164
|
+
if (latest && latest.state === 'done') return { act: view.waiting ? 'signed-in' : 'idle' };
|
|
18165
|
+
if (latest && latest.sessionId !== view.shown) return { act: 'ended', ended: latest.state, shown: latest.sessionId };
|
|
18166
|
+
if (!latest && view.waiting) return { act: 'ended', ended: 'stopped', shown: null };
|
|
18167
|
+
return { act: 'idle' };
|
|
18168
|
+
}
|
|
18169
|
+
|
|
17983
18170
|
function riRenderSignIn() {
|
|
17984
18171
|
const sub = document.createElement('div');
|
|
17985
18172
|
sub.className = 'modal-sub';
|
|
18173
|
+
sub.setAttribute('role', 'status');
|
|
17986
18174
|
sub.textContent = 'Sign in to send a report — your session has expired.';
|
|
17987
18175
|
const actions = document.createElement('div');
|
|
17988
18176
|
actions.className = 'modal-actions';
|
|
17989
18177
|
const close = riButton('ri-signin-close', 'Close', false, () => riClose());
|
|
18178
|
+
// #2786: the dialog stays open while the sign-in runs. It gives the report back once signed in, and says how
|
|
18179
|
+
// a sign-in that did not finish ended; the button then tries again.
|
|
18180
|
+
const showing = () => sub.isConnected && $riModal.classList.contains('show');
|
|
18181
|
+
const view = { waiting: false, shown: null, doneOnly: true }; // the report service, not the licence, asked for this
|
|
18182
|
+
const ended = (message) => { view.waiting = false; sub.textContent = message; signin.hidden = false; signin.textContent = 'Try again'; signin.focus(); };
|
|
18183
|
+
const watch = async () => {
|
|
18184
|
+
if (!showing() || !view.waiting) return;
|
|
18185
|
+
let st; try { st = await api('/api/license/status'); } catch { st = null; }
|
|
18186
|
+
if (!showing() || !view.waiting) return;
|
|
18187
|
+
const step = signInWatchStep(st, view);
|
|
18188
|
+
if (step.act === 'signed-in') {
|
|
18189
|
+
view.waiting = false;
|
|
18190
|
+
$riState.hidden = true; $riForm.hidden = false;
|
|
18191
|
+
$riSend.textContent = 'Send report'; // the send that was turned away left its "Sending…" label
|
|
18192
|
+
riSyncSend(); $riSend.focus();
|
|
18193
|
+
return;
|
|
18194
|
+
}
|
|
18195
|
+
if (step.act === 'ended') { view.shown = step.shown; ended(SIGN_IN_ENDED[step.ended]); return; }
|
|
18196
|
+
if (step.act === 'again') setTimeout(watch, 2000);
|
|
18197
|
+
};
|
|
17990
18198
|
const signin = riButton('ri-signin-btn', 'Sign in', true, async () => {
|
|
17991
|
-
|
|
17992
|
-
|
|
18199
|
+
view.waiting = false;
|
|
18200
|
+
signin.disabled = true;
|
|
18201
|
+
signin.setAttribute('data-blocked-reason', SIGN_IN_STARTING);
|
|
18202
|
+
sub.textContent = SIGN_IN_STARTING;
|
|
18203
|
+
let failed = null;
|
|
18204
|
+
try { await api('/api/license/start', { method: 'POST' }); }
|
|
18205
|
+
catch (e) { failed = e?.body?.code === 'sign-in-could-not-start' ? e.body.error : SIGN_IN_ENDED.unconfirmed; }
|
|
18206
|
+
signin.disabled = false;
|
|
18207
|
+
signin.removeAttribute('data-blocked-reason');
|
|
18208
|
+
if (failed) { ended(failed); return; }
|
|
18209
|
+
sub.textContent = 'Finish signing in in your browser. This dialog shows your report again once you are signed in.';
|
|
18210
|
+
signin.hidden = true;
|
|
18211
|
+
view.waiting = true;
|
|
18212
|
+
watch();
|
|
17993
18213
|
});
|
|
18214
|
+
signin.setAttribute('data-command-id', 'shell.issue-sign-in');
|
|
17994
18215
|
actions.append(close, signin);
|
|
17995
18216
|
riShowState(sub, actions);
|
|
17996
18217
|
}
|
|
@@ -18599,7 +18820,8 @@
|
|
|
18599
18820
|
#license-gate .primary{appearance:none;border:none;cursor:pointer;font-size:14px;font-weight:600;
|
|
18600
18821
|
padding:11px 22px;border-radius:8px;background:var(--accent,#3b82f6);color:#fff;}
|
|
18601
18822
|
#license-gate .primary:hover{filter:brightness(1.08);}
|
|
18602
|
-
#license-gate .
|
|
18823
|
+
#license-gate .primary:disabled{opacity:.6;cursor:default;filter:none;}
|
|
18824
|
+
#license-gate .lg-status{min-height:18px;margin:14px 0 0;font-size:12.5px;color:var(--text-muted,#9aa5b6);}
|
|
18603
18825
|
#license-gate .lg-sub{display:inline-block;margin-top:6px;font-size:12.5px;color:var(--accent,#3b82f6);text-decoration:none;}
|
|
18604
18826
|
#license-gate .lg-sub:hover{text-decoration:underline;}
|
|
18605
18827
|
#license-gate .lg-version{margin:18px 0 0;font-size:11px;font-family:var(--mono,monospace);color:var(--text-muted,#9aa5b6);}`;
|
|
@@ -18621,8 +18843,8 @@
|
|
|
18621
18843
|
</svg></div>
|
|
18622
18844
|
<h1>${escapeHtml(copy.headline)}</h1>
|
|
18623
18845
|
<p>${escapeHtml(copy.body)}</p>
|
|
18624
|
-
<button id="lg-signin" class="primary">Sign in at floless.io</button>
|
|
18625
|
-
<p class="lg-status" id="lg-status"></p>
|
|
18846
|
+
<button id="lg-signin" class="primary" data-command-id="shell.license-sign-in" aria-describedby="lg-status">Sign in at floless.io</button>
|
|
18847
|
+
<p class="lg-status" id="lg-status" role="status"></p>
|
|
18626
18848
|
${copy.secondary ? `<a class="lg-sub" href="${copy.secondary.href}" target="_blank" rel="noopener">${escapeHtml(copy.secondary.label)}</a>` : ''}
|
|
18627
18849
|
<p class="lg-version" id="lg-version"></p>
|
|
18628
18850
|
</div>`;
|
|
@@ -18633,20 +18855,41 @@
|
|
|
18633
18855
|
readHealth()
|
|
18634
18856
|
.then((h) => { if (h && h.appVersion) document.getElementById('lg-version').textContent = 'FloLess ' + h.appVersion; })
|
|
18635
18857
|
.catch(() => { /* version is a nicety; never block the gate on it */ });
|
|
18636
|
-
document.getElementById('lg-signin')
|
|
18637
|
-
|
|
18858
|
+
const signIn = document.getElementById('lg-signin');
|
|
18859
|
+
const s = document.getElementById('lg-status');
|
|
18860
|
+
// A sign-in that cannot go on says why, and the same button starts a fresh one.
|
|
18861
|
+
// #2786: one watcher, while a sign-in is under way. It reloads once FloLess is signed in, and says how the latest
|
|
18862
|
+
// sign-in ended wherever it was started (here, the report dialog, AI Chat or `floless login`), once per sign-in.
|
|
18863
|
+
const view = { waiting: false, shown: null, doneOnly: false };
|
|
18864
|
+
const stop = (message) => { view.waiting = false; s.textContent = message; signIn.textContent = 'Try again'; };
|
|
18865
|
+
let generation = 0;
|
|
18866
|
+
const watch = async (g = ++generation) => {
|
|
18867
|
+
let st; try { st = await api('/api/license/status'); } catch { st = null; }
|
|
18868
|
+
if (g !== generation) return; // a click or a newer watch took over
|
|
18869
|
+
const step = signInWatchStep(st, view);
|
|
18870
|
+
if (step.act === 'signed-in') { location.reload(); return; }
|
|
18871
|
+
if (step.act === 'ended') { view.shown = step.shown; stop(SIGN_IN_ENDED[step.ended]); return; }
|
|
18872
|
+
if (step.act === 'again') setTimeout(() => watch(g), 2000);
|
|
18873
|
+
};
|
|
18874
|
+
signIn.onclick = async () => {
|
|
18875
|
+
generation += 1; // an older watch stops here, so it cannot write over this sign-in while it registers
|
|
18876
|
+
view.waiting = false;
|
|
18638
18877
|
s.textContent = 'Opening sign-in in your browser…';
|
|
18639
|
-
|
|
18878
|
+
signIn.textContent = 'Sign in at floless.io';
|
|
18879
|
+
// Starting registers the sign-in with floless.io first, so it can take a moment: one start at a time.
|
|
18880
|
+
signIn.disabled = true;
|
|
18881
|
+
signIn.setAttribute('data-blocked-reason', SIGN_IN_STARTING);
|
|
18882
|
+
let failed = null;
|
|
18883
|
+
try { await api('/api/license/start', { method: 'POST' }); }
|
|
18884
|
+
catch (e) { failed = e?.body?.code === 'sign-in-could-not-start' ? e.body.error : SIGN_IN_ENDED.unconfirmed; }
|
|
18885
|
+
signIn.disabled = false;
|
|
18886
|
+
signIn.removeAttribute('data-blocked-reason');
|
|
18887
|
+
if (failed) { stop(failed); signIn.focus(); watch(); return; } // still follow a sign-in already under way
|
|
18888
|
+
view.waiting = true;
|
|
18640
18889
|
s.textContent = 'Waiting for sign-in to complete…';
|
|
18641
|
-
|
|
18642
|
-
const tick = async () => {
|
|
18643
|
-
let st; try { st = await api('/api/license/status'); } catch { st = {}; }
|
|
18644
|
-
if (st.state === 'valid' || st.state === 'offline-grace') { location.reload(); return; }
|
|
18645
|
-
if (Date.now() > deadline) { s.textContent = 'Timed out — click to try again.'; return; }
|
|
18646
|
-
setTimeout(tick, 2000);
|
|
18647
|
-
};
|
|
18648
|
-
tick();
|
|
18890
|
+
watch();
|
|
18649
18891
|
};
|
|
18892
|
+
watch(); // a sign-in started before this screen showed (or one that already ended) is said here too
|
|
18650
18893
|
}
|
|
18651
18894
|
|
|
18652
18895
|
// ── Custom Panels bridge (web/panels.js) ─────────────────────────────────────
|
|
@@ -19341,6 +19584,12 @@
|
|
|
19341
19584
|
|
|
19342
19585
|
window.flolessBridge = {
|
|
19343
19586
|
api,
|
|
19587
|
+
async reviewWorkflowUpdate(appId) {
|
|
19588
|
+
await refreshWorkflowUpdates();
|
|
19589
|
+
const offer = wfUpdateFor(appId);
|
|
19590
|
+
if (!offer) throw new Error('No bundled workflow update is currently available. Ask AI Chat to review the workflow requirements.');
|
|
19591
|
+
openWfUpdateModal(offer);
|
|
19592
|
+
},
|
|
19344
19593
|
/** #2046: the ≡ menu's New workflow, opened from a Guide suggestion with its name filled in. */
|
|
19345
19594
|
newWorkflow: (prefill) => requestNewWorkflow(prefill),
|
|
19346
19595
|
// #2185: a Guide card's Build it — straight to its own conversation, no dialog.
|