@floless/app 0.139.1 → 0.140.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 +4899 -3518
- package/dist/skills/floless-app-vectorize/SKILL.md +1 -1
- package/dist/skills/floless-app-vectorize/scripts/extract_pdf.py +7 -1
- package/dist/skills/floless-app-vectorize/scripts/vision_to_contract.py +7 -1
- package/dist/web/app.css +139 -1
- package/dist/web/aware.js +363 -31
- package/dist/web/chat.css +79 -5
- package/dist/web/chat.js +449 -52
- package/dist/web/commands-revit.js +2 -1
- package/dist/web/commands-shell.js +188 -7
- package/dist/web/commands-steel.js +12 -10
- package/dist/web/index.html +48 -2
- package/dist/web/instructor.js +26 -4
- package/dist/web/local-discovery.js +250 -0
- package/dist/web/model-editor-revit-adapter.js +3 -1
- package/dist/web/model-editor-steel-adapter.js +3 -1
- package/dist/web/model-viewport-toolbar.js +13 -1
- package/dist/web/model-viewport.js +16 -1
- package/dist/web/revit-editor.html +5 -5
- package/dist/web/revit-editor.js +3 -3
- package/dist/web/steel-detail-refs.js +0 -69
- package/dist/web/steel-editor.html +83 -261
- package/dist/web/steel-filter.html +43 -16
- package/dist/web/steel-split-view.js +1 -1
- package/dist/web/vector-editor.html +6 -1
- package/dist/web/workspaces.js +150 -16
- package/package.json +2 -1
package/dist/web/aware.js
CHANGED
|
@@ -5168,7 +5168,38 @@
|
|
|
5168
5168
|
const $graftBack = document.getElementById('graft-back');
|
|
5169
5169
|
const $graftCancel = document.getElementById('graft-cancel');
|
|
5170
5170
|
const $graftPrimary = document.getElementById('graft-primary');
|
|
5171
|
+
const $graftInstructorNote = document.getElementById('graft-instructor-note');
|
|
5171
5172
|
function graftFill(el, markup) { if (!el) return; el.replaceChildren(); if (markup) el.insertAdjacentHTML('beforeend', markup); }
|
|
5173
|
+
window.flolessGraftInstructorExplain = (guidance) => {
|
|
5174
|
+
if (!$graftModal.classList.contains('show') || !Array.isArray(guidance?.parts)) return;
|
|
5175
|
+
const chip = document.createElement('span');
|
|
5176
|
+
chip.className = 'ix-chip';
|
|
5177
|
+
chip.textContent = guidance.chip || '';
|
|
5178
|
+
const parts = document.createElement('div');
|
|
5179
|
+
parts.className = 'graft-instructor-parts';
|
|
5180
|
+
guidance.parts.forEach((part, index) => {
|
|
5181
|
+
if (index) parts.append(document.createTextNode(' · '));
|
|
5182
|
+
const segment = document.createElement('span');
|
|
5183
|
+
segment.textContent = part;
|
|
5184
|
+
parts.append(segment);
|
|
5185
|
+
});
|
|
5186
|
+
$graftInstructorNote.replaceChildren(chip, parts);
|
|
5187
|
+
$graftInstructorNote.dataset.commandId = guidance.commandId || '';
|
|
5188
|
+
$graftInstructorNote.hidden = false;
|
|
5189
|
+
};
|
|
5190
|
+
window.flolessGraftInstructorClear = () => {
|
|
5191
|
+
$graftInstructorNote.hidden = true;
|
|
5192
|
+
$graftInstructorNote.replaceChildren();
|
|
5193
|
+
delete $graftInstructorNote.dataset.commandId;
|
|
5194
|
+
};
|
|
5195
|
+
function clearGraftInstructorNote() {
|
|
5196
|
+
if (!$graftInstructorNote.hidden) window.Instructor?.clear();
|
|
5197
|
+
window.flolessGraftInstructorClear();
|
|
5198
|
+
}
|
|
5199
|
+
function closeGraftModal() {
|
|
5200
|
+
clearGraftInstructorNote();
|
|
5201
|
+
hideModal($graftModal);
|
|
5202
|
+
}
|
|
5172
5203
|
|
|
5173
5204
|
// Featured kinds (shown first) are the AEC-relevant ones; the rest live under "More".
|
|
5174
5205
|
const GRAFT_KINDS = [
|
|
@@ -5197,24 +5228,40 @@
|
|
|
5197
5228
|
];
|
|
5198
5229
|
|
|
5199
5230
|
let graftState = {};
|
|
5231
|
+
let graftGeneration = 0;
|
|
5200
5232
|
const graftCfg = (kind) => GRAFT_KINDS.find((k) => k.kind === kind) || GRAFT_KINDS[0];
|
|
5201
5233
|
const graftBodyEl = () => document.getElementById('graft-body');
|
|
5202
|
-
function graftFooter({ backShown = false, primaryLabel = '
|
|
5234
|
+
function graftFooter({ backShown = false, primaryLabel = 'Inspect source', primaryDisabled = false, primaryCommand = 'shell.graft-inspect-source' } = {}) {
|
|
5203
5235
|
$graftBack.hidden = !backShown;
|
|
5204
5236
|
$graftPrimary.textContent = primaryLabel;
|
|
5205
5237
|
$graftPrimary.disabled = primaryDisabled;
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5238
|
+
$graftPrimary.setAttribute('data-command-id', primaryCommand);
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
function openGraftModal(prefill) {
|
|
5242
|
+
graftGeneration += 1;
|
|
5243
|
+
clearGraftInstructorNote();
|
|
5244
|
+
for (const control of [$graftPrimary, $graftBack, $graftCancel]) control.removeAttribute('data-blocked-reason');
|
|
5245
|
+
$graftCancel.textContent = 'Cancel';
|
|
5246
|
+
$graftCancel.setAttribute('data-command-id', 'shell.dialog-cancel#building an agent');
|
|
5247
|
+
const supported = prefill && GRAFT_KINDS.some((item) => item.kind === prefill.kind)
|
|
5248
|
+
&& typeof prefill.ref === 'string' && prefill.ref.trim();
|
|
5249
|
+
graftState = { kind: supported ? prefill.kind : 'dlls', ref: supported ? prefill.ref : '', decompile: false, showMore: false, preview: null, stagedRef: null, verifyInFlight: false, commitInFlight: false, onPrimary: runGraftIntrospect, onBack: null };
|
|
5210
5250
|
document.getElementById('graft-title').textContent = 'Graft into agent';
|
|
5211
|
-
document.getElementById('graft-sub').textContent = '
|
|
5251
|
+
document.getElementById('graft-sub').textContent = 'Choose a DLL, package, or API spec. AWARE will inspect it and prepare command descriptions for your review.';
|
|
5212
5252
|
$graftBack.disabled = false; $graftCancel.disabled = false;
|
|
5213
5253
|
graftRenderPicker();
|
|
5214
5254
|
showModal($graftModal);
|
|
5215
5255
|
}
|
|
5256
|
+
document.addEventListener('floless:discovery-graft', (event) => {
|
|
5257
|
+
const source = event.detail;
|
|
5258
|
+
if (!source || typeof source !== 'object') return;
|
|
5259
|
+
openGraftModal(source);
|
|
5260
|
+
document.getElementById('graft-ref')?.focus();
|
|
5261
|
+
});
|
|
5216
5262
|
|
|
5217
5263
|
function graftRenderPicker() {
|
|
5264
|
+
clearGraftInstructorNote();
|
|
5218
5265
|
graftState.onPrimary = runGraftIntrospect;
|
|
5219
5266
|
graftState.onBack = null;
|
|
5220
5267
|
const cfg = graftCfg(graftState.kind);
|
|
@@ -5236,12 +5283,12 @@
|
|
|
5236
5283
|
const ref = document.getElementById('graft-ref');
|
|
5237
5284
|
ref.oninput = () => {
|
|
5238
5285
|
graftState.ref = ref.value;
|
|
5239
|
-
graftFooter({ primaryLabel: '
|
|
5286
|
+
graftFooter({ primaryLabel: 'Inspect source', primaryDisabled: !graftState.ref.trim() });
|
|
5240
5287
|
if (graftCfg(graftState.kind).match) graftMatchDebounced();
|
|
5241
5288
|
};
|
|
5242
5289
|
ref.onkeydown = (e) => { if (e.key === 'Enter' && graftState.ref.trim()) runGraftIntrospect(); };
|
|
5243
5290
|
const dec = document.getElementById('graft-decompile'); if (dec) dec.onchange = () => { graftState.decompile = dec.checked; };
|
|
5244
|
-
graftFooter({ backShown: false, primaryLabel: '
|
|
5291
|
+
graftFooter({ backShown: false, primaryLabel: 'Inspect source', primaryDisabled: !graftState.ref.trim() });
|
|
5245
5292
|
setTimeout(() => ref.focus(), 0);
|
|
5246
5293
|
if (graftCfg(graftState.kind).match && graftState.ref.trim()) graftMatch();
|
|
5247
5294
|
}
|
|
@@ -5274,7 +5321,7 @@
|
|
|
5274
5321
|
graftFill(graftBodyEl(),
|
|
5275
5322
|
`<div class="graft-progress"><span class="rtn-spinner"></span><span>${escapeHtml(graftIntrospectingLabel(graftState.kind))}</span></div>` +
|
|
5276
5323
|
'<div class="graft-hint">Large packages can take 30–60 seconds (a NuGet restore is included).</div>');
|
|
5277
|
-
graftFooter({ backShown: false, primaryLabel: '
|
|
5324
|
+
graftFooter({ backShown: false, primaryLabel: 'Inspecting…', primaryDisabled: true });
|
|
5278
5325
|
try {
|
|
5279
5326
|
const body = { sourceKind: graftState.kind, sourceRef: graftState.ref.trim() };
|
|
5280
5327
|
if (cfg.decompile && graftState.decompile) body.decompile = true;
|
|
@@ -5308,8 +5355,9 @@
|
|
|
5308
5355
|
}
|
|
5309
5356
|
|
|
5310
5357
|
function graftRenderPreview(preview) {
|
|
5311
|
-
|
|
5312
|
-
document.getElementById('graft-
|
|
5358
|
+
clearGraftInstructorNote();
|
|
5359
|
+
document.getElementById('graft-title').textContent = 'Review generated commands';
|
|
5360
|
+
document.getElementById('graft-sub').textContent = 'AWARE listed commands from this source. None has been run. Create the agent only if you want it in your Agents library.';
|
|
5313
5361
|
const tekla = preview.recipe === 'tekla-plugin';
|
|
5314
5362
|
const badge = tekla
|
|
5315
5363
|
? '<div class="graft-badge tekla">⊕ Tekla plug-in recipe</div>'
|
|
@@ -5328,35 +5376,144 @@
|
|
|
5328
5376
|
? `<div class="graft-cmds">${preview.commands.map(graftCmdHtml).join('')}</div>`
|
|
5329
5377
|
: '<div class="graft-warn">No commands found in this source. It may have no public API surface, or the reader couldn’t parse it — try a different entry point or path.</div>';
|
|
5330
5378
|
const skills = preview.skills ? `<div class="graft-skills">${preview.skills} skill${preview.skills === 1 ? '' : 's'} generated.</div>` : '';
|
|
5379
|
+
const modelRead = preview.sourceKind === 'dlls'
|
|
5380
|
+
&& /[\\/]Tekla\.Structures\.Model\.dll$/i.test(preview.sourceRef);
|
|
5381
|
+
const verify = modelRead
|
|
5382
|
+
? `<div class="graft-read-review"><strong>Check one live Tekla read</strong>` +
|
|
5383
|
+
`<p id="graft-verify-help">This reads the open model name using the selected library. It does not test the generated agent or its other commands.</p>` +
|
|
5384
|
+
`<dl class="graft-identity"><dt>Library</dt><dd>${escapeHtml(preview.sourceRef)}</dd>` +
|
|
5385
|
+
`<dt>Operation</dt><dd>Model.GetInfo().ModelName</dd></dl>` +
|
|
5386
|
+
`<button type="button" class="graft-verify-button" id="graft-verify-read" data-command-id="shell.graft-verify-tekla-read" aria-describedby="graft-verify-help">Verify model read</button>` +
|
|
5387
|
+
`<div id="graft-verify-result" role="status" aria-live="polite"></div></div>` : '';
|
|
5331
5388
|
graftFill(graftBodyEl(),
|
|
5332
|
-
badge + hero + warnings + cmds + skills +
|
|
5389
|
+
badge + hero + verify + warnings + cmds + skills +
|
|
5333
5390
|
`<div class="modal-field"><label>Agent name</label><div class="bake-name"><code>${escapeHtml(preview.agentId)}</code></div></div>`);
|
|
5391
|
+
const verifyButton = document.getElementById('graft-verify-read');
|
|
5392
|
+
verifyButton?.addEventListener('click', () => runGraftVerifyRead(preview));
|
|
5393
|
+
verifyButton?.focus();
|
|
5334
5394
|
graftState.onBack = graftRenderPicker;
|
|
5335
5395
|
graftState.onPrimary = () => runGraftCommit(false);
|
|
5336
|
-
graftFooter({ backShown: true, primaryLabel: 'Create agent', primaryDisabled: preview.commands.length === 0 });
|
|
5396
|
+
graftFooter({ backShown: true, primaryLabel: 'Create agent', primaryDisabled: preview.commands.length === 0, primaryCommand: 'shell.graft-create-agent' });
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5399
|
+
function graftTeklaReadErrorMessage(error) {
|
|
5400
|
+
const body = error?.body;
|
|
5401
|
+
if (error?.status === 402 || body?.error === 'subscription required') {
|
|
5402
|
+
if (body?.state === 'expired') return 'Your FloLess subscription has expired. Renew your FloLess subscription, then try again.';
|
|
5403
|
+
if (body?.reason === 'no-subscription') return 'This account does not have a FloLess subscription. Sign in with a subscribed account or subscribe, then try again.';
|
|
5404
|
+
if (body?.reason === 'session-expired') return 'Your FloLess sign-in has expired. Sign in again, then try again.';
|
|
5405
|
+
if (body?.reason === 'signed-out') return 'You are signed out of FloLess. Sign in again, then try again.';
|
|
5406
|
+
if (body?.reason === 'seat-taken') return 'Your FloLess session has ended. Sign in again, then try again.';
|
|
5407
|
+
return 'Sign in to FloLess to check your account access, then try again.';
|
|
5408
|
+
}
|
|
5409
|
+
if (body?.bootstrap === 'failed') {
|
|
5410
|
+
return 'FloLess could not prepare its runtime. Choose Try again on the setup card, then verify the model read again.';
|
|
5411
|
+
}
|
|
5412
|
+
if (body?.code === 'aware-setting-up' || body?.bootstrap) {
|
|
5413
|
+
return 'FloLess is still preparing its runtime. Wait for setup to finish, then try again.';
|
|
5414
|
+
}
|
|
5415
|
+
if (body?.code === 'maintenance-busy' && body?.message) return body.message;
|
|
5416
|
+
if (body?.code === 'response-unreadable' || error?.status >= 500) {
|
|
5417
|
+
return 'FloLess could not complete this read. Try again. If it keeps happening, report the issue.';
|
|
5418
|
+
}
|
|
5419
|
+
// A 200 refusal is the read endpoint's in-band domain result (host closed, model closed, and
|
|
5420
|
+
// similar). Other HTTP failures and transport failures do not establish a Tekla problem.
|
|
5421
|
+
if (error?.status === 200 && body?.message) return body.message;
|
|
5422
|
+
if (typeof error?.status !== 'number') return 'FloLess could not be reached. Check that FloLess is still open, then try again.';
|
|
5423
|
+
return 'FloLess could not complete this read. Try again. If it keeps happening, report the issue.';
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5426
|
+
async function runGraftVerifyRead(preview) {
|
|
5427
|
+
const button = document.getElementById('graft-verify-read');
|
|
5428
|
+
const result = document.getElementById('graft-verify-result');
|
|
5429
|
+
if (!button || !result || button.disabled || graftState.verifyInFlight || graftState.commitInFlight) return;
|
|
5430
|
+
const state = graftState;
|
|
5431
|
+
state.verifyInFlight = true;
|
|
5432
|
+
const generation = graftGeneration;
|
|
5433
|
+
let focusMoved = false;
|
|
5434
|
+
const trackFocus = (event) => { if (event.target !== button) focusMoved = true; };
|
|
5435
|
+
button.disabled = true;
|
|
5436
|
+
document.addEventListener('focusin', trackFocus, true);
|
|
5437
|
+
button.setAttribute('aria-busy', 'true');
|
|
5438
|
+
button.setAttribute('data-blocked-reason', 'A Tekla model read is in progress. Wait for the result.');
|
|
5439
|
+
result.textContent = 'Reading the open Tekla model name…';
|
|
5440
|
+
$graftPrimary.disabled = true;
|
|
5441
|
+
$graftPrimary.setAttribute('data-blocked-reason', 'A Tekla model read is in progress. Wait for the result.');
|
|
5442
|
+
$graftBack.disabled = true;
|
|
5443
|
+
$graftBack.setAttribute('data-blocked-reason', 'A Tekla model read is in progress. Wait for the result.');
|
|
5444
|
+
$graftCancel.textContent = 'Stop waiting';
|
|
5445
|
+
$graftCancel.setAttribute('data-command-id', 'shell.graft-stop-waiting');
|
|
5446
|
+
try {
|
|
5447
|
+
const data = await api('/api/graft/verify-tekla-read', { method: 'POST', body: JSON.stringify({ sourcePath: preview.sourceRef }) });
|
|
5448
|
+
if (generation !== graftGeneration || graftState.preview !== preview || !$graftModal.classList.contains('show') || !result.isConnected || state.commitInFlight) return;
|
|
5449
|
+
const proof = data.verification;
|
|
5450
|
+
graftFill(result, `<div class="graft-read-verified"><strong>Verified model read</strong>` +
|
|
5451
|
+
`<dl class="graft-identity"><dt>Operation</dt><dd>${escapeHtml(proof.operation)}</dd>` +
|
|
5452
|
+
`<dt>Result</dt><dd>${escapeHtml(proof.modelName)}</dd>` +
|
|
5453
|
+
`<dt>Tekla host</dt><dd>${escapeHtml(proof.hostVersion)} · PID ${escapeHtml(String(proof.hostPid))}</dd>` +
|
|
5454
|
+
`<dt>Library used</dt><dd>${escapeHtml(proof.sourcePath)}</dd>` +
|
|
5455
|
+
`<dt>Checked</dt><dd>${escapeHtml(proof.verifiedAt)}</dd></dl>` +
|
|
5456
|
+
`<p>The generated agent's commands remain unverified.</p></div>`);
|
|
5457
|
+
} catch (error) {
|
|
5458
|
+
if (generation !== graftGeneration || graftState.preview !== preview || !$graftModal.classList.contains('show') || !result.isConnected || state.commitInFlight) return;
|
|
5459
|
+
const message = graftTeklaReadErrorMessage(error);
|
|
5460
|
+
graftFill(result, `<div class="graft-warn"><strong>Could not verify this read.</strong> ${escapeHtml(message)}</div>`);
|
|
5461
|
+
} finally {
|
|
5462
|
+
document.removeEventListener('focusin', trackFocus, true);
|
|
5463
|
+
state.verifyInFlight = false;
|
|
5464
|
+
if (generation === graftGeneration && graftState.preview === preview && $graftModal.classList.contains('show') && result.isConnected && !state.commitInFlight) {
|
|
5465
|
+
button.disabled = false;
|
|
5466
|
+
button.removeAttribute('aria-busy');
|
|
5467
|
+
button.removeAttribute('data-blocked-reason');
|
|
5468
|
+
if (!focusMoved && (document.activeElement === button || document.activeElement === document.body)) button.focus();
|
|
5469
|
+
$graftPrimary.disabled = preview.commands.length === 0;
|
|
5470
|
+
$graftPrimary.removeAttribute('data-blocked-reason');
|
|
5471
|
+
$graftBack.disabled = false;
|
|
5472
|
+
$graftBack.removeAttribute('data-blocked-reason');
|
|
5473
|
+
$graftCancel.textContent = 'Cancel';
|
|
5474
|
+
$graftCancel.setAttribute('data-command-id', 'shell.dialog-cancel#building an agent');
|
|
5475
|
+
if ($graftInstructorNote.dataset.commandId) {
|
|
5476
|
+
const focused = document.activeElement;
|
|
5477
|
+
if (![button, $graftCancel, $graftPrimary, $graftBack].includes(focused) || !window.Instructor?.refreshCarrier(focused)) clearGraftInstructorNote();
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5337
5481
|
}
|
|
5338
5482
|
|
|
5339
5483
|
async function runGraftCommit(force) {
|
|
5340
|
-
if (!graftState.stagedRef) return;
|
|
5341
|
-
|
|
5484
|
+
if (!graftState.stagedRef || graftState.verifyInFlight || graftState.commitInFlight) return;
|
|
5485
|
+
const state = graftState;
|
|
5486
|
+
state.commitInFlight = true;
|
|
5487
|
+
graftGeneration += 1;
|
|
5488
|
+
clearGraftInstructorNote();
|
|
5489
|
+
graftFooter({ backShown: true, primaryLabel: 'Creating…', primaryDisabled: true,
|
|
5490
|
+
primaryCommand: force ? 'shell.graft-overwrite-agent' : 'shell.graft-create-agent' });
|
|
5342
5491
|
$graftBack.disabled = true; $graftCancel.disabled = true;
|
|
5492
|
+
for (const control of [$graftPrimary, $graftBack, $graftCancel]) {
|
|
5493
|
+
control.setAttribute('data-blocked-reason', 'Agent creation is in progress. Wait for it to finish.');
|
|
5494
|
+
}
|
|
5495
|
+
const verifyButton = document.getElementById('graft-verify-read');
|
|
5496
|
+
if (verifyButton) {
|
|
5497
|
+
verifyButton.disabled = true;
|
|
5498
|
+
verifyButton.setAttribute('data-blocked-reason', 'Agent creation is in progress. Wait for it to finish.');
|
|
5499
|
+
}
|
|
5343
5500
|
try {
|
|
5344
5501
|
const body = { stagedRef: graftState.stagedRef };
|
|
5345
5502
|
if (force) body.force = true;
|
|
5346
5503
|
const res = await api('/api/graft/commit', { method: 'POST', body: JSON.stringify(body) });
|
|
5347
5504
|
graftFill(graftBodyEl(), `<div class="graft-success"><div class="gs-icon">⊕</div><div class="gs-msg">Agent created — now in the Agents library as <code>${escapeHtml(res.agentId)}</code>.</div></div>`);
|
|
5348
5505
|
$graftBack.hidden = true; $graftCancel.disabled = false; $graftPrimary.textContent = 'Done'; $graftPrimary.disabled = false;
|
|
5349
|
-
|
|
5506
|
+
$graftPrimary.setAttribute('data-command-id', 'shell.graft-done');
|
|
5507
|
+
graftState.onPrimary = closeGraftModal;
|
|
5350
5508
|
loadAgentCatalog().catch(() => {}); // refresh count immediately (SSE also fires for other tabs)
|
|
5351
5509
|
appendNarration(`Grafted <strong>${escapeHtml(res.agentId)}</strong> from ${escapeHtml(graftState.preview.sourceRef)} — find it in the Agents library (<strong>⊞ Agents</strong>).`);
|
|
5352
5510
|
showToast(`Agent created — “${res.agentId}” is now in the Agents library`, 'ok');
|
|
5353
|
-
setTimeout(() => { if ($graftModal.classList.contains('show')) hideModal($graftModal); }, 1500);
|
|
5354
5511
|
} catch (e) {
|
|
5355
5512
|
$graftBack.disabled = false; $graftCancel.disabled = false;
|
|
5356
5513
|
const msg = (e && e.message) ? e.message : 'Create failed';
|
|
5357
5514
|
if (/already (installed|exists)/i.test(msg) && !force) {
|
|
5358
5515
|
// The stage is kept server-side on a collision — offer to overwrite.
|
|
5359
|
-
graftFooter({ backShown: true, primaryLabel: 'Overwrite existing', primaryDisabled: false });
|
|
5516
|
+
graftFooter({ backShown: true, primaryLabel: 'Overwrite existing', primaryDisabled: false, primaryCommand: 'shell.graft-overwrite-agent' });
|
|
5360
5517
|
graftState.onPrimary = () => runGraftCommit(true);
|
|
5361
5518
|
if (!graftBodyEl().querySelector('.graft-warn.collide')) {
|
|
5362
5519
|
const warn = document.createElement('div');
|
|
@@ -5365,17 +5522,24 @@
|
|
|
5365
5522
|
graftBodyEl().prepend(warn);
|
|
5366
5523
|
}
|
|
5367
5524
|
} else {
|
|
5368
|
-
graftFooter({ backShown: true, primaryLabel: 'Create agent', primaryDisabled: false });
|
|
5525
|
+
graftFooter({ backShown: true, primaryLabel: 'Create agent', primaryDisabled: false, primaryCommand: 'shell.graft-create-agent' });
|
|
5369
5526
|
graftState.onPrimary = () => runGraftCommit(false);
|
|
5370
5527
|
showToast('We couldn’t create this agent because FloLess could not finish the setup. Try again.', 'warn');
|
|
5371
5528
|
}
|
|
5529
|
+
} finally {
|
|
5530
|
+
state.commitInFlight = false;
|
|
5531
|
+
for (const control of [$graftPrimary, $graftBack, $graftCancel]) control.removeAttribute('data-blocked-reason');
|
|
5532
|
+
if (verifyButton?.isConnected) {
|
|
5533
|
+
verifyButton.disabled = false;
|
|
5534
|
+
verifyButton.removeAttribute('data-blocked-reason');
|
|
5535
|
+
}
|
|
5372
5536
|
}
|
|
5373
5537
|
}
|
|
5374
5538
|
|
|
5375
|
-
$graftBack.onclick = () => { if (graftState.onBack) graftState.onBack(); };
|
|
5376
|
-
$graftCancel.onclick = () =>
|
|
5539
|
+
$graftBack.onclick = () => { graftGeneration += 1; clearGraftInstructorNote(); if (graftState.onBack) graftState.onBack(); };
|
|
5540
|
+
$graftCancel.onclick = () => { graftGeneration += 1; closeGraftModal(); };
|
|
5377
5541
|
$graftPrimary.onclick = () => { if (graftState.onPrimary) graftState.onPrimary(); };
|
|
5378
|
-
onBackdropDismiss($graftModal,
|
|
5542
|
+
onBackdropDismiss($graftModal, closeGraftModal, () => !$graftCancel.disabled);
|
|
5379
5543
|
|
|
5380
5544
|
// Secondary entry: "⊕ Graft new agent" inside the Agents Library modal.
|
|
5381
5545
|
const $libGraft = document.getElementById('lib-graft');
|
|
@@ -7873,6 +8037,10 @@
|
|
|
7873
8037
|
let everOpened = false;
|
|
7874
8038
|
es.onopen = () => {
|
|
7875
8039
|
setServerStatus(true);
|
|
8040
|
+
// Core provisioning may have finished after the page read /api/apps but before this
|
|
8041
|
+
// at-most-once stream connected. Re-read the catalogue on every open, including the
|
|
8042
|
+
// first one; Workspaces defers its repaint while a dialog is active.
|
|
8043
|
+
window.dispatchEvent(new CustomEvent('floless:apps-changed', { detail: {} }));
|
|
7876
8044
|
// A RECONNECT MEANS WE MISSED WHATEVER HAPPENED WHILE WE WERE GONE — and this catches up the
|
|
7877
8045
|
// PROJECT half of that, not every arm below (workflow imports, contract writes and the rest
|
|
7878
8046
|
// still heal on their next event or a reload). These events are
|
|
@@ -8437,7 +8605,9 @@
|
|
|
8437
8605
|
//
|
|
8438
8606
|
// Detection is a workspace-level fact (which CLIs exist) fetched per surface-open and cached; the
|
|
8439
8607
|
// FOLDER is per project, so anything that needs it re-reads with the project key rather than
|
|
8440
|
-
// trusting this. Server-side detection
|
|
8608
|
+
// trusting this. Server-side detection is statSync work, and the account each runtime answers
|
|
8609
|
+
// from is cached 10 s server-side (one CLI status call per provider per window at most), so an
|
|
8610
|
+
// open is still cheap.
|
|
8441
8611
|
let headlessInfo = null;
|
|
8442
8612
|
let headlessFetchEpoch = 0;
|
|
8443
8613
|
async function refreshHeadless() {
|
|
@@ -10550,7 +10720,6 @@
|
|
|
10550
10720
|
void refreshIntegrations().then(focusPendingIntegration);
|
|
10551
10721
|
refreshHeadless().then(renderRuntimeSection);
|
|
10552
10722
|
};
|
|
10553
|
-
|
|
10554
10723
|
function focusPendingIntegration() {
|
|
10555
10724
|
if (!pendingIntegrationFocus || !$integrationsModal.classList.contains('show')) return;
|
|
10556
10725
|
const id = (window.CSS && CSS.escape) ? CSS.escape(pendingIntegrationFocus) : pendingIntegrationFocus;
|
|
@@ -10589,8 +10758,76 @@
|
|
|
10589
10758
|
$body.hidden = !runtimeSectionExpanded;
|
|
10590
10759
|
}
|
|
10591
10760
|
|
|
10761
|
+
// The four things the server can learn about a runtime's account, exactly as the chat Provider
|
|
10762
|
+
// row states them (web/chat.js). Anything that is not one of the three definite answers — a
|
|
10763
|
+
// missing or null field included — is 'unknown': a read that never completed is not a signed-out
|
|
10764
|
+
// CLI, and a working install on Bedrock/Vertex or an API key is 'no-identity', not signed out.
|
|
10765
|
+
function runtimeSignInAnswer(answer) {
|
|
10766
|
+
const state = answer && answer.state;
|
|
10767
|
+
if (state === 'signed-in' || state === 'signed-out' || state === 'no-identity') return answer;
|
|
10768
|
+
return { state: 'unknown', reason: (answer && answer.reason) || 'no answer' };
|
|
10769
|
+
}
|
|
10770
|
+
|
|
10771
|
+
// A stable identity for "is this a different answer than before?". Emails alone cannot see a
|
|
10772
|
+
// sign-OUT, because both sides of that comparison are absent.
|
|
10773
|
+
function runtimeAnswerKey(answer) {
|
|
10774
|
+
const settled = runtimeSignInAnswer(answer);
|
|
10775
|
+
return settled.state === 'signed-in' ? `signed-in:${settled.email}` : settled.state;
|
|
10776
|
+
}
|
|
10777
|
+
|
|
10778
|
+
function runtimeAccountLabel(answer) {
|
|
10779
|
+
const settled = runtimeSignInAnswer(answer);
|
|
10780
|
+
if (settled.state === 'signed-out') return 'Not signed in';
|
|
10781
|
+
if (settled.state === 'no-identity') return 'Signed in (no account to show)';
|
|
10782
|
+
if (settled.state === 'unknown') return 'Could not check';
|
|
10783
|
+
const plan = settled.plan ? ` · ${settled.plan.charAt(0).toUpperCase()}${settled.plan.slice(1)}` : '';
|
|
10784
|
+
return `Signed in as ${settled.email}${plan}`;
|
|
10785
|
+
}
|
|
10786
|
+
|
|
10787
|
+
// The sign-in itself happens in the window FloLess opened. Poll the runtimes read (10 s server
|
|
10788
|
+
// cache) until this runtime NAMES a sign-in different from the one held at click time, or give
|
|
10789
|
+
// up after two minutes. A different sign-in rather than "a different email": signing in with an
|
|
10790
|
+
// API key produces no email, and the button would stay disabled for the full two minutes. And
|
|
10791
|
+
// not "any definite change": the server signs the CLI out BEFORE the window opens, so signed-out
|
|
10792
|
+
// is what every poll sees while the user is still in it — ending there would offer "Sign in…"
|
|
10793
|
+
// again with the window open (the server refuses that click for its launch cooldown). And once
|
|
10794
|
+
// that sign-out HAS been seen, any named sign-in is the landed one — including the same account
|
|
10795
|
+
// again: a user who changes their mind in the browser must not wait out the deadline.
|
|
10796
|
+
async function waitForRuntimeSignIn(id, before, deadlineMs = 120_000, everyMs = 3_000) {
|
|
10797
|
+
const until = Date.now() + deadlineMs;
|
|
10798
|
+
let signedOutSeen = false;
|
|
10799
|
+
while (Date.now() < until) {
|
|
10800
|
+
await new Promise((resolve) => setTimeout(resolve, everyMs));
|
|
10801
|
+
let info = null;
|
|
10802
|
+
// Read the route directly rather than through refreshHeadless(): that one NULLS the shared
|
|
10803
|
+
// `headlessInfo` on a failed fetch, and a single blip during a two-minute poll would take the
|
|
10804
|
+
// Start affordances across Requests (headlessReady/preferredChatProvider) and this whole
|
|
10805
|
+
// section down with it. A poll is allowed to miss a beat; it is not allowed to erase state.
|
|
10806
|
+
try { info = await api('/api/terminal-runtimes'); } catch { continue; }
|
|
10807
|
+
const row = info?.runtimes?.find((r) => r && r.id === id);
|
|
10808
|
+
if (!row) continue;
|
|
10809
|
+
const answer = runtimeSignInAnswer(row.account);
|
|
10810
|
+
// An 'unknown' answer is a read that never completed; it is not evidence the window closed.
|
|
10811
|
+
if (answer.state === 'unknown') continue;
|
|
10812
|
+
// `headlessInfo` is not re-read until this wait ends, so any repaint meanwhile would keep
|
|
10813
|
+
// naming the old account for up to two minutes after the server signed it out. Text only, in
|
|
10814
|
+
// place: a full re-render replaces the focused button (see the click handler).
|
|
10815
|
+
const line = document.querySelector(`.int-rt [data-sign-in="${escapeAttr(id)}"]`)?.parentElement?.querySelector('.int-rt-account');
|
|
10816
|
+
if (line && line.textContent !== runtimeAccountLabel(row.account)) line.textContent = runtimeAccountLabel(row.account);
|
|
10817
|
+
// A 'signed-out' is FloLess's own doing (above), not the sign-in the user went off to make.
|
|
10818
|
+
if (answer.state === 'signed-out') { signedOutSeen = true; continue; }
|
|
10819
|
+
if (signedOutSeen || runtimeAnswerKey(answer) !== before) return;
|
|
10820
|
+
}
|
|
10821
|
+
}
|
|
10822
|
+
const pendingRuntimeSignIn = new Set();
|
|
10823
|
+
// The server's own sentence is the accurate one: it names which runtime problem happened, which
|
|
10824
|
+
// command to run by hand, or that a sign-in window is already open. reportErr would flatten all
|
|
10825
|
+
// of them into one line. Same rule as the chat Provider row (web/chat.js).
|
|
10826
|
+
const SERVER_WORDED_SIGN_IN_CODES = new Set(['chat-turn-active', 'runtime-unavailable', 'launch-unsafe', 'launch-failed', 'sign-in-active', 'sign-out-failed']);
|
|
10827
|
+
|
|
10592
10828
|
/**
|
|
10593
|
-
* Which terminal AIs are installed, which one headless runs use,
|
|
10829
|
+
* Which terminal AIs are installed, which one headless runs use, the folder they run in, and —
|
|
10830
|
+
* per runtime — the ACCOUNT it answers from, with the CLI's own sign-in a click away.
|
|
10594
10831
|
*
|
|
10595
10832
|
* Its own section rather than a card in the integrations grid: a detected CLI is not an OAuth
|
|
10596
10833
|
* connection. There is no Connect, no expiry — and deliberately no "ready", because a signed-out
|
|
@@ -10616,17 +10853,34 @@
|
|
|
10616
10853
|
if (folder) $summary.setAttribute('data-tip', folder); else $summary.removeAttribute('data-tip');
|
|
10617
10854
|
$toggle.onclick = () => setRuntimeSectionExpanded(!runtimeSectionExpanded);
|
|
10618
10855
|
setRuntimeSectionExpanded(runtimeSectionExpanded);
|
|
10856
|
+
const signInTip = 'FloLess uses whichever account is signed in to the Claude Code or Codex CLI on this computer. Signing in to the Claude desktop app or claude.ai does not change it. Switch account signs that CLI out first, then opens a window where you sign in.';
|
|
10619
10857
|
$list.innerHTML = rts.map((r) => {
|
|
10620
10858
|
const found = r.state === 'found';
|
|
10621
10859
|
const isDefault = found && r.id === active;
|
|
10860
|
+
const answer = runtimeSignInAnswer(r.account);
|
|
10861
|
+
// A missing user install can still have a managed copy that signs in: the account line
|
|
10862
|
+
// follows the account, not the badge. An answer that names one — or says it is signed in with
|
|
10863
|
+
// nothing to name — is such a copy; "signed out" and "could not check" are not.
|
|
10864
|
+
const showsAccount = found || answer.state === 'signed-in' || answer.state === 'no-identity';
|
|
10865
|
+
const pending = pendingRuntimeSignIn.has(r.id);
|
|
10866
|
+
// Both cards render the same visible "Switch account…", so without a runtime-specific
|
|
10867
|
+
// accessible name a screen reader (and Instructor's focus proof) cannot tell them apart.
|
|
10868
|
+
// Only a parsed sign-OUT may offer a sign-in; the label follows the same rule as the text.
|
|
10869
|
+
const signInName = answer.state === 'signed-out' ? `Sign in to ${r.label}` : `Switch ${r.label} account`;
|
|
10870
|
+
// The sign-in sits on the account line it acts on. The side column is a flex row already
|
|
10871
|
+
// holding the badge and, on the non-default card, "Use this one" — a third control wraps.
|
|
10622
10872
|
return `
|
|
10623
10873
|
<div class="int-rt${isDefault ? ' is-default' : ''}${found ? '' : ' is-missing'}">
|
|
10624
|
-
<div>
|
|
10874
|
+
<div class="int-rt-main">
|
|
10625
10875
|
<div class="int-rt-name">${escapeHtml(r.label)}${isDefault ? '<span class="int-rt-pill">Default</span>' : ''}</div>
|
|
10626
10876
|
<div class="int-rt-blurb">${escapeHtml(r.blurb)} · <code>${escapeHtml(r.command)}</code></div>
|
|
10627
10877
|
<div class="int-rt-where">${found
|
|
10628
10878
|
? `Found at ${escapeHtml(r.path || '')}`
|
|
10629
10879
|
: `Not installed — floless looks for <code>${escapeHtml(r.command)}</code>`}</div>
|
|
10880
|
+
${showsAccount ? `<div class="int-rt-signin">
|
|
10881
|
+
<div class="int-rt-account" aria-live="polite" data-tip="${escapeAttr(signInTip)}">${escapeHtml(runtimeAccountLabel(r.account))}</div>
|
|
10882
|
+
<button class="int-action" data-sign-in="${escapeAttr(r.id)}" data-command-id="shell.headless-sign-in#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(r.label)}" aria-label="${escapeAttr(signInName)}" data-tip="${escapeAttr(signInTip)}"${pending ? ' disabled data-blocked-reason="Waiting for the sign-in window."' : ''}>${pending ? 'Waiting for sign-in…' : answer.state === 'signed-out' ? 'Sign in…' : 'Switch account…'}</button>
|
|
10883
|
+
</div>` : ''}
|
|
10630
10884
|
</div>
|
|
10631
10885
|
<div class="int-rt-side">
|
|
10632
10886
|
<span class="int-rt-badge">${found ? 'Installed' : 'Not installed'}</span>
|
|
@@ -10644,6 +10898,51 @@
|
|
|
10644
10898
|
} catch (e) { reportErr(e); }
|
|
10645
10899
|
};
|
|
10646
10900
|
});
|
|
10901
|
+
$list.querySelectorAll('[data-sign-in]').forEach((b) => {
|
|
10902
|
+
b.onclick = async () => {
|
|
10903
|
+
const id = b.dataset.signIn;
|
|
10904
|
+
if (pendingRuntimeSignIn.has(id)) return;
|
|
10905
|
+
const before = runtimeAnswerKey(headlessRuntimes().find((r) => r && r.id === id)?.account);
|
|
10906
|
+
// Flip THIS button in place rather than re-rendering the list: a full re-render replaces the
|
|
10907
|
+
// focused button (dropping keyboard focus to <body> inside an aria-modal dialog for up to two
|
|
10908
|
+
// minutes) and swaps out the aria-live account node, which is then not reliably announced.
|
|
10909
|
+
// The pending id is still recorded so any OTHER re-render paints this card as waiting.
|
|
10910
|
+
pendingRuntimeSignIn.add(id);
|
|
10911
|
+
b.disabled = true;
|
|
10912
|
+
b.dataset.blockedReason = 'Waiting for the sign-in window.';
|
|
10913
|
+
b.textContent = 'Waiting for sign-in…';
|
|
10914
|
+
try {
|
|
10915
|
+
// api() has no deadline of its own. A POST that never answers would leave this button
|
|
10916
|
+
// disabled and `pendingRuntimeSignIn` populated for the life of the page, so bound it —
|
|
10917
|
+
// the chat's request() already defaults to the same 30 s.
|
|
10918
|
+
await api(`/api/terminal-runtimes/${encodeURIComponent(id)}/sign-in`, { method: 'POST', signal: AbortSignal.timeout(30_000) });
|
|
10919
|
+
await waitForRuntimeSignIn(id, before);
|
|
10920
|
+
} catch (e) {
|
|
10921
|
+
// api() rejects with the parsed body on `.body` and the HTTP status on `.status`.
|
|
10922
|
+
const code = e && e.body && e.body.code;
|
|
10923
|
+
const worded = SERVER_WORDED_SIGN_IN_CODES.has(code)
|
|
10924
|
+
&& [e.body.error, e.message].find((s) => typeof s === 'string' && s.trim());
|
|
10925
|
+
if (worded) showToast(worded, 'warn');
|
|
10926
|
+
else reportErr(e);
|
|
10927
|
+
} finally {
|
|
10928
|
+
pendingRuntimeSignIn.delete(id);
|
|
10929
|
+
delete b.dataset.blockedReason;
|
|
10930
|
+
// NOT refreshHeadless(): that one NULLS the shared `headlessInfo` on a failed fetch, so a
|
|
10931
|
+
// single blip here would hide this whole section and take the Start affordances across
|
|
10932
|
+
// Requests down with it — the exact hazard the comment on waitForRuntimeSignIn warns
|
|
10933
|
+
// about. Read the route directly and merge only a well-formed answer; a failed read
|
|
10934
|
+
// leaves the card showing what it last knew, and says so in the console.
|
|
10935
|
+
try {
|
|
10936
|
+
const info = await api('/api/terminal-runtimes');
|
|
10937
|
+
if (info && Array.isArray(info.runtimes)) headlessInfo = info;
|
|
10938
|
+
else console.warn('floless: the runtimes read after a sign-in had no runtime list', info);
|
|
10939
|
+
} catch (error) {
|
|
10940
|
+
console.warn('floless: could not re-read the terminal runtimes after a sign-in', error);
|
|
10941
|
+
}
|
|
10942
|
+
renderRuntimeSection();
|
|
10943
|
+
}
|
|
10944
|
+
};
|
|
10945
|
+
});
|
|
10647
10946
|
$folder.innerHTML = `
|
|
10648
10947
|
<span>Runs in</span>
|
|
10649
10948
|
<span class="int-folder-path${folder ? '' : ' is-unset'}"${folder ? ` data-tip="${escapeAttr(folder)}"` : ''}>${folder ? escapeHtml(folder) : 'not chosen yet — floless will ask the first time you run one'}</span>
|
|
@@ -10766,12 +11065,14 @@
|
|
|
10766
11065
|
const needsAttention = i.status === 'needs-attention';
|
|
10767
11066
|
const needsAccount = i.status === 'account-selection-required';
|
|
10768
11067
|
const checkUnavailable = i.status === 'check-unavailable';
|
|
11068
|
+
const missingReader = needsAttention && i.setup?.category === 'reader-release-unavailable';
|
|
10769
11069
|
const setupDetails = {
|
|
10770
11070
|
'aware-unavailable': 'FloLess couldn’t start the service used by Revit projects.',
|
|
10771
11071
|
'core-workflow-provisioning': 'FloLess couldn’t prepare the built-in Workspace workflows.',
|
|
10772
11072
|
'reader-verification': 'FloLess couldn’t verify the installed Revit reader.',
|
|
10773
11073
|
'workspace-bootstrap': 'FloLess couldn’t prepare the Workspace connection used by Revit workflows.',
|
|
10774
11074
|
'revit-workflow-provisioning': 'FloLess couldn’t prepare the Revit project workflows.',
|
|
11075
|
+
'reader-release-unavailable': 'FloLess can’t set up Revit because the required reader version is unavailable. Report this issue, then try setup again after FloLess restores it.',
|
|
10775
11076
|
unknown: 'FloLess couldn’t finish Revit setup.',
|
|
10776
11077
|
};
|
|
10777
11078
|
const badge = ready ? 'Ready' : needsAttention ? 'Needs setup'
|
|
@@ -10787,15 +11088,17 @@
|
|
|
10787
11088
|
: 'Revit model access is not included for this account. Ask the account owner to add it.';
|
|
10788
11089
|
const checkLabel = needsAttention ? 'Try setup again' : needsAccount ? 'Choose account'
|
|
10789
11090
|
: ready ? 'Check status' : 'Check access again';
|
|
10790
|
-
return `<div class="int-item int-${escapeAttr(i.status)}" data-integration-id="xeorvt" tabindex="-1">
|
|
11091
|
+
return `<div class="int-item int-${escapeAttr(i.status)}" data-integration-id="xeorvt" tabindex="-1"${missingReader ? ' aria-describedby="xeorvt-setup-detail"' : ''}>
|
|
10791
11092
|
<div class="int-icon">R</div><div class="int-info">
|
|
10792
11093
|
<div class="int-name">${escapeHtml(i.name)}</div>
|
|
10793
11094
|
<div class="int-kind">Revit project integration · provided by FloLess</div>
|
|
10794
|
-
<div class="int-scopes">${escapeHtml(detail)}</div>
|
|
11095
|
+
<div class="int-scopes${missingReader ? ' int-setup-detail' : ''}"${missingReader ? ' id="xeorvt-setup-detail"' : ''}>${escapeHtml(detail)}</div>
|
|
10795
11096
|
<div class="int-row"><span class="int-badge int-badge-${ready ? 'connected' : needsAttention ? 'expired' : 'disconnected'}">${badge}</span>
|
|
11097
|
+
<span class="int-recovery-actions">
|
|
10796
11098
|
${ready ? '<button class="int-action" data-xeorvt-action="open">Open Revit projects</button>' : ''}
|
|
11099
|
+
${missingReader ? '<button class="int-action" data-xeorvt-action="report" data-command-id="shell.revit-report-setup-issue" aria-label="Report issue: missing Revit reader" aria-describedby="xeorvt-setup-detail">Report issue</button>' : ''}
|
|
10797
11100
|
<button class="int-action" data-xeorvt-action="${needsAccount ? 'account' : 'check'}" data-xeorvt-retry="${needsAttention ? 'true' : 'false'}">${checkLabel}</button>
|
|
10798
|
-
|
|
11101
|
+
</span></div></div></div>`;
|
|
10799
11102
|
}
|
|
10800
11103
|
const action = i.status === 'connected' ? 'Disconnect' : i.status === 'expired' ? 'Reconnect' : 'Connect';
|
|
10801
11104
|
const badge = i.status === 'connected' ? 'Connected' : i.status === 'expired' ? 'Token expired' : 'Not connected';
|
|
@@ -10826,6 +11129,12 @@
|
|
|
10826
11129
|
if (btn.dataset.xeorvtAction === 'open') {
|
|
10827
11130
|
$integrationsModal.classList.remove('show');
|
|
10828
11131
|
if (window.flolessWorkspaces) await window.flolessWorkspaces.setMode('workspaces');
|
|
11132
|
+
} else if (btn.dataset.xeorvtAction === 'report') {
|
|
11133
|
+
hideModal($integrationsModal);
|
|
11134
|
+
riReturnToIntegration = true;
|
|
11135
|
+
openReportIssue();
|
|
11136
|
+
$riTitle.value = 'Revit setup: required reader unavailable';
|
|
11137
|
+
riSyncSend();
|
|
10829
11138
|
} else if (btn.dataset.xeorvtAction === 'account') {
|
|
10830
11139
|
await recheckLicenseAndGate({ forRevitAccountSelection: true });
|
|
10831
11140
|
} else {
|
|
@@ -10833,9 +11142,24 @@
|
|
|
10833
11142
|
const hadFocus = document.activeElement === btn;
|
|
10834
11143
|
btn.disabled = true;
|
|
10835
11144
|
btn.textContent = 'Setting up…';
|
|
10836
|
-
|
|
10837
|
-
|
|
11145
|
+
let retryAnnouncement = 'Revit setup is ready.';
|
|
11146
|
+
try {
|
|
11147
|
+
const setup = await api('/api/rvt-defaults/retry', { method: 'POST' });
|
|
11148
|
+
if (setup.status !== 'ready') {
|
|
11149
|
+
retryAnnouncement = 'Revit setup could not finish. The Integrations card shows what to do next.';
|
|
11150
|
+
showToast(setup.category === 'reader-release-unavailable'
|
|
11151
|
+
? 'The required Revit reader is unavailable. Choose Report issue; try setup again after FloLess restores it.'
|
|
11152
|
+
: 'Revit setup couldn’t finish. Try setup again.', 'warn');
|
|
11153
|
+
}
|
|
11154
|
+
}
|
|
11155
|
+
catch (error) {
|
|
11156
|
+
retryAnnouncement = 'Revit setup could not finish. The Integrations card shows what to do next.';
|
|
11157
|
+
showToast(error?.body?.category === 'reader-release-unavailable'
|
|
11158
|
+
? 'The required Revit reader is unavailable. Choose Report issue; try setup again after FloLess restores it.'
|
|
11159
|
+
: 'Revit setup couldn’t finish. Try setup again.', 'warn');
|
|
11160
|
+
}
|
|
10838
11161
|
await refreshIntegrations();
|
|
11162
|
+
document.getElementById('integrations-status').textContent = retryAnnouncement;
|
|
10839
11163
|
if (hadFocus) $integrationsList.querySelector('[data-integration-id="xeorvt"] [data-xeorvt-action]:last-of-type')?.focus();
|
|
10840
11164
|
return;
|
|
10841
11165
|
} else {
|
|
@@ -11724,10 +12048,18 @@
|
|
|
11724
12048
|
let riAppVersion = ''; // captured from /api/health on open so the report actually carries
|
|
11725
12049
|
let riAwareVersion = ''; // the versions the modal promises ("sent automatically: …")
|
|
11726
12050
|
let riReturnFocus = null;
|
|
12051
|
+
let riReturnToIntegration = false;
|
|
11727
12052
|
|
|
11728
12053
|
const riSyncSend = () => { $riSend.disabled = !($riTitle.value.trim() && $riDesc.value.trim()); };
|
|
11729
12054
|
function riHideAndRestoreFocus() {
|
|
11730
12055
|
hideModal($riModal);
|
|
12056
|
+
if (riReturnToIntegration) {
|
|
12057
|
+
riReturnToIntegration = false;
|
|
12058
|
+
riReturnFocus = null;
|
|
12059
|
+
showModal($integrationsModal);
|
|
12060
|
+
($integrationsList.querySelector('[data-xeorvt-action="report"]') || document.getElementById('integrations-close'))?.focus();
|
|
12061
|
+
return;
|
|
12062
|
+
}
|
|
11731
12063
|
const returnFocus = riReturnFocus;
|
|
11732
12064
|
riReturnFocus = null;
|
|
11733
12065
|
if (returnFocus && returnFocus.isConnected) returnFocus.focus();
|